Issue 67: convert to javax.inject annotations

git-svn-id: http://jclouds.googlecode.com/svn/trunk@1913 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2009-09-24 05:37:25 +00:00
parent 7a6b9fe6cd
commit 3cde3d6356
134 changed files with 314 additions and 230 deletions

View File

@ -27,7 +27,7 @@ import org.jclouds.aws.ec2.reference.EC2Constants;
import org.jclouds.http.options.HttpRequestOptions; import org.jclouds.http.options.HttpRequestOptions;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* *

View File

@ -32,7 +32,7 @@ import org.jclouds.aws.ec2.EC2Context;
import org.jclouds.lifecycle.Closer; import org.jclouds.lifecycle.Closer;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Injector; import com.google.inject.Injector;
/** /**

View File

@ -33,8 +33,8 @@ import org.jclouds.blobstore.binders.BlobBinder;
import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.Blob;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.name.Named; import javax.inject.Named;
public class S3ObjectBinder extends BlobBinder { public class S3ObjectBinder extends BlobBinder {
@Inject @Inject

View File

@ -46,11 +46,11 @@ import org.jclouds.rest.RestClientFactory;
import org.jclouds.rest.config.JaxrsModule; import org.jclouds.rest.config.JaxrsModule;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Provides; import com.google.inject.Provides;
import com.google.inject.Scopes; import com.google.inject.Scopes;
import com.google.inject.Singleton; import javax.inject.Singleton;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* Configures the S3 connection, including logging and http transport. * Configures the S3 connection, including logging and http transport.

View File

@ -25,7 +25,7 @@ package org.jclouds.aws.s3.domain;
import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.Blob;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
/** /**

View File

@ -42,9 +42,9 @@ import org.jclouds.http.HttpUtils;
import org.jclouds.util.DateService; import org.jclouds.util.DateService;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Singleton; import javax.inject.Singleton;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* Signs the S3 request. This will update timestamps at most once per second. * Signs the S3 request. This will update timestamps at most once per second.

View File

@ -27,7 +27,7 @@ import org.jclouds.aws.s3.domain.ObjectMetadata;
import org.jclouds.aws.s3.domain.S3Object; import org.jclouds.aws.s3.domain.S3Object;
import org.jclouds.blobstore.functions.ParseBlobFromHeadersAndHttpContent; import org.jclouds.blobstore.functions.ParseBlobFromHeadersAndHttpContent;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* Parses response headers and creates a new S3Object from them and the HTTP content. * Parses response headers and creates a new S3Object from them and the HTTP content.

View File

@ -35,8 +35,8 @@ import org.jclouds.http.HttpUtils;
import org.jclouds.util.DateService; import org.jclouds.util.DateService;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* This parses @{link {@link org.jclouds.aws.s3.domain.ObjectMetadata} from HTTP headers. * This parses @{link {@link org.jclouds.aws.s3.domain.ObjectMetadata} from HTTP headers.

View File

@ -35,8 +35,8 @@ import org.jclouds.http.HttpRetryHandler;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import org.jclouds.util.Utils; import org.jclouds.util.Utils;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* Handles Retryable responses with error codes in the 3xx range * Handles Retryable responses with error codes in the 3xx range

View File

@ -37,8 +37,8 @@ import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
import org.jclouds.http.handlers.RedirectionRetryHandler; import org.jclouds.http.handlers.RedirectionRetryHandler;
import org.jclouds.util.Utils; import org.jclouds.util.Utils;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* Handles Retryable responses with error codes in the 3xx range * Handles Retryable responses with error codes in the 3xx range

View File

@ -36,7 +36,7 @@ import org.jclouds.http.HttpResponseException;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import org.jclouds.util.Utils; import org.jclouds.util.Utils;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* This will parse and set an appropriate exception on the command object. * This will parse and set an appropriate exception on the command object.

View File

@ -38,9 +38,9 @@ import org.jclouds.blobstore.InputStreamMap;
import org.jclouds.lifecycle.Closer; import org.jclouds.lifecycle.Closer;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* Uses a Guice Injector to configure the objects served by S3Context methods. * Uses a Guice Injector to configure the objects served by S3Context methods.

View File

@ -29,7 +29,7 @@ import org.jclouds.aws.s3.domain.ObjectMetadata;
import org.jclouds.aws.s3.domain.S3Object; import org.jclouds.aws.s3.domain.S3Object;
import org.jclouds.blobstore.LiveInputStreamMap; import org.jclouds.blobstore.LiveInputStreamMap;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
/** /**

View File

@ -29,7 +29,7 @@ import org.jclouds.aws.s3.domain.ObjectMetadata;
import org.jclouds.aws.s3.domain.S3Object; import org.jclouds.aws.s3.domain.S3Object;
import org.jclouds.blobstore.LiveBlobMap; import org.jclouds.blobstore.LiveBlobMap;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
/** /**

View File

@ -39,8 +39,8 @@ import org.joda.time.DateTime;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.HashMultimap; import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* Contains options supported in the REST API for the COPY object operation. * Contains options supported in the REST API for the COPY object operation.

View File

@ -34,7 +34,7 @@ import org.jclouds.blobstore.reference.BlobStoreConstants;
public interface S3Constants extends AWSConstants, S3Headers, BlobStoreConstants { public interface S3Constants extends AWSConstants, S3Headers, BlobStoreConstants {
/** /**
* S3 service's XML Namespace, as used in XML request and response documents. * S3 service's XML Jsr330pace, as used in XML request and response documents.
*/ */
public static final String S3_REST_API_XML_NAMESPACE = "http://s3.amazonaws.com/doc/2006-03-01/"; public static final String S3_REST_API_XML_NAMESPACE = "http://s3.amazonaws.com/doc/2006-03-01/";
public static final String ENDPOINT = "Endpoint"; public static final String ENDPOINT = "Endpoint";

View File

@ -39,7 +39,7 @@ import org.jclouds.http.HttpException;
import org.jclouds.http.HttpResponse; import org.jclouds.http.HttpResponse;
import org.jclouds.http.HttpUtils; import org.jclouds.http.HttpUtils;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* Encryption, Hashing, and IO Utilities needed to sign and verify S3 requests and responses. * Encryption, Hashing, and IO Utilities needed to sign and verify S3 requests and responses.

View File

@ -28,7 +28,7 @@ import org.jclouds.http.HttpUtils;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.jclouds.util.DateService; import org.jclouds.util.DateService;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* Parses the response from Amazon S3 COPY Object command. * Parses the response from Amazon S3 COPY Object command.

View File

@ -31,7 +31,7 @@ import org.jclouds.aws.s3.domain.BucketMetadata;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.jclouds.util.DateService; import org.jclouds.util.DateService;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* Parses the following XML document: * Parses the following XML document:

View File

@ -37,7 +37,7 @@ import org.jclouds.util.DateService;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* Parses the following XML document: * Parses the following XML document:

View File

@ -34,8 +34,8 @@ import org.jclouds.aws.xml.ErrorHandler;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Provider; import javax.inject.Provider;
/** /**
* Creates Parsers needed to interpret S3 Server messages. This class uses guice assisted inject, * Creates Parsers needed to interpret S3 Server messages. This class uses guice assisted inject,

View File

@ -39,7 +39,7 @@ import org.testng.annotations.Test;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.name.Names; import org.jclouds.util.Jsr330;
/** /**
* @author Adrian Cole * @author Adrian Cole
@ -52,17 +52,17 @@ public class S3ContextModuleTest {
new WithinThreadExecutorService()), new S3ParserModule(), new S3ContextModule() { new WithinThreadExecutorService()), new S3ParserModule(), new S3ContextModule() {
@Override @Override
protected void configure() { protected void configure() {
bindConstant().annotatedWith(Names.named(S3Constants.PROPERTY_AWS_ACCESSKEYID)).to( bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_AWS_ACCESSKEYID)).to(
"localhost"); "localhost");
bindConstant().annotatedWith(Names.named(S3Constants.PROPERTY_AWS_SECRETACCESSKEY)).to( bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_AWS_SECRETACCESSKEY)).to(
"localhost"); "localhost");
bindConstant().annotatedWith(Names.named(S3Constants.PROPERTY_HTTP_ADDRESS)).to( bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_HTTP_ADDRESS)).to(
"localhost"); "localhost");
bindConstant().annotatedWith(Names.named(S3Constants.PROPERTY_HTTP_PORT)).to("1000"); bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_HTTP_PORT)).to("1000");
bindConstant().annotatedWith(Names.named(S3Constants.PROPERTY_HTTP_SECURE)).to("false"); bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_HTTP_SECURE)).to("false");
bindConstant().annotatedWith(Names.named(S3Constants.PROPERTY_HTTP_MAX_RETRIES)) bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_HTTP_MAX_RETRIES))
.to("5"); .to("5");
bindConstant().annotatedWith(Names.named(S3Constants.PROPERTY_HTTP_MAX_REDIRECTS)).to( bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_HTTP_MAX_REDIRECTS)).to(
"5"); "5");
super.configure(); super.configure();
} }

View File

@ -40,7 +40,7 @@ import org.testng.annotations.Test;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.name.Names; import org.jclouds.util.Jsr330;
@Test(groups = "unit", testName = "s3.RequestAuthorizeSignatureTest") @Test(groups = "unit", testName = "s3.RequestAuthorizeSignatureTest")
public class RequestAuthorizeSignatureTest { public class RequestAuthorizeSignatureTest {
@ -152,9 +152,9 @@ public class RequestAuthorizeSignatureTest {
injector = Guice.createInjector(new AbstractModule() { injector = Guice.createInjector(new AbstractModule() {
protected void configure() { protected void configure() {
bindConstant().annotatedWith(Names.named(S3Constants.PROPERTY_AWS_ACCESSKEYID)).to( bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_AWS_ACCESSKEYID)).to(
"foo"); "foo");
bindConstant().annotatedWith(Names.named(S3Constants.PROPERTY_AWS_SECRETACCESSKEY)).to( bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_AWS_SECRETACCESSKEY)).to(
"bar"); "bar");
bind(DateService.class); bind(DateService.class);

View File

@ -47,7 +47,7 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.inject.Provider; import javax.inject.Provider;
/** /**
* Tests relative performance of S3 functions. * Tests relative performance of S3 functions.

View File

@ -54,7 +54,7 @@
<dependency> <dependency>
<groupId>com.google.code.guice</groupId> <groupId>com.google.code.guice</groupId>
<artifactId>guice-servlet</artifactId> <artifactId>guice-servlet</artifactId>
<version>2.0</version> <version>2.1-r1089</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>displaytag</groupId> <groupId>displaytag</groupId>

View File

@ -42,9 +42,9 @@ import org.jclouds.samples.googleappengine.domain.BucketResult;
import org.jclouds.samples.googleappengine.functions.MetadataToBucketResult; import org.jclouds.samples.googleappengine.functions.MetadataToBucketResult;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Provider; import javax.inject.Provider;
import com.google.inject.Singleton; import javax.inject.Singleton;
/** /**
* Shows an example of how to use @{link S3Connection} injected with Guice. * Shows an example of how to use @{link S3Connection} injected with Guice.

View File

@ -41,8 +41,8 @@ import org.jclouds.aws.s3.domain.ListBucketResponse;
import org.jclouds.blobstore.ContainerNotFoundException; import org.jclouds.blobstore.ContainerNotFoundException;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Singleton; import javax.inject.Singleton;
/** /**
* Shows an example of how to use @{link S3Connection} injected with Guice. * Shows an example of how to use @{link S3Connection} injected with Guice.

View File

@ -23,7 +23,7 @@
*/ */
package org.jclouds.samples.googleappengine.config; package org.jclouds.samples.googleappengine.config;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.servlet.GuiceServletContextListener; import com.google.inject.servlet.GuiceServletContextListener;
import com.google.inject.servlet.ServletModule; import com.google.inject.servlet.ServletModule;

View File

@ -35,7 +35,7 @@ import org.jclouds.logging.Logger;
import org.jclouds.samples.googleappengine.domain.BucketResult; import org.jclouds.samples.googleappengine.domain.BucketResult;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.inject.Inject; import javax.inject.Inject;
public class MetadataToBucketResult implements Function<BucketMetadata, BucketResult> { public class MetadataToBucketResult implements Function<BucketMetadata, BucketResult> {
private final S3BlobStore connection; private final S3BlobStore connection;

View File

@ -32,8 +32,8 @@ import org.jclouds.azure.storage.blob.domain.BlobMetadata;
import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.Blob;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.name.Named; import javax.inject.Named;
public class BlobBinder extends org.jclouds.blobstore.binders.BlobBinder { public class BlobBinder extends org.jclouds.blobstore.binders.BlobBinder {
@Inject @Inject

View File

@ -32,7 +32,7 @@ import org.jclouds.http.RequiresHttp;
import org.jclouds.rest.RestClientFactory; import org.jclouds.rest.RestClientFactory;
import com.google.inject.Provides; import com.google.inject.Provides;
import com.google.inject.Singleton; import javax.inject.Singleton;
/** /**
* Configures the Azure Blob Service connection, including logging and http transport. * Configures the Azure Blob Service connection, including logging and http transport.

View File

@ -23,7 +23,7 @@
*/ */
package org.jclouds.azure.storage.blob.domain; package org.jclouds.azure.storage.blob.domain;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
/** /**

View File

@ -27,7 +27,7 @@ import org.jclouds.azure.storage.blob.domain.Blob;
import org.jclouds.azure.storage.blob.domain.BlobMetadata; import org.jclouds.azure.storage.blob.domain.BlobMetadata;
import org.jclouds.blobstore.functions.ParseBlobMetadataFromHeaders; import org.jclouds.blobstore.functions.ParseBlobMetadataFromHeaders;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* Parses response headers and creates a new Azure Blob from them and the HTTP content. * Parses response headers and creates a new Azure Blob from them and the HTTP content.

View File

@ -31,8 +31,8 @@ import org.jclouds.azure.storage.blob.domain.BlobMetadata;
import org.jclouds.http.HttpResponse; import org.jclouds.http.HttpResponse;
import org.jclouds.util.DateService; import org.jclouds.util.DateService;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* This parses @{link {@link org.jclouds.azure.storage.blob.domain.BlobMetadata} from HTTP headers. * This parses @{link {@link org.jclouds.azure.storage.blob.domain.BlobMetadata} from HTTP headers.

View File

@ -38,9 +38,9 @@ import org.jclouds.blobstore.InputStreamMap;
import org.jclouds.lifecycle.Closer; import org.jclouds.lifecycle.Closer;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* Uses a Guice Injector to configure the objects served by AzureBlobContext methods. * Uses a Guice Injector to configure the objects served by AzureBlobContext methods.

View File

@ -29,7 +29,7 @@ import org.jclouds.azure.storage.blob.domain.BlobMetadata;
import org.jclouds.azure.storage.blob.domain.ContainerMetadata; import org.jclouds.azure.storage.blob.domain.ContainerMetadata;
import org.jclouds.blobstore.LiveInputStreamMap; import org.jclouds.blobstore.LiveInputStreamMap;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
/** /**

View File

@ -29,7 +29,7 @@ import org.jclouds.azure.storage.blob.domain.BlobMetadata;
import org.jclouds.azure.storage.blob.domain.ContainerMetadata; import org.jclouds.azure.storage.blob.domain.ContainerMetadata;
import org.jclouds.blobstore.LiveBlobMap; import org.jclouds.blobstore.LiveBlobMap;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
/** /**

View File

@ -35,7 +35,7 @@ import org.jclouds.http.functions.ParseSax;
import org.jclouds.util.DateService; import org.jclouds.util.DateService;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* Parses the following XML document: * Parses the following XML document:

View File

@ -29,8 +29,8 @@ import org.jclouds.azure.storage.domain.BoundedList;
import org.jclouds.azure.storage.xml.AzureStorageParserFactory; import org.jclouds.azure.storage.xml.AzureStorageParserFactory;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Provider; import javax.inject.Provider;
/** /**
* Creates Parsers needed to interpret Azure Blob Service messages. This class uses guice assisted * Creates Parsers needed to interpret Azure Blob Service messages. This class uses guice assisted

View File

@ -37,7 +37,7 @@ import org.joda.time.DateTime;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* Parses the following XML document: * Parses the following XML document:

View File

@ -55,7 +55,7 @@ import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableMultimap;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.name.Names; import org.jclouds.util.Jsr330;
/** /**
* Tests behavior of {@code AzureBlobStore} * Tests behavior of {@code AzureBlobStore}
@ -264,10 +264,10 @@ public class AzureBlobStoreTest {
protected void configure() { protected void configure() {
bind(URI.class).toInstance(URI.create("http://blob.core.windows.net")); bind(URI.class).toInstance(URI.create("http://blob.core.windows.net"));
bindConstant().annotatedWith( bindConstant().annotatedWith(
Names.named(AzureStorageConstants.PROPERTY_AZURESTORAGE_ACCOUNT)).to( Jsr330.named(AzureStorageConstants.PROPERTY_AZURESTORAGE_ACCOUNT)).to(
"myaccount"); "myaccount");
bindConstant().annotatedWith( bindConstant().annotatedWith(
Names.named(AzureStorageConstants.PROPERTY_AZURESTORAGE_KEY)).to( Jsr330.named(AzureStorageConstants.PROPERTY_AZURESTORAGE_KEY)).to(
HttpUtils.toBase64String("key".getBytes())); HttpUtils.toBase64String("key".getBytes()));
} }

View File

@ -41,11 +41,11 @@ import org.jclouds.logging.Logger;
import org.jclouds.rest.config.JaxrsModule; import org.jclouds.rest.config.JaxrsModule;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Provides; import com.google.inject.Provides;
import com.google.inject.Scopes; import com.google.inject.Scopes;
import com.google.inject.Singleton; import javax.inject.Singleton;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* Configures the AzureStorage connection, including logging and http transport. * Configures the AzureStorage connection, including logging and http transport.

View File

@ -40,9 +40,9 @@ import org.jclouds.http.HttpUtils;
import org.jclouds.util.DateService; import org.jclouds.util.DateService;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Singleton; import javax.inject.Singleton;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* Signs the Azure Storage request. This will update timestamps at most once per second. * Signs the Azure Storage request. This will update timestamps at most once per second.

View File

@ -36,7 +36,7 @@ import org.jclouds.http.HttpResponseException;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import org.jclouds.util.Utils; import org.jclouds.util.Utils;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* This will parse and set an appropriate exception on the command object. * This will parse and set an appropriate exception on the command object.

View File

@ -34,7 +34,7 @@ import org.jclouds.http.HttpCommand;
import org.jclouds.http.HttpException; import org.jclouds.http.HttpException;
import org.jclouds.http.HttpResponse; import org.jclouds.http.HttpResponse;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* Encryption, Hashing, and IO Utilities needed to sign and verify Azure Storage requests and * Encryption, Hashing, and IO Utilities needed to sign and verify Azure Storage requests and

View File

@ -27,8 +27,8 @@ import org.jclouds.azure.storage.domain.AzureStorageError;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Provider; import javax.inject.Provider;
/** /**
* Creates Parsers needed to interpret Azure Storage Service messages. This class uses guice * Creates Parsers needed to interpret Azure Storage Service messages. This class uses guice

View File

@ -45,7 +45,7 @@ import org.testng.annotations.Test;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.name.Names; import org.jclouds.util.Jsr330;
/** /**
* Tests behavior of {@code JaxrsAnnotationProcessor} * Tests behavior of {@code JaxrsAnnotationProcessor}
@ -85,9 +85,9 @@ public class SharedKeyAuthenticationLiveTest {
@Override @Override
protected void configure() { protected void configure() {
bindConstant().annotatedWith( bindConstant().annotatedWith(
Names.named(AzureStorageConstants.PROPERTY_AZURESTORAGE_ACCOUNT)).to(account); Jsr330.named(AzureStorageConstants.PROPERTY_AZURESTORAGE_ACCOUNT)).to(account);
bindConstant().annotatedWith( bindConstant().annotatedWith(
Names.named(AzureStorageConstants.PROPERTY_AZURESTORAGE_KEY)).to(key); Jsr330.named(AzureStorageConstants.PROPERTY_AZURESTORAGE_KEY)).to(key);
} }
}, new JaxrsModule(), new Log4JLoggingModule(), new ExecutorServiceModule( }, new JaxrsModule(), new Log4JLoggingModule(), new ExecutorServiceModule(

View File

@ -41,7 +41,7 @@ import org.testng.annotations.Test;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.name.Names; import org.jclouds.util.Jsr330;
@Test(groups = "unit", testName = "azurestorage.SharedKeyAuthenticationTest") @Test(groups = "unit", testName = "azurestorage.SharedKeyAuthenticationTest")
public class SharedKeyAuthenticationTest { public class SharedKeyAuthenticationTest {
@ -148,9 +148,9 @@ public class SharedKeyAuthenticationTest {
protected void configure() { protected void configure() {
bindConstant().annotatedWith( bindConstant().annotatedWith(
Names.named(AzureStorageConstants.PROPERTY_AZURESTORAGE_ACCOUNT)).to(ACCOUNT); Jsr330.named(AzureStorageConstants.PROPERTY_AZURESTORAGE_ACCOUNT)).to(ACCOUNT);
bindConstant().annotatedWith( bindConstant().annotatedWith(
Names.named(AzureStorageConstants.PROPERTY_AZURESTORAGE_KEY)).to(KEY); Jsr330.named(AzureStorageConstants.PROPERTY_AZURESTORAGE_KEY)).to(KEY);
bind(DateService.class); bind(DateService.class);
} }

View File

@ -32,7 +32,7 @@ import org.jclouds.http.RequiresHttp;
import org.jclouds.rest.RestClientFactory; import org.jclouds.rest.RestClientFactory;
import com.google.inject.Provides; import com.google.inject.Provides;
import com.google.inject.Singleton; import javax.inject.Singleton;
/** /**
* Configures the Azure Queue Service connection, including logging and http transport. * Configures the Azure Queue Service connection, including logging and http transport.

View File

@ -34,9 +34,9 @@ import org.jclouds.azure.storage.reference.AzureStorageConstants;
import org.jclouds.lifecycle.Closer; import org.jclouds.lifecycle.Closer;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* Uses a Guice Injector to configure the objects served by AzureQueueContext methods. * Uses a Guice Injector to configure the objects served by AzureQueueContext methods.

View File

@ -32,7 +32,7 @@ import org.jclouds.azure.storage.domain.BoundedList;
import org.jclouds.azure.storage.queue.domain.QueueMetadata; import org.jclouds.azure.storage.queue.domain.QueueMetadata;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* Parses the following XML document: * Parses the following XML document:

View File

@ -28,8 +28,8 @@ import org.jclouds.azure.storage.queue.domain.QueueMetadata;
import org.jclouds.azure.storage.xml.AzureStorageParserFactory; import org.jclouds.azure.storage.xml.AzureStorageParserFactory;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Provider; import javax.inject.Provider;
/** /**
* Creates Parsers needed to interpret Azure Queue Service messages. This class uses guice assisted * Creates Parsers needed to interpret Azure Queue Service messages. This class uses guice assisted

View File

@ -52,7 +52,7 @@ import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableMultimap;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.name.Names; import org.jclouds.util.Jsr330;
/** /**
* Tests behavior of {@code AzureQueueConnection} * Tests behavior of {@code AzureQueueConnection}
@ -170,10 +170,10 @@ public class AzureQueueConnectionTest {
protected void configure() { protected void configure() {
bind(URI.class).toInstance(URI.create("http://localhost:8080")); bind(URI.class).toInstance(URI.create("http://localhost:8080"));
bindConstant().annotatedWith( bindConstant().annotatedWith(
Names.named(AzureStorageConstants.PROPERTY_AZURESTORAGE_ACCOUNT)).to( Jsr330.named(AzureStorageConstants.PROPERTY_AZURESTORAGE_ACCOUNT)).to(
"user"); "user");
bindConstant().annotatedWith( bindConstant().annotatedWith(
Names.named(AzureStorageConstants.PROPERTY_AZURESTORAGE_KEY)).to( Jsr330.named(AzureStorageConstants.PROPERTY_AZURESTORAGE_KEY)).to(
HttpUtils.toBase64String("key".getBytes())); HttpUtils.toBase64String("key".getBytes()));
} }

View File

@ -49,9 +49,9 @@ import org.jclouds.util.Utils;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* Implements core Map functionality with an {@link BlobStore} * Implements core Map functionality with an {@link BlobStore}

View File

@ -37,7 +37,7 @@ import org.jclouds.blobstore.domain.BlobMetadata;
import org.jclouds.blobstore.domain.ContainerMetadata; import org.jclouds.blobstore.domain.ContainerMetadata;
import org.jclouds.util.Utils; import org.jclouds.util.Utils;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
/** /**

View File

@ -41,7 +41,7 @@ import org.jclouds.blobstore.domain.ContainerMetadata;
import org.jclouds.util.Utils; import org.jclouds.util.Utils;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
/** /**

View File

@ -33,8 +33,8 @@ import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpUtils; import org.jclouds.http.HttpUtils;
import org.jclouds.rest.EntityBinder; import org.jclouds.rest.EntityBinder;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.name.Named; import javax.inject.Named;
public class BlobBinder implements EntityBinder { public class BlobBinder implements EntityBinder {
private final String metadataPrefix; private final String metadataPrefix;

View File

@ -31,8 +31,8 @@ import org.jclouds.http.HttpRequest;
import org.jclouds.rest.EntityBinder; import org.jclouds.rest.EntityBinder;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.name.Named; import javax.inject.Named;
public class UserMetadataBinder implements EntityBinder { public class UserMetadataBinder implements EntityBinder {
private final String metadataPrefix; private final String metadataPrefix;

View File

@ -33,7 +33,7 @@ import java.io.InputStream;
import org.jclouds.http.HttpUtils; import org.jclouds.http.HttpUtils;
import org.jclouds.http.HttpUtils.MD5InputStreamResult; import org.jclouds.http.HttpUtils.MD5InputStreamResult;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
/** /**

View File

@ -32,7 +32,7 @@ import org.jclouds.http.HttpResponse;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* Parses response headers and creates a new Blob from them and the HTTP content. * Parses response headers and creates a new Blob from them and the HTTP content.

View File

@ -37,8 +37,8 @@ import org.jclouds.util.DateService;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* @author Adrian Cole * @author Adrian Cole

View File

@ -50,7 +50,7 @@ import org.jclouds.logging.Logger;
import org.testng.ITestContext; import org.testng.ITestContext;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.Key; import com.google.inject.Key;
import com.google.inject.Module; import com.google.inject.Module;

View File

@ -99,7 +99,7 @@ public class BaseBlobStoreIntegrationTest<S extends BlobStore<C, M, B>, C extend
/** /**
* two test groups integration and live. * two test groups integration and live.
*/ */
private volatile static BlockingQueue<String> containerNames = new ArrayBlockingQueue<String>( private volatile static BlockingQueue<String> containerJsr330 = new ArrayBlockingQueue<String>(
containerCount); containerCount);
@BeforeGroups(groups = { "integration", "live" }) @BeforeGroups(groups = { "integration", "live" })
@ -169,7 +169,7 @@ public class BaseBlobStoreIntegrationTest<S extends BlobStore<C, M, B>, C extend
} else { } else {
try { try {
createContainerAndEnsureEmpty(client, context, containerName); createContainerAndEnsureEmpty(client, context, containerName);
containerNames.put(containerName); containerJsr330.put(containerName);
} catch (Throwable e) { } catch (Throwable e) {
// throw away the container and try again with the next index // throw away the container and try again with the next index
deleteContainerOrWarnIfUnable(client, context, containerName); deleteContainerOrWarnIfUnable(client, context, containerName);
@ -177,8 +177,8 @@ public class BaseBlobStoreIntegrationTest<S extends BlobStore<C, M, B>, C extend
} }
} }
} }
testContext.setAttribute("containerNames", containerNames); testContext.setAttribute("containerJsr330", containerJsr330);
System.err.printf("*** containers to test: %s%n", containerNames); System.err.printf("*** containers to test: %s%n", containerJsr330);
// careful not to keep too many files open // careful not to keep too many files open
context.close(); context.close();
initialized = true; initialized = true;
@ -338,7 +338,7 @@ public class BaseBlobStoreIntegrationTest<S extends BlobStore<C, M, B>, C extend
public String getContainerName() throws InterruptedException, ExecutionException, public String getContainerName() throws InterruptedException, ExecutionException,
TimeoutException { TimeoutException {
String containerName = containerNames.poll(30, TimeUnit.SECONDS); String containerName = containerJsr330.poll(30, TimeUnit.SECONDS);
assert containerName != null : "unable to get a container for the test"; assert containerName != null : "unable to get a container for the test";
emptyContainer(containerName); emptyContainer(containerName);
return containerName; return containerName;
@ -357,7 +357,7 @@ public class BaseBlobStoreIntegrationTest<S extends BlobStore<C, M, B>, C extend
public void returnContainer(final String containerName) throws InterruptedException, public void returnContainer(final String containerName) throws InterruptedException,
ExecutionException, TimeoutException { ExecutionException, TimeoutException {
if (containerName != null) { if (containerName != null) {
containerNames.add(containerName); containerJsr330.add(containerName);
/* /*
* Ensure that any returned container name actually exists on the server. Return of a * Ensure that any returned container name actually exists on the server. Return of a
* non-existent container introduces subtle testing bugs, where later unrelated tests will * non-existent container introduces subtle testing bugs, where later unrelated tests will

View File

@ -70,12 +70,17 @@
<dependency> <dependency>
<groupId>com.google.code.guice</groupId> <groupId>com.google.code.guice</groupId>
<artifactId>guice</artifactId> <artifactId>guice</artifactId>
<version>2.1-r1039</version> <version>2.1-r1089</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>atinject</artifactId>
<version>1.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.code.guice</groupId> <groupId>com.google.code.guice</groupId>
<artifactId>guice-assistedinject</artifactId> <artifactId>guice-assistedinject</artifactId>
<version>2.0</version> <version>2.1-r1089</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.collections</groupId> <groupId>com.google.collections</groupId>

View File

@ -64,7 +64,7 @@ import com.google.inject.AbstractModule;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.Module; import com.google.inject.Module;
import com.google.inject.name.Names; import org.jclouds.util.Jsr330;
/** /**
* Creates {@link CloudContext} or {@link Injector} instances based on the most commonly requested * Creates {@link CloudContext} or {@link Injector} instances based on the most commonly requested
@ -199,7 +199,7 @@ public abstract class CloudContextBuilder<X extends CloudContext<?>> {
modules.add(new AbstractModule() { modules.add(new AbstractModule() {
@Override @Override
protected void configure() { protected void configure() {
Names.bindProperties(binder(), checkNotNull(properties, "properties")); Jsr330.bindProperties(binder(), checkNotNull(properties, "properties"));
} }
}); });
addContextModule(modules); addContextModule(modules);

View File

@ -30,7 +30,7 @@ import java.util.concurrent.Future;
import org.jclouds.concurrent.FutureFunctionCallable; import org.jclouds.concurrent.FutureFunctionCallable;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* Executor which will invoke and transform the response of an {@code EndpointCommand} into generic * Executor which will invoke and transform the response of an {@code EndpointCommand} into generic

View File

@ -36,7 +36,7 @@ import javax.ws.rs.core.UriBuilder;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
import com.google.inject.internal.Nullable; import com.google.inject.internal.Nullable;

View File

@ -23,7 +23,7 @@
*/ */
package org.jclouds.http.annotation; package org.jclouds.http.annotation;
import com.google.inject.BindingAnnotation; import javax.inject.Qualifier;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
@ -37,7 +37,7 @@ import static java.lang.annotation.ElementType.METHOD;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@BindingAnnotation @Qualifier
@Target( { FIELD, PARAMETER, METHOD }) @Target( { FIELD, PARAMETER, METHOD })
@Retention(RUNTIME) @Retention(RUNTIME)
public @interface ClientError { public @interface ClientError {

View File

@ -23,7 +23,7 @@
*/ */
package org.jclouds.http.annotation; package org.jclouds.http.annotation;
import com.google.inject.BindingAnnotation; import javax.inject.Qualifier;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
@ -37,7 +37,7 @@ import static java.lang.annotation.ElementType.METHOD;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@BindingAnnotation @Qualifier
@Target( { FIELD, PARAMETER, METHOD }) @Target( { FIELD, PARAMETER, METHOD })
@Retention(RUNTIME) @Retention(RUNTIME)
public @interface Redirection { public @interface Redirection {

View File

@ -23,7 +23,7 @@
*/ */
package org.jclouds.http.annotation; package org.jclouds.http.annotation;
import com.google.inject.BindingAnnotation; import javax.inject.Qualifier;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
@ -37,7 +37,7 @@ import static java.lang.annotation.ElementType.METHOD;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@BindingAnnotation @Qualifier
@Target( { FIELD, PARAMETER, METHOD }) @Target( { FIELD, PARAMETER, METHOD })
@Retention(RUNTIME) @Retention(RUNTIME)
public @interface ServerError { public @interface ServerError {

View File

@ -35,7 +35,7 @@ import org.jclouds.http.HttpRequest;
import org.jclouds.rest.MapEntityBinder; import org.jclouds.rest.MapEntityBinder;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* Binds the object to the request as a json object. * Binds the object to the request as a json object.

View File

@ -36,8 +36,8 @@ import org.jclouds.logging.Logger;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* This object will parse the body of an HttpResponse and return the result of type <T> back to the * This object will parse the body of an HttpResponse and return the result of type <T> back to the

View File

@ -41,9 +41,9 @@ import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.DefaultHandler;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* This object will parse the body of an HttpResponse and return the result of type <T> back to the * This object will parse the body of an HttpResponse and return the result of type <T> back to the

View File

@ -48,7 +48,7 @@ import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer; import com.google.gson.JsonSerializer;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import com.google.inject.Provides; import com.google.inject.Provides;
import com.google.inject.Singleton; import javax.inject.Singleton;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
import com.google.inject.assistedinject.FactoryProvider; import com.google.inject.assistedinject.FactoryProvider;

View File

@ -32,8 +32,8 @@ import org.jclouds.http.HttpRetryHandler;
import org.jclouds.http.TransformingHttpCommand; import org.jclouds.http.TransformingHttpCommand;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* Allow replayable request to be retried a limited number of times, and impose an exponential * Allow replayable request to be retried a limited number of times, and impose an exponential

View File

@ -31,7 +31,7 @@ import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError; import org.jclouds.http.annotation.ServerError;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* Delegates to {@link HttpErrorHandler HttpErrorHandlers} who are annotated according to the * Delegates to {@link HttpErrorHandler HttpErrorHandlers} who are annotated according to the

View File

@ -31,7 +31,7 @@ import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError; import org.jclouds.http.annotation.ServerError;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* Delegates to {@link HttpRetryHandler HttpRetryHandlers} who are annotated according to the * Delegates to {@link HttpRetryHandler HttpRetryHandlers} who are annotated according to the

View File

@ -38,8 +38,8 @@ import org.jclouds.http.HttpRetryHandler;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* Handles Retryable responses with error codes in the 3xx range * Handles Retryable responses with error codes in the 3xx range
@ -52,7 +52,6 @@ public class RedirectionRetryHandler implements HttpRetryHandler {
@Resource @Resource
protected Logger logger = Logger.NULL; protected Logger logger = Logger.NULL;
@Inject
protected final BackoffLimitedRetryHandler backoffHandler; protected final BackoffLimitedRetryHandler backoffHandler;
@Inject @Inject

View File

@ -49,8 +49,8 @@ import org.jclouds.http.handlers.DelegatingErrorHandler;
import org.jclouds.http.handlers.DelegatingRetryHandler; import org.jclouds.http.handlers.DelegatingRetryHandler;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* Basic implementation of a {@link HttpCommandExecutorService}. * Basic implementation of a {@link HttpCommandExecutorService}.

View File

@ -46,7 +46,7 @@ import org.jclouds.util.Utils;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.collect.MapMaker; import com.google.common.collect.MapMaker;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* // TODO: Adrian: Document this! * // TODO: Adrian: Document this!

View File

@ -35,7 +35,7 @@ import org.jclouds.http.HttpCommandRendezvous;
import org.jclouds.lifecycle.BaseLifeCycle; import org.jclouds.lifecycle.BaseLifeCycle;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* // TODO: Adrian: Document this! * // TODO: Adrian: Document this!

View File

@ -32,7 +32,7 @@ import org.jclouds.lifecycle.config.LifeCycleModule;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import com.google.inject.Provides; import com.google.inject.Provides;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* *

View File

@ -40,7 +40,7 @@ import javax.annotation.PreDestroy;
import org.jclouds.lifecycle.Closer; import org.jclouds.lifecycle.Closer;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.ProvisionException; import com.google.inject.ProvisionException;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
import com.google.inject.spi.InjectionListener; import com.google.inject.spi.InjectionListener;

View File

@ -26,7 +26,7 @@ package org.jclouds.logging.config;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import static com.google.common.collect.Sets.filter; import static com.google.common.collect.Sets.filter;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.ProvisionException; import com.google.inject.ProvisionException;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
import com.google.inject.spi.InjectionListener; import com.google.inject.spi.InjectionListener;

View File

@ -28,7 +28,7 @@ import javax.ws.rs.core.HttpHeaders;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.options.HttpRequestOptions; import org.jclouds.http.options.HttpRequestOptions;
import com.google.inject.Singleton; import javax.inject.Singleton;
/** /**
* Adds an entity to a request. * Adds an entity to a request.

View File

@ -65,14 +65,14 @@ import com.google.common.collect.MapMaker;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.Key; import com.google.inject.Key;
import com.google.inject.Singleton; import javax.inject.Singleton;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
import com.google.inject.internal.Lists; import com.google.inject.internal.Lists;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* Tests behavior of JaxrsUtil * Tests behavior of JaxrsUtil

View File

@ -28,7 +28,7 @@ import java.net.URI;
import org.jclouds.rest.RestClientProxy.RestClientProxyFactory; import org.jclouds.rest.RestClientProxy.RestClientProxyFactory;
import com.google.inject.Inject; import javax.inject.Inject;
public class RestClientFactory { public class RestClientFactory {
private final RestClientProxyFactory proxyFactory; private final RestClientProxyFactory proxyFactory;

View File

@ -44,9 +44,9 @@ import org.jclouds.http.TransformingHttpCommand;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
import com.google.inject.name.Named; import javax.inject.Named;
public class RestClientProxy implements InvocationHandler { public class RestClientProxy implements InvocationHandler {
private final JaxrsAnnotationProcessor util; private final JaxrsAnnotationProcessor util;

View File

@ -27,7 +27,7 @@ import javax.ws.rs.core.HttpHeaders;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import com.google.inject.Singleton; import javax.inject.Singleton;
/** /**
* Adds an entity to a request. * Adds an entity to a request.

View File

@ -0,0 +1,80 @@
/**
*
* Copyright (C) 2009 Global Cloud Specialists, Inc. <info@globalcloudspecialists.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.util;
import java.util.Enumeration;
import java.util.Map;
import java.util.Properties;
import javax.inject.Named;
import com.google.inject.Binder;
import com.google.inject.Key;
/**
* Utility methods for use with {@code @}{@link Named}.
*
* @author crazybob@google.com (Bob Lee) - original code taken from
* {@link com.google.inject.name.Names}
* @author Adrian Cole
*/
public class Jsr330 {
/**
* @see org.jclouds.util.Jsr330#named
*/
public static Named named(String name) {
return com.google.inject.util.Jsr330.named(name);
}
/**
* Creates a constant binding to {@code @Named(key)} for each entry in {@code properties}.
*/
public static void bindProperties(Binder binder, Map<String, String> properties) {
binder = binder.skipSources(Jsr330.class);
for (Map.Entry<String, String> entry : properties.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
binder.bind(Key.get(String.class, com.google.inject.util.Jsr330.named(key))).toInstance(
value);
}
}
/**
* Creates a constant binding to {@code @Named(key)} for each property. This method binds all
* properties including those inherited from {@link Properties#defaults defaults}.
*/
public static void bindProperties(Binder binder, Properties properties) {
binder = binder.skipSources(Jsr330.class);
// use enumeration to include the default properties
for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();) {
String propertyName = (String) e.nextElement();
String value = properties.getProperty(propertyName);
binder.bind(Key.get(String.class, com.google.inject.util.Jsr330.named(propertyName)))
.toInstance(value);
}
}
}

View File

@ -54,7 +54,7 @@ import com.google.inject.AbstractModule;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.Module; import com.google.inject.Module;
import com.google.inject.name.Names; import org.jclouds.util.Jsr330;
public abstract class BaseJettyTest { public abstract class BaseJettyTest {
protected static final String XML = "<foo><bar>whoppers</bar></foo>"; protected static final String XML = "<foo><bar>whoppers</bar></foo>";
@ -147,7 +147,7 @@ public abstract class BaseJettyTest {
List<Module> modules = Lists.newArrayList(new AbstractModule() { List<Module> modules = Lists.newArrayList(new AbstractModule() {
@Override @Override
protected void configure() { protected void configure() {
Names.bindProperties(binder(), properties); Jsr330.bindProperties(binder(), properties);
} }
}, new JDKLoggingModule(), new JaxrsModule(), createClientModule()); }, new JDKLoggingModule(), new JaxrsModule(), createClientModule());
CloudContextBuilder.addExecutorServiceIfNotPresent(modules); CloudContextBuilder.addExecutorServiceIfNotPresent(modules);

View File

@ -36,7 +36,7 @@ import org.testng.annotations.Test;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Injector; import com.google.inject.Injector;
/** /**

View File

@ -41,7 +41,7 @@ import org.testng.annotations.Test;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Injector; import com.google.inject.Injector;
@Test @Test

View File

@ -39,6 +39,7 @@ import java.util.Collections;
import java.util.Map; import java.util.Map;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import javax.inject.Named;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam; import javax.ws.rs.HeaderParam;
import javax.ws.rs.HttpMethod; import javax.ws.rs.HttpMethod;
@ -73,8 +74,7 @@ import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.name.Named; import org.jclouds.util.Jsr330;
import com.google.inject.name.Names;
/** /**
* Tests behavior of {@code JaxrsAnnotationProcessor} * Tests behavior of {@code JaxrsAnnotationProcessor}
@ -990,7 +990,7 @@ public class JaxrsAnnotationProcessorTest {
factory = Guice.createInjector(new AbstractModule() { factory = Guice.createInjector(new AbstractModule() {
@Override @Override
protected void configure() { protected void configure() {
bindConstant().annotatedWith(Names.named("testaccount")).to("ralphie"); bindConstant().annotatedWith(Jsr330.named("testaccount")).to("ralphie");
bind(URI.class).toInstance(URI.create("http://localhost:8080")); bind(URI.class).toInstance(URI.create("http://localhost:8080"));
} }
}, new JaxrsModule(), new ExecutorServiceModule(new WithinThreadExecutorService()), }, new JaxrsModule(), new ExecutorServiceModule(new WithinThreadExecutorService()),

View File

@ -56,7 +56,7 @@ import com.google.appengine.api.urlfetch.HTTPRequest;
import com.google.appengine.api.urlfetch.HTTPResponse; import com.google.appengine.api.urlfetch.HTTPResponse;
import com.google.appengine.api.urlfetch.URLFetchService; import com.google.appengine.api.urlfetch.URLFetchService;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* Google App Engine version of {@link HttpCommandExecutorService} * Google App Engine version of {@link HttpCommandExecutorService}

View File

@ -37,7 +37,7 @@ import org.testng.annotations.Test;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.name.Names; import org.jclouds.util.Jsr330;
/** /**
* Tests the ability to configure a {@link GaeHttpCommandExecutorService} * Tests the ability to configure a {@link GaeHttpCommandExecutorService}
@ -58,7 +58,7 @@ public class GaeHttpCommandExecutorServiceModuleTest {
new GaeHttpCommandExecutorServiceModule() { new GaeHttpCommandExecutorServiceModule() {
@Override @Override
protected void configure() { protected void configure() {
Names.bindProperties(binder(), properties); Jsr330.bindProperties(binder(), properties);
super.configure(); super.configure();
} }
}); });

View File

@ -27,6 +27,10 @@ import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import org.apache.http.ConnectionReuseStrategy; import org.apache.http.ConnectionReuseStrategy;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.impl.DefaultConnectionReuseStrategy; import org.apache.http.impl.DefaultConnectionReuseStrategy;
@ -57,14 +61,11 @@ import org.jclouds.http.httpnio.pool.NioTransformingHttpCommandExecutorService;
import org.jclouds.http.pool.PoolConstants; import org.jclouds.http.pool.PoolConstants;
import org.jclouds.http.pool.config.ConnectionPoolCommandExecutorServiceModule; import org.jclouds.http.pool.config.ConnectionPoolCommandExecutorServiceModule;
import com.google.inject.Inject;
import com.google.inject.Provides; import com.google.inject.Provides;
import com.google.inject.Scopes; import com.google.inject.Scopes;
import com.google.inject.Singleton;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
import com.google.inject.assistedinject.FactoryProvider; import com.google.inject.assistedinject.FactoryProvider;
import com.google.inject.name.Named;
/** /**
* *
@ -125,8 +126,7 @@ public class NioTransformingHttpCommandExecutorServiceModule extends
Scopes.SINGLETON); Scopes.SINGLETON);
bind(ByteBufferAllocator.class).to(HeapByteBufferAllocator.class); bind(ByteBufferAllocator.class).to(HeapByteBufferAllocator.class);
bind(NioHttpCommandConnectionPool.Factory.class).toProvider( bind(NioHttpCommandConnectionPool.Factory.class).toProvider(
FactoryProvider.newFactory( FactoryProvider.newFactory(new TypeLiteral<NioHttpCommandConnectionPool.Factory>() {
new TypeLiteral<NioHttpCommandConnectionPool.Factory>() {
}, new TypeLiteral<NioHttpCommandConnectionPool>() { }, new TypeLiteral<NioHttpCommandConnectionPool>() {
})); }));
} }

View File

@ -58,9 +58,9 @@ import org.jclouds.http.pool.HttpCommandConnectionPool;
import org.jclouds.http.pool.PoolConstants; import org.jclouds.http.pool.PoolConstants;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
import com.google.inject.name.Named; import javax.inject.Named;
/** /**
* Connection Pool for HTTP requests that utilizes Apache HTTPNio * Connection Pool for HTTP requests that utilizes Apache HTTPNio

View File

@ -43,7 +43,7 @@ import org.jclouds.http.handlers.DelegatingRetryHandler;
import org.jclouds.http.httpnio.util.NioHttpUtils; import org.jclouds.http.httpnio.util.NioHttpUtils;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import com.google.inject.Inject; import javax.inject.Inject;
/** /**
* // TODO: Adrian: Document this! * // TODO: Adrian: Document this!

View File

@ -30,8 +30,8 @@ import org.apache.http.nio.NHttpConnection;
import org.jclouds.http.HttpCommandRendezvous; import org.jclouds.http.HttpCommandRendezvous;
import org.jclouds.http.pool.ConnectionPoolTransformingHttpCommandExecutorService; import org.jclouds.http.pool.ConnectionPoolTransformingHttpCommandExecutorService;
import com.google.inject.Inject; import javax.inject.Inject;
import com.google.inject.Singleton; import javax.inject.Singleton;
/** /**
* // TODO: Adrian: Document this! * // TODO: Adrian: Document this!

Some files were not shown because too many files have changed in this diff Show More