git-svn-id: http://jclouds.googlecode.com/svn/trunk@1920 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2009-09-25 00:00:22 +00:00
parent f0d0aeb723
commit 7a83144421
4 changed files with 26 additions and 11 deletions

View File

@ -1,4 +1,4 @@
package org.jclouds.azure.storage; package org.jclouds.azure.storage.queue;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
@ -8,7 +8,7 @@ import java.lang.annotation.Target;
import javax.inject.Qualifier; import javax.inject.Qualifier;
/** /**
* Related to a resource of type Azure Storage * Related to a resource of type Azure Queue
* *
* @author Adrian Cole * @author Adrian Cole
* *
@ -16,6 +16,6 @@ import javax.inject.Qualifier;
@Retention(value = RetentionPolicy.RUNTIME) @Retention(value = RetentionPolicy.RUNTIME)
@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) @Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
@Qualifier @Qualifier
public @interface AzureStorage { public @interface AzureQueue {
} }

View File

@ -58,7 +58,7 @@ public class AzureQueueContextBuilder extends CloudContextBuilder<AzureQueueCont
public AzureQueueContextBuilder(Properties props) { public AzureQueueContextBuilder(Properties props) {
super(props); super(props);
properties.setProperty(AzureQueueConstants.PROPERTY_AZUREQUEUE_ENDPOINT, properties.setProperty(AzureQueueConstants.PROPERTY_AZUREQUEUE_ENDPOINT,
"https://{account}.blob.core.windows.net"); "https://{account}.queue.core.windows.net");
} }
public static AzureQueueContextBuilder newBuilder(String id, String secret) { public static AzureQueueContextBuilder newBuilder(String id, String secret) {

View File

@ -25,14 +25,18 @@ package org.jclouds.azure.storage.queue.config;
import java.net.URI; import java.net.URI;
import org.jclouds.azure.storage.queue.AzureQueueConnection; import javax.inject.Named;
import javax.inject.Singleton;
import org.jclouds.azure.storage.config.RestAzureStorageConnectionModule; import org.jclouds.azure.storage.config.RestAzureStorageConnectionModule;
import org.jclouds.azure.storage.queue.AzureQueue;
import org.jclouds.azure.storage.queue.AzureQueueConnection;
import org.jclouds.azure.storage.queue.reference.AzureQueueConstants;
import org.jclouds.cloud.ConfiguresCloudConnection; import org.jclouds.cloud.ConfiguresCloudConnection;
import org.jclouds.http.RequiresHttp; 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 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.
@ -45,7 +49,16 @@ public class RestAzureQueueConnectionModule extends RestAzureStorageConnectionMo
@Provides @Provides
@Singleton @Singleton
protected AzureQueueConnection provideAzureStorageConnection(URI uri, RestClientFactory factory) { @AzureQueue
protected URI provideAuthenticationURI(
@Named(AzureQueueConstants.PROPERTY_AZUREQUEUE_ENDPOINT) String endpoint) {
return URI.create(endpoint);
}
@Provides
@Singleton
protected AzureQueueConnection provideAzureStorageConnection(@AzureQueue URI uri,
RestClientFactory factory) {
return factory.create(uri, AzureQueueConnection.class); return factory.create(uri, AzureQueueConnection.class);
} }

View File

@ -27,16 +27,17 @@ import java.io.IOException;
import java.net.URI; import java.net.URI;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Named;
import org.jclouds.azure.storage.queue.AzureQueue;
import org.jclouds.azure.storage.queue.AzureQueueConnection; import org.jclouds.azure.storage.queue.AzureQueueConnection;
import org.jclouds.azure.storage.queue.AzureQueueContext; import org.jclouds.azure.storage.queue.AzureQueueContext;
import org.jclouds.azure.storage.reference.AzureStorageConstants; 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 javax.inject.Inject;
import com.google.inject.Injector; import com.google.inject.Injector;
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.
@ -55,7 +56,8 @@ public class GuiceAzureQueueContext implements AzureQueueContext {
@Inject @Inject
private GuiceAzureQueueContext(Injector injector, Closer closer, private GuiceAzureQueueContext(Injector injector, Closer closer,
@Named(AzureStorageConstants.PROPERTY_AZURESTORAGE_ACCOUNT) String account, URI endPoint) { @Named(AzureStorageConstants.PROPERTY_AZURESTORAGE_ACCOUNT) String account,
@AzureQueue URI endPoint) {
this.injector = injector; this.injector = injector;
this.closer = closer; this.closer = closer;
this.endPoint = endPoint; this.endPoint = endPoint;