mirror of https://github.com/apache/jclouds.git
Inject TransientStorageStrategy
Remove some unneeded checkNotNull as Guice does not inject null parameters.
This commit is contained in:
parent
4ac8770e66
commit
a2d5a48f3f
|
@ -141,7 +141,7 @@ public class FilesystemAsyncBlobStore extends BaseAsyncBlobStore {
|
|||
this.httpGetOptionsConverter = httpGetOptionsConverter;
|
||||
this.contentMetadataCodec = contentMetadataCodec;
|
||||
this.ifDirectoryReturnName = ifDirectoryReturnName;
|
||||
this.storageStrategy = checkNotNull(storageStrategy, "Storage strategy");
|
||||
this.storageStrategy = storageStrategy;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -132,7 +132,8 @@ public class TransientAsyncBlobStore extends BaseAsyncBlobStore {
|
|||
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService service,
|
||||
Supplier<Location> defaultLocation,
|
||||
@Memoized Supplier<Set<? extends Location>> locations,
|
||||
Factory blobFactory, Provider<UriBuilder> uriBuilders) {
|
||||
Factory blobFactory, LocalStorageStrategy storageStrategy,
|
||||
Provider<UriBuilder> uriBuilders) {
|
||||
super(context, blobUtils, service, defaultLocation, locations);
|
||||
this.blobFactory = blobFactory;
|
||||
this.dateService = dateService;
|
||||
|
@ -140,7 +141,7 @@ public class TransientAsyncBlobStore extends BaseAsyncBlobStore {
|
|||
this.httpGetOptionsConverter = httpGetOptionsConverter;
|
||||
this.contentMetadataCodec = contentMetadataCodec;
|
||||
this.ifDirectoryReturnName = ifDirectoryReturnName;
|
||||
this.storageStrategy = new TransientStorageStrategy(defaultLocation);
|
||||
this.storageStrategy = storageStrategy;
|
||||
this.uriBuilders = uriBuilders;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.jclouds.blobstore;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Supplier;
|
||||
|
@ -34,8 +35,9 @@ public class TransientStorageStrategy implements LocalStorageStrategy {
|
|||
private final ConcurrentMap<String, Location> containerToLocation = new ConcurrentHashMap<String, Location>();
|
||||
private final Supplier<Location> defaultLocation;
|
||||
|
||||
public TransientStorageStrategy(final Supplier<Location> defaultLocation) {
|
||||
this.defaultLocation = Preconditions.checkNotNull(defaultLocation);
|
||||
@Inject
|
||||
TransientStorageStrategy(final Supplier<Location> defaultLocation) {
|
||||
this.defaultLocation = defaultLocation;
|
||||
}
|
||||
|
||||
public Iterable<String> getAllContainerNames() {
|
||||
|
|
|
@ -21,8 +21,10 @@ package org.jclouds.blobstore.config;
|
|||
import org.jclouds.blobstore.AsyncBlobStore;
|
||||
import org.jclouds.blobstore.BlobRequestSigner;
|
||||
import org.jclouds.blobstore.BlobStore;
|
||||
import org.jclouds.blobstore.LocalStorageStrategy;
|
||||
import org.jclouds.blobstore.TransientAsyncBlobStore;
|
||||
import org.jclouds.blobstore.TransientBlobRequestSigner;
|
||||
import org.jclouds.blobstore.TransientStorageStrategy;
|
||||
import org.jclouds.blobstore.attr.ConsistencyModel;
|
||||
import org.jclouds.rest.config.BinderUtils;
|
||||
|
||||
|
@ -44,6 +46,7 @@ public class TransientBlobStoreContextModule extends AbstractModule {
|
|||
install(new BlobStoreMapModule());
|
||||
bind(BlobStore.class).to(TransientBlobStore.class);
|
||||
bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT);
|
||||
bind(LocalStorageStrategy.class).to(TransientStorageStrategy.class);
|
||||
bind(BlobRequestSigner.class).to(TransientBlobRequestSigner.class);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue