EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.trmk.vcloud_0_8.compute.suppliers]

COVERAGE SUMMARY FOR SOURCE FILE [VCloudImageSupplier.java]

nameclass, %method, %block, %line, %
VCloudImageSupplier.java0%   (0/3)0%   (0/9)0%   (0/114)0%   (0/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VCloudImageSupplier0%   (0/1)0%   (0/4)0%   (0/63)0%   (0/10)
VCloudImageSupplier (Supplier, Function, ExecutorService): void 0%   (0/1)0%   (0/24)0%   (0/6)
access$000 (VCloudImageSupplier): Function 0%   (0/1)0%   (0/3)0%   (0/1)
access$100 (VCloudImageSupplier): ExecutorService 0%   (0/1)0%   (0/3)0%   (0/1)
get (): Set 0%   (0/1)0%   (0/33)0%   (0/3)
     
class VCloudImageSupplier$10%   (0/1)0%   (0/2)0%   (0/20)0%   (0/3)
VCloudImageSupplier$1 (VCloudImageSupplier): void 0%   (0/1)0%   (0/6)0%   (0/1)
apply (Org): Future 0%   (0/1)0%   (0/14)0%   (0/2)
     
class VCloudImageSupplier$1$10%   (0/1)0%   (0/3)0%   (0/31)0%   (0/3)
VCloudImageSupplier$1$1 (VCloudImageSupplier$1, Org): void 0%   (0/1)0%   (0/9)0%   (0/1)
call (): Iterable 0%   (0/1)0%   (0/9)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/13)0%   (0/1)

1/**
2 * Licensed to jclouds, Inc. (jclouds) under one or more
3 * contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  jclouds licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  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,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.jclouds.trmk.vcloud_0_8.compute.suppliers;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22import static com.google.common.collect.Iterables.concat;
23import static com.google.common.collect.Sets.newLinkedHashSet;
24import static org.jclouds.concurrent.FutureIterables.transformParallel;
25 
26import java.util.Map;
27import java.util.Set;
28import java.util.concurrent.Callable;
29import java.util.concurrent.ExecutorService;
30import java.util.concurrent.Future;
31 
32import javax.annotation.Resource;
33import javax.inject.Inject;
34import javax.inject.Named;
35import javax.inject.Singleton;
36 
37import org.jclouds.Constants;
38import org.jclouds.compute.domain.Image;
39import org.jclouds.compute.reference.ComputeServiceConstants;
40import org.jclouds.logging.Logger;
41import org.jclouds.trmk.vcloud_0_8.domain.Org;
42 
43import com.google.common.base.Function;
44import com.google.common.base.Supplier;
45 
46/**
47 * @author Adrian Cole
48 */
49@Singleton
50public class VCloudImageSupplier implements Supplier<Set<? extends Image>> {
51 
52   @Resource
53   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
54   public Logger logger = Logger.NULL;
55 
56   private final Supplier<Map<String, ? extends Org>> orgMap;
57   private final Function<Org, Iterable<? extends Image>> imagesInOrg;
58   private final ExecutorService executor;
59 
60   @Inject
61   VCloudImageSupplier(Supplier<Map<String, ? extends Org>> orgMap,
62            Function<Org, Iterable<? extends Image>> imagesInOrg,
63            @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
64      this.orgMap = checkNotNull(orgMap, "orgMap");
65      this.imagesInOrg = checkNotNull(imagesInOrg, "imagesInOrg");
66      this.executor = checkNotNull(executor, "executor");
67   }
68 
69   @Override
70   public Set<? extends Image> get() {
71      Iterable<? extends Org> orgs = checkNotNull(orgMap.get().values(), "orgs");
72      Iterable<Iterable<? extends Image>> images = transformParallel(orgs,
73               new Function<Org, Future<Iterable<? extends Image>>>() {
74 
75                  @Override
76                  public Future<Iterable<? extends Image>> apply(final Org from) {
77                     checkNotNull(from, "org");
78                     return executor.submit(new Callable<Iterable<? extends Image>>() {
79 
80                        @Override
81                        public Iterable<? extends Image> call() throws Exception {
82                           return imagesInOrg.apply(from);
83                        }
84 
85                        @Override
86                        public String toString() {
87                           return "imagesInOrg(" + from.getHref() + ")";
88                        }
89                     });
90                  }
91 
92               }, executor, null, logger, "images in " + orgs);
93      return newLinkedHashSet(concat(images));
94   }
95}

[all classes][org.jclouds.trmk.vcloud_0_8.compute.suppliers]
EMMA 2.0.5312 (C) Vladimir Roubtsov