diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CloudFilesContextBuilder.java b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CloudFilesContextBuilder.java
index 32f3c8a0c9..f436fb60c3 100644
--- a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CloudFilesContextBuilder.java
+++ b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CloudFilesContextBuilder.java
@@ -34,8 +34,8 @@ import static org.jclouds.http.pool.PoolConstants.PROPERTY_POOL_MAX_CONNECTIONS;
import static org.jclouds.http.pool.PoolConstants.PROPERTY_POOL_MAX_CONNECTION_REUSE;
import static org.jclouds.http.pool.PoolConstants.PROPERTY_POOL_MAX_SESSION_FAILURES;
import static org.jclouds.http.pool.PoolConstants.PROPERTY_POOL_REQUEST_INVOKER_THREADS;
-import static org.jclouds.rackspace.cloudfiles.reference.CloudFilesConstants.PROPERTY_CLOUDFILES_KEY;
-import static org.jclouds.rackspace.cloudfiles.reference.CloudFilesConstants.PROPERTY_CLOUDFILES_USER;
+import static org.jclouds.rackspace.cloudfiles.reference.CloudFilesConstants.PROPERTY_RACKSPACE_KEY;
+import static org.jclouds.rackspace.cloudfiles.reference.CloudFilesConstants.PROPERTY_RACKSPACE_USER;
import java.util.List;
import java.util.Properties;
@@ -88,8 +88,8 @@ public class CloudFilesContextBuilder extends
}
public void authenticate(String id, String secret) {
- properties.setProperty(PROPERTY_CLOUDFILES_USER, checkNotNull(id, "user"));
- properties.setProperty(PROPERTY_CLOUDFILES_KEY, checkNotNull(secret, "key"));
+ properties.setProperty(PROPERTY_RACKSPACE_USER, checkNotNull(id, "user"));
+ properties.setProperty(PROPERTY_RACKSPACE_KEY, checkNotNull(secret, "key"));
}
public CloudFilesContext buildContext() {
diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/config/RestCloudFilesConnectionModule.java b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/config/RestCloudFilesConnectionModule.java
index 38800a75b9..2b4c564b17 100644
--- a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/config/RestCloudFilesConnectionModule.java
+++ b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/config/RestCloudFilesConnectionModule.java
@@ -6,13 +6,13 @@ import java.net.URI;
import org.jclouds.cloud.ConfiguresCloudConnection;
import org.jclouds.http.HttpConstants;
import org.jclouds.http.RequiresHttp;
-import org.jclouds.rackspace.cloudfiles.Authentication;
-import org.jclouds.rackspace.cloudfiles.CDN;
-import org.jclouds.rackspace.cloudfiles.CloudFilesAuthentication;
+import org.jclouds.rackspace.Authentication;
+import org.jclouds.rackspace.CDN;
+import org.jclouds.rackspace.RackSpaceAuthentication;
+import org.jclouds.rackspace.Storage;
+import org.jclouds.rackspace.RackSpaceAuthentication.AuthenticationResponse;
import org.jclouds.rackspace.cloudfiles.CloudFilesConnection;
import org.jclouds.rackspace.cloudfiles.CloudFilesContext;
-import org.jclouds.rackspace.cloudfiles.Storage;
-import org.jclouds.rackspace.cloudfiles.CloudFilesAuthentication.AuthenticationResponse;
import org.jclouds.rackspace.cloudfiles.internal.GuiceCloudFilesContext;
import org.jclouds.rackspace.cloudfiles.reference.CloudFilesConstants;
import org.jclouds.rest.RestClientFactory;
@@ -44,9 +44,9 @@ public class RestCloudFilesConnectionModule extends AbstractModule {
@Singleton
protected AuthenticationResponse provideAuthenticationResponse(
@Authentication URI authenticationUri, RestClientFactory factory,
- @Named(CloudFilesConstants.PROPERTY_CLOUDFILES_USER) String user,
- @Named(CloudFilesConstants.PROPERTY_CLOUDFILES_KEY) String key) {
- return factory.create(authenticationUri, CloudFilesAuthentication.class).authenticate(user,
+ @Named(CloudFilesConstants.PROPERTY_RACKSPACE_USER) String user,
+ @Named(CloudFilesConstants.PROPERTY_RACKSPACE_KEY) String key) {
+ return factory.create(authenticationUri, RackSpaceAuthentication.class).authenticate(user,
key);
}
@@ -54,9 +54,9 @@ public class RestCloudFilesConnectionModule extends AbstractModule {
@Authentication
protected String provideAuthenticationToken(@Authentication URI authenticationUri,
RestClientFactory factory,
- @Named(CloudFilesConstants.PROPERTY_CLOUDFILES_USER) String user,
- @Named(CloudFilesConstants.PROPERTY_CLOUDFILES_KEY) String key) {
- return factory.create(authenticationUri, CloudFilesAuthentication.class).authenticate(user,
+ @Named(CloudFilesConstants.PROPERTY_RACKSPACE_USER) String user,
+ @Named(CloudFilesConstants.PROPERTY_RACKSPACE_KEY) String key) {
+ return factory.create(authenticationUri, RackSpaceAuthentication.class).authenticate(user,
key).getAuthToken();
}
diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/CloudFilesConstants.java b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/CloudFilesConstants.java
index 3244ebfae9..c1e198e98e 100644
--- a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/CloudFilesConstants.java
+++ b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/CloudFilesConstants.java
@@ -33,7 +33,6 @@ import org.jclouds.rackspace.reference.RackSpaceConstants;
*/
public interface CloudFilesConstants extends ObjectStoreConstants, RackSpaceConstants {
- public static final String PROPERTY_CLOUDFILES_USER = "jclouds.cloudfiles.user";
- public static final String PROPERTY_CLOUDFILES_KEY = "jclouds.cloudfiles.key";
+
}
diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/CloudFilesHeaders.java b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/CloudFilesHeaders.java
index 0ab4001cc0..7d0ab9a8d4 100644
--- a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/CloudFilesHeaders.java
+++ b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/CloudFilesHeaders.java
@@ -35,17 +35,12 @@ public interface CloudFilesHeaders {
public static final String ACCOUNT_BYTES_USED = "X-Account-Bytes-Used";
public static final String ACCOUNT_CONTAINER_COUNT = "X-Account-Container-Count";
- public static final String AUTH_KEY = "X-Auth-Key";
- public static final String AUTH_TOKEN = "X-Auth-Token";
- public static final String AUTH_USER = "X-Auth-User";
public static final String CDN_ENABLED = "X-CDN-Enabled";
- public static final String CDN_MANAGEMENT_URL = "X-CDN-Management-Url";
public static final String CDN_REFERRER_ACL = "X-Referrer-ACL ";
public static final String CDN_TTL = "X-TTL";
public static final String CDN_URI = "X-CDN-URI";
public static final String CDN_USER_AGENT_ACL = "X-User-Agent-ACL";
public static final String CONTAINER_BYTES_USED = "X-Container-Bytes-Used";
public static final String CONTAINER_OBJECT_COUNT = "X-Container-Object-Count";
- public static final String STORAGE_URL = "X-Storage-Url";
}
\ No newline at end of file
diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/filters/AuthenticateRequest.java b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/filters/AuthenticateRequest.java
index a06f4df161..dbee91b0bf 100644
--- a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/filters/AuthenticateRequest.java
+++ b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/filters/AuthenticateRequest.java
@@ -30,8 +30,8 @@ import java.util.concurrent.atomic.AtomicReference;
import org.jclouds.http.HttpException;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpRequestFilter;
-import org.jclouds.rackspace.cloudfiles.Authentication;
-import org.jclouds.rackspace.cloudfiles.reference.CloudFilesHeaders;
+import org.jclouds.rackspace.Authentication;
+import org.jclouds.rackspace.reference.RackSpaceHeaders;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -89,7 +89,7 @@ public class AuthenticateRequest implements HttpRequestFilter {
}
public void filter(HttpRequest request) throws HttpException {
- request.getHeaders().replaceValues(CloudFilesHeaders.AUTH_TOKEN,
+ request.getHeaders().replaceValues(RackSpaceHeaders.AUTH_TOKEN,
Collections.singletonList(getAuthToken()));
}
diff --git a/rackspace/cloudfiles/core/src/test/java/org/jclouds/rackspace/cloudfiles/CloudFilesConnectionLiveTest.java b/rackspace/cloudfiles/core/src/test/java/org/jclouds/rackspace/cloudfiles/CloudFilesConnectionLiveTest.java
index da620d9edd..c34afb04c6 100644
--- a/rackspace/cloudfiles/core/src/test/java/org/jclouds/rackspace/cloudfiles/CloudFilesConnectionLiveTest.java
+++ b/rackspace/cloudfiles/core/src/test/java/org/jclouds/rackspace/cloudfiles/CloudFilesConnectionLiveTest.java
@@ -23,12 +23,11 @@
*/
package org.jclouds.rackspace.cloudfiles;
-import static org.jclouds.rackspace.cloudfiles.reference.CloudFilesConstants.PROPERTY_CLOUDFILES_KEY;
-import static org.jclouds.rackspace.cloudfiles.reference.CloudFilesConstants.PROPERTY_CLOUDFILES_USER;
+import static org.jclouds.rackspace.cloudfiles.reference.CloudFilesConstants.PROPERTY_RACKSPACE_KEY;
+import static org.jclouds.rackspace.cloudfiles.reference.CloudFilesConstants.PROPERTY_RACKSPACE_USER;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.assertFalse;
import static org.testng.Assert.fail;
import java.util.List;
@@ -46,8 +45,8 @@ import org.testng.annotations.Test;
@Test(groups = "live", testName = "cloudfiles.CloudFilesAuthenticationLiveTest")
public class CloudFilesConnectionLiveTest {
- protected static final String sysRackspaceUser = System.getProperty(PROPERTY_CLOUDFILES_USER);
- protected static final String sysRackspaceKey = System.getProperty(PROPERTY_CLOUDFILES_KEY);
+ protected static final String sysRackspaceUser = System.getProperty(PROPERTY_RACKSPACE_USER);
+ protected static final String sysRackspaceKey = System.getProperty(PROPERTY_RACKSPACE_KEY);
private String bucketPrefix = System.getProperty("user.name") + ".cfint";
diff --git a/rackspace/cloudfiles/pom.xml b/rackspace/cloudfiles/pom.xml
index c5e4ff3ef5..ef6c3270f3 100644
--- a/rackspace/cloudfiles/pom.xml
+++ b/rackspace/cloudfiles/pom.xml
@@ -39,10 +39,6 @@
core
-
-
-
-
${project.groupId}
@@ -69,53 +65,4 @@
test
-
-
- live
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- integration
- integration-test
-
- test
-
-
-
-
- none
-
-
- **/*IntegrationTest.java
- **/*LiveTest.java
-
-
-
- file.encoding
- UTF-8
-
-
- jclouds.cloudfiles.user
- ${jclouds.cloudfiles.user}
-
-
- jclouds.cloudfiles.key
- ${jclouds.cloudfiles.key}
-
-
-
-
-
-
-
-
-
-
diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/Authentication.java b/rackspace/core/src/main/java/org/jclouds/rackspace/Authentication.java
old mode 100644
new mode 100755
similarity index 84%
rename from rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/Authentication.java
rename to rackspace/core/src/main/java/org/jclouds/rackspace/Authentication.java
index 4b5ba3bd38..f5193f6b48
--- a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/Authentication.java
+++ b/rackspace/core/src/main/java/org/jclouds/rackspace/Authentication.java
@@ -21,23 +21,19 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.rackspace.cloudfiles;
+package org.jclouds.rackspace;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.jclouds.cloud.CloudContext;
-
import com.google.inject.BindingAnnotation;
/**
- * Represents an authenticated context to Cloud Files.
+ * Represents an authenticated context to RackSpace.
*
- * @see
- * @see CloudFilesConnection
- * @see CloudContext
+ * @see
* @author Adrian Cole
*
*/
diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CDN.java b/rackspace/core/src/main/java/org/jclouds/rackspace/CDN.java
old mode 100644
new mode 100755
similarity index 89%
rename from rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CDN.java
rename to rackspace/core/src/main/java/org/jclouds/rackspace/CDN.java
index 5f027f684b..84ea7222b0
--- a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CDN.java
+++ b/rackspace/core/src/main/java/org/jclouds/rackspace/CDN.java
@@ -21,23 +21,19 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.rackspace.cloudfiles;
+package org.jclouds.rackspace;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.jclouds.cloud.CloudContext;
-
import com.google.inject.BindingAnnotation;
/**
- * Represents an authenticated context to Cloud Files.
+ * Represents a component related to RackSpace Cloud Files Content delivery network.
*
* @see
- * @see CloudFilesConnection
- * @see CloudContext
* @author Adrian Cole
*
*/
diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CloudFilesAuthentication.java b/rackspace/core/src/main/java/org/jclouds/rackspace/RackSpaceAuthentication.java
old mode 100644
new mode 100755
similarity index 65%
rename from rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CloudFilesAuthentication.java
rename to rackspace/core/src/main/java/org/jclouds/rackspace/RackSpaceAuthentication.java
index 07d4e62584..72e4180c39
--- a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CloudFilesAuthentication.java
+++ b/rackspace/core/src/main/java/org/jclouds/rackspace/RackSpaceAuthentication.java
@@ -21,31 +21,28 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.rackspace.cloudfiles;
+package org.jclouds.rackspace;
import java.net.URI;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.Path;
-import org.jclouds.rackspace.cloudfiles.functions.ParseAuthenticationResponseFromHeaders;
-import org.jclouds.rackspace.cloudfiles.reference.CloudFilesHeaders;
+import org.jclouds.rackspace.functions.ParseAuthenticationResponseFromHeaders;
+import org.jclouds.rackspace.reference.RackSpaceHeaders;
import org.jclouds.rest.ResponseParser;
/**
- * Provides access to Cloud Files via their REST API.
+ * Provides access to Rackspace resources via their REST API.
*
- * All commands return a Future of the result from Cloud Files. Any exceptions incurred during
- * processing will be wrapped in an {@link ExecutionException} as documented in {@link Future#get()}.
*
- * @see
+ * @see
+ * @see
* @author Adrian Cole
*/
-public interface CloudFilesAuthentication {
+public interface RackSpaceAuthentication {
public interface AuthenticationResponse {
@Storage
@@ -54,6 +51,9 @@ public interface CloudFilesAuthentication {
@CDN
URI getCDNManagementUrl();
+ @Server
+ URI getServerManagementUrl();
+
@Authentication
String getAuthToken();
}
@@ -61,6 +61,6 @@ public interface CloudFilesAuthentication {
@GET
@ResponseParser(ParseAuthenticationResponseFromHeaders.class)
@Path("/auth")
- AuthenticationResponse authenticate(@HeaderParam(CloudFilesHeaders.AUTH_USER) String user,
- @HeaderParam(CloudFilesHeaders.AUTH_KEY) String key);
+ AuthenticationResponse authenticate(@HeaderParam(RackSpaceHeaders.AUTH_USER) String user,
+ @HeaderParam(RackSpaceHeaders.AUTH_KEY) String key);
}
diff --git a/rackspace/core/src/main/java/org/jclouds/rackspace/Server.java b/rackspace/core/src/main/java/org/jclouds/rackspace/Server.java
new file mode 100644
index 0000000000..e4918dc571
--- /dev/null
+++ b/rackspace/core/src/main/java/org/jclouds/rackspace/Server.java
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright (C) 2009 Global Cloud Specialists, Inc.
+ *
+ * ====================================================================
+ * 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.rackspace;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import com.google.inject.BindingAnnotation;
+
+/**
+ * Represents a component related to RackSpace Cloud Servers.
+ *
+ * @see
+ * @author Adrian Cole
+ *
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@BindingAnnotation
+public @interface Server {
+
+}
\ No newline at end of file
diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/Storage.java b/rackspace/core/src/main/java/org/jclouds/rackspace/Storage.java
old mode 100644
new mode 100755
similarity index 89%
rename from rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/Storage.java
rename to rackspace/core/src/main/java/org/jclouds/rackspace/Storage.java
index 273b7df842..1583b16dd7
--- a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/Storage.java
+++ b/rackspace/core/src/main/java/org/jclouds/rackspace/Storage.java
@@ -21,23 +21,19 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.rackspace.cloudfiles;
+package org.jclouds.rackspace;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.jclouds.cloud.CloudContext;
-
import com.google.inject.BindingAnnotation;
/**
- * Represents an authenticated context to Cloud Files.
+ * Represents a component related to RackSpace Cloud Files.
*
* @see
- * @see CloudFilesConnection
- * @see CloudContext
* @author Adrian Cole
*
*/
diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/functions/ParseAuthenticationResponseFromHeaders.java b/rackspace/core/src/main/java/org/jclouds/rackspace/functions/ParseAuthenticationResponseFromHeaders.java
old mode 100644
new mode 100755
similarity index 66%
rename from rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/functions/ParseAuthenticationResponseFromHeaders.java
rename to rackspace/core/src/main/java/org/jclouds/rackspace/functions/ParseAuthenticationResponseFromHeaders.java
index bb26ccf63c..7c0bba2f52
--- a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/functions/ParseAuthenticationResponseFromHeaders.java
+++ b/rackspace/core/src/main/java/org/jclouds/rackspace/functions/ParseAuthenticationResponseFromHeaders.java
@@ -21,15 +21,18 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.rackspace.cloudfiles.functions;
+package org.jclouds.rackspace.functions;
import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.rackspace.reference.RackSpaceHeaders.AUTH_TOKEN;
+import static org.jclouds.rackspace.reference.RackSpaceHeaders.CDN_MANAGEMENT_URL;
+import static org.jclouds.rackspace.reference.RackSpaceHeaders.SERVER_MANAGEMENT_URL;
+import static org.jclouds.rackspace.reference.RackSpaceHeaders.STORAGE_URL;
import java.net.URI;
import org.jclouds.http.HttpResponse;
-import org.jclouds.rackspace.cloudfiles.CloudFilesAuthentication.AuthenticationResponse;
-import org.jclouds.rackspace.cloudfiles.reference.CloudFilesHeaders;
+import org.jclouds.rackspace.RackSpaceAuthentication.AuthenticationResponse;
import com.google.common.base.Function;
@@ -49,21 +52,28 @@ public class ParseAuthenticationResponseFromHeaders implements
return new AuthenticationResponse() {
public String getAuthToken() {
- return checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.AUTH_TOKEN),
- CloudFilesHeaders.AUTH_TOKEN);
+ return checkNotNull(from.getFirstHeaderOrNull(AUTH_TOKEN),
+ AUTH_TOKEN);
}
public URI getCDNManagementUrl() {
String cdnManagementUrl = checkNotNull(from
- .getFirstHeaderOrNull(CloudFilesHeaders.CDN_MANAGEMENT_URL),
- CloudFilesHeaders.CDN_MANAGEMENT_URL);
+ .getFirstHeaderOrNull(CDN_MANAGEMENT_URL),
+ CDN_MANAGEMENT_URL);
return URI.create(cdnManagementUrl);
}
+ public URI getServerManagementUrl() {
+ String serverManagementUrl = checkNotNull(from
+ .getFirstHeaderOrNull(SERVER_MANAGEMENT_URL),
+ SERVER_MANAGEMENT_URL);
+ return URI.create(serverManagementUrl);
+ }
+
public URI getStorageUrl() {
String storageUrl = checkNotNull(from
- .getFirstHeaderOrNull(CloudFilesHeaders.STORAGE_URL),
- CloudFilesHeaders.STORAGE_URL);
+ .getFirstHeaderOrNull(STORAGE_URL),
+ STORAGE_URL);
return URI.create(storageUrl);
}
diff --git a/rackspace/core/src/main/java/org/jclouds/rackspace/reference/RackSpaceConstants.java b/rackspace/core/src/main/java/org/jclouds/rackspace/reference/RackSpaceConstants.java
index f96f0c672f..87c92bc6af 100644
--- a/rackspace/core/src/main/java/org/jclouds/rackspace/reference/RackSpaceConstants.java
+++ b/rackspace/core/src/main/java/org/jclouds/rackspace/reference/RackSpaceConstants.java
@@ -29,5 +29,6 @@ package org.jclouds.rackspace.reference;
* @author Adrian Cole
*/
public interface RackSpaceConstants {
-
+ public static final String PROPERTY_RACKSPACE_USER = "jclouds.rackspace.user";
+ public static final String PROPERTY_RACKSPACE_KEY = "jclouds.rackspace.key";
}
diff --git a/rackspace/core/src/main/java/org/jclouds/rackspace/reference/RackSpaceHeaders.java b/rackspace/core/src/main/java/org/jclouds/rackspace/reference/RackSpaceHeaders.java
new file mode 100644
index 0000000000..f105c9c3ca
--- /dev/null
+++ b/rackspace/core/src/main/java/org/jclouds/rackspace/reference/RackSpaceHeaders.java
@@ -0,0 +1,19 @@
+package org.jclouds.rackspace.reference;
+
+/**
+ * Headers common to Rackspace apis.
+ *
+ * @see
+ * @author Adrian Cole
+ *
+ */
+public interface RackSpaceHeaders {
+
+ public static final String AUTH_USER = "X-Auth-User";
+ public static final String AUTH_KEY = "X-Auth-Key";
+ public static final String AUTH_TOKEN = "X-Auth-Token";
+ public static final String CDN_MANAGEMENT_URL = "X-CDN-Management-Url";
+ public static final String SERVER_MANAGEMENT_URL = "X-Server-Management-Url";
+ public static final String STORAGE_URL = "X-Storage-Url";
+
+}
\ No newline at end of file
diff --git a/rackspace/cloudfiles/core/src/test/java/org/jclouds/rackspace/cloudfiles/CloudFilesAuthenticationLiveTest.java b/rackspace/core/src/test/java/org/jclouds/rackspace/RackSpaceAuthenticationLiveTest.java
old mode 100644
new mode 100755
similarity index 78%
rename from rackspace/cloudfiles/core/src/test/java/org/jclouds/rackspace/cloudfiles/CloudFilesAuthenticationLiveTest.java
rename to rackspace/core/src/test/java/org/jclouds/rackspace/RackSpaceAuthenticationLiveTest.java
index d39a1ca357..89a1347f36
--- a/rackspace/cloudfiles/core/src/test/java/org/jclouds/rackspace/cloudfiles/CloudFilesAuthenticationLiveTest.java
+++ b/rackspace/core/src/test/java/org/jclouds/rackspace/RackSpaceAuthenticationLiveTest.java
@@ -21,10 +21,10 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.rackspace.cloudfiles;
+package org.jclouds.rackspace;
-import static org.jclouds.rackspace.cloudfiles.reference.CloudFilesConstants.PROPERTY_CLOUDFILES_KEY;
-import static org.jclouds.rackspace.cloudfiles.reference.CloudFilesConstants.PROPERTY_CLOUDFILES_USER;
+import static org.jclouds.rackspace.reference.RackSpaceConstants.PROPERTY_RACKSPACE_KEY;
+import static org.jclouds.rackspace.reference.RackSpaceConstants.PROPERTY_RACKSPACE_USER;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.fail;
@@ -36,7 +36,8 @@ import org.jclouds.concurrent.WithinThreadExecutorService;
import org.jclouds.concurrent.config.ExecutorServiceModule;
import org.jclouds.http.HttpResponseException;
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
-import org.jclouds.rackspace.cloudfiles.CloudFilesAuthentication.AuthenticationResponse;
+import org.jclouds.rackspace.RackSpaceAuthentication;
+import org.jclouds.rackspace.RackSpaceAuthentication.AuthenticationResponse;
import org.jclouds.rest.RestClientFactory;
import org.jclouds.rest.config.JaxrsModule;
import org.testng.annotations.BeforeClass;
@@ -53,29 +54,30 @@ import com.google.inject.Singleton;
*
* @author Adrian Cole
*/
-@Test(groups = "live", testName = "cloudfiles.CloudFilesAuthenticationLiveTest")
-public class CloudFilesAuthenticationLiveTest {
+@Test(groups = "live", testName = "rackspace.RackSpaceAuthenticationLiveTest")
+public class RackSpaceAuthenticationLiveTest {
- protected static final String sysRackspaceUser = System.getProperty(PROPERTY_CLOUDFILES_USER);
- protected static final String sysRackspaceKey = System.getProperty(PROPERTY_CLOUDFILES_KEY);
+ protected static final String sysRackspaceUser = System.getProperty(PROPERTY_RACKSPACE_USER);
+ protected static final String sysRackspaceKey = System.getProperty(PROPERTY_RACKSPACE_KEY);
private Injector injector;
@Test
public void testAuthentication() throws Exception {
- CloudFilesAuthentication authentication = injector
- .getInstance(CloudFilesAuthentication.class);
+ RackSpaceAuthentication authentication = injector
+ .getInstance(RackSpaceAuthentication.class);
AuthenticationResponse response = authentication.authenticate(sysRackspaceUser,
sysRackspaceKey);
assertNotNull(response);
assertNotNull(response.getStorageUrl());
assertNotNull(response.getCDNManagementUrl());
+ assertNotNull(response.getServerManagementUrl());
assertNotNull(response.getAuthToken());
}
@Test(expectedExceptions = HttpResponseException.class)
public void testBadAuthentication() throws Exception {
- CloudFilesAuthentication authentication = injector
- .getInstance(CloudFilesAuthentication.class);
+ RackSpaceAuthentication authentication = injector
+ .getInstance(RackSpaceAuthentication.class);
try {
authentication.authenticate("foo", "bar");
} catch (UndeclaredThrowableException e) {
@@ -96,10 +98,10 @@ public class CloudFilesAuthenticationLiveTest {
@SuppressWarnings("unused")
@Provides
@Singleton
- protected CloudFilesAuthentication provideCloudFilesAuthentication(
+ protected RackSpaceAuthentication provideCloudFilesAuthentication(
RestClientFactory factory) {
return factory.create(URI.create("https://api.mosso.com"),
- CloudFilesAuthentication.class);
+ RackSpaceAuthentication.class);
}
}, new JaxrsModule(), new ExecutorServiceModule(new WithinThreadExecutorService()),
new JavaUrlHttpCommandExecutorServiceModule());
diff --git a/rackspace/cloudfiles/core/src/test/java/org/jclouds/rackspace/cloudfiles/CloudFilesAuthenticationTest.java b/rackspace/core/src/test/java/org/jclouds/rackspace/RackSpaceAuthenticationTest.java
old mode 100644
new mode 100755
similarity index 80%
rename from rackspace/cloudfiles/core/src/test/java/org/jclouds/rackspace/cloudfiles/CloudFilesAuthenticationTest.java
rename to rackspace/core/src/test/java/org/jclouds/rackspace/RackSpaceAuthenticationTest.java
index ebcc4f0563..23412b396a
--- a/rackspace/cloudfiles/core/src/test/java/org/jclouds/rackspace/cloudfiles/CloudFilesAuthenticationTest.java
+++ b/rackspace/core/src/test/java/org/jclouds/rackspace/RackSpaceAuthenticationTest.java
@@ -21,7 +21,7 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.rackspace.cloudfiles;
+package org.jclouds.rackspace;
import static org.testng.Assert.assertEquals;
@@ -34,8 +34,8 @@ import org.jclouds.concurrent.config.ExecutorServiceModule;
import org.jclouds.http.HttpMethod;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
-import org.jclouds.rackspace.cloudfiles.functions.ParseAuthenticationResponseFromHeaders;
-import org.jclouds.rackspace.cloudfiles.reference.CloudFilesHeaders;
+import org.jclouds.rackspace.functions.ParseAuthenticationResponseFromHeaders;
+import org.jclouds.rackspace.reference.RackSpaceHeaders;
import org.jclouds.rest.JaxrsAnnotationProcessor;
import org.jclouds.rest.config.JaxrsModule;
import org.testng.annotations.BeforeClass;
@@ -49,26 +49,26 @@ import com.google.inject.Guice;
*
* @author Adrian Cole
*/
-@Test(groups = "unit", testName = "cloudfiles.CloudFilesAuthentication")
-public class CloudFilesAuthenticationTest {
+@Test(groups = "unit", testName = "rackspace.RackSpaceAuthentication")
+public class RackSpaceAuthenticationTest {
JaxrsAnnotationProcessor.Factory factory;
public void testAuthenticate() throws SecurityException, NoSuchMethodException {
- Method method = CloudFilesAuthentication.class.getMethod("authenticate", String.class,
+ Method method = RackSpaceAuthentication.class.getMethod("authenticate", String.class,
String.class);
URI endpoint = URI.create("http://localhost");
- HttpRequest httpMethod = factory.create(CloudFilesAuthentication.class).createRequest(
+ HttpRequest httpMethod = factory.create(RackSpaceAuthentication.class).createRequest(
endpoint, method, new Object[] { "foo", "bar" });
assertEquals(httpMethod.getEndpoint().getHost(), "localhost");
assertEquals(httpMethod.getEndpoint().getPath(), "/auth");
assertEquals(httpMethod.getMethod(), HttpMethod.GET);
assertEquals(httpMethod.getHeaders().size(), 2);
- assertEquals(httpMethod.getHeaders().get(CloudFilesHeaders.AUTH_USER), Collections
+ assertEquals(httpMethod.getHeaders().get(RackSpaceHeaders.AUTH_USER), Collections
.singletonList("foo"));
- assertEquals(httpMethod.getHeaders().get(CloudFilesHeaders.AUTH_KEY), Collections
+ assertEquals(httpMethod.getHeaders().get(RackSpaceHeaders.AUTH_KEY), Collections
.singletonList("bar"));
- factory.create(CloudFilesAuthentication.class);
+ factory.create(RackSpaceAuthentication.class);
assertEquals(JaxrsAnnotationProcessor.getParserOrThrowException(method),
ParseAuthenticationResponseFromHeaders.class);
diff --git a/rackspace/pom.xml b/rackspace/pom.xml
index f273359d80..11c8fc8027 100644
--- a/rackspace/pom.xml
+++ b/rackspace/pom.xml
@@ -40,6 +40,10 @@
core
cloudfiles
+
+
+
+
${project.groupId}
@@ -66,4 +70,54 @@
test
+
+
+ live
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ integration
+ integration-test
+
+ test
+
+
+
+
+ none
+
+
+ **/*IntegrationTest.java
+ **/*LiveTest.java
+
+
+
+ file.encoding
+ UTF-8
+
+
+ jclouds.rackspace.user
+ ${jclouds.rackspace.user}
+
+
+ jclouds.rackspace.key
+ ${jclouds.rackspace.key}
+
+
+
+
+
+
+
+
+
+
+