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

COVERAGE SUMMARY FOR SOURCE FILE [CloudFilesAsyncBlobStore.java]

nameclass, %method, %block, %line, %
CloudFilesAsyncBlobStore.java0%   (0/2)0%   (0/5)0%   (0/75)0%   (0/11)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CloudFilesAsyncBlobStore0%   (0/1)0%   (0/3)0%   (0/47)0%   (0/8)
CloudFilesAsyncBlobStore (BlobStoreContext, BlobUtils, ExecutorService, Suppl... 0%   (0/1)0%   (0/21)0%   (0/3)
access$000 (CloudFilesAsyncBlobStore): EnableCDNAndCache 0%   (0/1)0%   (0/3)0%   (0/1)
createContainerInLocation (Location, String, CreateContainerOptions): Listena... 0%   (0/1)0%   (0/23)0%   (0/4)
     
class CloudFilesAsyncBlobStore$10%   (0/1)0%   (0/2)0%   (0/28)0%   (0/4)
CloudFilesAsyncBlobStore$1 (CloudFilesAsyncBlobStore, String): void 0%   (0/1)0%   (0/9)0%   (0/1)
apply (Boolean): Boolean 0%   (0/1)0%   (0/19)0%   (0/3)

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.cloudfiles.blobstore;
20 
21import java.util.Set;
22import java.util.concurrent.ExecutorService;
23 
24import javax.inject.Inject;
25import javax.inject.Named;
26import javax.inject.Provider;
27import javax.inject.Singleton;
28 
29import org.jclouds.Constants;
30import org.jclouds.blobstore.BlobStoreContext;
31import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
32import org.jclouds.blobstore.options.CreateContainerOptions;
33import org.jclouds.blobstore.strategy.internal.FetchBlobMetadata;
34import org.jclouds.blobstore.util.BlobUtils;
35import org.jclouds.cloudfiles.CloudFilesAsyncClient;
36import org.jclouds.cloudfiles.CloudFilesClient;
37import org.jclouds.cloudfiles.blobstore.functions.EnableCDNAndCache;
38import org.jclouds.collect.Memoized;
39import org.jclouds.concurrent.Futures;
40import org.jclouds.domain.Location;
41import org.jclouds.openstack.swift.blobstore.SwiftAsyncBlobStore;
42import org.jclouds.openstack.swift.blobstore.functions.BlobStoreListContainerOptionsToListContainerOptions;
43import org.jclouds.openstack.swift.blobstore.functions.BlobToObject;
44import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceList;
45import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceMetadata;
46import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlob;
47import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlobMetadata;
48 
49import com.google.common.base.Function;
50import com.google.common.base.Supplier;
51import com.google.common.util.concurrent.ListenableFuture;
52 
53/**
54 * 
55 * @author Adrian Cole
56 */
57@Singleton
58public class CloudFilesAsyncBlobStore extends SwiftAsyncBlobStore {
59   private final EnableCDNAndCache enableCDNAndCache;
60 
61   @Inject
62   protected CloudFilesAsyncBlobStore(BlobStoreContext context, BlobUtils blobUtils,
63            @Named(Constants.PROPERTY_USER_THREADS) ExecutorService service, Supplier<Location> defaultLocation,
64            @Memoized Supplier<Set<? extends Location>> locations, CloudFilesClient sync, CloudFilesAsyncClient async,
65            ContainerToResourceMetadata container2ResourceMd,
66            BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions,
67            ContainerToResourceList container2ResourceList, ObjectToBlob object2Blob, BlobToObject blob2Object,
68            ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions,
69            Provider<FetchBlobMetadata> fetchBlobMetadataProvider, EnableCDNAndCache enableCDNAndCache) {
70      super(context, blobUtils, service, defaultLocation, locations, sync, async, container2ResourceMd,
71               container2ContainerListOptions, container2ResourceList, object2Blob, blob2Object, object2BlobMd,
72               blob2ObjectGetOptions, fetchBlobMetadataProvider);
73      this.enableCDNAndCache = enableCDNAndCache;
74   }
75 
76   @Override
77   public ListenableFuture<Boolean> createContainerInLocation(Location location, final String container,
78            CreateContainerOptions options) {
79 
80      ListenableFuture<Boolean> returnVal = createContainerInLocation(location, container);
81      if (options.isPublicRead())
82         return Futures.compose(createContainerInLocation(location, container), new Function<Boolean, Boolean>() {
83 
84            @Override
85            public Boolean apply(Boolean input) {
86               if (Boolean.TRUE.equals(input)) {
87                  return enableCDNAndCache.apply(container) != null;
88               }
89               return false;
90            }
91 
92         }, service);
93      return returnVal;
94   }
95}

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