EMMA Coverage Report (generated Fri Apr 27 15:03:37 EDT 2012)
[all classes][org.jclouds.ec2.config]

COVERAGE SUMMARY FOR SOURCE FILE [EC2RestClientModule.java]

nameclass, %method, %block, %line, %
EC2RestClientModule.java100% (1/1)50%  (2/4)52%  (36/69)30%  (3/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class EC2RestClientModule100% (1/1)50%  (2/4)52%  (36/69)30%  (3/10)
EC2RestClientModule (TypeToken, TypeToken, Map): void 0%   (0/1)0%   (0/6)0%   (0/2)
installLocations (): void 0%   (0/1)0%   (0/27)0%   (0/5)
<static initializer> 100% (1/1)100% (28/28)100% (1/1)
EC2RestClientModule (): void 100% (1/1)100% (8/8)100% (2/2)

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.ec2.config;
20 
21import java.util.Map;
22 
23import org.jclouds.aws.config.WithZonesFormSigningRestClientModule;
24import org.jclouds.ec2.EC2AsyncClient;
25import org.jclouds.ec2.EC2Client;
26import org.jclouds.ec2.services.AMIAsyncClient;
27import org.jclouds.ec2.services.AMIClient;
28import org.jclouds.ec2.services.AvailabilityZoneAndRegionAsyncClient;
29import org.jclouds.ec2.services.AvailabilityZoneAndRegionClient;
30import org.jclouds.ec2.services.ElasticBlockStoreAsyncClient;
31import org.jclouds.ec2.services.ElasticBlockStoreClient;
32import org.jclouds.ec2.services.ElasticIPAddressAsyncClient;
33import org.jclouds.ec2.services.ElasticIPAddressClient;
34import org.jclouds.ec2.services.InstanceAsyncClient;
35import org.jclouds.ec2.services.InstanceClient;
36import org.jclouds.ec2.services.KeyPairAsyncClient;
37import org.jclouds.ec2.services.KeyPairClient;
38import org.jclouds.ec2.services.SecurityGroupAsyncClient;
39import org.jclouds.ec2.services.SecurityGroupClient;
40import org.jclouds.ec2.services.WindowsAsyncClient;
41import org.jclouds.ec2.services.WindowsClient;
42import org.jclouds.ec2.suppliers.DescribeAvailabilityZonesInRegion;
43import org.jclouds.ec2.suppliers.DescribeRegionsForConfiguredRegions;
44import org.jclouds.location.config.LocationModule;
45import org.jclouds.location.suppliers.RegionIdToURISupplier;
46import org.jclouds.location.suppliers.RegionIdToZoneIdsSupplier;
47import org.jclouds.location.suppliers.ZoneIdsSupplier;
48import org.jclouds.location.suppliers.derived.ZoneIdsFromRegionIdToZoneIdsValues;
49import org.jclouds.rest.ConfiguresRestClient;
50 
51import com.google.common.collect.ImmutableMap;
52import com.google.common.reflect.TypeToken;
53import com.google.inject.Scopes;
54 
55/**
56 * Configures the EC2 connection.
57 * 
58 * @author Adrian Cole (EDIT: Nick Terry nterry@familysearch.org)
59 */
60@ConfiguresRestClient
61public class EC2RestClientModule<S extends EC2Client, A extends EC2AsyncClient> extends
62         WithZonesFormSigningRestClientModule<S, A> {
63   public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()//
64   .put(AMIClient.class, AMIAsyncClient.class)//
65   .put(ElasticIPAddressClient.class, ElasticIPAddressAsyncClient.class)//
66   .put(InstanceClient.class, InstanceAsyncClient.class)//
67   .put(KeyPairClient.class, KeyPairAsyncClient.class)//
68   .put(SecurityGroupClient.class, SecurityGroupAsyncClient.class)//
69   .put(WindowsClient.class, WindowsAsyncClient.class)//
70   .put(AvailabilityZoneAndRegionClient.class, AvailabilityZoneAndRegionAsyncClient.class)//
71   .put(ElasticBlockStoreClient.class, ElasticBlockStoreAsyncClient.class)//
72   .build();
73   
74   @SuppressWarnings("unchecked")
75   public EC2RestClientModule() {
76      super((TypeToken) TypeToken.of(EC2Client.class), (TypeToken) TypeToken.of(EC2AsyncClient.class), DELEGATE_MAP);
77   }
78 
79   protected EC2RestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType,
80            Map<Class<?>, Class<?>> sync2Async) {
81      super(syncClientType, asyncClientType, sync2Async);
82   }
83   
84 
85 
86   @Override
87   protected void installLocations() {
88      install(new LocationModule());
89      bind(RegionIdToZoneIdsSupplier.class).to(DescribeAvailabilityZonesInRegion.class).in(Scopes.SINGLETON);
90      bind(RegionIdToURISupplier.class).to(DescribeRegionsForConfiguredRegions.class).in(Scopes.SINGLETON);
91      bind(ZoneIdsSupplier.class).to(ZoneIdsFromRegionIdToZoneIdsValues.class).in(Scopes.SINGLETON);
92   }
93}

[all classes][org.jclouds.ec2.config]
EMMA 2.0.5312 (C) Vladimir Roubtsov