EMMA Coverage Report (generated Wed Oct 26 13:47:17 EDT 2011)
[all classes][org.jclouds.compute.config]

COVERAGE SUMMARY FOR SOURCE FILE [BindComputeSuppliersByClass.java]

nameclass, %method, %block, %line, %
BindComputeSuppliersByClass.java0%   (0/6)0%   (0/14)0%   (0/101)0%   (0/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class BindComputeSuppliersByClass0%   (0/1)0%   (0/8)0%   (0/68)0%   (0/17)
BindComputeSuppliersByClass (): void 0%   (0/1)0%   (0/3)0%   (0/2)
bindDefaultLocationSupplier (Class): void 0%   (0/1)0%   (0/11)0%   (0/2)
bindHardwareSupplier (Class): void 0%   (0/1)0%   (0/11)0%   (0/2)
bindImageSupplier (Class): void 0%   (0/1)0%   (0/11)0%   (0/2)
bindLocationSupplier (Class): void 0%   (0/1)0%   (0/11)0%   (0/2)
configure (): void 0%   (0/1)0%   (0/17)0%   (0/5)
defineDefaultLocationSupplier (): Class 0%   (0/1)0%   (0/2)0%   (0/1)
defineLocationSupplier (): Class 0%   (0/1)0%   (0/2)0%   (0/1)
     
class BindComputeSuppliersByClass$10%   (0/1)0%   (0/1)0%   (0/6)0%   (0/1)
BindComputeSuppliersByClass$1 (BindComputeSuppliersByClass): void 0%   (0/1)0%   (0/6)0%   (0/1)
     
class BindComputeSuppliersByClass$20%   (0/1)0%   (0/1)0%   (0/6)0%   (0/1)
BindComputeSuppliersByClass$2 (BindComputeSuppliersByClass): void 0%   (0/1)0%   (0/6)0%   (0/1)
     
class BindComputeSuppliersByClass$30%   (0/1)0%   (0/1)0%   (0/6)0%   (0/1)
BindComputeSuppliersByClass$3 (BindComputeSuppliersByClass): void 0%   (0/1)0%   (0/6)0%   (0/1)
     
class BindComputeSuppliersByClass$40%   (0/1)0%   (0/1)0%   (0/6)0%   (0/1)
BindComputeSuppliersByClass$4 (BindComputeSuppliersByClass): void 0%   (0/1)0%   (0/6)0%   (0/1)
     
class BindComputeSuppliersByClass$SupplierOfLocationSet0%   (0/1)0%   (0/2)0%   (0/9)0%   (0/4)
BindComputeSuppliersByClass$SupplierOfLocationSet (Set): void 0%   (0/1)0%   (0/6)0%   (0/3)
get (): Set 0%   (0/1)0%   (0/3)0%   (0/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.compute.config;
20 
21import java.util.Set;
22 
23import javax.inject.Inject;
24import javax.inject.Singleton;
25 
26import org.jclouds.compute.domain.Hardware;
27import org.jclouds.compute.domain.Image;
28import org.jclouds.domain.Location;
29import org.jclouds.location.suppliers.OnlyLocationOrFirstZone;
30 
31import com.google.common.base.Supplier;
32import com.google.inject.AbstractModule;
33import com.google.inject.Scopes;
34import com.google.inject.TypeLiteral;
35 
36/**
37 * @author Adrian Cole
38 */
39public abstract class BindComputeSuppliersByClass extends AbstractModule {
40 
41   @Override
42   protected void configure() {
43      bindImageSupplier(defineImageSupplier());
44      bindLocationSupplier(defineLocationSupplier());
45      bindHardwareSupplier(defineHardwareSupplier());
46      bindDefaultLocationSupplier(defineDefaultLocationSupplier());
47   }
48 
49   protected abstract Class<? extends Supplier<Set<? extends Image>>> defineImageSupplier();
50 
51   protected abstract Class<? extends Supplier<Set<? extends Hardware>>> defineHardwareSupplier();
52 
53   protected Class<? extends Supplier<Set<? extends Location>>> defineLocationSupplier() {
54      return SupplierOfLocationSet.class;
55   }
56 
57   @Singleton
58   static class SupplierOfLocationSet implements Supplier<Set<? extends Location>> {
59      private final Set<? extends Location> locations;
60 
61      @Inject
62      SupplierOfLocationSet(Set<? extends Location> locations) {
63         this.locations = locations;
64      }
65 
66      @Override
67      public Set<? extends Location> get() {
68         return locations;
69      }
70 
71   }
72 
73   protected Class<? extends Supplier<Location>> defineDefaultLocationSupplier() {
74      return OnlyLocationOrFirstZone.class;
75   }
76 
77   protected void bindImageSupplier(Class<? extends Supplier<Set<? extends Image>>> clazz) {
78      bind(new TypeLiteral<Supplier<Set<? extends Image>>>() {
79      }).to(clazz).in(Scopes.SINGLETON);
80   }
81 
82   protected void bindLocationSupplier(Class<? extends Supplier<Set<? extends Location>>> clazz) {
83      bind(new TypeLiteral<Supplier<Set<? extends Location>>>() {
84      }).to(clazz).in(Scopes.SINGLETON);
85   }
86 
87   protected void bindDefaultLocationSupplier(Class<? extends Supplier<Location>> clazz) {
88      bind(new TypeLiteral<Supplier<Location>>() {
89      }).to(clazz).in(Scopes.SINGLETON);
90   }
91 
92   protected void bindHardwareSupplier(Class<? extends Supplier<Set<? extends Hardware>>> clazz) {
93      bind(new TypeLiteral<Supplier<Set<? extends Hardware>>>() {
94      }).to(clazz).in(Scopes.SINGLETON);
95   }
96 
97}

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