diff --git a/pom.xml b/pom.xml
index ab1fbb0029..32b5464eb9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -47,7 +47,7 @@
rackspace
mezeo
nirvanix
- vcloudx
+ vcloud
atmosonline
twitter
diff --git a/vcloudx/core/pom.xml b/vcloud/core/pom.xml
similarity index 74%
rename from vcloudx/core/pom.xml
rename to vcloud/core/pom.xml
index 346c3dad3a..a558f1db51 100755
--- a/vcloudx/core/pom.xml
+++ b/vcloud/core/pom.xml
@@ -28,26 +28,26 @@
org.jclouds
- jclouds-vcloudx-project
+ jclouds-vcloud-project
1.0-SNAPSHOT
../pom.xml
4.0.0
org.jclouds
- jclouds-vcloudx-core
- jclouds vcloudx Components Core
+ jclouds-vcloud-core
+ jclouds vcloud Components Core
jar
- jclouds Core components to access vcloudx
+ jclouds Core components to access vcloud
- ${jclouds.vcloudx.user}
- ${jclouds.vcloudx.password}
- ${jclouds.vcloudx.endpoint}
+ ${jclouds.vcloud.user}
+ ${jclouds.vcloud.password}
+ ${jclouds.vcloud.endpoint}
- scm:svn:http://jclouds.googlecode.com/svn/trunk/vcloudx/core
- scm:svn:https://jclouds.googlecode.com/svn/trunk/vcloudx/core
- http://jclouds.googlecode.com/svn/trunk/vcloudx/core
+ scm:svn:http://jclouds.googlecode.com/svn/trunk/vcloud/core
+ scm:svn:https://jclouds.googlecode.com/svn/trunk/vcloud/core
+ http://jclouds.googlecode.com/svn/trunk/vcloud/core
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/BaseVCloudXContextBuilder.java b/vcloud/core/src/main/java/org/jclouds/vcloud/BaseVCloudContextBuilder.java
similarity index 67%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/BaseVCloudXContextBuilder.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/BaseVCloudContextBuilder.java
index 6d4dd6c36a..c860eebb18 100644
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/BaseVCloudXContextBuilder.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/BaseVCloudContextBuilder.java
@@ -21,7 +21,7 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx;
+package org.jclouds.vcloud;
import java.util.List;
import java.util.Properties;
@@ -30,16 +30,16 @@ import java.util.concurrent.ExecutorService;
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
import org.jclouds.logging.jdk.config.JDKLoggingModule;
import org.jclouds.rest.RestContextBuilder;
-import org.jclouds.vcloudx.config.BaseVCloudXRestClientModule;
-import org.jclouds.vcloudx.config.BaseVCloudXContextModule;
-import org.jclouds.vcloudx.config.RestVCloudXAuthenticationModule;
+import org.jclouds.vcloud.config.BaseVCloudContextModule;
+import org.jclouds.vcloud.config.BaseVCloudRestClientModule;
+import org.jclouds.vcloud.config.VCloudDiscoveryRestClientModule;
import com.google.inject.Injector;
import com.google.inject.Module;
import com.google.inject.TypeLiteral;
/**
- * Creates {@link VCloudXContext} or {@link Injector} instances based on the most commonly requested
+ * Creates {@link VCloudContext} or {@link Injector} instances based on the most commonly requested
* arguments.
*
* Note that Threadsafe objects will be bound as singletons to the Injector or Context provided.
@@ -51,32 +51,32 @@ import com.google.inject.TypeLiteral;
* @author Adrian Cole
* @see CloudFilesContext
*/
-public class BaseVCloudXContextBuilder extends RestContextBuilder {
+public class BaseVCloudContextBuilder extends RestContextBuilder {
- public BaseVCloudXContextBuilder(Properties props) {
- super(new TypeLiteral() {
+ public BaseVCloudContextBuilder(Properties props) {
+ super(new TypeLiteral() {
}, props);
}
@Override
protected void addClientModule(List modules) {
- modules.add(new RestVCloudXAuthenticationModule());
- modules.add(new BaseVCloudXRestClientModule());
+ modules.add(new VCloudDiscoveryRestClientModule());
+ modules.add(new BaseVCloudRestClientModule());
}
@Override
protected void addContextModule(List modules) {
- modules.add(new BaseVCloudXContextModule());
+ modules.add(new BaseVCloudContextModule());
}
@Override
- public BaseVCloudXContextBuilder withExecutorService(ExecutorService service) {
- return (BaseVCloudXContextBuilder) super.withExecutorService(service);
+ public BaseVCloudContextBuilder withExecutorService(ExecutorService service) {
+ return (BaseVCloudContextBuilder) super.withExecutorService(service);
}
@Override
- public BaseVCloudXContextBuilder withModules(Module... modules) {
- return (BaseVCloudXContextBuilder) super.withModules(modules);
+ public BaseVCloudContextBuilder withModules(Module... modules) {
+ return (BaseVCloudContextBuilder) super.withModules(modules);
}
}
diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudClient.java b/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudClient.java
new file mode 100644
index 0000000000..f6945a1a5b
--- /dev/null
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudClient.java
@@ -0,0 +1,69 @@
+/**
+ *
+ * Copyright (C) 2009 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * 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.vcloud;
+
+import java.util.concurrent.Future;
+import static org.jclouds.vcloud.VCloudMediaType.*;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
+import org.jclouds.vcloud.xml.CatalogHandler;
+
+/**
+ * Provides access to VCloud resources via their REST API.
+ *
+ *
+ * @see
+ * @author Adrian Cole
+ */
+@RequestFilters(SetVCloudTokenCookie.class)
+public interface VCloudClient {
+
+ @GET
+ @Endpoint(org.jclouds.vcloud.endpoints.Catalog.class)
+ @Consumes(CATALOG_XML)
+ @XMLResponseParser(CatalogHandler.class)
+ Future getCatalog();
+
+
+ @GET
+ @Endpoint(org.jclouds.vcloud.endpoints.VDC.class)
+ @Consumes(VDC_XML)
+ String getDefaultVDC();
+
+ //
+ // @GET
+ // @Endpoint(vDC.class)
+ // public Set getvDCs();
+ //
+ // @GET
+ // @Endpoint(TasksList.class)
+ // public Set getTasksLists();
+
+}
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/VCloudXClient.java b/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudDiscovery.java
similarity index 74%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/VCloudXClient.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/VCloudDiscovery.java
index 4f28f291f3..c12d76588f 100644
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/VCloudXClient.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudDiscovery.java
@@ -21,37 +21,36 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx;
+package org.jclouds.vcloud;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
-import javax.ws.rs.core.MediaType;
import org.jclouds.rest.annotations.Endpoint;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.XMLResponseParser;
-import org.jclouds.vcloudx.domain.OrgLinks;
-import org.jclouds.vcloudx.endpoints.Org;
-import org.jclouds.vcloudx.filters.SetVCloudTokenCookie;
-import org.jclouds.vcloudx.xml.OrgLinksHandler;
+import org.jclouds.vcloud.domain.Organization;
+import org.jclouds.vcloud.endpoints.Org;
+import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
+import org.jclouds.vcloud.xml.OrgHandler;
/**
- * Provides access to VCloudX resources via their REST API.
+ * Provides access to VCloud resources via their REST API.
*
*
* @see
* @author Adrian Cole
*/
@RequestFilters(SetVCloudTokenCookie.class)
-public interface VCloudXClient {
+public interface VCloudDiscovery {
/**
- * This call returns a list of all vCloud Data Centers (vDCs), catalogs, and task lists within
+ * This call returns a list of all vCloud Data Centers (vdcs), catalogs, and task lists within
* the organization.
*/
@GET
@Endpoint(Org.class)
- @Consumes(MediaType.APPLICATION_XML)
- @XMLResponseParser(OrgLinksHandler.class)
- OrgLinks getOrganization();
+ @Consumes(VCloudMediaType.ORG_XML)
+ @XMLResponseParser(OrgHandler.class)
+ Organization getOrganization();
}
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/VCloudXLogin.java b/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudLogin.java
similarity index 81%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/VCloudXLogin.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/VCloudLogin.java
index e5a31f86b7..dbb862f723 100755
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/VCloudXLogin.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudLogin.java
@@ -21,9 +21,9 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx;
+package org.jclouds.vcloud;
-import java.net.URI;
+import java.util.Map;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
@@ -34,27 +34,28 @@ import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.rest.annotations.Endpoint;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.vcloudx.endpoints.Org;
-import org.jclouds.vcloudx.endpoints.VCloudX;
-import org.jclouds.vcloudx.functions.ParseLoginResponseFromHeaders;
+import org.jclouds.vcloud.domain.Link;
+import org.jclouds.vcloud.endpoints.Org;
+import org.jclouds.vcloud.endpoints.VCloud;
+import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
/**
- * Establishes a context with a VCloudX endpoint.
+ * Establishes a context with a VCloud endpoint.
*
*
* @see
* @author Adrian Cole
*/
-@Endpoint(VCloudX.class)
+@Endpoint(VCloud.class)
@RequestFilters(BasicAuthentication.class)
-public interface VCloudXLogin {
+public interface VCloudLogin {
- public interface VCloudXSession {
+ public interface VCloudSession {
@VCloudToken
String getVCloudToken();
@Org
- URI getOrg();
+ Map getOrgs();
}
/**
@@ -65,5 +66,5 @@ public interface VCloudXLogin {
@ResponseParser(ParseLoginResponseFromHeaders.class)
@Path("/login")
@Consumes(MediaType.APPLICATION_XML)
- VCloudXSession login();
+ VCloudSession login();
}
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/VCloudXMediaType.java b/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudMediaType.java
similarity index 85%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/VCloudXMediaType.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/VCloudMediaType.java
index 19f7f3dd64..75eb8f7902 100644
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/VCloudXMediaType.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudMediaType.java
@@ -21,7 +21,7 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx;
+package org.jclouds.vcloud;
import javax.ws.rs.core.MediaType;
@@ -30,7 +30,7 @@ import javax.ws.rs.core.MediaType;
*
* @see MediaType
*/
-public class VCloudXMediaType {
+public class VCloudMediaType {
/**
* "application/vnd.vmware.vcloud.org+xml"
@@ -72,4 +72,14 @@ public class VCloudXMediaType {
public final static MediaType TASKSLIST_XML_TYPE = new MediaType("application",
"vnd.vmware.vcloud.tasksList+xml");
+ /**
+ * "application/vnd.vmware.vcloud.catalogItem+xml"
+ */
+ public final static String CATALOGITEM_XML = "application/vnd.vmware.vcloud.catalogItem+xml";
+ /**
+ * "application/vnd.vmware.vcloud.catalogItem+xml"
+ */
+ public final static MediaType CATALOGITEM_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.catalogItem+xml");
+
}
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/VCloudXPropertiesBuilder.java b/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudPropertiesBuilder.java
similarity index 56%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/VCloudXPropertiesBuilder.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/VCloudPropertiesBuilder.java
index de6c56f24d..6244866b34 100644
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/VCloudXPropertiesBuilder.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudPropertiesBuilder.java
@@ -21,13 +21,13 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx;
+package org.jclouds.vcloud;
import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.vcloudx.reference.VCloudXConstants.PROPERTY_VCLOUDX_ENDPOINT;
-import static org.jclouds.vcloudx.reference.VCloudXConstants.PROPERTY_VCLOUDX_KEY;
-import static org.jclouds.vcloudx.reference.VCloudXConstants.PROPERTY_VCLOUDX_SESSIONINTERVAL;
-import static org.jclouds.vcloudx.reference.VCloudXConstants.PROPERTY_VCLOUDX_USER;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_ENDPOINT;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_KEY;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_SESSIONINTERVAL;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_USER;
import java.net.URI;
import java.util.Properties;
@@ -35,41 +35,41 @@ import java.util.Properties;
import org.jclouds.http.HttpPropertiesBuilder;
/**
- * Builds properties used in VCloudX Clients
+ * Builds properties used in VCloud Clients
*
* @author Adrian Cole
*/
-public class VCloudXPropertiesBuilder extends HttpPropertiesBuilder {
+public class VCloudPropertiesBuilder extends HttpPropertiesBuilder {
@Override
protected Properties defaultProperties() {
Properties properties = super.defaultProperties();
- properties.setProperty(PROPERTY_VCLOUDX_SESSIONINTERVAL, 9 * 60 + "");
+ properties.setProperty(PROPERTY_VCLOUD_SESSIONINTERVAL, 9 * 60 + "");
return properties;
}
- public VCloudXPropertiesBuilder(Properties properties) {
+ public VCloudPropertiesBuilder(Properties properties) {
super(properties);
}
- public VCloudXPropertiesBuilder(URI endpoint, String id, String secret) {
+ public VCloudPropertiesBuilder(URI endpoint, String id, String secret) {
super();
withCredentials(id, secret);
withEndpoint(endpoint);
}
- public VCloudXPropertiesBuilder withTokenExpiration(long seconds) {
- properties.setProperty(PROPERTY_VCLOUDX_SESSIONINTERVAL, seconds + "");
+ public VCloudPropertiesBuilder withTokenExpiration(long seconds) {
+ properties.setProperty(PROPERTY_VCLOUD_SESSIONINTERVAL, seconds + "");
return this;
}
- public VCloudXPropertiesBuilder withCredentials(String id, String secret) {
- properties.setProperty(PROPERTY_VCLOUDX_USER, checkNotNull(id, "user"));
- properties.setProperty(PROPERTY_VCLOUDX_KEY, checkNotNull(secret, "key"));
+ public VCloudPropertiesBuilder withCredentials(String id, String secret) {
+ properties.setProperty(PROPERTY_VCLOUD_USER, checkNotNull(id, "user"));
+ properties.setProperty(PROPERTY_VCLOUD_KEY, checkNotNull(secret, "key"));
return this;
}
- public VCloudXPropertiesBuilder withEndpoint(URI endpoint) {
- properties.setProperty(PROPERTY_VCLOUDX_ENDPOINT, checkNotNull(endpoint, "endpoint")
+ public VCloudPropertiesBuilder withEndpoint(URI endpoint) {
+ properties.setProperty(PROPERTY_VCLOUD_ENDPOINT, checkNotNull(endpoint, "endpoint")
.toString());
return this;
}
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/VCloudToken.java b/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudToken.java
similarity index 98%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/VCloudToken.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/VCloudToken.java
index 11572c051d..a2c61e71c6 100644
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/VCloudToken.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudToken.java
@@ -21,7 +21,7 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx;
+package org.jclouds.vcloud;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/config/BaseVCloudXContextModule.java b/vcloud/core/src/main/java/org/jclouds/vcloud/config/BaseVCloudContextModule.java
similarity index 73%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/config/BaseVCloudXContextModule.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/config/BaseVCloudContextModule.java
index 8b9eef4545..21d0f50f63 100644
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/config/BaseVCloudXContextModule.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/config/BaseVCloudContextModule.java
@@ -21,7 +21,7 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx.config;
+package org.jclouds.vcloud.config;
import java.net.URI;
@@ -31,9 +31,9 @@ import javax.inject.Singleton;
import org.jclouds.lifecycle.Closer;
import org.jclouds.rest.RestContext;
import org.jclouds.rest.internal.RestContextImpl;
-import org.jclouds.vcloudx.VCloudXClient;
-import org.jclouds.vcloudx.endpoints.Org;
-import org.jclouds.vcloudx.reference.VCloudXConstants;
+import org.jclouds.vcloud.VCloudClient;
+import org.jclouds.vcloud.endpoints.Org;
+import org.jclouds.vcloud.reference.VCloudConstants;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
@@ -41,16 +41,16 @@ import com.google.inject.Provides;
/**
* @author Adrian Cole
*/
-public class BaseVCloudXContextModule extends AbstractModule {
+public class BaseVCloudContextModule extends AbstractModule {
@Override
protected void configure() {
}
@Provides
@Singleton
- RestContext provideContext(Closer closer, VCloudXClient defaultApi,
- @Org URI endPoint, @Named(VCloudXConstants.PROPERTY_VCLOUDX_USER) String account) {
- return new RestContextImpl(closer, defaultApi, endPoint, account);
+ RestContext provideContext(Closer closer, VCloudClient defaultApi,
+ @Org URI endPoint, @Named(VCloudConstants.PROPERTY_VCLOUD_USER) String account) {
+ return new RestContextImpl(closer, defaultApi, endPoint, account);
}
}
\ No newline at end of file
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/config/BaseVCloudXRestClientModule.java b/vcloud/core/src/main/java/org/jclouds/vcloud/config/BaseVCloudRestClientModule.java
similarity index 61%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/config/BaseVCloudXRestClientModule.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/config/BaseVCloudRestClientModule.java
index 58ab5b0ffb..dcb7613b8a 100644
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/config/BaseVCloudXRestClientModule.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/config/BaseVCloudRestClientModule.java
@@ -21,37 +21,53 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx.config;
+package org.jclouds.vcloud.config;
+
+import java.net.URI;
import javax.inject.Singleton;
import org.jclouds.http.RequiresHttp;
import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.RestClientFactory;
-import org.jclouds.vcloudx.VCloudXClient;
+import org.jclouds.vcloud.VCloudClient;
+import org.jclouds.vcloud.VCloudDiscovery;
+import org.jclouds.vcloud.endpoints.Catalog;
+import org.jclouds.vcloud.endpoints.VDC;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
/**
- * Configures the VCloudX authentication service connection, including logging and http
- * transport.
+ * Configures the VCloud authentication service connection, including logging and http transport.
*
* @author Adrian Cole
*/
@RequiresHttp
@ConfiguresRestClient
-public class BaseVCloudXRestClientModule extends AbstractModule {
+public class BaseVCloudRestClientModule extends AbstractModule {
@Override
protected void configure() {
}
-
+
@Provides
@Singleton
- protected VCloudXClient provideVCloudXClient(RestClientFactory factory) {
- return factory.create(VCloudXClient.class);
+ protected VCloudClient provideVCloudClient(RestClientFactory factory) {
+ return factory.create(VCloudClient.class);
}
+ @Provides
+ @Catalog
+ @Singleton
+ protected URI provideCatalog(VCloudDiscovery discovery) {
+ return discovery.getOrganization().getCatalog().getLocation();
+ }
+ @Provides
+ @VDC
+ @Singleton
+ protected URI provideDefaultVDC(VCloudDiscovery discovery) {
+ return discovery.getOrganization().getVDCs().values().iterator().next().getLocation();
+ }
}
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/config/RestVCloudXAuthenticationModule.java b/vcloud/core/src/main/java/org/jclouds/vcloud/config/VCloudDiscoveryRestClientModule.java
similarity index 55%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/config/RestVCloudXAuthenticationModule.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/config/VCloudDiscoveryRestClientModule.java
index 05509c9ea4..4dea1b7381 100755
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/config/RestVCloudXAuthenticationModule.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/config/VCloudDiscoveryRestClientModule.java
@@ -21,12 +21,12 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx.config;
+package org.jclouds.vcloud.config;
-import static org.jclouds.vcloudx.reference.VCloudXConstants.PROPERTY_VCLOUDX_ENDPOINT;
-import static org.jclouds.vcloudx.reference.VCloudXConstants.PROPERTY_VCLOUDX_KEY;
-import static org.jclouds.vcloudx.reference.VCloudXConstants.PROPERTY_VCLOUDX_SESSIONINTERVAL;
-import static org.jclouds.vcloudx.reference.VCloudXConstants.PROPERTY_VCLOUDX_USER;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_ENDPOINT;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_KEY;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_SESSIONINTERVAL;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_USER;
import java.io.UnsupportedEncodingException;
import java.net.URI;
@@ -39,23 +39,24 @@ import org.jclouds.concurrent.ExpirableSupplier;
import org.jclouds.http.RequiresHttp;
import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.rest.RestClientFactory;
-import org.jclouds.vcloudx.VCloudToken;
-import org.jclouds.vcloudx.VCloudXLogin;
-import org.jclouds.vcloudx.VCloudXLogin.VCloudXSession;
-import org.jclouds.vcloudx.endpoints.Org;
-import org.jclouds.vcloudx.endpoints.VCloudX;
+import org.jclouds.vcloud.VCloudDiscovery;
+import org.jclouds.vcloud.VCloudLogin;
+import org.jclouds.vcloud.VCloudToken;
+import org.jclouds.vcloud.VCloudLogin.VCloudSession;
+import org.jclouds.vcloud.endpoints.Org;
+import org.jclouds.vcloud.endpoints.VCloud;
import com.google.common.base.Supplier;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
/**
- * Configures the VCloudX authentication service connection, including logging and http transport.
+ * Configures the VCloud authentication service connection, including logging and http transport.
*
* @author Adrian Cole
*/
@RequiresHttp
-public class RestVCloudXAuthenticationModule extends AbstractModule {
+public class VCloudDiscoveryRestClientModule extends AbstractModule {
@Override
protected void configure() {
@@ -63,14 +64,15 @@ public class RestVCloudXAuthenticationModule extends AbstractModule {
@VCloudToken
@Provides
- String provideVCloudToken(Supplier cache) {
+ String provideVCloudToken(Supplier cache) {
return cache.get().getVCloudToken();
}
@Provides
@Org
- protected URI provideOrg(VCloudXLogin login) {
- return login.login().getOrg();
+ @Singleton
+ protected URI provideOrg(Supplier cache, @Named(PROPERTY_VCLOUD_USER) String user) {
+ return cache.get().getOrgs().get(user).getLocation();
}
/**
@@ -78,10 +80,10 @@ public class RestVCloudXAuthenticationModule extends AbstractModule {
*/
@Provides
@Singleton
- Supplier provideVCloudTokenCache(
- @Named(PROPERTY_VCLOUDX_SESSIONINTERVAL) long seconds, final VCloudXLogin login) {
- return new ExpirableSupplier(new Supplier() {
- public VCloudXSession get() {
+ Supplier provideVCloudTokenCache(
+ @Named(PROPERTY_VCLOUD_SESSIONINTERVAL) long seconds, final VCloudLogin login) {
+ return new ExpirableSupplier(new Supplier() {
+ public VCloudSession get() {
return login.login();
}
}, seconds, TimeUnit.SECONDS);
@@ -89,21 +91,27 @@ public class RestVCloudXAuthenticationModule extends AbstractModule {
@Provides
@Singleton
- @VCloudX
- protected URI provideAuthenticationURI(@Named(PROPERTY_VCLOUDX_ENDPOINT) String endpoint) {
+ @VCloud
+ protected URI provideAuthenticationURI(@Named(PROPERTY_VCLOUD_ENDPOINT) String endpoint) {
return URI.create(endpoint);
}
@Provides
@Singleton
- protected VCloudXLogin provideVCloudXLogin(RestClientFactory factory) {
- return factory.create(VCloudXLogin.class);
+ protected VCloudLogin provideVCloudLogin(RestClientFactory factory) {
+ return factory.create(VCloudLogin.class);
}
@Provides
@Singleton
- public BasicAuthentication provideBasicAuthentication(@Named(PROPERTY_VCLOUDX_USER) String user,
- @Named(PROPERTY_VCLOUDX_KEY) String key) throws UnsupportedEncodingException {
+ protected VCloudDiscovery provideVCloudDiscovery(RestClientFactory factory) {
+ return factory.create(VCloudDiscovery.class);
+ }
+
+ @Provides
+ @Singleton
+ public BasicAuthentication provideBasicAuthentication(@Named(PROPERTY_VCLOUD_USER) String user,
+ @Named(PROPERTY_VCLOUD_KEY) String key) throws UnsupportedEncodingException {
return new BasicAuthentication(user, key);
}
diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Catalog.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Catalog.java
new file mode 100644
index 0000000000..485a15cf66
--- /dev/null
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Catalog.java
@@ -0,0 +1,39 @@
+/**
+ *
+ * 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.vcloud.domain;
+
+import java.util.Map;
+
+import org.jclouds.vcloud.domain.internal.CatalogImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * @author Adrian Cole
+ */
+@org.jclouds.vcloud.endpoints.Catalog
+@ImplementedBy(CatalogImpl.class)
+public interface Catalog extends Link, Map {
+
+}
\ No newline at end of file
diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Link.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Link.java
new file mode 100644
index 0000000000..45feccbadb
--- /dev/null
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Link.java
@@ -0,0 +1,47 @@
+/**
+ *
+ * Copyright (C) 2009 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * 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.vcloud.domain;
+
+import java.net.URI;
+
+import org.jclouds.vcloud.domain.internal.LinkImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * Location of a vCloud resource
+ *
+ * @author Adrian Cole
+ *
+ */
+@ImplementedBy(LinkImpl.class)
+public interface Link {
+
+ String getName();
+
+ String getType();
+
+ URI getLocation();
+
+}
\ No newline at end of file
diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Organization.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Organization.java
new file mode 100644
index 0000000000..845882e68b
--- /dev/null
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Organization.java
@@ -0,0 +1,52 @@
+/**
+ *
+ * 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.vcloud.domain;
+
+import java.util.Map;
+
+import org.jclouds.vcloud.domain.internal.OrganizationImpl;
+import org.jclouds.vcloud.endpoints.Catalog;
+import org.jclouds.vcloud.endpoints.Org;
+import org.jclouds.vcloud.endpoints.TasksList;
+import org.jclouds.vcloud.endpoints.VDC;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * @author Adrian Cole
+ */
+@Org
+@ImplementedBy(OrganizationImpl.class)
+public interface Organization extends Link {
+
+ @Catalog
+ Link getCatalog();
+
+ @VDC
+ Map getVDCs();
+
+ @TasksList
+ Map getTasksLists();
+
+}
\ No newline at end of file
diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java
new file mode 100644
index 0000000000..dd56897a2c
--- /dev/null
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java
@@ -0,0 +1,91 @@
+/**
+ *
+ * Copyright (C) 2009 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * 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.vcloud.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.Link;
+
+/**
+ * Locations of resources in vCloud
+ *
+ * @author Adrian Cole
+ *
+ */
+public class CatalogImpl extends HashMap implements Catalog {
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 8464716396538298809L;
+ private final Link catalog;
+
+ public CatalogImpl(String name, String type, URI location, Map contents) {
+ super(contents.size());
+ this.catalog = new LinkImpl(checkNotNull(name, "name"), checkNotNull(type, "type"),
+ checkNotNull(location, "location"));
+ putAll(checkNotNull(contents, "contents"));
+ }
+
+ public URI getLocation() {
+ return catalog.getLocation();
+ }
+
+ public String getName() {
+ return catalog.getName();
+ }
+
+ public String getType() {
+ return catalog.getType();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((catalog == null) ? 0 : catalog.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ CatalogImpl other = (CatalogImpl) obj;
+ if (catalog == null) {
+ if (other.catalog != null)
+ return false;
+ } else if (!catalog.equals(other.catalog))
+ return false;
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/domain/OrgLinks.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/LinkImpl.java
similarity index 54%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/domain/OrgLinks.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/LinkImpl.java
index c3b40a81dc..e25deaabaa 100644
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/domain/OrgLinks.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/LinkImpl.java
@@ -21,65 +21,53 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx.domain;
+package org.jclouds.vcloud.domain.internal;
import java.net.URI;
-import java.util.Set;
-import javax.inject.Singleton;
+import org.jclouds.vcloud.domain.Link;
/**
- * Locations of resources in VCloud Express
+ * Location of a vCloud resource
*
* @author Adrian Cole
*
*/
-@Singleton
-public class OrgLinks {
-
+public class LinkImpl implements Link {
private final String name;
- private final URI org;
- private final URI catalog;
- private final Set vDCs;
- private final Set taskLists;
+ private final String type;
+ private final URI location;
- public OrgLinks(String name, URI org, URI catalog, Set vDCs, Set tasksLists) {
+ public LinkImpl(String name, String type, URI location) {
this.name = name;
- this.org = org;
- this.catalog = catalog;
- this.vDCs = vDCs;
- this.taskLists = tasksLists;
+ this.type = type;
+ this.location = location;
}
public String getName() {
return name;
}
- public URI getOrg() {
- return org;
+ public String getType() {
+ return type;
}
- public URI getCatalog() {
- return catalog;
+ public URI getLocation() {
+ return location;
}
- public Set getVDCs() {
- return vDCs;
- }
-
- public Set getTaskLists() {
- return taskLists;
+ @Override
+ public String toString() {
+ return "Link [name=" + name + ", type=" + type + ", location=" + location + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((catalog == null) ? 0 : catalog.hashCode());
+ result = prime * result + ((location == null) ? 0 : location.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((org == null) ? 0 : org.hashCode());
- result = prime * result + ((taskLists == null) ? 0 : taskLists.hashCode());
- result = prime * result + ((vDCs == null) ? 0 : vDCs.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
}
@@ -91,33 +79,22 @@ public class OrgLinks {
return false;
if (getClass() != obj.getClass())
return false;
- OrgLinks other = (OrgLinks) obj;
- if (catalog == null) {
- if (other.catalog != null)
+ LinkImpl other = (LinkImpl) obj;
+ if (location == null) {
+ if (other.location != null)
return false;
- } else if (!catalog.equals(other.catalog))
+ } else if (!location.equals(other.location))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
- if (org == null) {
- if (other.org != null)
+ if (type == null) {
+ if (other.type != null)
return false;
- } else if (!org.equals(other.org))
- return false;
- if (taskLists == null) {
- if (other.taskLists != null)
- return false;
- } else if (!taskLists.equals(other.taskLists))
- return false;
- if (vDCs == null) {
- if (other.vDCs != null)
- return false;
- } else if (!vDCs.equals(other.vDCs))
+ } else if (!type.equals(other.type))
return false;
return true;
}
-
}
\ No newline at end of file
diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/OrganizationImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/OrganizationImpl.java
new file mode 100644
index 0000000000..24092d0cd0
--- /dev/null
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/OrganizationImpl.java
@@ -0,0 +1,107 @@
+/**
+ *
+ * Copyright (C) 2009 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * 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.vcloud.domain.internal;
+
+import java.net.URI;
+import java.util.Map;
+
+import org.jclouds.vcloud.domain.Link;
+import org.jclouds.vcloud.domain.Organization;
+import org.jclouds.vcloud.endpoints.Catalog;
+import org.jclouds.vcloud.endpoints.TasksList;
+import org.jclouds.vcloud.endpoints.VDC;
+
+/**
+ * Locations of resources in vCloud
+ *
+ * @author Adrian Cole
+ *
+ */
+public class OrganizationImpl extends LinkImpl implements Organization {
+
+ private final Link catalog;
+ private final Map vdcs;
+ private final Map tasksLists;
+
+ public OrganizationImpl(String name, String type, URI location, Link catalog,
+ Map vdcs, Map tasksLists) {
+ super(name, type, location);
+ this.catalog = catalog;
+ this.vdcs = vdcs;
+ this.tasksLists = tasksLists;
+ }
+
+ @Catalog
+ public Link getCatalog() {
+ return catalog;
+ }
+
+ @VDC
+ public Map getVDCs() {
+ return vdcs;
+ }
+
+ @TasksList
+ public Map getTasksLists() {
+ return tasksLists;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((catalog == null) ? 0 : catalog.hashCode());
+ result = prime * result + ((tasksLists == null) ? 0 : tasksLists.hashCode());
+ result = prime * result + ((vdcs == null) ? 0 : vdcs.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ OrganizationImpl other = (OrganizationImpl) obj;
+ if (catalog == null) {
+ if (other.catalog != null)
+ return false;
+ } else if (!catalog.equals(other.catalog))
+ return false;
+ if (tasksLists == null) {
+ if (other.tasksLists != null)
+ return false;
+ } else if (!tasksLists.equals(other.tasksLists))
+ return false;
+ if (vdcs == null) {
+ if (other.vdcs != null)
+ return false;
+ } else if (!vdcs.equals(other.vdcs))
+ return false;
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/endpoints/Catalog.java b/vcloud/core/src/main/java/org/jclouds/vcloud/endpoints/Catalog.java
similarity index 88%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/endpoints/Catalog.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/endpoints/Catalog.java
index 7b342457ce..600ba76e23 100644
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/endpoints/Catalog.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/endpoints/Catalog.java
@@ -21,7 +21,7 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx.endpoints;
+package org.jclouds.vcloud.endpoints;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -31,13 +31,13 @@ import java.lang.annotation.Target;
import javax.inject.Qualifier;
/**
- * Related to a VCloud express vDC.
+ * Related to a VCloud Catalog.
*
* @author Adrian Cole
*
*/
@Retention(value = RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
@Qualifier
public @interface Catalog {
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/endpoints/Org.java b/vcloud/core/src/main/java/org/jclouds/vcloud/endpoints/Org.java
similarity index 90%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/endpoints/Org.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/endpoints/Org.java
index 7472f6e833..59a47f53b2 100644
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/endpoints/Org.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/endpoints/Org.java
@@ -21,7 +21,7 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx.endpoints;
+package org.jclouds.vcloud.endpoints;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -37,7 +37,7 @@ import javax.inject.Qualifier;
*
*/
@Retention(value = RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
@Qualifier
public @interface Org {
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/endpoints/TaskList.java b/vcloud/core/src/main/java/org/jclouds/vcloud/endpoints/TasksList.java
similarity index 95%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/endpoints/TaskList.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/endpoints/TasksList.java
index 2b05c94330..3ac64b4398 100644
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/endpoints/TaskList.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/endpoints/TasksList.java
@@ -21,7 +21,7 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx.endpoints;
+package org.jclouds.vcloud.endpoints;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -39,6 +39,6 @@ import javax.inject.Qualifier;
@Retention(value = RetentionPolicy.RUNTIME)
@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
@Qualifier
-public @interface TaskList {
+public @interface TasksList {
}
\ No newline at end of file
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/endpoints/VCloudX.java b/vcloud/core/src/main/java/org/jclouds/vcloud/endpoints/VCloud.java
similarity index 92%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/endpoints/VCloudX.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/endpoints/VCloud.java
index 7735bc90bb..0f319f9e43 100644
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/endpoints/VCloudX.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/endpoints/VCloud.java
@@ -21,7 +21,7 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx.endpoints;
+package org.jclouds.vcloud.endpoints;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -31,7 +31,7 @@ import java.lang.annotation.Target;
import javax.inject.Qualifier;
/**
- * Represents a component related to VCloud Express.
+ * Represents a component related to vCloud.
*
* @see
* @author Adrian Cole
@@ -40,6 +40,6 @@ import javax.inject.Qualifier;
@Retention(value = RetentionPolicy.RUNTIME)
@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
@Qualifier
-public @interface VCloudX {
+public @interface VCloud {
}
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/endpoints/VDC.java b/vcloud/core/src/main/java/org/jclouds/vcloud/endpoints/VDC.java
similarity index 97%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/endpoints/VDC.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/endpoints/VDC.java
index 43779edcc2..0635a111b6 100644
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/endpoints/VDC.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/endpoints/VDC.java
@@ -21,7 +21,7 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx.endpoints;
+package org.jclouds.vcloud.endpoints;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/filters/SetVCloudTokenCookie.java b/vcloud/core/src/main/java/org/jclouds/vcloud/filters/SetVCloudTokenCookie.java
similarity index 96%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/filters/SetVCloudTokenCookie.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/filters/SetVCloudTokenCookie.java
index 35ec57d897..56218deb99 100644
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/filters/SetVCloudTokenCookie.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/filters/SetVCloudTokenCookie.java
@@ -21,7 +21,7 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx.filters;
+package org.jclouds.vcloud.filters;
import java.util.Collections;
@@ -32,7 +32,7 @@ import javax.inject.Singleton;
import org.jclouds.http.HttpException;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpRequestFilter;
-import org.jclouds.vcloudx.VCloudToken;
+import org.jclouds.vcloud.VCloudToken;
/**
* Adds the VCloud Token to the request as a cookie
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/functions/ParseLoginResponseFromHeaders.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java
similarity index 76%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/functions/ParseLoginResponseFromHeaders.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java
index d957385a03..fba6f838c8 100755
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/functions/ParseLoginResponseFromHeaders.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java
@@ -21,11 +21,11 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx.functions;
+package org.jclouds.vcloud.functions;
import static com.google.common.base.Preconditions.checkNotNull;
-import java.net.URI;
+import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -38,36 +38,37 @@ import org.jclouds.http.HttpResponse;
import org.jclouds.http.HttpResponseException;
import org.jclouds.http.functions.ParseSax;
import org.jclouds.http.functions.ParseSax.Factory;
-import org.jclouds.vcloudx.VCloudToken;
-import org.jclouds.vcloudx.VCloudXLogin.VCloudXSession;
-import org.jclouds.vcloudx.endpoints.Org;
-import org.jclouds.vcloudx.xml.OrgListToOrgUriHandler;
+import org.jclouds.vcloud.VCloudToken;
+import org.jclouds.vcloud.VCloudLogin.VCloudSession;
+import org.jclouds.vcloud.domain.Link;
+import org.jclouds.vcloud.endpoints.Org;
+import org.jclouds.vcloud.xml.OrgListHandler;
import com.google.common.base.Function;
/**
- * This parses {@link VCloudXSession} from HTTP headers.
+ * This parses {@link VCloudSession} from HTTP headers.
*
* @author Adrian Cole
*/
@Singleton
-public class ParseLoginResponseFromHeaders implements Function {
+public class ParseLoginResponseFromHeaders implements Function {
static final Pattern pattern = Pattern.compile("vcloud-token=(.*); path=.*");
private final ParseSax.Factory factory;
- private final Provider orgHandlerProvider;
+ private final Provider orgHandlerProvider;
@Inject
private ParseLoginResponseFromHeaders(Factory factory,
- Provider orgHandlerProvider) {
+ Provider orgHandlerProvider) {
this.factory = factory;
this.orgHandlerProvider = orgHandlerProvider;
}
/**
- * parses the http response headers to create a new {@link VCloudXSession} object.
+ * parses the http response headers to create a new {@link VCloudSession} object.
*/
- public VCloudXSession apply(HttpResponse from) {
+ public VCloudSession apply(HttpResponse from) {
String cookieHeader = checkNotNull(from.getFirstHeaderOrNull(HttpHeaders.SET_COOKIE),
HttpHeaders.SET_COOKIE);
@@ -75,16 +76,17 @@ public class ParseLoginResponseFromHeaders implements Function org = factory.create(orgHandlerProvider.get()).parse(
+ from.getContent());
- return new VCloudXSession() {
+ return new VCloudSession() {
@VCloudToken
public String getVCloudToken() {
return matcher.group(1);
}
@Org
- public URI getOrg() {
+ public Map getOrgs() {
return org;
}
};
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/reference/VCloudXConstants.java b/vcloud/core/src/main/java/org/jclouds/vcloud/reference/VCloudConstants.java
similarity index 70%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/reference/VCloudXConstants.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/reference/VCloudConstants.java
index 0d10648069..fe6dcaca8f 100644
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/reference/VCloudXConstants.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/reference/VCloudConstants.java
@@ -21,19 +21,19 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx.reference;
+package org.jclouds.vcloud.reference;
/**
- * Configuration properties and constants used in VCloudX connections.
+ * Configuration properties and constants used in VCloud connections.
*
* @author Adrian Cole
*/
-public interface VCloudXConstants {
- public static final String PROPERTY_VCLOUDX_ENDPOINT = "jclouds.vcloudx.endpoint";
- public static final String PROPERTY_VCLOUDX_USER = "jclouds.vcloudx.user";
- public static final String PROPERTY_VCLOUDX_KEY = "jclouds.vcloudx.key";
+public interface VCloudConstants {
+ public static final String PROPERTY_VCLOUD_ENDPOINT = "jclouds.vcloud.endpoint";
+ public static final String PROPERTY_VCLOUD_USER = "jclouds.vcloud.user";
+ public static final String PROPERTY_VCLOUD_KEY = "jclouds.vcloud.key";
/**
* automatically renew vcloud token before this interval expires.
*/
- public static final String PROPERTY_VCLOUDX_SESSIONINTERVAL = "jclouds.vcloudx.sessioninterval";
+ public static final String PROPERTY_VCLOUD_SESSIONINTERVAL = "jclouds.vcloud.sessioninterval";
}
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/reference/package-info.java b/vcloud/core/src/main/java/org/jclouds/vcloud/reference/package-info.java
similarity index 89%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/reference/package-info.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/reference/package-info.java
index a3b68da07e..182eefbaa6 100755
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/reference/package-info.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/reference/package-info.java
@@ -22,7 +22,7 @@
* ====================================================================
*/
/**
- * This package contains properties and reference data used in VCloud Express.
+ * This package contains properties and reference data used in vCloud.
* @author Adrian Cole
*/
-package org.jclouds.vcloudx.reference;
+package org.jclouds.vcloud.reference;
diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/util/Utils.java b/vcloud/core/src/main/java/org/jclouds/vcloud/util/Utils.java
new file mode 100644
index 0000000000..35bca128d0
--- /dev/null
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/util/Utils.java
@@ -0,0 +1,48 @@
+/**
+ *
+ * Copyright (C) 2009 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * 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.vcloud.util;
+
+import java.net.URI;
+import java.util.Map;
+
+import org.jclouds.vcloud.domain.Link;
+import org.jclouds.vcloud.domain.internal.LinkImpl;
+import org.xml.sax.Attributes;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public class Utils {
+
+ public static void putLink(Map map, Attributes attributes) {
+ map.put(attributes.getValue(attributes.getIndex("name")), newLink(attributes));
+ }
+
+ public static Link newLink(Attributes attributes) {
+ return new LinkImpl(attributes.getValue(attributes.getIndex("name")), attributes
+ .getValue(attributes.getIndex("type")), URI.create(attributes.getValue(attributes
+ .getIndex("href"))));
+ }
+}
diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java
new file mode 100644
index 0000000000..25446190c3
--- /dev/null
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java
@@ -0,0 +1,64 @@
+/**
+ *
+ * Copyright (C) 2009 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * 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.vcloud.xml;
+
+import static org.jclouds.vcloud.util.Utils.putLink;
+
+import java.net.URI;
+import java.util.Map;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.Link;
+import org.jclouds.vcloud.domain.internal.CatalogImpl;
+import org.jclouds.vcloud.domain.internal.LinkImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adrian Cole
+ */
+public class CatalogHandler extends ParseSax.HandlerWithResult {
+ private Link Catalog;
+ private Map contents = Maps.newHashMap();
+
+ public Catalog getResult() {
+ return new CatalogImpl(Catalog.getName(), Catalog.getType(), Catalog.getLocation(), contents);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attributes)
+ throws SAXException {
+ if (qName.equals("Catalog")) {
+ Catalog = new LinkImpl(attributes.getValue(attributes.getIndex("name")), attributes
+ .getValue(attributes.getIndex("type")), URI.create(attributes.getValue(attributes
+ .getIndex("href"))));
+ } else if (qName.equals("CatalogItem")) {
+ putLink(contents, attributes);
+ }
+ }
+
+}
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/xml/OrgLinksHandler.java b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgHandler.java
similarity index 54%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/xml/OrgLinksHandler.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgHandler.java
index 091736baff..28357d4bf3 100644
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/xml/OrgLinksHandler.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgHandler.java
@@ -21,68 +21,60 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx.xml;
+package org.jclouds.vcloud.xml;
-import static org.jclouds.vcloudx.VCloudXMediaType.CATALOG_XML;
-import static org.jclouds.vcloudx.VCloudXMediaType.TASKSLIST_XML;
-import static org.jclouds.vcloudx.VCloudXMediaType.VDC_XML;
+import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
+import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
+import static org.jclouds.vcloud.VCloudMediaType.TASKSLIST_XML;
+import static org.jclouds.vcloud.VCloudMediaType.VDC_XML;
+import static org.jclouds.vcloud.util.Utils.newLink;
+import static org.jclouds.vcloud.util.Utils.putLink;
import java.net.URI;
-import java.util.Set;
+import java.util.Map;
import org.jclouds.http.functions.ParseSax;
-import org.jclouds.vcloudx.domain.OrgLinks;
+import org.jclouds.vcloud.domain.Link;
+import org.jclouds.vcloud.domain.Organization;
+import org.jclouds.vcloud.domain.internal.LinkImpl;
+import org.jclouds.vcloud.domain.internal.OrganizationImpl;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
-import com.google.common.collect.Sets;
+import com.google.common.collect.Maps;
/**
* @author Adrian Cole
*/
-public class OrgLinksHandler extends ParseSax.HandlerWithResult {
- private String name;
- private URI org;
- private Set vdcs = Sets.newHashSet();
- private Set tasksLists = Sets.newHashSet();
- private URI catalog;
+public class OrgHandler extends ParseSax.HandlerWithResult {
+ private Link org;
+ private Map vdcs = Maps.newHashMap();
+ private Map tasksLists = Maps.newHashMap();
+ private Link catalog;
- public OrgLinks getResult() {
- return new OrgLinks(name, org, catalog, vdcs, tasksLists);
+ public Organization getResult() {
+ return new OrganizationImpl(org.getName(), org.getType(), org.getLocation(), catalog, vdcs,
+ tasksLists);
}
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes)
throws SAXException {
if (qName.equals("Org")) {
- int index = attributes.getIndex("href");
- if (index != -1) {
- org = URI.create(attributes.getValue(index));
- }
- index = attributes.getIndex("name");
- if (index != -1) {
- name = attributes.getValue(index);
- }
+ org = new LinkImpl(attributes.getValue(attributes.getIndex("name")), ORG_XML, URI
+ .create(attributes.getValue(attributes.getIndex("href"))));
} else if (qName.equals("Link")) {
int typeIndex = attributes.getIndex("type");
if (typeIndex != -1) {
if (attributes.getValue(typeIndex).equals(VDC_XML)) {
- int index = attributes.getIndex("href");
- if (index != -1) {
- vdcs.add(URI.create(attributes.getValue(index)));
- }
+ putLink(vdcs, attributes);
} else if (attributes.getValue(typeIndex).equals(CATALOG_XML)) {
- int index = attributes.getIndex("href");
- if (index != -1) {
- catalog = URI.create(attributes.getValue(index));
- }
+ catalog = newLink(attributes);
} else if (attributes.getValue(typeIndex).equals(TASKSLIST_XML)) {
- int index = attributes.getIndex("href");
- if (index != -1) {
- tasksLists.add(URI.create(attributes.getValue(index)));
- }
+ putLink(tasksLists, attributes);
}
}
}
}
+
}
diff --git a/vcloudx/core/src/main/java/org/jclouds/vcloudx/xml/OrgListToOrgUriHandler.java b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgListHandler.java
similarity index 76%
rename from vcloudx/core/src/main/java/org/jclouds/vcloudx/xml/OrgListToOrgUriHandler.java
rename to vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgListHandler.java
index d3dbabfafa..0490580202 100755
--- a/vcloudx/core/src/main/java/org/jclouds/vcloudx/xml/OrgListToOrgUriHandler.java
+++ b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgListHandler.java
@@ -21,22 +21,28 @@
* under the License.
* ====================================================================
*/
-package org.jclouds.vcloudx.xml;
+package org.jclouds.vcloud.xml;
+
+import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
+import static org.jclouds.vcloud.util.Utils.putLink;
+
+import java.util.Map;
-import java.net.URI;
-import static org.jclouds.vcloudx.VCloudXMediaType.*;
import org.jclouds.http.functions.ParseSax;
+import org.jclouds.vcloud.domain.Link;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
+import com.google.common.collect.Maps;
+
/**
* @author Adrian Cole
*/
-public class OrgListToOrgUriHandler extends ParseSax.HandlerWithResult {
+public class OrgListHandler extends ParseSax.HandlerWithResult