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

COVERAGE SUMMARY FOR SOURCE FILE [CacheNodeStoreModule.java]

nameclass, %method, %block, %line, %
CacheNodeStoreModule.java100% (3/3)100% (5/5)100% (66/66)100% (10/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CacheNodeStoreModule100% (1/1)100% (3/3)100% (54/54)100% (10/10)
CacheNodeStoreModule (Cache): void 100% (1/1)100% (9/9)100% (3/3)
CacheNodeStoreModule (Map): void 100% (1/1)100% (25/25)100% (4/4)
configure (): void 100% (1/1)100% (20/20)100% (3/3)
     
class CacheNodeStoreModule$1100% (1/1)100% (1/1)100% (6/6)100% (1/1)
CacheNodeStoreModule$1 (CacheNodeStoreModule): void 100% (1/1)100% (6/6)100% (1/1)
     
class CacheNodeStoreModule$2100% (1/1)100% (1/1)100% (6/6)100% (1/1)
CacheNodeStoreModule$2 (CacheNodeStoreModule): void 100% (1/1)100% (6/6)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.byon.config;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.util.Map;
24 
25import org.jclouds.byon.Node;
26 
27import com.google.common.annotations.Beta;
28import com.google.common.base.Functions;
29import com.google.common.base.Supplier;
30import com.google.common.base.Suppliers;
31import com.google.common.cache.Cache;
32import com.google.common.cache.CacheBuilder;
33import com.google.common.cache.CacheLoader;
34import com.google.inject.AbstractModule;
35import com.google.inject.TypeLiteral;
36 
37/**
38 * 
39 * @author Adrian Cole
40 */
41@ConfiguresNodeStore
42@Beta
43public class CacheNodeStoreModule extends AbstractModule {
44   private final Cache<String, Node> backing;
45 
46   public CacheNodeStoreModule(Cache<String, Node> backing) {
47      this.backing = checkNotNull(backing, "backing");
48   }
49 
50   public CacheNodeStoreModule(Map<String, Node> backing) {
51      this(CacheBuilder.newBuilder().<String, Node>build(CacheLoader.from(Functions.forMap(backing))));
52      for (String node : backing.keySet())
53         this.backing.getUnchecked(node);
54   }
55 
56   @Override
57   protected void configure() {
58      bind(new TypeLiteral<Cache<String, Node>>() {
59      }).toInstance(backing);
60      bind(new TypeLiteral<Supplier<Cache<String, Node>>>() {
61      }).toInstance(Suppliers.<Cache<String, Node>> ofInstance(backing));
62   }
63 
64}

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