EMMA Coverage Report (generated Mon Dec 09 15:12:29 EST 2013)
[all classes][org.jclouds.glesys.config]

COVERAGE SUMMARY FOR SOURCE FILE [GleSYSRestClientModule.java]

nameclass, %method, %block, %line, %
GleSYSRestClientModule.java100% (1/1)100% (6/6)100% (75/75)100% (15/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class GleSYSRestClientModule100% (1/1)100% (6/6)100% (75/75)100% (15/15)
<static initializer> 100% (1/1)100% (19/19)100% (1/1)
GleSYSRestClientModule (): void 100% (1/1)100% (4/4)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)
installLocations (): void 100% (1/1)100% (10/10)100% (3/3)

1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17package org.jclouds.glesys.config;
18 
19import java.util.Map;
20 
21import org.jclouds.glesys.GleSYSApi;
22import org.jclouds.glesys.GleSYSAsyncApi;
23import org.jclouds.glesys.features.ArchiveApi;
24import org.jclouds.glesys.features.ArchiveAsyncApi;
25import org.jclouds.glesys.features.DomainApi;
26import org.jclouds.glesys.features.DomainAsyncApi;
27import org.jclouds.glesys.features.EmailAccountApi;
28import org.jclouds.glesys.features.EmailAccountAsyncApi;
29import org.jclouds.glesys.features.IpApi;
30import org.jclouds.glesys.features.IpAsyncApi;
31import org.jclouds.glesys.features.ServerApi;
32import org.jclouds.glesys.features.ServerAsyncApi;
33import org.jclouds.glesys.handlers.GleSYSErrorHandler;
34import org.jclouds.http.HttpErrorHandler;
35import org.jclouds.http.HttpRetryHandler;
36import org.jclouds.http.annotation.ClientError;
37import org.jclouds.http.annotation.Redirection;
38import org.jclouds.http.annotation.ServerError;
39import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
40import org.jclouds.location.suppliers.ImplicitLocationSupplier;
41import org.jclouds.location.suppliers.implicit.OnlyLocationOrFirstZone;
42import org.jclouds.rest.ConfiguresRestClient;
43import org.jclouds.rest.config.RestClientModule;
44 
45import com.google.common.collect.ImmutableMap;
46import com.google.inject.Scopes;
47 
48/**
49 * Configures the GleSYS connection.
50 * 
51 * @author Adrian Cole
52 */
53@ConfiguresRestClient
54public class GleSYSRestClientModule extends RestClientModule<GleSYSApi, GleSYSAsyncApi> {
55 
56   public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()//
57         .put(ServerApi.class, ServerAsyncApi.class)//
58         .put(IpApi.class, IpAsyncApi.class)//
59         .put(ArchiveApi.class, ArchiveAsyncApi.class)//
60         .put(DomainApi.class, DomainAsyncApi.class)//
61         .put(EmailAccountApi.class, EmailAccountAsyncApi.class)//
62         .build();
63 
64   public GleSYSRestClientModule() {
65      super(DELEGATE_MAP);
66   }
67 
68   @Override
69   protected void configure() {
70      install(new GleSYSParserModule());
71      super.configure();
72   }
73 
74   @Override
75   protected void bindErrorHandlers() {
76      bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(GleSYSErrorHandler.class);
77      bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(GleSYSErrorHandler.class);
78      bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(GleSYSErrorHandler.class);
79   }
80 
81   @Override
82   protected void bindRetryHandlers() {
83      bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(BackoffLimitedRetryHandler.class);
84   }
85   
86   @Override
87   protected void installLocations() {
88      super.installLocations();
89      bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstZone.class).in(Scopes.SINGLETON);
90   }
91}

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