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

COVERAGE SUMMARY FOR SOURCE FILE [AtmosBlobStoreContextModule.java]

nameclass, %method, %block, %line, %
AtmosBlobStoreContextModule.java100% (3/3)71%  (5/7)91%  (83/91)85%  (11/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AtmosBlobStoreContextModule$2100% (1/1)33%  (1/3)53%  (9/17)33%  (1/3)
apply (String): Boolean 0%   (0/1)0%   (0/6)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/2)0%   (0/1)
AtmosBlobStoreContextModule$2 (AtmosBlobStoreContextModule, AtmosClient): void 100% (1/1)100% (9/9)100% (1/1)
     
class AtmosBlobStoreContextModule100% (1/1)100% (3/3)100% (68/68)100% (11/11)
AtmosBlobStoreContextModule (): void 100% (1/1)100% (3/3)100% (1/1)
configure (): void 100% (1/1)100% (52/52)100% (9/9)
isPublic (AtmosClient): Map 100% (1/1)100% (13/13)100% (1/1)
     
class AtmosBlobStoreContextModule$1100% (1/1)100% (1/1)100% (6/6)100% (1/1)
AtmosBlobStoreContextModule$1 (AtmosBlobStoreContextModule): 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.atmos.blobstore.config;
20 
21import java.util.Map;
22import java.util.concurrent.TimeUnit;
23 
24import javax.inject.Singleton;
25 
26import org.jclouds.atmos.AtmosAsyncClient;
27import org.jclouds.atmos.AtmosClient;
28import org.jclouds.atmos.blobstore.AtmosAsyncBlobStore;
29import org.jclouds.atmos.blobstore.AtmosBlobRequestSigner;
30import org.jclouds.atmos.blobstore.AtmosBlobStore;
31import org.jclouds.atmos.blobstore.strategy.FindMD5InUserMetadata;
32import org.jclouds.blobstore.AsyncBlobStore;
33import org.jclouds.blobstore.BlobRequestSigner;
34import org.jclouds.blobstore.BlobStore;
35import org.jclouds.blobstore.BlobStoreContext;
36import org.jclouds.blobstore.attr.ConsistencyModel;
37import org.jclouds.blobstore.config.BlobStoreMapModule;
38import org.jclouds.blobstore.internal.BlobStoreContextImpl;
39import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
40import org.jclouds.location.config.JustProviderLocationModule;
41 
42import com.google.common.base.Function;
43import com.google.common.collect.MapMaker;
44import com.google.inject.AbstractModule;
45import com.google.inject.Provides;
46import com.google.inject.Scopes;
47import com.google.inject.TypeLiteral;
48 
49/**
50 * Configures the {@link AtmosBlobStoreContext}; requires {@link AtmosAsyncBlobStore} bound.
51 * 
52 * @author Adrian Cole
53 */
54public class AtmosBlobStoreContextModule extends AbstractModule {
55 
56   @Override
57   protected void configure() {
58      install(new BlobStoreMapModule());
59      bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
60      bind(AsyncBlobStore.class).to(AtmosAsyncBlobStore.class).in(Scopes.SINGLETON);
61      bind(BlobStore.class).to(AtmosBlobStore.class).in(Scopes.SINGLETON);
62      bind(BlobStoreContext.class).to(new TypeLiteral<BlobStoreContextImpl<AtmosClient, AtmosAsyncClient>>() {
63      }).in(Scopes.SINGLETON);
64      bind(ContainsValueInListStrategy.class).to(FindMD5InUserMetadata.class);
65      bind(BlobRequestSigner.class).to(AtmosBlobRequestSigner.class);
66      install(new JustProviderLocationModule());
67   }
68 
69   @Provides
70   @Singleton
71   protected Map<String, Boolean> isPublic(final AtmosClient client) {
72      return new MapMaker().expireAfterWrite(30, TimeUnit.SECONDS).makeComputingMap(new Function<String, Boolean>() {
73         public Boolean apply(String directory) {
74            return client.isPublic(directory);
75         }
76 
77         @Override
78         public String toString() {
79            return "isPublic()";
80         }
81      });
82   }
83}

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