EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.softlayer.config]

COVERAGE SUMMARY FOR SOURCE FILE [SoftLayerRestClientModule.java]

nameclass, %method, %block, %line, %
SoftLayerRestClientModule.java100% (1/1)100% (5/5)100% (64/64)100% (12/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SoftLayerRestClientModule100% (1/1)100% (5/5)100% (64/64)100% (12/12)
<static initializer> 100% (1/1)100% (16/16)100% (1/1)
SoftLayerRestClientModule (): void 100% (1/1)100% (6/6)100% (2/2)
bindErrorHandlers (): void 100% (1/1)100% (25/25)100% (4/4)
bindRetryHandlers (): void 100% (1/1)100% (9/9)100% (2/2)
configure (): void 100% (1/1)100% (8/8)100% (3/3)

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.softlayer.config;
20 
21import java.util.Map;
22 
23import org.jclouds.http.HttpErrorHandler;
24import org.jclouds.http.HttpRetryHandler;
25import org.jclouds.http.RequiresHttp;
26import org.jclouds.http.annotation.ClientError;
27import org.jclouds.http.annotation.Redirection;
28import org.jclouds.http.annotation.ServerError;
29import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
30import org.jclouds.rest.ConfiguresRestClient;
31import org.jclouds.rest.config.RestClientModule;
32import org.jclouds.softlayer.SoftLayerAsyncClient;
33import org.jclouds.softlayer.SoftLayerClient;
34import org.jclouds.softlayer.features.AccountAsyncClient;
35import org.jclouds.softlayer.features.AccountClient;
36import org.jclouds.softlayer.features.DatacenterAsyncClient;
37import org.jclouds.softlayer.features.DatacenterClient;
38import org.jclouds.softlayer.features.ProductPackageAsyncClient;
39import org.jclouds.softlayer.features.ProductPackageClient;
40import org.jclouds.softlayer.features.VirtualGuestAsyncClient;
41import org.jclouds.softlayer.features.VirtualGuestClient;
42import org.jclouds.softlayer.handlers.SoftLayerErrorHandler;
43 
44import com.google.common.collect.ImmutableMap;
45 
46/**
47 * Configures the SoftLayer connection.
48 * 
49 * @author Adrian Cole
50 */
51@RequiresHttp
52@ConfiguresRestClient
53public class SoftLayerRestClientModule extends RestClientModule<SoftLayerClient, SoftLayerAsyncClient> {
54 
55   public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()//
56            .put(VirtualGuestClient.class, VirtualGuestAsyncClient.class)//
57            .put(DatacenterClient.class, DatacenterAsyncClient.class)//
58            .put(ProductPackageClient.class, ProductPackageAsyncClient.class)//
59            .put(AccountClient.class, AccountAsyncClient.class)//
60            .build();
61 
62   public SoftLayerRestClientModule() {
63      super(SoftLayerClient.class, SoftLayerAsyncClient.class, DELEGATE_MAP);
64   }
65 
66   @Override
67   protected void configure() {
68      install(new SoftLayerParserModule());
69      super.configure();
70   }
71 
72   @Override
73   protected void bindErrorHandlers() {
74      bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(SoftLayerErrorHandler.class);
75      bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(SoftLayerErrorHandler.class);
76      bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(SoftLayerErrorHandler.class);
77   }
78 
79   @Override
80   protected void bindRetryHandlers() {
81      bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(BackoffLimitedRetryHandler.class);
82   }
83 
84}

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