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.Retention;
@ -8,7 +8,7 @@ import java.lang.annotation.Target;
import javax.inject.Qualifier;
/**
* Related to a resource of type Azure Storage
* Related to a resource of type Azure Queue
*
* @author Adrian Cole
*
@ -16,6 +16,6 @@ import javax.inject.Qualifier;
@Retention(value = RetentionPolicy.RUNTIME)
@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
@Qualifier
public @interface AzureStorage {
public @interface AzureQueue {
}

View File

@ -58,7 +58,7 @@ public class AzureQueueContextBuilder extends CloudContextBuilder<AzureQueueCont
public AzureQueueContextBuilder(Properties props) {
super(props);
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) {

View File

@ -25,14 +25,18 @@ package org.jclouds.azure.storage.queue.config;
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.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.http.RequiresHttp;
import org.jclouds.rest.RestClientFactory;
import com.google.inject.Provides;
import javax.inject.Singleton;
/**
* Configures the Azure Queue Service connection, including logging and http transport.
@ -42,10 +46,19 @@ import javax.inject.Singleton;
@ConfiguresCloudConnection
@RequiresHttp
public class RestAzureQueueConnectionModule extends RestAzureStorageConnectionModule {
@Provides
@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);
}

View File

@ -27,16 +27,17 @@ import java.io.IOException;
import java.net.URI;
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.AzureQueueContext;
import org.jclouds.azure.storage.reference.AzureStorageConstants;
import org.jclouds.lifecycle.Closer;
import org.jclouds.logging.Logger;
import javax.inject.Inject;
import com.google.inject.Injector;
import javax.inject.Named;
/**
* Uses a Guice Injector to configure the objects served by AzureQueueContext methods.
@ -55,7 +56,8 @@ public class GuiceAzureQueueContext implements AzureQueueContext {
@Inject
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.closer = closer;
this.endPoint = endPoint;