EMMA Coverage Report (generated Mon Oct 17 05:41:20 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 * 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.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