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

COVERAGE SUMMARY FOR SOURCE FILE [AWSRegionAndNameToImageSupplier.java]

nameclass, %method, %block, %line, %
AWSRegionAndNameToImageSupplier.java0%   (0/1)0%   (0/3)0%   (0/60)0%   (0/8)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AWSRegionAndNameToImageSupplier0%   (0/1)0%   (0/3)0%   (0/60)0%   (0/8)
AWSRegionAndNameToImageSupplier (Set, DescribeImagesParallel, String [], Stri... 0%   (0/1)0%   (0/11)0%   (0/3)
ccAmisToDescribeQueries (String []): Map 0%   (0/1)0%   (0/39)0%   (0/4)
getDescribeQueriesForOwnersInRegions (Set, String []): Iterable 0%   (0/1)0%   (0/10)0%   (0/1)

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.aws.ec2.compute.suppliers;
20 
21/**
22 *
23 *
24 * ====================================================================
25 * Licensed under the Apache License, Version 2.0 (the "License");
26 * you may not use this file except in compliance with the License.
27 * You may obtain a copy of the License at
28 *
29 * http://www.apache.org/licenses/LICENSE-2.0
30 *
31 * Unless required by applicable law or agreed to in writing, software
32 * distributed under the License is distributed on an "AS IS" BASIS,
33 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34 * See the License for the specific language governing permissions and
35 * limitations under the License.
36 * ====================================================================
37 */
38 
39import static com.google.common.collect.Iterables.concat;
40import static com.google.common.collect.Maps.newLinkedHashMap;
41import static org.jclouds.aws.ec2.reference.AWSEC2Constants.PROPERTY_EC2_CC_AMIs;
42import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.imageIds;
43import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS;
44 
45import java.util.Map;
46import java.util.Set;
47import java.util.Map.Entry;
48 
49import javax.inject.Inject;
50import javax.inject.Named;
51import javax.inject.Singleton;
52 
53import org.jclouds.compute.domain.Image;
54import org.jclouds.ec2.compute.domain.RegionAndName;
55import org.jclouds.ec2.compute.functions.EC2ImageParser;
56import org.jclouds.ec2.compute.strategy.DescribeImagesParallel;
57import org.jclouds.ec2.compute.suppliers.RegionAndNameToImageSupplier;
58import org.jclouds.ec2.options.DescribeImagesOptions;
59import org.jclouds.location.Region;
60 
61/**
62 * 
63 * @author Adrian Cole
64 */
65@Singleton
66public class AWSRegionAndNameToImageSupplier extends RegionAndNameToImageSupplier {
67 
68   private final String[] ccAmis;
69 
70   @Inject
71   AWSRegionAndNameToImageSupplier(@Region Set<String> regions, DescribeImagesParallel describer,
72            @Named(PROPERTY_EC2_CC_AMIs) String[] ccAmis, @Named(PROPERTY_EC2_AMI_OWNERS) String[] amiOwners,
73            EC2ImageParser parser, Map<RegionAndName, Image> images) {
74      super(regions, describer, amiOwners, parser, images);
75      this.ccAmis = ccAmis;
76   }
77 
78   public Iterable<Entry<String, DescribeImagesOptions>> getDescribeQueriesForOwnersInRegions(Set<String> regions,
79            String[] amiOwners) {
80      return concat(super.getDescribeQueriesForOwnersInRegions(regions, amiOwners), ccAmisToDescribeQueries(ccAmis)
81               .entrySet());
82   }
83 
84   static Map<String, DescribeImagesOptions> ccAmisToDescribeQueries(String[] ccAmis) {
85      Map<String, DescribeImagesOptions> queries = newLinkedHashMap();
86      for (String from : ccAmis) {
87         queries.put(from.split("/")[0], imageIds(from.split("/")[1]));
88      }
89      return queries;
90   }
91 
92}

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