EMMA Coverage Report (generated Tue Jun 21 05:51:52 EDT 2011)
[all classes][org.jclouds.openstack.swift.config]

COVERAGE SUMMARY FOR SOURCE FILE [BaseSwiftRestClientModule.java]

nameclass, %method, %block, %line, %
BaseSwiftRestClientModule.java100% (1/1)60%  (3/5)78%  (51/65)80%  (12/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class BaseSwiftRestClientModule100% (1/1)60%  (3/5)78%  (51/65)80%  (12/15)
BaseSwiftRestClientModule (Class, Class): void 0%   (0/1)0%   (0/8)0%   (0/2)
provideStorageUrl (OpenStackAuthAsyncClient$AuthenticationResponse): URI 0%   (0/1)0%   (0/6)0%   (0/1)
BaseSwiftRestClientModule (OpenStackAuthenticationModule, Class, Class): void 100% (1/1)100% (8/8)100% (3/3)
bindErrorHandlers (): void 100% (1/1)100% (25/25)100% (4/4)
configure (): void 100% (1/1)100% (18/18)100% (5/5)

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.openstack.swift.config;
20 
21import java.net.URI;
22 
23import javax.inject.Singleton;
24 
25import org.jclouds.http.HttpErrorHandler;
26import org.jclouds.http.RequiresHttp;
27import org.jclouds.http.annotation.ClientError;
28import org.jclouds.http.annotation.Redirection;
29import org.jclouds.http.annotation.ServerError;
30import org.jclouds.json.config.GsonModule.DateAdapter;
31import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
32import org.jclouds.openstack.OpenStackAuthAsyncClient.AuthenticationResponse;
33import org.jclouds.openstack.config.OpenStackAuthenticationModule;
34import org.jclouds.openstack.reference.AuthHeaders;
35import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
36import org.jclouds.openstack.swift.CommonSwiftClient;
37import org.jclouds.openstack.swift.Storage;
38import org.jclouds.openstack.swift.handlers.ParseSwiftErrorFromHttpResponse;
39import org.jclouds.rest.ConfiguresRestClient;
40import org.jclouds.rest.config.RestClientModule;
41 
42import com.google.inject.Provides;
43 
44/**
45 * 
46 * @author Adrian Cole
47 */
48@ConfiguresRestClient
49@RequiresHttp
50public class BaseSwiftRestClientModule<S extends CommonSwiftClient, A extends CommonSwiftAsyncClient> extends
51         RestClientModule<S, A> {
52   private final OpenStackAuthenticationModule module;
53 
54   public BaseSwiftRestClientModule(Class<S> syncClientType, Class<A> asyncClientType) {
55      this(new OpenStackAuthenticationModule(), syncClientType, asyncClientType);
56   }
57 
58   public BaseSwiftRestClientModule(OpenStackAuthenticationModule module, Class<S> syncClientType,
59            Class<A> asyncClientType) {
60      super(syncClientType, asyncClientType);
61      this.module = module;
62   }
63 
64   @Override
65   protected void configure() {
66      install(module);
67      install(new SwiftObjectModule());
68      bind(DateAdapter.class).to(Iso8601DateAdapter.class);
69      super.configure();
70   }
71 
72   @Override
73   protected void bindErrorHandlers() {
74      bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseSwiftErrorFromHttpResponse.class);
75      bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseSwiftErrorFromHttpResponse.class);
76      bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseSwiftErrorFromHttpResponse.class);
77   }
78 
79   @Provides
80   @Singleton
81   @Storage
82   protected URI provideStorageUrl(AuthenticationResponse response) {
83      return response.getServices().get(AuthHeaders.STORAGE_URL);
84   }
85}

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