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

COVERAGE SUMMARY FOR SOURCE FILE [AzureBlobStoreContextModule.java]

nameclass, %method, %block, %line, %
AzureBlobStoreContextModule.java100% (3/3)71%  (5/7)92%  (83/90)86%  (12/14)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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