EMMA Coverage Report (generated Wed Jun 22 19:47:49 EDT 2011)
[all classes][org.jclouds.vcloud.compute.functions]

COVERAGE SUMMARY FOR SOURCE FILE [ImagesInOrg.java]

nameclass, %method, %block, %line, %
ImagesInOrg.java0%   (0/1)0%   (0/2)0%   (0/34)0%   (0/8)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ImagesInOrg0%   (0/1)0%   (0/2)0%   (0/34)0%   (0/8)
ImagesInOrg (AllCatalogItemsInOrg, Provider, Function): void 0%   (0/1)0%   (0/12)0%   (0/5)
apply (Org): Iterable 0%   (0/1)0%   (0/22)0%   (0/3)

1/**
2 *
3 * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
4 *
5 * ====================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ====================================================================
18 */
19package org.jclouds.vcloud.compute.functions;
20 
21import javax.inject.Inject;
22import javax.inject.Provider;
23import javax.inject.Singleton;
24 
25import org.jclouds.compute.domain.Image;
26import org.jclouds.vcloud.domain.CatalogItem;
27import org.jclouds.vcloud.domain.Org;
28import org.jclouds.vcloud.domain.VAppTemplate;
29import org.jclouds.vcloud.functions.AllCatalogItemsInOrg;
30 
31import com.google.common.base.Function;
32import com.google.common.base.Predicates;
33import com.google.common.collect.Iterables;
34 
35/**
36 * @author Adrian Cole
37 */
38@Singleton
39public class ImagesInOrg implements Function<Org, Iterable<? extends Image>> {
40 
41   private final AllCatalogItemsInOrg allCatalogItemsInOrg;
42   private final Function<Iterable<? extends CatalogItem>, Iterable<? extends VAppTemplate>> vAppTemplatesForCatalogItems;
43   private final Provider<ImageForVAppTemplate> imageForVAppTemplateProvider;
44 
45   @Inject
46   ImagesInOrg(AllCatalogItemsInOrg allCatalogItemsInOrg,
47            Provider<ImageForVAppTemplate> imageForVAppTemplateProvider,
48            Function<Iterable<? extends CatalogItem>, Iterable<? extends VAppTemplate>> vAppTemplatesForCatalogItems) {
49      this.imageForVAppTemplateProvider = imageForVAppTemplateProvider;
50      this.allCatalogItemsInOrg = allCatalogItemsInOrg;
51      this.vAppTemplatesForCatalogItems = vAppTemplatesForCatalogItems;
52   }
53 
54   @Override
55   public Iterable<? extends Image> apply(Org from) {
56      Iterable<? extends CatalogItem> catalogs = allCatalogItemsInOrg.apply(from);
57      Iterable<? extends VAppTemplate> vAppTemplates = vAppTemplatesForCatalogItems.apply(catalogs);
58      return Iterables.transform(Iterables.filter(vAppTemplates, Predicates.notNull()), imageForVAppTemplateProvider.get().withParent(from));
59   }
60 
61}

[all classes][org.jclouds.vcloud.compute.functions]
EMMA 2.0.5312 (C) Vladimir Roubtsov