You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by an...@apache.org on 2014/05/07 10:16:47 UTC
git commit: JCLOUDS-505: Remove unused ObjectMD5
Repository: jclouds
Updated Branches:
refs/heads/master 3f22f6738 -> a45124c51
JCLOUDS-505: Remove unused ObjectMD5
The only users of this seem to be
org.jclouds.atmos.blobstore.strategy.FindMD5InUserMetadata and
org.jclouds.azureblob.blobstore.strategy.FindMD5InBlobProperties which
are themselves unused.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/a45124c5
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/a45124c5
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/a45124c5
Branch: refs/heads/master
Commit: a45124c51a80e96f033059584dd4ef3763b56804
Parents: 3f22f67
Author: Andrew Gaul <ga...@apache.org>
Authored: Thu Mar 20 12:14:54 2014 -0700
Committer: Andrew Phillips <an...@apache.org>
Committed: Wed May 7 10:16:18 2014 +0200
----------------------------------------------------------------------
.../config/AtmosBlobStoreContextModule.java | 3 -
.../strategy/FindMD5InUserMetadata.java | 130 -------------------
.../config/AtmosBlobStoreModuleTest.java | 62 ---------
.../jclouds/blobstore/functions/ObjectMD5.java | 56 --------
.../strategy/ContainsValueInListStrategy.java | 34 -----
.../strategy/internal/FindMD5InList.java | 66 ----------
.../blobstore/functions/ObjectMD5Test.java | 62 ---------
.../config/AzureBlobStoreContextModule.java | 3 -
.../strategy/FindMD5InBlobProperties.java | 72 ----------
.../config/AzureBlobStoreModuleTest.java | 45 -------
10 files changed, 533 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a45124c5/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java
index ba4b8ef..d067395 100644
--- a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java
@@ -24,12 +24,10 @@ import org.jclouds.atmos.AtmosClient;
import org.jclouds.atmos.blobstore.AtmosAsyncBlobStore;
import org.jclouds.atmos.blobstore.AtmosBlobRequestSigner;
import org.jclouds.atmos.blobstore.AtmosBlobStore;
-import org.jclouds.atmos.blobstore.strategy.FindMD5InUserMetadata;
import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
-import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
@@ -50,7 +48,6 @@ public class AtmosBlobStoreContextModule extends AbstractModule {
bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
bind(AsyncBlobStore.class).to(AtmosAsyncBlobStore.class).in(Scopes.SINGLETON);
bind(BlobStore.class).to(AtmosBlobStore.class).in(Scopes.SINGLETON);
- bind(ContainsValueInListStrategy.class).to(FindMD5InUserMetadata.class);
bind(BlobRequestSigner.class).to(AtmosBlobRequestSigner.class);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a45124c5/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/strategy/FindMD5InUserMetadata.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/strategy/FindMD5InUserMetadata.java b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/strategy/FindMD5InUserMetadata.java
deleted file mode 100644
index f339abc..0000000
--- a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/strategy/FindMD5InUserMetadata.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.atmos.blobstore.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Throwables.propagate;
-import static org.jclouds.concurrent.FutureIterables.awaitCompletion;
-
-import java.util.Arrays;
-import java.util.Map;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.atmos.AtmosAsyncClient;
-import org.jclouds.atmos.domain.AtmosObject;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.functions.ObjectMD5;
-import org.jclouds.blobstore.internal.BlobRuntimeException;
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
-import org.jclouds.blobstore.strategy.ListBlobsInContainer;
-import org.jclouds.logging.Logger;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.Maps;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.inject.Inject;
-
-/**
- * Searches Content-MD5 tag for the value associated with the value
- *
- * @author Adrian Cole
- */
-@Singleton
-public class FindMD5InUserMetadata implements ContainsValueInListStrategy {
- @Resource
- protected Logger logger = Logger.NULL;
- protected final ObjectMD5 objectMD5;
- protected final ListBlobsInContainer getAllBlobMetadata;
- private final AtmosAsyncClient client;
- private final ListeningExecutorService userExecutor;
- /**
- * maximum duration of an blob Request
- */
- @Inject(optional = true)
- @Named(Constants.PROPERTY_REQUEST_TIMEOUT)
- protected Long maxTime;
-
- @Inject
- FindMD5InUserMetadata(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, ObjectMD5 objectMD5,
- ListBlobsInContainer getAllBlobMetadata, AtmosAsyncClient client) {
- this.objectMD5 = objectMD5;
- this.getAllBlobMetadata = getAllBlobMetadata;
- this.client = client;
- this.userExecutor = userExecutor;
- }
-
- @Override
- public boolean execute(final String containerName, Object value, ListContainerOptions options) {
- final byte[] toSearch = objectMD5.apply(value);
- final BlockingQueue<Boolean> queue = new SynchronousQueue<Boolean>();
- Map<String, ListenableFuture<?>> responses = Maps.newHashMap();
- for (BlobMetadata md : getAllBlobMetadata.execute(containerName, options)) {
- final ListenableFuture<AtmosObject> future = client.headFile(containerName + "/" + md.getName());
- future.addListener(new Runnable() {
- public void run() {
- try {
- AtmosObject object = future.get();
- checkNotNull(object.getSystemMetadata(), object + " has no content metadata");
- if (object.getSystemMetadata().getContentMD5() != null) {
- if (Arrays.equals(toSearch, object.getSystemMetadata().getContentMD5())) {
- queue.put(true);
- }
- } else {
- logger.debug("object %s has no content md5", object.getSystemMetadata().getObjectID());
- }
- } catch (InterruptedException e) {
- Throwables.propagate(e);
- } catch (ExecutionException e) {
- Throwables.propagate(e);
- }
- }
- }, userExecutor);
- responses.put(md.getName(), future);
- }
- Map<String, Exception> exceptions;
- try {
- exceptions = awaitCompletion(responses, userExecutor, maxTime, logger,
- String.format("searching for md5 in container %s", containerName));
- } catch (TimeoutException te) {
- throw propagate(te);
- }
- if (exceptions.size() > 0)
- throw new BlobRuntimeException(String.format("searching for md5 in container %s: %s", containerName,
- exceptions));
- try {
- return queue.poll(1, TimeUnit.MICROSECONDS) != null;
- } catch (InterruptedException e) {
- Throwables.propagate(e);
- return false;
- } catch (Exception e) {
- Throwables.propagateIfPossible(e, BlobRuntimeException.class);
- throw new BlobRuntimeException(String.format("Error searching for ETAG of value: [%s] in container:%s", value,
- containerName), e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a45124c5/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreModuleTest.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreModuleTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreModuleTest.java
deleted file mode 100644
index 4b97746..0000000
--- a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreModuleTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.atmos.blobstore.config;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.ContextBuilder;
-import org.jclouds.atmos.AtmosApiMetadata;
-import org.jclouds.atmos.blobstore.strategy.FindMD5InUserMetadata;
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.blobstore.internal.BlobStoreContextImpl;
-import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
-import org.jclouds.logging.config.NullLoggingModule;
-import org.jclouds.rest.internal.BaseRestApiTest.MockModule;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-
-/**
- * @author Adrian Cole
- */
-@Test(groups = "unit")
-public class AtmosBlobStoreModuleTest {
-
- Injector createInjector() {
- return ContextBuilder
- .newBuilder(new AtmosApiMetadata())
- .credentials("uid", "key")
- .modules(
- ImmutableSet.<Module> of(new MockModule(),new NullLoggingModule()))
- .buildInjector();
- }
-
- @Test
- void testContextImpl() {
-
- Injector injector = createInjector();
- BlobStoreContext handler = injector.getInstance(BlobStoreContext.class);
- assertEquals(handler.getClass(), BlobStoreContextImpl.class);
- ContainsValueInListStrategy valueList = injector
- .getInstance(ContainsValueInListStrategy.class);
-
- assertEquals(valueList.getClass(), FindMD5InUserMetadata.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a45124c5/blobstore/src/main/java/org/jclouds/blobstore/functions/ObjectMD5.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/functions/ObjectMD5.java b/blobstore/src/main/java/org/jclouds/blobstore/functions/ObjectMD5.java
deleted file mode 100644
index 271f411..0000000
--- a/blobstore/src/main/java/org/jclouds/blobstore/functions/ObjectMD5.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.blobstore.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.IOException;
-
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpMessage;
-import org.jclouds.io.PayloadEnclosing;
-import org.jclouds.io.Payloads;
-
-import com.google.common.base.Function;
-import com.google.common.base.Throwables;
-
-/**
- *
- * @author Adrian Cole
- */
-@Singleton
-public class ObjectMD5 implements Function<Object, byte[]> {
-
- public byte[] apply(Object from) {
- checkNotNull(from, "thing to md5");
- PayloadEnclosing payloadEnclosing;
- if (from instanceof PayloadEnclosing) {
- payloadEnclosing = (PayloadEnclosing) from;
- } else {
- payloadEnclosing = HttpMessage.builder().payload(Payloads.newPayload(from)).build();
- }
- if (payloadEnclosing.getPayload().getContentMetadata().getContentMD5() == null)
- try {
- Payloads.calculateMD5(payloadEnclosing);
- } catch (IOException e) {
- Throwables.propagate(e);
- }
- return payloadEnclosing.getPayload().getContentMetadata().getContentMD5();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a45124c5/blobstore/src/main/java/org/jclouds/blobstore/strategy/ContainsValueInListStrategy.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/strategy/ContainsValueInListStrategy.java b/blobstore/src/main/java/org/jclouds/blobstore/strategy/ContainsValueInListStrategy.java
deleted file mode 100644
index fa27078..0000000
--- a/blobstore/src/main/java/org/jclouds/blobstore/strategy/ContainsValueInListStrategy.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.blobstore.strategy;
-
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.blobstore.strategy.internal.FindMD5InList;
-
-import com.google.inject.ImplementedBy;
-
-/**
- * Determines whether a value exists in the store
- *
- * @author Adrian Cole
- */
-@ImplementedBy(FindMD5InList.class)
-public interface ContainsValueInListStrategy {
-
- boolean execute(String containerName, Object value, ListContainerOptions options);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a45124c5/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/FindMD5InList.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/FindMD5InList.java b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/FindMD5InList.java
deleted file mode 100644
index 6ab87f5..0000000
--- a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/FindMD5InList.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.blobstore.strategy.internal;
-
-import java.util.Arrays;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.functions.ObjectMD5;
-import org.jclouds.blobstore.internal.BlobRuntimeException;
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
-import org.jclouds.blobstore.strategy.ListBlobsInContainer;
-
-import com.google.common.base.Throwables;
-
-/**
- * Searches Content-MD5 tag for the value associated with the value
- *
- * @author Adrian Cole
- */
-@Singleton
-public class FindMD5InList implements ContainsValueInListStrategy {
-
- protected final ObjectMD5 objectMD5;
- protected final ListBlobsInContainer getAllBlobMetadata;
-
- @Inject
- private FindMD5InList(ObjectMD5 objectMD5, ListBlobsInContainer getAllBlobMetadata) {
- this.objectMD5 = objectMD5;
- this.getAllBlobMetadata = getAllBlobMetadata;
- }
-
- public boolean execute(String containerName, Object value, ListContainerOptions options) {
- try {
- byte[] toSearch = objectMD5.apply(value);
- for (BlobMetadata metadata : getAllBlobMetadata.execute(containerName, options)) {
- if (Arrays.equals(toSearch, metadata.getContentMetadata().getContentMD5()))
- return true;
- }
- return false;
- } catch (Exception e) {
- Throwables.propagateIfPossible(e, BlobRuntimeException.class);
- throw new BlobRuntimeException(String.format(
- "Error searching for ETAG of value: [%2$s] in container:%1$s", containerName,
- value), e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a45124c5/blobstore/src/test/java/org/jclouds/blobstore/functions/ObjectMD5Test.java
----------------------------------------------------------------------
diff --git a/blobstore/src/test/java/org/jclouds/blobstore/functions/ObjectMD5Test.java b/blobstore/src/test/java/org/jclouds/blobstore/functions/ObjectMD5Test.java
deleted file mode 100644
index 7c5b02f..0000000
--- a/blobstore/src/test/java/org/jclouds/blobstore/functions/ObjectMD5Test.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.blobstore.functions;
-
-import static com.google.common.base.Charsets.UTF_8;
-import static com.google.common.hash.Hashing.md5;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-
-import org.jclouds.http.HttpMessage;
-import org.jclouds.io.Payload;
-import org.jclouds.io.Payloads;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author Adrian Cole
- */
-@Test(groups = "unit")
-public class ObjectMD5Test {
- private ObjectMD5 fn = new ObjectMD5();
-
- @Test
- public void testAlreadyHasMD5() {
- Payload payload = Payloads.newPayload("foo");
- payload.getContentMetadata().setContentMD5(new byte[] {});
- HttpMessage payloadEnclosing = HttpMessage.builder().payload(payload).build();
- assertEquals(fn.apply(payloadEnclosing), new byte[] {});
- }
-
- @Test
- public void testMD5PayloadEnclosing() throws IOException {
- Payload payload = Payloads.newPayload("foo");
- HttpMessage payloadEnclosing = HttpMessage.builder().payload(payload).build();
- assertEquals(fn.apply(payloadEnclosing), md5().hashString("foo", UTF_8).asBytes());
- }
-
- @Test
- public void testMD5String() throws IOException {
- assertEquals(fn.apply("foo"), md5().hashString("foo", UTF_8).asBytes());
- }
-
- @Test(expectedExceptions = { NullPointerException.class, IllegalStateException.class })
- public void testNullIsBad() {
- fn.apply(null);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a45124c5/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreContextModule.java b/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreContextModule.java
index 47614ab..e503a77 100644
--- a/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreContextModule.java
+++ b/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreContextModule.java
@@ -24,13 +24,11 @@ import org.jclouds.azureblob.AzureBlobClient;
import org.jclouds.azureblob.blobstore.AzureAsyncBlobStore;
import org.jclouds.azureblob.blobstore.AzureBlobRequestSigner;
import org.jclouds.azureblob.blobstore.AzureBlobStore;
-import org.jclouds.azureblob.blobstore.strategy.FindMD5InBlobProperties;
import org.jclouds.azureblob.domain.PublicAccess;
import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
-import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
@@ -51,7 +49,6 @@ public class AzureBlobStoreContextModule extends AbstractModule {
bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT);
bind(AsyncBlobStore.class).to(AzureAsyncBlobStore.class).in(Scopes.SINGLETON);
bind(BlobStore.class).to(AzureBlobStore.class).in(Scopes.SINGLETON);
- bind(ContainsValueInListStrategy.class).to(FindMD5InBlobProperties.class);
bind(BlobRequestSigner.class).to(AzureBlobRequestSigner.class);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a45124c5/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/strategy/FindMD5InBlobProperties.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/strategy/FindMD5InBlobProperties.java b/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/strategy/FindMD5InBlobProperties.java
deleted file mode 100644
index f51ace0..0000000
--- a/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/strategy/FindMD5InBlobProperties.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.azureblob.blobstore.strategy;
-
-import java.util.Arrays;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.azureblob.AzureBlobClient;
-import org.jclouds.azureblob.domain.BlobProperties;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.functions.ObjectMD5;
-import org.jclouds.blobstore.internal.BlobRuntimeException;
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
-import org.jclouds.blobstore.strategy.ListBlobsInContainer;
-
-import com.google.common.base.Throwables;
-
-/**
- * Searches Content-MD5 tag for the value associated with the value
- *
- * @author Adrian Cole
- */
-@Singleton
-public class FindMD5InBlobProperties implements ContainsValueInListStrategy {
-
- protected final ObjectMD5 objectMD5;
- protected final ListBlobsInContainer getAllBlobMetadata;
- private final AzureBlobClient client;
-
- @Inject
- private FindMD5InBlobProperties(ObjectMD5 objectMD5,
- ListBlobsInContainer getAllBlobMetadata, AzureBlobClient client) {
- this.objectMD5 = objectMD5;
- this.getAllBlobMetadata = getAllBlobMetadata;
- this.client = client;
- }
-
- public boolean execute(String containerName, Object value, ListContainerOptions options) {
- try {
- byte[] toSearch = objectMD5.apply(value);
- for (BlobMetadata metadata : getAllBlobMetadata.execute(containerName, options)) {
- BlobProperties properties = client.getBlobProperties(containerName, metadata.getName());
- if (Arrays.equals(toSearch, properties.getContentMetadata().getContentMD5()))
- return true;
- }
- return false;
- } catch (Exception e) {
- Throwables.propagateIfPossible(e, BlobRuntimeException.class);
- throw new BlobRuntimeException(String.format(
- "Error searching for ETAG of value: [%2$s] in container:%1$s", containerName,
- value), e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a45124c5/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreModuleTest.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreModuleTest.java b/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreModuleTest.java
deleted file mode 100644
index 5f3fbad..0000000
--- a/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreModuleTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.azureblob.blobstore.config;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.ContextBuilder;
-import org.jclouds.azureblob.AzureBlobProviderMetadata;
-import org.jclouds.azureblob.blobstore.strategy.FindMD5InBlobProperties;
-import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
-import org.testng.annotations.Test;
-
-import com.google.inject.Injector;
-
-/**
- * @author Adrian Cole
- */
-@Test(groups = "unit")
-public class AzureBlobStoreModuleTest {
-
- @Test
- void testContextImpl() {
-
- Injector injector = ContextBuilder.newBuilder(new AzureBlobProviderMetadata()).credentials("foo", "bar")
- .buildInjector();
- ContainsValueInListStrategy valueList = injector.getInstance(ContainsValueInListStrategy.class);
-
- assertEquals(valueList.getClass(), FindMD5InBlobProperties.class);
- }
-
-}