mirror of https://github.com/apache/jclouds.git
updated to latest guice
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2300 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
4b43b70a53
commit
a35a0f84ab
|
@ -28,7 +28,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.atmosonline.saas.AtmosStorageAsyncClient;
|
||||
|
@ -46,6 +45,7 @@ import org.jclouds.concurrent.FutureFunctionWrapper;
|
|||
import org.jclouds.logging.Logger.LoggerFactory;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
public class BaseAtmosBlobStore {
|
||||
protected final AtmosStorageAsyncClient async;
|
||||
|
|
|
@ -30,7 +30,6 @@ import java.util.concurrent.TimeUnit;
|
|||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
|
@ -50,6 +49,7 @@ import org.jclouds.util.Utils;
|
|||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* Recursively remove a path.
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
package org.jclouds.atmosonline.saas.handlers;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.http.HttpCommand;
|
||||
|
@ -34,6 +33,8 @@ import org.jclouds.http.HttpRetryHandler;
|
|||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.util.Utils;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* Handles Retryable responses with error codes in the 4xx range
|
||||
*
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
package org.jclouds.aws.handlers;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.aws.domain.AWSError;
|
||||
|
@ -37,6 +36,8 @@ import org.jclouds.http.HttpRetryHandler;
|
|||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.util.Utils;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* Handles Retryable responses with error codes in the 3xx range
|
||||
*
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
<dependency>
|
||||
<groupId>com.google.code.guice</groupId>
|
||||
<artifactId>guice-servlet</artifactId>
|
||||
<version>2.1-r1089</version>
|
||||
<version>2.1-r1128</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>displaytag</groupId>
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
package org.jclouds.azure.storage.blob.handlers;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.azure.storage.domain.AzureStorageError;
|
||||
|
@ -38,6 +37,8 @@ import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
|
|||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.util.Utils;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* Handles Retryable responses with error codes in the 4xx range
|
||||
*
|
||||
|
|
|
@ -71,11 +71,11 @@
|
|||
<dependency>
|
||||
<groupId>com.google.code.guice</groupId>
|
||||
<artifactId>guice</artifactId>
|
||||
<version>2.1-r1089</version>
|
||||
<version>2.1-r1128</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.inject</groupId>
|
||||
<artifactId>atinject</artifactId>
|
||||
<artifactId>inject</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -26,7 +26,6 @@ package org.jclouds.blobstore.functions;
|
|||
import java.lang.reflect.Constructor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.blobstore.AsyncBlobStore;
|
||||
|
@ -39,6 +38,7 @@ import org.jclouds.rest.internal.GeneratedHttpRequest;
|
|||
import org.jclouds.util.Utils;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
public class ClearAndDeleteIfNotEmpty implements Function<Exception, Void>, InvocationContext {
|
||||
static final Void v;
|
||||
|
|
|
@ -30,7 +30,6 @@ import java.util.Set;
|
|||
import java.util.SortedSet;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.blobstore.AsyncBlobStore;
|
||||
|
@ -54,6 +53,7 @@ import org.jclouds.util.Utils;
|
|||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* Implements core Map functionality with an {@link AsyncBlobStore}
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.util.Set;
|
|||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
|
@ -43,6 +42,7 @@ import org.jclouds.blobstore.strategy.ListBlobMetadataStrategy;
|
|||
import org.jclouds.util.Utils;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* Deletes all keys in the container
|
||||
|
|
|
@ -32,7 +32,6 @@ import java.util.concurrent.Future;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
|
@ -50,6 +49,7 @@ import org.jclouds.util.Utils;
|
|||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* Retrieves all blobs in the blobstore under the current path, by the most efficient means
|
||||
|
|
|
@ -26,7 +26,6 @@ package org.jclouds.blobstore.strategy.internal;
|
|||
import java.util.SortedSet;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
|
@ -42,6 +41,7 @@ import org.jclouds.blobstore.strategy.ListBlobMetadataStrategy;
|
|||
import org.jclouds.util.Utils;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* Retrieves all blobs in the blobstore by the most efficient means possible.
|
||||
|
@ -65,8 +65,8 @@ public class ListBlobMetadataInContainer implements ListBlobMetadataStrategy {
|
|||
|
||||
public SortedSet<? extends BlobMetadata> execute(String container, ListContainerOptions options) {
|
||||
try {
|
||||
ListResponse<? extends ResourceMetadata> resources = connection.list(container,
|
||||
options).get(requestTimeoutMilliseconds, TimeUnit.MILLISECONDS);
|
||||
ListResponse<? extends ResourceMetadata> resources = connection.list(container, options)
|
||||
.get(requestTimeoutMilliseconds, TimeUnit.MILLISECONDS);
|
||||
SortedSet<BlobMetadata> blobM = Sets.newTreeSet();
|
||||
for (ResourceMetadata from : resources) {
|
||||
if (from.getType() == ResourceType.BLOB)
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
package org.jclouds.http.handlers;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
@ -35,6 +34,8 @@ import org.jclouds.http.HttpRetryHandler;
|
|||
import org.jclouds.http.TransformingHttpCommand;
|
||||
import org.jclouds.logging.Logger;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* Allow replayable request to be retried a limited number of times, and impose an exponential
|
||||
* back-off delay before returning.
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.jclouds.http.annotation.Redirection;
|
|||
import org.jclouds.http.annotation.ServerError;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import javax.inject.Inject;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* Delegates to {@link HttpErrorHandler HttpErrorHandlers} who are annotated according to the
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
*/
|
||||
package org.jclouds.http.handlers;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.jclouds.http.HttpCommand;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.http.HttpRetryHandler;
|
||||
|
@ -33,6 +31,7 @@ import org.jclouds.http.annotation.Redirection;
|
|||
import org.jclouds.http.annotation.ServerError;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* Delegates to {@link HttpRetryHandler HttpRetryHandlers} who are annotated according to the
|
||||
|
|
|
@ -28,7 +28,6 @@ import java.io.IOException;
|
|||
import java.net.URI;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
|
@ -41,6 +40,7 @@ import org.jclouds.http.HttpRetryHandler;
|
|||
import org.jclouds.logging.Logger;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* Handles Retryable responses with error codes in the 3xx range
|
||||
|
|
|
@ -34,7 +34,6 @@ import java.net.URL;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
|
@ -51,6 +50,7 @@ import org.jclouds.http.handlers.DelegatingErrorHandler;
|
|||
import org.jclouds.http.handlers.DelegatingRetryHandler;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* Basic implementation of a {@link HttpCommandExecutorService}.
|
||||
|
|
|
@ -143,6 +143,7 @@ public class ConnectionPoolTransformingHttpCommandExecutorService<C> extends Bas
|
|||
// should block and immediately parse the response on exit.
|
||||
Future<T> future = executorService.submit(new Callable<T>() {
|
||||
Logger transformerLogger = logFactory.getLogger(responseTransformer.getClass().getName());
|
||||
|
||||
public T call() throws Exception {
|
||||
Object o = channel.take();
|
||||
if (o instanceof Exception) {
|
||||
|
|
|
@ -31,12 +31,13 @@ import java.util.concurrent.TimeUnit;
|
|||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.http.HttpCommandRendezvous;
|
||||
import org.jclouds.lifecycle.BaseLifeCycle;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* // TODO: Adrian: Document this!
|
||||
*
|
||||
|
|
|
@ -27,13 +27,13 @@ import java.util.concurrent.BlockingQueue;
|
|||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.http.pool.PoolConstants;
|
||||
import org.jclouds.lifecycle.config.LifeCycleModule;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provides;
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
*
|
||||
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
*
|
||||
* ====================================================================
|
||||
* 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.predicates;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.logging.Logger;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
*
|
||||
* Tests to see if an address is reachable.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Singleton
|
||||
public class AddressReachable implements Predicate<InetAddress> {
|
||||
|
||||
@Resource
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
@Inject(optional = true)
|
||||
@Named("org.jclouds.address_timeout")
|
||||
private int timeout = 2000;
|
||||
|
||||
@Override
|
||||
public boolean apply(InetAddress address) {
|
||||
try {
|
||||
logger.trace("testing address %s", address);
|
||||
return address.isReachable(timeout);
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -28,13 +28,13 @@ import java.net.InetSocketAddress;
|
|||
import java.net.Socket;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.logging.Logger;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -36,7 +36,6 @@ import java.util.concurrent.TimeUnit;
|
|||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
|
@ -49,6 +48,7 @@ import org.jclouds.logging.Logger;
|
|||
import org.jclouds.rest.InvocationContext;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.TypeLiteral;
|
||||
import com.google.inject.internal.Nullable;
|
||||
|
@ -88,7 +88,8 @@ public class AsyncRestClientProxy<T> implements InvocationHandler {
|
|||
return this.hashCode();
|
||||
} else if (method.getName().startsWith("new")) {
|
||||
return injector.getInstance(method.getReturnType());
|
||||
} else if (util.getDelegateOrNull(method) != null &&Future.class.isAssignableFrom(method.getReturnType())) {
|
||||
} else if (util.getDelegateOrNull(method) != null
|
||||
&& Future.class.isAssignableFrom(method.getReturnType())) {
|
||||
method = util.getDelegateOrNull(method);
|
||||
logger.trace("Converting %s.%s", declaring.getSimpleName(), method.getName());
|
||||
Function<Exception, ?> exceptionParser = util
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
<dependency>
|
||||
<groupId>com.google.code.guice</groupId>
|
||||
<artifactId>guice-servlet</artifactId>
|
||||
<version>2.1-r1089</version>
|
||||
<version>2.1-r1128</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>displaytag</groupId>
|
||||
|
|
Loading…
Reference in New Issue