EMMA Coverage Report (generated Wed Jun 22 19:47:49 EDT 2011)
[all classes][org.jclouds.blobstore.config]

COVERAGE SUMMARY FOR SOURCE FILE [TransientBlobStoreContextModule.java]

nameclass, %method, %block, %line, %
TransientBlobStoreContextModule.java100% (5/5)100% (8/8)100% (94/94)100% (14/14)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TransientBlobStoreContextModule100% (1/1)100% (4/4)100% (70/70)100% (13/13)
<static initializer> 100% (1/1)100% (9/9)100% (2/2)
TransientBlobStoreContextModule (): void 100% (1/1)100% (3/3)100% (1/1)
configure (): void 100% (1/1)100% (56/56)100% (9/9)
provide (TransientBlobStore): BlobStore 100% (1/1)100% (2/2)100% (1/1)
     
class TransientBlobStoreContextModule$1100% (1/1)100% (1/1)100% (6/6)100% (1/1)
TransientBlobStoreContextModule$1 (TransientBlobStoreContextModule): void 100% (1/1)100% (6/6)100% (1/1)
     
class TransientBlobStoreContextModule$2100% (1/1)100% (1/1)100% (6/6)100% (1/1)
TransientBlobStoreContextModule$2 (TransientBlobStoreContextModule): void 100% (1/1)100% (6/6)100% (1/1)
     
class TransientBlobStoreContextModule$3100% (1/1)100% (1/1)100% (6/6)100% (1/1)
TransientBlobStoreContextModule$3 (TransientBlobStoreContextModule): void 100% (1/1)100% (6/6)100% (1/1)
     
class TransientBlobStoreContextModule$4100% (1/1)100% (1/1)100% (6/6)100% (1/1)
TransientBlobStoreContextModule$4 (TransientBlobStoreContextModule): void 100% (1/1)100% (6/6)100% (1/1)

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.blobstore.config;
20 
21import java.util.concurrent.ConcurrentHashMap;
22import java.util.concurrent.ConcurrentMap;
23 
24import javax.inject.Singleton;
25 
26import org.jclouds.blobstore.AsyncBlobStore;
27import org.jclouds.blobstore.BlobRequestSigner;
28import org.jclouds.blobstore.BlobStore;
29import org.jclouds.blobstore.BlobStoreContext;
30import org.jclouds.blobstore.TransientAsyncBlobStore;
31import org.jclouds.blobstore.TransientBlobRequestSigner;
32import org.jclouds.blobstore.attr.ConsistencyModel;
33import org.jclouds.blobstore.domain.Blob;
34import org.jclouds.blobstore.internal.BlobStoreContextImpl;
35import org.jclouds.domain.Location;
36import org.jclouds.location.config.JustProviderLocationModule;
37 
38import com.google.inject.AbstractModule;
39import com.google.inject.Provides;
40import com.google.inject.Scopes;
41import com.google.inject.TypeLiteral;
42 
43/**
44 * Configures the {@link TransientBlobStoreContext}; requires {@link TransientAsyncBlobStore} bound.
45 * 
46 * @author Adrian Cole
47 */
48public class TransientBlobStoreContextModule extends AbstractModule {
49 
50   // must be singleton for all threads and all objects or tests may fail;
51   static final ConcurrentHashMap<String, ConcurrentMap<String, Blob>> map = new ConcurrentHashMap<String, ConcurrentMap<String, Blob>>();
52   static final ConcurrentHashMap<String, Location> containerToLocation = new ConcurrentHashMap<String, Location>();
53 
54   @Override
55   protected void configure() {
56      bind(new TypeLiteral<BlobStoreContext>() {
57      }).to(new TypeLiteral<BlobStoreContextImpl<TransientBlobStore, AsyncBlobStore>>() {
58      }).in(Scopes.SINGLETON);
59      bind(new TypeLiteral<ConcurrentMap<String, ConcurrentMap<String, Blob>>>() {
60      }).toInstance(map);
61      bind(new TypeLiteral<ConcurrentMap<String, Location>>() {
62      }).toInstance(containerToLocation);
63      install(new BlobStoreObjectModule());
64      install(new BlobStoreMapModule());
65      install(new JustProviderLocationModule());
66      bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT);
67      bind(BlobRequestSigner.class).to(TransientBlobRequestSigner.class);
68   }
69 
70   @Provides
71   @Singleton
72   BlobStore provide(TransientBlobStore in) {
73      return in;
74   }
75}

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