EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.vcloud.functions]

COVERAGE SUMMARY FOR SOURCE FILE [AllCatalogsInOrg.java]

nameclass, %method, %block, %line, %
AllCatalogsInOrg.java0%   (0/2)0%   (0/5)0%   (0/53)0%   (0/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AllCatalogsInOrg0%   (0/1)0%   (0/3)0%   (0/40)0%   (0/8)
AllCatalogsInOrg (VCloudAsyncClient, ExecutorService): void 0%   (0/1)0%   (0/12)0%   (0/5)
access$000 (AllCatalogsInOrg): VCloudAsyncClient 0%   (0/1)0%   (0/3)0%   (0/1)
apply (Org): Iterable 0%   (0/1)0%   (0/25)0%   (0/2)
     
class AllCatalogsInOrg$10%   (0/1)0%   (0/2)0%   (0/13)0%   (0/2)
AllCatalogsInOrg$1 (AllCatalogsInOrg): void 0%   (0/1)0%   (0/6)0%   (0/1)
apply (ReferenceType): Future 0%   (0/1)0%   (0/7)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.vcloud.functions;
20 
21import static org.jclouds.concurrent.FutureIterables.transformParallel;
22 
23import java.util.concurrent.ExecutorService;
24import java.util.concurrent.Future;
25 
26import javax.annotation.Resource;
27import javax.inject.Inject;
28import javax.inject.Named;
29import javax.inject.Singleton;
30 
31import org.jclouds.Constants;
32import org.jclouds.logging.Logger;
33import org.jclouds.vcloud.VCloudAsyncClient;
34import org.jclouds.vcloud.domain.Catalog;
35import org.jclouds.vcloud.domain.Org;
36import org.jclouds.vcloud.domain.ReferenceType;
37 
38import com.google.common.base.Function;
39 
40/**
41 * @author Adrian Cole
42 */
43@Singleton
44public class AllCatalogsInOrg implements Function<Org, Iterable<? extends Catalog>> {
45   @Resource
46   public Logger logger = Logger.NULL;
47 
48   private final VCloudAsyncClient aclient;
49   private final ExecutorService executor;
50 
51   @Inject
52   AllCatalogsInOrg(VCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
53      this.aclient = aclient;
54      this.executor = executor;
55   }
56 
57   @Override
58   public Iterable<? extends Catalog> apply(final Org org) {
59      Iterable<Catalog> catalogs = transformParallel(org.getCatalogs().values(),
60            new Function<ReferenceType, Future<Catalog>>() {
61               @SuppressWarnings("unchecked")
62               @Override
63               public Future<Catalog> apply(ReferenceType from) {
64                  return (Future<Catalog>) aclient.getCatalog(from.getHref());
65               }
66 
67            }, executor, null, logger, "catalogs in " + org.getName());
68      return catalogs;
69   }
70}

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