EMMA Coverage Report (generated Fri Aug 26 14:14:05 EDT 2011)
[all classes][org.jclouds.aws.s3.config]

COVERAGE SUMMARY FOR SOURCE FILE [AWSS3RestClientModule.java]

nameclass, %method, %block, %line, %
AWSS3RestClientModule.java100% (1/1)50%  (3/6)70%  (16/23)67%  (6/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AWSS3RestClientModule100% (1/1)50%  (3/6)70%  (16/23)67%  (6/9)
provide (AWSS3AsyncClient): S3AsyncClient 0%   (0/1)0%   (0/2)0%   (0/1)
provide (AWSS3Client): S3Client 0%   (0/1)0%   (0/2)0%   (0/1)
provideBucketURI (String): URI 0%   (0/1)0%   (0/3)0%   (0/1)
AWSS3RestClientModule (): void 100% (1/1)100% (5/5)100% (2/2)
configure (): void 100% (1/1)100% (9/9)100% (3/3)
defaultRegionForBucket (String): String 100% (1/1)100% (2/2)100% (1/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.s3.config;
20 
21import static org.jclouds.aws.domain.Region.US_STANDARD;
22import static org.jclouds.location.reference.LocationConstants.ENDPOINT;
23import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGION;
24 
25import java.net.URI;
26 
27import javax.inject.Named;
28import javax.inject.Singleton;
29 
30import org.jclouds.aws.s3.AWSS3AsyncClient;
31import org.jclouds.aws.s3.AWSS3Client;
32import org.jclouds.aws.s3.binders.AssignCorrectHostnameAndBindAsHostPrefixIfConfigured;
33import org.jclouds.http.RequiresHttp;
34import org.jclouds.location.Region;
35import org.jclouds.rest.ConfiguresRestClient;
36import org.jclouds.s3.Bucket;
37import org.jclouds.s3.S3AsyncClient;
38import org.jclouds.s3.S3Client;
39import org.jclouds.s3.binders.BindAsHostPrefixIfConfigured;
40import org.jclouds.s3.config.S3RestClientModule;
41 
42import com.google.inject.Provides;
43 
44/**
45 * Configures the S3 connection.
46 * 
47 * @author Adrian Cole
48 */
49@RequiresHttp
50@ConfiguresRestClient
51public class AWSS3RestClientModule extends S3RestClientModule<AWSS3Client, AWSS3AsyncClient> {
52 
53   @Provides
54   @Singleton
55   @Bucket
56   protected URI provideBucketURI(@Named(PROPERTY_REGION + "." + US_STANDARD + "." + ENDPOINT) String endpoint) {
57      return URI.create(endpoint);
58   }
59 
60   @Override
61   protected String defaultRegionForBucket(@Region String defaultRegion) {
62      return US_STANDARD;
63   }
64 
65   @Override
66   protected void configure() {
67      bind(BindAsHostPrefixIfConfigured.class).to(AssignCorrectHostnameAndBindAsHostPrefixIfConfigured.class);
68      super.configure();
69   }
70 
71   public AWSS3RestClientModule() {
72      super(AWSS3Client.class, AWSS3AsyncClient.class);
73   }
74 
75   @Singleton
76   @Provides
77   S3Client provide(AWSS3Client in) {
78      return in;
79   }
80 
81   @Singleton
82   @Provides
83   S3AsyncClient provide(AWSS3AsyncClient in) {
84      return in;
85   }
86 
87}

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