diff --git a/allcompute/pom.xml b/allcompute/pom.xml
index 095ac3af14..015cd60c82 100644
--- a/allcompute/pom.xml
+++ b/allcompute/pom.xml
@@ -68,11 +68,6 @@
cloudservers
${project.version}
-
- org.apache.jclouds.api
- vcloud
- ${project.version}
-
org.apache.jclouds.provider
gogrid
diff --git a/apis/byon/README.txt b/apis/byon/README.txt
index 3b7a9c467e..0c53c7a549 100644
--- a/apis/byon/README.txt
+++ b/apis/byon/README.txt
@@ -57,7 +57,7 @@ Here are the properties:
* group - primary group of the machine. ex. hadoop
* tags - optional; list of arbitrary tags.
* note this list is not yet in jclouds NodeMetadata
- * username - primary login user. ex. ubuntu, vcloud, toor, root
+ * username - primary login user. ex. ubuntu, toor, root
* sudo_password - optional; when a script is run with the "runAsRoot" option true, yet the
username is not root, a sudo command is invoked. If sudo_password
is set, the contents will be passed to sudo -S.
diff --git a/apis/pom.xml b/apis/pom.xml
index 81792936fd..ddd1764143 100644
--- a/apis/pom.xml
+++ b/apis/pom.xml
@@ -36,7 +36,6 @@
s3
ec2
sqs
- vcloud
elasticstack
atmos
swift
diff --git a/apis/vcloud/README.txt b/apis/vcloud/README.txt
deleted file mode 100644
index b00a7affa2..0000000000
--- a/apis/vcloud/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# The jclouds API for VMware vCloud (http://www.vmware.com/products/vcloud/).
-#
-# TODO: Implementation status.
-# TODO: Supported features.
-# TODO: Usage example.
diff --git a/apis/vcloud/pom.xml b/apis/vcloud/pom.xml
deleted file mode 100644
index 3c9a1f12f5..0000000000
--- a/apis/vcloud/pom.xml
+++ /dev/null
@@ -1,128 +0,0 @@
-
-
-
- 4.0.0
-
- org.apache.jclouds
- jclouds-project
- 2.0.0-SNAPSHOT
- ../../project/pom.xml
-
- org.apache.jclouds.api
- vcloud
- jclouds vcloud api
- jclouds components to access an implementation of VMWare vCloud
- bundle
-
-
- FIXME_ENDPOINT
- 1.0
-
- FIXME_IDENTITY
- FIXME_CREDENTIAL
-
- org.jclouds.vcloud*;version="${project.version}"
-
- org.jclouds.compute.internal;version="${project.version}",
- org.jclouds.rest.internal;version="${project.version}",
- org.jclouds*;version="${project.version}",
- *
-
-
-
-
-
- com.jamesmurty.utils
- java-xmlbuilder
- 0.4
-
-
- org.apache.jclouds
- jclouds-core
- ${project.version}
-
-
- org.apache.jclouds
- jclouds-core
- ${project.version}
- test-jar
- test
-
-
- org.apache.jclouds
- jclouds-compute
- ${project.version}
-
-
- org.apache.jclouds
- jclouds-compute
- ${project.version}
- test-jar
- test
-
-
- org.apache.jclouds.driver
- jclouds-sshj
- ${project.version}
- test
-
-
- org.apache.jclouds.driver
- jclouds-log4j
- ${project.version}
- test
-
-
-
-
-
- live
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- integration
- integration-test
-
- test
-
-
-
- ${test.vcloud.endpoint}
- ${test.vcloud.api-version}
- ${test.vcloud.build-version}
- ${test.vcloud.identity}
- ${test.vcloud.credential}
- ${test.vcloud.template}
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/TaskInErrorStateException.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/TaskInErrorStateException.java
deleted file mode 100644
index fb54599068..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/TaskInErrorStateException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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 org.jclouds.vcloud.domain.Task;
-
-public class TaskInErrorStateException extends RuntimeException {
-
- private final Task task;
-
- public TaskInErrorStateException(Task task) {
- super("error on task: " + task + " error: " + task.getError());
- this.task = task;
- }
-
- public Task getTask() {
- return task;
- }
-
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/TaskStillRunningException.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/TaskStillRunningException.java
deleted file mode 100644
index 64eafbed76..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/TaskStillRunningException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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 org.jclouds.vcloud.domain.Task;
-
-public class TaskStillRunningException extends RuntimeException {
-
- private final Task task;
-
- public TaskStillRunningException(Task task) {
- super("task still running: " + task);
- this.task = task;
- }
-
- public Task getTask() {
- return task;
- }
-
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudApi.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudApi.java
deleted file mode 100644
index 1c3b46c92c..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudApi.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.io.Closeable;
-
-import org.jclouds.rest.annotations.Delegate;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.vcloud.features.CatalogApi;
-import org.jclouds.vcloud.features.NetworkApi;
-import org.jclouds.vcloud.features.OrgApi;
-import org.jclouds.vcloud.features.TaskApi;
-import org.jclouds.vcloud.features.VAppApi;
-import org.jclouds.vcloud.features.VAppTemplateApi;
-import org.jclouds.vcloud.features.VDCApi;
-import org.jclouds.vcloud.features.VmApi;
-import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
-
-/**
- * Provides access to VCloud resources via their REST API.
- *
- *
- * @see
- */
-@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
-public interface VCloudApi extends Closeable {
- /**
- * Provides asynchronous access to VApp Template features.
- *
- */
- @Delegate
- VAppTemplateApi getVAppTemplateApi();
-
- /**
- * Provides synchronous access to VApp features.
- */
- @Delegate
- VAppApi getVAppApi();
-
- /**
- * Provides synchronous access to Vm features.
- */
- @Delegate
- VmApi getVmApi();
-
- /**
- * Provides synchronous access to Catalog features.
- */
- @Delegate
- CatalogApi getCatalogApi();
-
- /**
- * Provides synchronous access to Task features.
- */
- @Delegate
- TaskApi getTaskApi();
-
- /**
- * Provides synchronous access to VDC features.
- */
- @Delegate
- VDCApi getVDCApi();
-
- /**
- * Provides synchronous access to Network features.
- */
- @Delegate
- NetworkApi getNetworkApi();
-
- /**
- * Provides synchronous access to Org features.
- */
- @Delegate
- OrgApi getOrgApi();
-
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.java
deleted file mode 100644
index 4c88d8aa0b..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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 static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
-import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
-import static org.jclouds.reflect.Reflection2.typeToken;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_FENCEMODE;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_VERSION_SCHEMA;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
-
-import java.net.URI;
-import java.util.Properties;
-
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.rest.internal.BaseHttpApiMetadata;
-import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule;
-import org.jclouds.vcloud.config.VCloudHttpApiModule;
-import org.jclouds.vcloud.domain.network.FenceMode;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-
-/**
- * Implementation of {@link ApiMetadata} for VCloud 1.0 API
- */
-public class VCloudApiMetadata extends BaseHttpApiMetadata {
-
-
- @Override
- public Builder toBuilder() {
- return new Builder().fromApiMetadata(this);
- }
-
- public VCloudApiMetadata() {
- this(new Builder());
- }
-
- protected VCloudApiMetadata(Builder builder) {
- super(builder);
- }
-
- public static Properties defaultProperties() {
- Properties properties = BaseHttpApiMetadata.defaultProperties();
- properties.setProperty(PROPERTY_VCLOUD_VERSION_SCHEMA, "1");
- properties.setProperty(PROPERTY_VCLOUD_XML_NAMESPACE,
- String.format("http://www.vmware.com/vcloud/v${%s}", PROPERTY_VCLOUD_VERSION_SCHEMA));
- properties.setProperty(PROPERTY_SESSION_INTERVAL, 8 * 60 + "");
- properties.setProperty(PROPERTY_VCLOUD_XML_SCHEMA, "http://vcloud.safesecureweb.com/ns/vcloud.xsd");
- properties.setProperty("jclouds.dns_name_length_min", "1");
- properties.setProperty("jclouds.dns_name_length_max", "80");
- properties.setProperty(PROPERTY_VCLOUD_DEFAULT_FENCEMODE, FenceMode.BRIDGED.toString());
- // TODO integrate this with the {@link ComputeTimeouts} instead of having
- // a single timeout for
- // everything.
- properties.setProperty(PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED, 1200l * 1000l + "");
- properties.setProperty(PROPERTY_SESSION_INTERVAL, 300 + "");
- // CIM ostype does not include version info
- properties.setProperty(TEMPLATE, "osFamily=UBUNTU,os64Bit=true");
- return properties;
- }
-
- public static class Builder extends BaseHttpApiMetadata.Builder {
- protected Builder() {
- id("vcloud")
- .name("VCloud 1.0 API")
- .identityName("User at Organization (user@org)")
- .credentialName("Password")
- .documentation(URI.create("http://www.vmware.com/support/pubs/vcd_pubs.html"))
- .version("1.0")
- .defaultProperties(VCloudApiMetadata.defaultProperties())
- .view(typeToken(ComputeServiceContext.class))
- .defaultModules(ImmutableSet.>of(VCloudHttpApiModule.class, VCloudComputeServiceContextModule.class));
- }
-
- @Override
- public VCloudApiMetadata build() {
- return new VCloudApiMetadata(this);
- }
-
- @Override
- protected Builder self() {
- return this;
- }
- }
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudMediaType.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudMediaType.java
deleted file mode 100644
index f8f5ed4f42..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudMediaType.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * 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 javax.ws.rs.core.MediaType;
-
-/**
- * Resource Types used in VCloud
- *
- * @see MediaType
- */
-public final class VCloudMediaType {
- /**
- * "application/vnd.vmware.vcloud.error+xml"
- */
- public static final String ERROR_XML = "application/vnd.vmware.vcloud.error+xml";
-
- /**
- * "application/vnd.vmware.vcloud.error+xml"
- */
- public static final MediaType ERROR_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.error+xml");
-
- /**
- * "application/vnd.vmware.vcloud.vcloud+xml"
- */
- public static final String VCLOUD_XML = "application/vnd.vmware.vcloud.vcloud+xml";
-
- /**
- * "application/vnd.vmware.vcloud.vcloud+xml"
- */
- public static final MediaType VCLOUD_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.vcloud+xml");
- /**
- * "application/vnd.vmware.vcloud.orgList+xml"
- */
- public static final String ORGLIST_XML = "application/vnd.vmware.vcloud.orgList+xml";
-
- /**
- * "application/vnd.vmware.vcloud.orgList+xml"
- */
- public static final MediaType ORGLIST_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.orgList+xml");
- /**
- * "application/vnd.vmware.vcloud.org+xml"
- */
- public static final String ORG_XML = "application/vnd.vmware.vcloud.org+xml";
- /**
- * "application/vnd.vmware.vcloud.org+xml"
- */
- public static final MediaType ORG_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.org+xml");
-
- /**
- * "application/vnd.vmware.vcloud.vdc+xml"
- */
- public static final String VDC_XML = "application/vnd.vmware.vcloud.vdc+xml";
- /**
- * "application/vnd.vmware.vcloud.vdc+xml"
- */
- public static final MediaType VDC_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.vdc+xml");
-
- /**
- * "application/vnd.vmware.vcloud.catalog+xml"
- */
- public static final String CATALOG_XML = "application/vnd.vmware.vcloud.catalog+xml";
- /**
- * "application/vnd.vmware.vcloud.catalog+xml"
- */
- public static final MediaType CATALOG_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.catalog+xml");
-
- /**
- * "application/vnd.vmware.vcloud.tasksList+xml"
- */
- public static final String TASKSLIST_XML = "application/vnd.vmware.vcloud.tasksList+xml";
- /**
- * "application/vnd.vmware.vcloud.tasksList+xml"
- */
- public static final MediaType TASKSLIST_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.tasksList+xml");
-
- /**
- * "application/vnd.vmware.vcloud.catalogItem+xml"
- */
- public static final String CATALOGITEM_XML = "application/vnd.vmware.vcloud.catalogItem+xml";
- /**
- * "application/vnd.vmware.vcloud.catalogItem+xml"
- */
- public static final MediaType CATALOGITEM_XML_TYPE = new MediaType("application",
- "vnd.vmware.vcloud.catalogItem+xml");
- /**
- * "application/vnd.vmware.vcloud.networkConnectionSection+xml"
- */
- public static final String NETWORKCONNECTIONSECTION_XML = "application/vnd.vmware.vcloud.networkConnectionSection+xml";
- /**
- * "application/vnd.vmware.vcloud.networkConnectionSection+xml"
- */
- public static final MediaType NETWORKCONNECTIONSECTION_XML_TYPE = new MediaType("application",
- "vnd.vmware.vcloud.networkConnectionSection+xml");
- /**
- * "application/vnd.vmware.vcloud.virtualHardwareSection+xml"
- */
- public static final String VIRTUALHARDWARESECTION_XML = "application/vnd.vmware.vcloud.virtualHardwareSection+xml";
- /**
- * "application/vnd.vmware.vcloud.virtualHardwareSection+xml"
- */
- public static final MediaType VIRTUALHARDWARESECTION_XML_TYPE = new MediaType("application",
- "vnd.vmware.vcloud.virtualHardwareSection+xml");
- /**
- * "application/vnd.vmware.vcloud.guestCustomizationSection+xml"
- */
- public static final String GUESTCUSTOMIZATIONSECTION_XML = "application/vnd.vmware.vcloud.guestCustomizationSection+xml";
- /**
- * "application/vnd.vmware.vcloud.guestCustomizationSection+xml"
- */
- public static final MediaType GUESTCUSTOMIZATIONSECTION_XML_TYPE = new MediaType("application",
- "vnd.vmware.vcloud.guestCustomizationSection+xml");
-
- /**
- * "application/vnd.vmware.vcloud.networkSection+xml"
- */
- public static final String NETWORKSECTION_XML = "application/vnd.vmware.vcloud.networkSection+xml";
- /**
- * "application/vnd.vmware.vcloud.networkSection+xml"
- */
- public static final MediaType NETWORKSECTION_XML_TYPE = new MediaType("application",
- "vnd.vmware.vcloud.networkSection+xml");
-
- /**
- * "application/vnd.vmware.vcloud.task+xml"
- */
- public static final String TASK_XML = "application/vnd.vmware.vcloud.task+xml";
- /**
- * "application/vnd.vmware.vcloud.task+xml"
- */
- public static final MediaType TASK_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.task+xml");
-
- /**
- * "application/vnd.vmware.vcloud.undeployVAppParams+xml"
- */
- public static final String UNDEPLOYVAPPPARAMS_XML = "application/vnd.vmware.vcloud.undeployVAppParams+xml";
- /**
- * "application/vnd.vmware.vcloud.undeployVAppParams+xml"
- */
- public static final MediaType UNDEPLOYVAPPPARAMS_XML_TYPE = new MediaType("application",
- "vnd.vmware.vcloud.undeployVAppParams+xml");
-
- /**
- * "application/vnd.vmware.vcloud.deployVAppParams+xml"
- */
- public static final String DEPLOYVAPPPARAMS_XML = "application/vnd.vmware.vcloud.deployVAppParams+xml";
- /**
- * "application/vnd.vmware.vcloud.deployVAppParams+xml"
- */
- public static final MediaType DEPLOYVAPPPARAMS_XML_TYPE = new MediaType("application",
- "vnd.vmware.vcloud.deployVAppParams+xml");
-
- /**
- * "application/vnd.vmware.vcloud.vApp+xml"
- */
- public static final String VAPP_XML = "application/vnd.vmware.vcloud.vApp+xml";
- /**
- * "application/vnd.vmware.vcloud.vApp+xml"
- */
- public static final MediaType VAPP_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.vApp+xml");
-
- /**
- * "application/vnd.vmware.vcloud.vm+xml"
- */
- public static final String VM_XML = "application/vnd.vmware.vcloud.vm+xml";
- /**
- * "application/vnd.vmware.vcloud.vm+xml"
- */
- public static final MediaType VM_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.vm+xml");
-
- /**
- * "application/vnd.vmware.vcloud.vAppTemplate+xml"
- */
- public static final String VAPPTEMPLATE_XML = "application/vnd.vmware.vcloud.vAppTemplate+xml";
- /**
- * "application/vnd.vmware.vcloud.vAppTemplate+xml"
- */
- public static final MediaType VAPPTEMPLATE_XML_TYPE = new MediaType("application",
- "vnd.vmware.vcloud.vAppTemplate+xml");
- /**
- * "application/vnd.vmware.vcloud.network+xml"
- */
- public static final String NETWORK_XML = "application/vnd.vmware.vcloud.network+xml";
- /**
- * "application/vnd.vmware.vcloud.network+xml"
- */
- public static final MediaType NETWORK_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.network+xml");
-
- /**
- * "application/vnd.vmware.vcloud.rasdItem+xml"
- */
- public static final String RASDITEM_XML = "application/vnd.vmware.vcloud.rasdItem+xml";
- /**
- * "application/vnd.vmware.vcloud.rasdItem+xml"
- */
- public static final MediaType RASDITEM_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.rasdItem+xml");
-
- private VCloudMediaType() {
- throw new AssertionError("intentionally unimplemented");
- }
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudResponseException.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudResponseException.java
deleted file mode 100644
index ea8d7f83d9..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudResponseException.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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 org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.vcloud.domain.VCloudError;
-
-/**
- * Encapsulates an VCloud Error.
- */
-public class VCloudResponseException extends HttpResponseException {
-
- private org.jclouds.vcloud.domain.VCloudError error;
-
- public VCloudResponseException(HttpCommand command, HttpResponse response, VCloudError error) {
- super(String.format("request %s failed with code %s, error: %s", command.getCurrentRequest().getRequestLine(), response
- .getStatusCode(), error.toString()), command, response);
- this.setError(error);
-
- }
-
- public VCloudResponseException(HttpCommand command, HttpResponse response, VCloudError error, Throwable cause) {
- super(String.format("request %1$s failed with error: %2$s", command.getCurrentRequest().getRequestLine(), error
- .toString()), command, response, cause);
- this.setError(error);
-
- }
-
- public VCloudResponseException(String message, HttpCommand command, HttpResponse response, VCloudError error) {
- super(message, command, response);
- this.setError(error);
-
- }
-
- public VCloudResponseException(String message, HttpCommand command, HttpResponse response, VCloudError error,
- Throwable cause) {
- super(message, command, response, cause);
- this.setError(error);
-
- }
-
- public void setError(VCloudError error) {
- this.error = error;
- }
-
- public VCloudError getError() {
- return error;
- }
-
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudToken.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudToken.java
deleted file mode 100644
index 2aca7bd8c2..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudToken.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- * A VCloud Session Token
- */
-@Retention(value = RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
-@Qualifier
-public @interface VCloudToken {
-
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsApi.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsApi.java
deleted file mode 100644
index 01ec0459cf..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsApi.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.io.Closeable;
-import java.net.URI;
-import java.util.SortedMap;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-
-import org.jclouds.rest.annotations.XMLResponseParser;
-import org.jclouds.vcloud.xml.SupportedVersionsHandler;
-
-public interface VCloudVersionsApi extends Closeable {
-
- @GET
- @XMLResponseParser(SupportedVersionsHandler.class)
- @Path("/versions")
- SortedMap getSupportedVersions();
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCPUCountToXmlPayload.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCPUCountToXmlPayload.java
deleted file mode 100644
index fc757a1b84..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCPUCountToXmlPayload.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
-
-import java.util.Properties;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.cim.ResourceAllocationSettingData.ResourceType;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.binders.BindToStringPayload;
-
-import com.google.common.base.Throwables;
-import com.google.inject.Inject;
-import com.jamesmurty.utils.XMLBuilder;
-
-@Singleton
-public class BindCPUCountToXmlPayload extends BindToStringPayload {
- protected final String ns;
- protected final String schema;
-
- @Inject
- public BindCPUCountToXmlPayload(BindToStringPayload stringBinder, @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns,
- @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
- this.ns = ns;
- this.schema = schema;
- }
-
- private static final String RESOURCE_ALLOCATION_NS = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData";
-
- @Override
- public R bindToRequest(R request, Object payload) {
- checkArgument(checkNotNull(payload, "cpuCount") instanceof Integer, "this binder is only valid for Integers!");
- Integer cpuCount = Integer.class.cast(payload);
- XMLBuilder cpuItem;
- try {
- cpuItem = XMLBuilder.create("Item").a("xmlns", ns).a("xmlns:rasd", RESOURCE_ALLOCATION_NS);
- cpuItem.e("rasd:AllocationUnits").t("hertz * 10^6");
- cpuItem.e("rasd:Description").t("Number of Virtual CPUs");
- cpuItem.e("rasd:ElementName").t(cpuCount.toString() + " virtual CPU(s)");
- cpuItem.e("rasd:InstanceID").t("4");
- cpuItem.e("rasd:ResourceType").t(ResourceType.PROCESSOR.value());
- cpuItem.e("rasd:VirtualQuantity").t(cpuCount.toString());
- cpuItem.e("rasd:Weight").t("0");
- Properties outputProperties = new Properties();
- outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
- request = super.bindToRequest(request, cpuItem.asString(outputProperties));
- } catch (Exception e) {
- Throwables.propagate(e);
- }
- return request;
- }
-
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCaptureVAppParamsToXmlPayload.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCaptureVAppParamsToXmlPayload.java
deleted file mode 100644
index 8a556be3fd..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCaptureVAppParamsToXmlPayload.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
-
-import java.util.Map;
-import java.util.Properties;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToStringPayload;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.vcloud.VCloudMediaType;
-import org.jclouds.vcloud.options.CaptureVAppOptions;
-
-import com.google.inject.Inject;
-import com.jamesmurty.utils.XMLBuilder;
-
-@Singleton
-public class BindCaptureVAppParamsToXmlPayload implements MapBinder {
-
- protected final String ns;
- protected final String schema;
- private final BindToStringPayload stringBinder;
-
- @Inject
- public BindCaptureVAppParamsToXmlPayload(BindToStringPayload stringBinder,
- @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
- this.ns = ns;
- this.schema = schema;
- this.stringBinder = stringBinder;
- }
-
- @Override
- public R bindToRequest(R request, Map postParams) {
- checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
- "this binder is only valid for GeneratedHttpRequests!");
- GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
- String templateName = checkNotNull(postParams.remove("templateName"), "templateName").toString();
- String vApp = checkNotNull(postParams.remove("vApp"), "vApp").toString();
-
- CaptureVAppOptions options = findOptionsInArgsOrNull(gRequest);
- if (options == null) {
- options = new CaptureVAppOptions();
- }
- try {
- return stringBinder.bindToRequest(request, generateXml(templateName, vApp, options));
- } catch (ParserConfigurationException e) {
- throw new RuntimeException(e);
- } catch (FactoryConfigurationError e) {
- throw new RuntimeException(e);
- } catch (TransformerException e) {
- throw new RuntimeException(e);
- }
-
- }
-
- protected String generateXml(String templateName, String vApp, CaptureVAppOptions options)
- throws ParserConfigurationException, FactoryConfigurationError, TransformerException {
- XMLBuilder rootBuilder = buildRoot(templateName);
- if (options.getDescription() != null)
- rootBuilder.e("Description").text(options.getDescription());
- rootBuilder.e("Source").a("href", vApp).a("type", VCloudMediaType.VAPP_XML);
- Properties outputProperties = new Properties();
- outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
- return rootBuilder.asString(outputProperties);
- }
-
- protected XMLBuilder buildRoot(String name) throws ParserConfigurationException, FactoryConfigurationError {
- XMLBuilder rootBuilder = XMLBuilder.create("CaptureVAppParams").a("name", name).a("xmlns", ns)
- .a("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance").a("xsi:schemaLocation", ns + " " + schema);
- return rootBuilder;
- }
-
- protected CaptureVAppOptions findOptionsInArgsOrNull(GeneratedHttpRequest gRequest) {
- for (Object arg : gRequest.getInvocation().getArgs()) {
- if (arg instanceof CaptureVAppOptions) {
- return (CaptureVAppOptions) arg;
- } else if (arg instanceof CaptureVAppOptions[]) {
- CaptureVAppOptions[] options = (CaptureVAppOptions[]) arg;
- return (options.length > 0) ? options[0] : null;
- }
- }
- return null;
- }
-
- @Override
- public R bindToRequest(R request, Object input) {
- throw new IllegalStateException("CaptureVAppParams is needs parameters");
- }
-
- protected String ifNullDefaultTo(String value, String defaultValue) {
- return value != null ? value : checkNotNull(defaultValue, "defaultValue");
- }
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayload.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayload.java
deleted file mode 100644
index 98c4e3a187..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayload.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToStringPayload;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.vcloud.options.CatalogItemOptions;
-
-import com.google.inject.Inject;
-import com.jamesmurty.utils.XMLBuilder;
-
-@Singleton
-public class BindCatalogItemToXmlPayload implements MapBinder {
-
- protected final String ns;
- protected final String schema;
- private final BindToStringPayload stringBinder;
-
- @Inject
- public BindCatalogItemToXmlPayload(BindToStringPayload stringBinder,
- @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
- this.ns = ns;
- this.schema = schema;
- this.stringBinder = stringBinder;
- }
-
- @Override
- public R bindToRequest(R request, Map postParams) {
- checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
- "this binder is only valid for GeneratedHttpRequests!");
- GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
- String name = checkNotNull(postParams.get("name"), "name").toString();
- URI entity = URI.create(checkNotNull(postParams.get("Entity"), "Entity").toString());
-
- CatalogItemOptions options = findOptionsInArgsOrNew(gRequest);
- try {
- return stringBinder.bindToRequest(request, generateXml(name, entity, options));
- } catch (ParserConfigurationException e) {
- throw new RuntimeException(e);
- } catch (FactoryConfigurationError e) {
- throw new RuntimeException(e);
- } catch (TransformerException e) {
- throw new RuntimeException(e);
- }
-
- }
-
- protected String generateXml(String templateName, URI entity, CatalogItemOptions options)
- throws ParserConfigurationException, FactoryConfigurationError, TransformerException {
- XMLBuilder rootBuilder = buildRoot(templateName);
- if (options.getDescription() != null)
- rootBuilder.e("Description").t(options.getDescription());
- rootBuilder.e("Entity").a("href", entity.toASCIIString());
- for (Entry entry : options.getProperties().entrySet()) {
- rootBuilder.e("Property").a("key", entry.getKey()).t(entry.getValue());
- }
- Properties outputProperties = new Properties();
- outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
- return rootBuilder.asString(outputProperties);
- }
-
- protected XMLBuilder buildRoot(String name) throws ParserConfigurationException, FactoryConfigurationError {
- XMLBuilder rootBuilder = XMLBuilder.create("CatalogItem").a("name", name).a("xmlns", ns).a("xmlns:xsi",
- "http://www.w3.org/2001/XMLSchema-instance").a("xsi:schemaLocation", ns + " " + schema);
- return rootBuilder;
- }
-
- protected CatalogItemOptions findOptionsInArgsOrNew(GeneratedHttpRequest gRequest) {
- for (Object arg : gRequest.getInvocation().getArgs()) {
- if (arg instanceof CatalogItemOptions) {
- return CatalogItemOptions.class.cast(arg);
- } else if (arg.getClass().isArray()) {
- Object[] array = (Object[]) arg;
- if (array.length > 0 && array[0] instanceof CatalogItemOptions)
- return CatalogItemOptions.class.cast(array[0]);
- }
- }
- return new CatalogItemOptions();
- }
-
- @Override
- public R bindToRequest(R request, Object input) {
- throw new IllegalStateException("CatalogItem is needs parameters");
- }
-
- protected String ifNullDefaultTo(String value, String defaultValue) {
- return value != null ? value : checkNotNull(defaultValue, "defaultValue");
- }
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCloneParamsToXmlPayload.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCloneParamsToXmlPayload.java
deleted file mode 100644
index 71617bc268..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCloneParamsToXmlPayload.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
-
-import java.util.Map;
-import java.util.Properties;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToStringPayload;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.vcloud.options.CloneOptions;
-
-import com.google.common.base.Throwables;
-import com.google.inject.Inject;
-import com.jamesmurty.utils.XMLBuilder;
-
-@Singleton
-public abstract class BindCloneParamsToXmlPayload implements MapBinder {
-
- protected final String ns;
- protected final String schema;
- private final BindToStringPayload stringBinder;
-
- protected abstract String getRootElement();
- protected abstract String getSourceMediaType();
- protected abstract Class getOptionClass();
-
- @Inject
- public BindCloneParamsToXmlPayload(BindToStringPayload stringBinder,
- @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
- this.ns = ns;
- this.schema = schema;
- this.stringBinder = stringBinder;
- }
-
- @Override
- public R bindToRequest(R request, Map postParams) {
- checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
- "this binder is only valid for GeneratedHttpRequests!");
- GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
- String name = checkNotNull(postParams.get("name"), "name").toString();
- String source = checkNotNull(postParams.get("Source"), "Source").toString();
- boolean isSourceDelete = Boolean.parseBoolean((String) postParams.get("IsSourceDelete"));
-
- O options = findOptionsInArgsOrNew(gRequest);
- return stringBinder.bindToRequest(request, generateXml(name, source, isSourceDelete, options));
- }
-
- protected String generateXml(String name, String source, boolean isSourceDelete, O options) {
- XMLBuilder rootBuilder = buildRoot(name, options);
- addElementsUnderRoot(rootBuilder, source, options, isSourceDelete);
- Properties outputProperties = new Properties();
- outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
- try {
- return rootBuilder.asString(outputProperties);
- } catch (Exception e) {
- throw Throwables.propagate(e);
- }
- }
-
- protected void addElementsUnderRoot(XMLBuilder rootBuilder, String source, O options, boolean isSourceDelete) {
- if (options.getDescription() != null)
- rootBuilder.e("Description").text(options.getDescription());
- rootBuilder.e("Source").a("href", source).a("type", getSourceMediaType());
- if (isSourceDelete)
- rootBuilder.e("IsSourceDelete").t("true");
- }
-
- protected XMLBuilder buildRoot(String name, O options) {
- try {
- return XMLBuilder.create(getRootElement()).a("xmlns", ns).a("xmlns:xsi",
- "http://www.w3.org/2001/XMLSchema-instance").a("xsi:schemaLocation", ns + " " + schema).a("name",
- name);
- } catch (Exception e) {
- throw Throwables.propagate(e);
- }
- }
-
- @SuppressWarnings("unchecked")
- protected O findOptionsInArgsOrNew(GeneratedHttpRequest gRequest) {
- for (Object arg : gRequest.getInvocation().getArgs()) {
- if (getOptionClass().isInstance(arg)) {
- return (O) arg;
- } else if (arg.getClass().isArray()) {
- Object[] array = (Object[]) arg;
- if (array.length > 0 && getOptionClass().isInstance(array[0]))
- return (O) array[0];
- }
- }
- try {
- return getOptionClass().newInstance();
- } catch (Exception e) {
- throw Throwables.propagate(e);
- }
- }
-
- @Override
- public R bindToRequest(R request, Object input) {
- throw new IllegalStateException("CloneParams is needs parameters");
- }
-
- protected String ifNullDefaultTo(String value, String defaultValue) {
- return value != null ? value : checkNotNull(defaultValue, "defaultValue");
- }
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayload.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayload.java
deleted file mode 100644
index 50c3b83112..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayload.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.binders;
-
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.rest.binders.BindToStringPayload;
-import org.jclouds.vcloud.VCloudMediaType;
-import org.jclouds.vcloud.options.CloneVAppOptions;
-
-import com.google.inject.Inject;
-import com.jamesmurty.utils.XMLBuilder;
-
-@Singleton
-public class BindCloneVAppParamsToXmlPayload extends BindCloneParamsToXmlPayload {
-
- @Inject
- public BindCloneVAppParamsToXmlPayload(BindToStringPayload stringBinder,
- @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
- super(stringBinder, ns, schema);
- }
-
- @Override
- protected Class getOptionClass() {
- return CloneVAppOptions.class;
- }
-
- @Override
- protected String getRootElement() {
- return "CloneVAppParams";
- }
-
- @Override
- protected String getSourceMediaType() {
- return VCloudMediaType.VAPP_XML;
- }
-
- protected XMLBuilder buildRoot(String name, CloneVAppOptions options) {
- return super.buildRoot(name, options).a("deploy", options.isDeploy() + "").a("powerOn", options.isPowerOn() + "");
- }
-
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayload.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayload.java
deleted file mode 100644
index 2323c94427..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayload.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.binders;
-
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.rest.binders.BindToStringPayload;
-import org.jclouds.vcloud.VCloudMediaType;
-import org.jclouds.vcloud.options.CloneVAppTemplateOptions;
-
-import com.google.inject.Inject;
-
-@Singleton
-public class BindCloneVAppTemplateParamsToXmlPayload extends BindCloneParamsToXmlPayload {
-
- @Inject
- public BindCloneVAppTemplateParamsToXmlPayload(BindToStringPayload stringBinder,
- @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
- super(stringBinder, schema, schema);
- }
-
- @Override
- protected Class getOptionClass() {
- return CloneVAppTemplateOptions.class;
- }
-
- @Override
- protected String getRootElement() {
- return "CloneVAppTemplateParams";
- }
-
- @Override
- protected String getSourceMediaType() {
- return VCloudMediaType.VAPPTEMPLATE_XML;
- }
-
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayload.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayload.java
deleted file mode 100644
index d376222a1e..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayload.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.binders;
-
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.rest.binders.BindToStringPayload;
-
-import com.google.inject.Inject;
-
-@Singleton
-public class BindDeployVAppParamsToXmlPayload extends BindParamsToXmlPayload {
-
- @Inject
- public BindDeployVAppParamsToXmlPayload(BindToStringPayload stringBinder,
- @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns) {
- super("DeployVAppParams", stringBinder, ns);
- }
-
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindGuestCustomizationSectionToXmlPayload.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindGuestCustomizationSectionToXmlPayload.java
deleted file mode 100644
index 3ba51d1d3e..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindGuestCustomizationSectionToXmlPayload.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
-
-import java.util.Properties;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.logging.Logger;
-import org.jclouds.rest.binders.BindToStringPayload;
-import org.jclouds.vcloud.domain.GuestCustomizationSection;
-
-import com.google.common.base.Throwables;
-import com.google.inject.Inject;
-import com.jamesmurty.utils.XMLBuilder;
-
-@Singleton
-public class BindGuestCustomizationSectionToXmlPayload extends BindToStringPayload {
- @Resource
- protected Logger logger = Logger.NULL;
-
- protected final String ns;
- protected final String schema;
-
- @Inject
- public BindGuestCustomizationSectionToXmlPayload(BindToStringPayload stringBinder,
- @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
- this.ns = ns;
- this.schema = schema;
- }
- @Override
- public R bindToRequest(R request, Object payload) {
- checkArgument(checkNotNull(payload, "GuestCustomizationSection") instanceof GuestCustomizationSection,
- "this binder is only valid for GuestCustomizationSection!");
- GuestCustomizationSection guest = GuestCustomizationSection.class.cast(payload);
- XMLBuilder guestCustomizationSection;
- try {
- guestCustomizationSection = XMLBuilder.create("GuestCustomizationSection").a("xmlns", ns).a("xmlns:ovf",
- "http://schemas.dmtf.org/ovf/envelope/1").a("type", guest.getType()).a("href",
- guest.getHref().toASCIIString()).a("ovf:required", "false");
- guestCustomizationSection.e("ovf:Info").t(guest.getInfo());
-
- if (guest.isEnabled() != null)
- guestCustomizationSection.e("Enabled").t(guest.isEnabled().toString());
- if (guest.shouldChangeSid() != null)
- guestCustomizationSection.e("ChangeSid").t(guest.shouldChangeSid().toString());
- if (guest.getVirtualMachineId() != null)
- guestCustomizationSection.e("VirtualMachineId").t(guest.getVirtualMachineId().toString());
- if (guest.isJoinDomainEnabled() != null)
- guestCustomizationSection.e("JoinDomainEnabled").t(guest.isJoinDomainEnabled().toString());
- if (guest.shouldUseOrgSettings() != null)
- guestCustomizationSection.e("UseOrgSettings").t(guest.shouldUseOrgSettings().toString());
- if (guest.getDomainName() != null)
- guestCustomizationSection.e("DomainName").t(guest.getDomainName().toString());
- if (guest.getDomainUserName() != null)
- guestCustomizationSection.e("DomainUserName").t(guest.getDomainUserName().toString());
- if (guest.getDomainUserPassword() != null)
- guestCustomizationSection.e("DomainUserPassword").t(guest.getDomainUserPassword().toString());
- if (guest.isAdminPasswordEnabled() != null)
- guestCustomizationSection.e("AdminPasswordEnabled").t(guest.isAdminPasswordEnabled().toString());
- if (guest.isAdminPasswordAuto() != null)
- guestCustomizationSection.e("AdminPasswordAuto").t(guest.isAdminPasswordAuto().toString());
- // if (guest.getAdminPassword() != null)
- // guestCustomizationSection.e("AdminPassword").t(guest.getAdminPassword().toString());
- if (guest.isResetPasswordRequired() != null)
- guestCustomizationSection.e("ResetPasswordRequired").t(guest.isResetPasswordRequired().toString());
- if (guest.getCustomizationScript() != null)
- guestCustomizationSection.e("CustomizationScript").t(guest.getCustomizationScript());
- if (guest.getComputerName() != null)
- guestCustomizationSection.e("ComputerName").t(guest.getComputerName().toString());
- if (guest.getEdit() != null)
- guestCustomizationSection.e("Link").a("rel", "edit").a("type", guest.getType()).a("href",
- guest.getHref().toASCIIString());
-
- Properties outputProperties = new Properties();
- outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
- request = super.bindToRequest(request, guestCustomizationSection.asString(outputProperties));
- request.getPayload().getContentMetadata().setContentType(guest.getType());
- } catch (Exception e) {
- Throwables.propagate(e);
- }
- return request;
- }
-
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java
deleted file mode 100644
index 5576ca0432..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * 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.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.transform;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToStringPayload;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.vcloud.domain.ReferenceType;
-import org.jclouds.vcloud.domain.VAppTemplate;
-import org.jclouds.vcloud.domain.Vm;
-import org.jclouds.vcloud.domain.network.FenceMode;
-import org.jclouds.vcloud.domain.network.NetworkConfig;
-import org.jclouds.vcloud.endpoints.Network;
-import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableSet;
-import com.jamesmurty.utils.XMLBuilder;
-
-@Singleton
-public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder {
-
- protected final String ns;
- protected final String schema;
- protected final BindToStringPayload stringBinder;
- protected final Supplier defaultNetwork;
- protected final FenceMode defaultFenceMode;
- protected final LoadingCache templateCache;
- protected final Function defaultNetworkNameInTemplate;
-
- @Inject
- public BindInstantiateVAppTemplateParamsToXmlPayload(LoadingCache templateCache,
- @Network Function defaultNetworkNameInTemplate, BindToStringPayload stringBinder,
- @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema,
- @Network Supplier network, FenceMode fenceMode) {
- this.templateCache = templateCache;
- this.defaultNetworkNameInTemplate = defaultNetworkNameInTemplate;
- this.ns = ns;
- this.schema = schema;
- this.stringBinder = stringBinder;
- this.defaultNetwork = network;
- this.defaultFenceMode = fenceMode;
- }
-
- @Override
- public R bindToRequest(R request, Map postParams) {
- checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
- "this binder is only valid for GeneratedHttpRequests!");
- GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
- String name = checkNotNull(postParams.remove("name"), "name").toString();
- URI template = URI.create(checkNotNull(postParams.remove("template"), "template").toString());
-
- Set networkConfig = null;
-
- NetworkConfigDecorator networkConfigDecorator = new NetworkConfigDecorator(templateCache.getUnchecked(template),
- defaultNetwork.get().getHref(), defaultFenceMode, defaultNetworkNameInTemplate);
-
- InstantiateVAppTemplateOptions options = findOptionsInArgsOrNull(gRequest);
-
- if (options != null) {
- if (!options.getNetworkConfig().isEmpty())
- networkConfig = ImmutableSet
- .copyOf(transform(options.getNetworkConfig(), networkConfigDecorator));
- } else {
- options = new InstantiateVAppTemplateOptions();
- }
-
- if (networkConfig == null)
- networkConfig = ImmutableSet.of(networkConfigDecorator.apply(null));
-
- try {
- return stringBinder.bindToRequest(request, generateXml(name, options.getDescription(), options.shouldDeploy(),
- options.shouldPowerOn(), template, networkConfig));
- } catch (ParserConfigurationException e) {
- throw new RuntimeException(e);
- } catch (FactoryConfigurationError e) {
- throw new RuntimeException(e);
- } catch (TransformerException e) {
- throw new RuntimeException(e);
- }
-
- }
-
- @VisibleForTesting
- Set ifCustomizationScriptIsSetGetVmsInTemplate(String customizationScript, final URI template) {
- Set vms = ImmutableSet.of();
- if (customizationScript != null) {
- VAppTemplate vAppTemplate = templateCache.getUnchecked(template);
- checkArgument(vAppTemplate != null, "vAppTemplate %s not found!", template);
- vms = vAppTemplate.getChildren();
- checkArgument(!vms.isEmpty(), "no vms found in vAppTemplate %s", vAppTemplate);
- }
- return vms;
- }
-
- protected static final class NetworkConfigDecorator implements Function {
- private final VAppTemplate template;
- private final URI defaultNetwork;
- private final FenceMode defaultFenceMode;
- private final Function defaultNetworkNameInTemplate;
-
- protected NetworkConfigDecorator(VAppTemplate template, URI defaultNetwork, FenceMode defaultFenceMode,
- Function defaultNetworkNameInTemplate) {
- this.template = checkNotNull(template, "template");
- this.defaultNetwork = checkNotNull(defaultNetwork, "defaultNetwork");
- this.defaultFenceMode = checkNotNull(defaultFenceMode, "defaultFenceMode");
- this.defaultNetworkNameInTemplate = checkNotNull(defaultNetworkNameInTemplate, "defaultNetworkNameInTemplate");
- }
-
- @Override
- public NetworkConfig apply(NetworkConfig from) {
- if (from == null)
- return new NetworkConfig(defaultNetworkNameInTemplate.apply(template), defaultNetwork, defaultFenceMode);
- URI network = ifNullDefaultTo(from.getParentNetwork(), defaultNetwork);
- FenceMode fenceMode = ifNullDefaultTo(from.getFenceMode(), defaultFenceMode);
- // using conditional statement instead of ifNullDefaultTo so that we lazy invoke the
- // function, as it is an expensive one.
- String networkName = from.getNetworkName() != null ? from.getNetworkName() : defaultNetworkNameInTemplate
- .apply(template);
- return new NetworkConfig(networkName, network, fenceMode);
- }
- }
-
- protected String generateXml(String name, @Nullable String description, boolean deploy, boolean powerOn,
- URI template, Iterable networkConfig)
- throws ParserConfigurationException, FactoryConfigurationError, TransformerException {
- XMLBuilder rootBuilder = buildRoot(name).a("deploy", deploy + "").a("powerOn", powerOn + "");
- if (description != null)
- rootBuilder.e("Description").t(description);
- XMLBuilder instantiationParamsBuilder = rootBuilder.e("InstantiationParams");
- addNetworkConfig(instantiationParamsBuilder, networkConfig);
- rootBuilder.e("Source").a("href", template.toASCIIString());
- rootBuilder.e("AllEULAsAccepted").t("true");
-
- Properties outputProperties = new Properties();
- outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
- return rootBuilder.asString(outputProperties);
- }
-
- protected void addNetworkConfig(XMLBuilder instantiationParamsBuilder,
- Iterable networkConfig) {
- XMLBuilder networkConfigBuilder = instantiationParamsBuilder.e("NetworkConfigSection");
- networkConfigBuilder.e("ovf:Info").t("Configuration parameters for logical networks");
- for (NetworkConfig n : networkConfig) {
- XMLBuilder configurationBuilder = networkConfigBuilder.e("NetworkConfig").a("networkName", n.getNetworkName())
- .e("Configuration");
- configurationBuilder.e("ParentNetwork").a("href", n.getParentNetwork().toASCIIString());
- if (n.getFenceMode() != null) {
- configurationBuilder.e("FenceMode").t(n.getFenceMode().toString());
- }
- }
- }
-
- protected XMLBuilder buildRoot(String name) throws ParserConfigurationException, FactoryConfigurationError {
- return XMLBuilder.create("InstantiateVAppTemplateParams").a("name", name).a("xmlns", ns)
- .a("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1");
- }
-
- protected InstantiateVAppTemplateOptions findOptionsInArgsOrNull(GeneratedHttpRequest gRequest) {
- for (Object arg : gRequest.getInvocation().getArgs()) {
- if (arg instanceof InstantiateVAppTemplateOptions) {
- return (InstantiateVAppTemplateOptions) arg;
- } else if (arg instanceof InstantiateVAppTemplateOptions[]) {
- InstantiateVAppTemplateOptions[] options = (InstantiateVAppTemplateOptions[]) arg;
- return (options.length > 0) ? options[0] : null;
- }
- }
- return null;
- }
-
- @Override
- public R bindToRequest(R request, Object input) {
- throw new IllegalStateException("InstantiateVAppTemplateParams is needs parameters");
- }
-
- public static T ifNullDefaultTo(T value, T defaultValue) {
- return value != null ? value : checkNotNull(defaultValue, "defaultValue");
- }
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindMemoryToXmlPayload.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindMemoryToXmlPayload.java
deleted file mode 100644
index e6a1cd450f..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindMemoryToXmlPayload.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
-
-import java.util.Properties;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.cim.ResourceAllocationSettingData.ResourceType;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.binders.BindToStringPayload;
-
-import com.google.common.base.Throwables;
-import com.google.inject.Inject;
-import com.jamesmurty.utils.XMLBuilder;
-
-@Singleton
-public class BindMemoryToXmlPayload extends BindToStringPayload {
- protected final String ns;
- protected final String schema;
-
- @Inject
- public BindMemoryToXmlPayload(BindToStringPayload stringBinder, @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns,
- @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
- this.ns = ns;
- this.schema = schema;
- }
-
- private static final String RESOURCE_ALLOCATION_NS = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData";
-
- @Override
- public R bindToRequest(R request, Object payload) {
- checkArgument(checkNotNull(payload, "memoryInMB") instanceof Integer, "this binder is only valid for Integers!");
- Integer memoryInMB = Integer.class.cast(payload);
- XMLBuilder cpuItem;
- try {
- cpuItem = XMLBuilder.create("Item").a("xmlns", ns).a("xmlns:rasd", RESOURCE_ALLOCATION_NS);
- cpuItem.e("rasd:AllocationUnits").t("byte * 2^20");
- cpuItem.e("rasd:Description").t("Memory Size");
- cpuItem.e("rasd:ElementName").t(memoryInMB.toString() + " MB of memory");
- cpuItem.e("rasd:InstanceID").t("5");
- cpuItem.e("rasd:Reservation").t("0");
- cpuItem.e("rasd:ResourceType").t(ResourceType.MEMORY.value());
- cpuItem.e("rasd:VirtualQuantity").t(memoryInMB.toString());
- cpuItem.e("rasd:Weight").t("0");
- Properties outputProperties = new Properties();
- outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
- request = super.bindToRequest(request, cpuItem.asString(outputProperties));
- } catch (Exception e) {
- Throwables.propagate(e);
- }
- return request;
- }
-
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayload.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayload.java
deleted file mode 100644
index 6a277255f9..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayload.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
-
-import java.util.Properties;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.logging.Logger;
-import org.jclouds.rest.binders.BindToStringPayload;
-import org.jclouds.vcloud.domain.NetworkConnection;
-import org.jclouds.vcloud.domain.NetworkConnectionSection;
-
-import com.google.common.base.Throwables;
-import com.google.inject.Inject;
-import com.jamesmurty.utils.XMLBuilder;
-
-@Singleton
-public class BindNetworkConnectionSectionToXmlPayload extends BindToStringPayload {
- @Resource
- protected Logger logger = Logger.NULL;
-
- protected final String ns;
- protected final String schema;
-
- @Inject
- public BindNetworkConnectionSectionToXmlPayload(BindToStringPayload stringBinder,
- @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
- this.ns = ns;
- this.schema = schema;
- }
-
- @Override
- public R bindToRequest(R request, Object payload) {
- checkArgument(checkNotNull(payload, "NetworkConnectionSection") instanceof NetworkConnectionSection,
- "this binder is only valid for NetworkConnectionSection!");
- NetworkConnectionSection net = NetworkConnectionSection.class.cast(payload);
- XMLBuilder networkConnectionSection;
- try {
- networkConnectionSection = XMLBuilder.create("NetworkConnectionSection").a("xmlns", ns)
- .a("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1").a("type", net.getType())
- .a("href", net.getHref().toASCIIString()).a("ovf:required", "false");
- networkConnectionSection.e("ovf:Info").t(net.getInfo());
-
- if (net.getPrimaryNetworkConnectionIndex() != null)
- networkConnectionSection.e("PrimaryNetworkConnectionIndex").t(
- net.getPrimaryNetworkConnectionIndex().toString());
- for (NetworkConnection networkConnection : net.getConnections()) {
- XMLBuilder networkConnectionSectionChild = networkConnectionSection.e("NetworkConnection").a("network",
- networkConnection.getNetwork());
- networkConnectionSectionChild.e("NetworkConnectionIndex").t(
- networkConnection.getNetworkConnectionIndex() + "");
- if (networkConnection.getExternalIpAddress() != null)
- networkConnectionSectionChild.e("ExternalIpAddress").t(networkConnection.getExternalIpAddress());
- if (networkConnection.getIpAddress() != null)
- networkConnectionSectionChild.e("IpAddress").t(networkConnection.getIpAddress());
- networkConnectionSectionChild.e("IsConnected").t(networkConnection.isConnected() + "");
- if (networkConnection.getMACAddress() != null)
- networkConnectionSectionChild.e("MACAddress").t(networkConnection.getMACAddress());
- if (networkConnection.getIpAddressAllocationMode() != null)
- networkConnectionSectionChild.e("IpAddressAllocationMode").t(
- networkConnection.getIpAddressAllocationMode().toString());
- }
-
- if (net.getEdit() != null)
- networkConnectionSection.e("Link").a("rel", "edit").a("type", net.getType())
- .a("href", net.getHref().toASCIIString());
-
- Properties outputProperties = new Properties();
- outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
- request = super.bindToRequest(request, networkConnectionSection.asString(outputProperties));
- request.getPayload().getContentMetadata().setContentType(net.getType());
- } catch (Exception e) {
- Throwables.propagate(e);
- }
- return request;
- }
-
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindParamsToXmlPayload.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindParamsToXmlPayload.java
deleted file mode 100644
index f613c1bf6a..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindParamsToXmlPayload.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.binders;
-
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
-
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToStringPayload;
-
-import com.google.inject.Inject;
-import com.jamesmurty.utils.XMLBuilder;
-
-@Singleton
-public class BindParamsToXmlPayload implements MapBinder {
-
- protected final String ns;
- protected final BindToStringPayload stringBinder;
- protected final String element;
-
- @Inject
- public BindParamsToXmlPayload(String element, BindToStringPayload stringBinder,
- @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns) {
- this.element = element;
- this.ns = ns;
- this.stringBinder = stringBinder;
- }
- @Override
- public R bindToRequest(R request, Map postParams) {
- try {
- return stringBinder.bindToRequest(request, generateXml(postParams));
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- private String generateXml(Map postParams) throws ParserConfigurationException,
- FactoryConfigurationError, TransformerException {
- XMLBuilder rootBuilder = XMLBuilder.create(element);
- for (Entry entry : postParams.entrySet())
- rootBuilder.a(entry.getKey(), (String) entry.getValue());
- rootBuilder.a("xmlns", ns);
- Properties outputProperties = new Properties();
- outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
- return rootBuilder.asString(outputProperties);
- }
-
- @Override
- public R bindToRequest(R request, Object input) {
- throw new IllegalArgumentException("incorrect usage");
- }
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayload.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayload.java
deleted file mode 100644
index d95846e24e..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayload.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.binders;
-
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.rest.binders.BindToStringPayload;
-
-import com.google.inject.Inject;
-
-@Singleton
-public class BindUndeployVAppParamsToXmlPayload extends BindParamsToXmlPayload {
-
- @Inject
- public BindUndeployVAppParamsToXmlPayload(BindToStringPayload stringBinder,
- @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns) {
- super("UndeployVAppParams", stringBinder, ns);
- }
-
-}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/OrgNameAndCatalogNameToEndpoint.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/OrgNameAndCatalogNameToEndpoint.java
deleted file mode 100644
index 09c81e5925..0000000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/OrgNameAndCatalogNameToEndpoint.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.binders;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.vcloud.domain.Org;
-import org.jclouds.vcloud.domain.ReferenceType;
-import org.jclouds.vcloud.endpoints.Catalog;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.Iterables;
-
-@Singleton
-public class OrgNameAndCatalogNameToEndpoint implements MapBinder {
- private final Supplier