You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ad...@apache.org on 2013/09/30 18:15:36 UTC

[16/17] JCLOUDS-304. Remove broken terremark providers

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java
deleted file mode 100644
index cc5e95c..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/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.trmk.vcloud_0_8.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static org.jclouds.trmk.vcloud_0_8.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_FENCEMODE;
-import static org.jclouds.trmk.vcloud_0_8.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
-import static org.jclouds.trmk.vcloud_0_8.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.SortedMap;
-
-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.cim.ResourceAllocationSettingData.ResourceType;
-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.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.trmk.vcloud_0_8.endpoints.Network;
-import org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions;
-import org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions.NetworkConfig;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-import com.google.inject.Inject;
-import com.jamesmurty.utils.XMLBuilder;
-
-/**
- * 
- * @author Adrian Cole
- * 
- */
-@Singleton
-public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder {
-
-   protected final String ns;
-   protected final String schema;
-   private final BindToStringPayload stringBinder;
-   protected final Map<ResourceType, String> virtualHardwareToInstanceId = ImmutableMap.of(ResourceType.PROCESSOR, "1",
-         ResourceType.MEMORY, "2", ResourceType.DISK_DRIVE, "9");
-   private final Supplier<ReferenceType> defaultNetwork;
-   private final String defaultFenceMode;
-
-   @Inject
-   public BindInstantiateVAppTemplateParamsToXmlPayload(BindToStringPayload stringBinder,
-         @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema,
-         @Network Supplier<ReferenceType> network, @Named(PROPERTY_VCLOUD_DEFAULT_FENCEMODE) String fenceMode) {
-      this.ns = ns;
-      this.schema = schema;
-      this.stringBinder = stringBinder;
-      this.defaultNetwork = network;
-      this.defaultFenceMode = fenceMode;
-   }
-
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> 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();
-      String template = checkNotNull(postParams.remove("template"), "template").toString();
-
-      SortedMap<ResourceType, String> virtualHardwareQuantity = Maps.newTreeMap();
-
-      InstantiateVAppTemplateOptions options = findOptionsInArgsOrNull(gRequest);
-      String network = (defaultNetwork != null) ? defaultNetwork.get().getHref().toASCIIString() : null;
-      String fenceMode = defaultFenceMode;
-      String networkName = name;
-      if (options != null) {
-         if (options.getNetworkConfig().size() > 0) {
-            NetworkConfig config = Iterables.get(options.getNetworkConfig(), 0);
-            network = ifNullDefaultTo(config.getParentNetwork(), network);
-            fenceMode = ifNullDefaultTo(config.getFenceMode(), defaultFenceMode);
-            networkName = ifNullDefaultTo(config.getNetworkName(), networkName);
-         }
-         addQuantity(options, virtualHardwareQuantity);
-      }
-      try {
-         return stringBinder.bindToRequest(request,
-               generateXml(name, template, virtualHardwareQuantity, networkName, fenceMode, URI.create(network)));
-      } 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 name, String template, SortedMap<ResourceType, String> virtualHardwareQuantity,
-         String networkName, @Nullable String fenceMode, URI network) throws ParserConfigurationException,
-         FactoryConfigurationError, TransformerException {
-      XMLBuilder rootBuilder = buildRoot(name);
-
-      rootBuilder.e("VAppTemplate").a("href", template);
-
-      XMLBuilder instantiationParamsBuilder = rootBuilder.e("InstantiationParams");
-      addVirtualQuantityIfPresent(instantiationParamsBuilder, virtualHardwareQuantity);
-      addNetworkConfig(instantiationParamsBuilder, networkName, fenceMode, network);
-      Properties outputProperties = new Properties();
-      outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
-      return rootBuilder.asString(outputProperties);
-   }
-
-   protected void addNetworkConfig(XMLBuilder instantiationParamsBuilder, String name, @Nullable String fenceMode,
-         URI network) {
-      XMLBuilder networkConfigBuilder = instantiationParamsBuilder.e("NetworkConfigSection").e("NetworkConfig")
-            .a("name", name);
-      if (fenceMode != null) {
-         XMLBuilder featuresBuilder = networkConfigBuilder.e("Features");
-         featuresBuilder.e("FenceMode").t(fenceMode);
-      }
-      networkConfigBuilder.e("NetworkAssociation").a("href", network.toASCIIString());
-   }
-
-   protected XMLBuilder buildRoot(String name) throws ParserConfigurationException, FactoryConfigurationError {
-      XMLBuilder rootBuilder = XMLBuilder.create("InstantiateVAppTemplateParams").a("name", name).a("xmlns", ns)
-            .a("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance").a("xsi:schemaLocation", ns + " " + schema)
-            .a("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1");
-      return rootBuilder;
-   }
-
-   private void addQuantity(InstantiateVAppTemplateOptions options, Map<ResourceType, String> virtualHardwareQuantity) {
-      if (options.getCpuCount() != null) {
-         virtualHardwareQuantity.put(ResourceType.PROCESSOR, options.getCpuCount());
-      }
-      if (options.getMemorySizeMegabytes() != null) {
-         virtualHardwareQuantity.put(ResourceType.MEMORY, options.getMemorySizeMegabytes());
-      }
-   }
-
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
-      throw new IllegalStateException("InstantiateVAppTemplateParams is needs parameters");
-   }
-
-   protected String ifNullDefaultTo(Object value, String defaultValue) {
-      return value != null ? value.toString() : checkNotNull(defaultValue, "defaultValue");
-   }
-
-   ThreadLocal<Map<String, String>> propLocal = new ThreadLocal<Map<String, String>>();
-
-   protected InstantiateVAppTemplateOptions findOptionsInArgsOrNull(GeneratedHttpRequest gRequest) {
-      InstantiateVAppTemplateOptions options = null;
-      for (Object arg : gRequest.getInvocation().getArgs()) {
-         if (arg instanceof InstantiateVAppTemplateOptions) {
-            options = (InstantiateVAppTemplateOptions) arg;
-         } else if (arg instanceof InstantiateVAppTemplateOptions[]) {
-            InstantiateVAppTemplateOptions[] optionsA = (InstantiateVAppTemplateOptions[]) arg;
-            options = (optionsA.length > 0) ? optionsA[0] : null;
-         }
-      }
-      if (options != null)
-         propLocal.set(options.getProperties());
-      return options;
-   }
-
-   protected void addVirtualQuantityIfPresent(XMLBuilder instantiationParamsBuilder,
-         SortedMap<ResourceType, String> virtualHardwareQuantity) {
-      XMLBuilder productSectionBuilder = instantiationParamsBuilder.e("ProductSection").a("xmlns:q1", ns)
-            .a("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1");
-      if (propLocal.get() != null) {
-         for (Entry<String, String> entry : propLocal.get().entrySet()) {
-            productSectionBuilder.e("Property").a("xmlns", "http://schemas.dmtf.org/ovf/envelope/1")
-                  .a("ovf:key", entry.getKey()).a("ovf:value", entry.getValue());
-         }
-         propLocal.set(null);
-      }
-      if (virtualHardwareQuantity.size() > 0) {
-         XMLBuilder virtualHardwareSectionBuilder = instantiationParamsBuilder.e("VirtualHardwareSection").a(
-               "xmlns:q1", ns);
-         for (Entry<ResourceType, String> entry : virtualHardwareQuantity.entrySet()) {
-            XMLBuilder itemBuilder = virtualHardwareSectionBuilder.e("Item").a("xmlns",
-                  "http://schemas.dmtf.org/ovf/envelope/1");
-            itemBuilder.e("InstanceID")
-                  .a("xmlns", "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData")
-                  .t(virtualHardwareToInstanceId.get(entry.getKey()));
-            itemBuilder.e("ResourceType")
-                  .a("xmlns", "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData")
-                  .t(entry.getKey().value());
-            itemBuilder.e("VirtualQuantity")
-                  .a("xmlns", "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData")
-                  .t(entry.getValue());
-         }
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/BindNodeConfigurationToXmlPayload.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/BindNodeConfigurationToXmlPayload.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/BindNodeConfigurationToXmlPayload.java
deleted file mode 100644
index ae0cb40..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/BindNodeConfigurationToXmlPayload.java
+++ /dev/null
@@ -1,83 +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.trmk.vcloud_0_8.binders;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.trmk.vcloud_0_8.reference.TerremarkConstants.PROPERTY_TERREMARK_EXTENSION_NS;
-
-import java.util.Map;
-import java.util.Properties;
-
-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.rest.MapBinder;
-import org.jclouds.rest.binders.BindToStringPayload;
-
-import com.google.common.base.Throwables;
-import com.jamesmurty.utils.XMLBuilder;
-
-/**
- * 
- * @author Adrian Cole
- * 
- */
-@Singleton
-public class BindNodeConfigurationToXmlPayload implements MapBinder {
-
-   private final String ns;
-   private final BindToStringPayload stringBinder;
-
-   @Inject
-   BindNodeConfigurationToXmlPayload(@Named(PROPERTY_TERREMARK_EXTENSION_NS) String ns, BindToStringPayload stringBinder) {
-      this.ns = ns;
-      this.stringBinder = stringBinder;
-   }
-
-   protected String generateXml(Map<String, Object> postParams) throws ParserConfigurationException,
-         FactoryConfigurationError, TransformerException {
-      XMLBuilder rootBuilder = XMLBuilder.create("NodeService").a("xmlns", ns).a("xmlns:xsi",
-            "http://www.w3.org/2001/XMLSchema-instance").a("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
-      rootBuilder.e("Name").t(checkNotNull(postParams.get("name"), "name").toString());
-      rootBuilder.e("Enabled").t(checkNotNull(postParams.get("enabled"), "enabled").toString());
-      if (postParams.containsKey("description") && postParams.get("description") != null)
-         rootBuilder.e("Description").t((String) postParams.get("description"));
-      Properties outputProperties = new Properties();
-      outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
-      return rootBuilder.asString(outputProperties);
-   }
-
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
-      try {
-         return stringBinder.bindToRequest(request, generateXml(postParams));
-      } catch (Exception e) {
-         Throwables.propagate(e);
-      }
-      return request;
-   }
-
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
-      throw new IllegalArgumentException("this is a map binder");
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/BindVAppConfigurationToXmlPayload.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/BindVAppConfigurationToXmlPayload.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/BindVAppConfigurationToXmlPayload.java
deleted file mode 100644
index bfb8ea8..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/BindVAppConfigurationToXmlPayload.java
+++ /dev/null
@@ -1,217 +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.trmk.vcloud_0_8.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.find;
-import static org.jclouds.trmk.vcloud_0_8.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
-import static org.jclouds.trmk.vcloud_0_8.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
-
-import java.net.URI;
-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.cim.CIMPredicates;
-import org.jclouds.cim.ResourceAllocationSettingData;
-import org.jclouds.cim.ResourceAllocationSettingData.ResourceType;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.annotations.ApiVersion;
-import org.jclouds.rest.binders.BindToStringPayload;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.trmk.vcloud_0_8.domain.Status;
-import org.jclouds.trmk.vcloud_0_8.domain.VApp;
-import org.jclouds.trmk.vcloud_0_8.domain.VAppConfiguration;
-
-import com.google.common.base.Function;
-import com.google.inject.Inject;
-import com.jamesmurty.utils.XMLBuilder;
-
-/**
- * 
- * @author Adrian Cole
- * 
- */
-@Singleton
-public class BindVAppConfigurationToXmlPayload implements MapBinder, Function<Object, URI> {
-
-   private static final String RESOURCE_ALLOCATION_NS = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData";
-
-   protected final String ns;
-   protected final String schema;
-   protected final BindToStringPayload stringBinder;
-   protected final String apiVersion;
-
-   @Inject
-   public BindVAppConfigurationToXmlPayload(@ApiVersion String apiVersion,
-            BindToStringPayload stringBinder, @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns,
-            @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
-      this.apiVersion = apiVersion;
-      this.ns = ns;
-      this.schema = schema;
-      this.stringBinder = stringBinder;
-   }
-
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
-      checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
-               "this binder is only valid for GeneratedHttpRequests!");
-      GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
-      VApp vApp = checkNotNull(findVAppInArgsOrNull(gRequest), "vApp");
-      checkArgument(vApp.getStatus() == Status.OFF, "vApp must be off!");
-      VAppConfiguration configuration = checkNotNull(findConfigInArgsOrNull(gRequest), "config");
-
-      try {
-         return stringBinder.bindToRequest(request, generateXml(vApp, configuration));
-      } catch (ParserConfigurationException e) {
-         throw new RuntimeException(e);
-      } catch (FactoryConfigurationError e) {
-         throw new RuntimeException(e);
-      } catch (TransformerException e) {
-         throw new RuntimeException(e);
-      }
-
-   }
-
-   protected String generateXml(VApp vApp, VAppConfiguration configuration)
-            throws ParserConfigurationException, FactoryConfigurationError, TransformerException {
-      String name = configuration.getName() != null ? configuration.getName() : vApp.getName();
-
-      XMLBuilder rootBuilder = buildRoot(vApp, name);
-
-      XMLBuilder sectionBuilder = rootBuilder.e("Section").a("xsi:type", "VirtualHardwareSection_Type").a("xmlns",
-               "http://schemas.dmtf.org/ovf/envelope/1").a("xmlns:q2", "http://www.vmware.com/vcloud/v1");
-      sectionBuilder.e("Info").t("Virtual Hardware");
-
-      addProcessorItem(sectionBuilder, vApp, configuration);
-      addMemoryItem(sectionBuilder, vApp, configuration);
-      addDiskItems(sectionBuilder, vApp, configuration);
-
-      Properties outputProperties = new Properties();
-      outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
-      return rootBuilder.asString(outputProperties);
-   }
-
-   private void addProcessorItem(XMLBuilder sectionBuilder, VApp vApp, VAppConfiguration configuration) {
-      ResourceAllocationSettingData cpu = find(vApp.getResourceAllocations(), CIMPredicates
-               .resourceTypeIn(ResourceType.PROCESSOR));
-      long quantity = configuration.getProcessorCount() != null ? configuration.getProcessorCount() : cpu
-               .getVirtualQuantity();
-      addResourceWithQuantity(sectionBuilder, cpu, quantity);
-   }
-
-   private void addMemoryItem(XMLBuilder sectionBuilder, VApp vApp, VAppConfiguration configuration) {
-      ResourceAllocationSettingData memory = find(vApp.getResourceAllocations(), CIMPredicates
-               .resourceTypeIn(ResourceType.MEMORY));
-      long quantity = configuration.getMemory() != null ? configuration.getMemory() : memory.getVirtualQuantity();
-      addResourceWithQuantity(sectionBuilder, memory, quantity);
-   }
-
-   private void addDiskItems(XMLBuilder sectionBuilder, VApp vApp, VAppConfiguration configuration) {
-      for (ResourceAllocationSettingData disk : filter(vApp.getResourceAllocations(), CIMPredicates
-               .resourceTypeIn(ResourceType.DISK_DRIVE))) {
-         if (!configuration.getDisksToDelete().contains(Integer.valueOf(disk.getAddressOnParent()))) {
-            addDiskWithQuantity(sectionBuilder, disk);
-         }
-      }
-      for (Long quantity : configuration.getDisks()) {
-         ResourceAllocationSettingData disk = ResourceAllocationSettingData.builder().instanceID("9").addressOnParent(
-                  "-1").elementName("").resourceType(ResourceType.DISK_DRIVE).virtualQuantity(quantity).build();
-         addDiskWithQuantity(sectionBuilder, disk);
-      }
-   }
-
-   private XMLBuilder addResourceWithQuantity(XMLBuilder sectionBuilder, ResourceAllocationSettingData resource,
-            long quantity) {
-      XMLBuilder itemBuilder = sectionBuilder.e("Item");
-      addCommonElements(itemBuilder, resource, quantity);
-      return itemBuilder;
-   }
-
-   private void addCommonElements(XMLBuilder itemBuilder, ResourceAllocationSettingData resource, long quantity) {
-      itemBuilder.e("InstanceID").a("xmlns", RESOURCE_ALLOCATION_NS).t(resource.getInstanceID() + "");
-      itemBuilder.e("ResourceType").a("xmlns", RESOURCE_ALLOCATION_NS).t(resource.getResourceType().value());
-      itemBuilder.e("VirtualQuantity").a("xmlns", RESOURCE_ALLOCATION_NS).t(quantity + "");
-   }
-
-   private XMLBuilder addDiskWithQuantity(XMLBuilder sectionBuilder, ResourceAllocationSettingData disk) {
-      XMLBuilder itemBuilder = sectionBuilder.e("Item");
-      itemBuilder.e("AddressOnParent").a("xmlns", RESOURCE_ALLOCATION_NS).t(disk.getAddressOnParent() + "");
-      for (String hostResource : disk.getHostResources())
-         itemBuilder.e("HostResource").a("xmlns", RESOURCE_ALLOCATION_NS).t(hostResource);
-      addCommonElements(itemBuilder, disk, disk.getVirtualQuantity());
-      return itemBuilder;
-   }
-
-   protected XMLBuilder buildRoot(VApp vApp, String name) throws ParserConfigurationException,
-            FactoryConfigurationError {
-      String status = vApp.getStatus().value();
-      if (apiVersion.indexOf("0.8") != -1 && "8".equals(status))
-         status = "2";
-      XMLBuilder rootBuilder = XMLBuilder.create("VApp").a("type", vApp.getType()).a("name", name).a("status", status)
-               .a("size", vApp.getSize() + "").a("xmlns", ns).a("xmlns:xsi",
-                        "http://www.w3.org/2001/XMLSchema-instance").a("xsi:schemaLocation", ns + " " + schema);
-      return rootBuilder;
-   }
-
-   protected VApp findVAppInArgsOrNull(GeneratedHttpRequest gRequest) {
-      for (Object arg : gRequest.getInvocation().getArgs()) {
-         if (arg instanceof VApp) {
-            return (VApp) arg;
-         } else if (arg instanceof VApp[]) {
-            VApp[] vapps = (VApp[]) arg;
-            return (vapps.length > 0) ? vapps[0] : null;
-         }
-      }
-      return null;
-   }
-
-   protected VAppConfiguration findConfigInArgsOrNull(GeneratedHttpRequest gRequest) {
-      for (Object arg : gRequest.getInvocation().getArgs()) {
-         if (arg instanceof VAppConfiguration) {
-            return (VAppConfiguration) arg;
-         } else if (arg instanceof VAppConfiguration[]) {
-            VAppConfiguration[] configuration = (VAppConfiguration[]) arg;
-            return (configuration.length > 0) ? configuration[0] : null;
-         }
-      }
-      return null;
-   }
-
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
-      throw new IllegalStateException("BindVAppConfigurationToXmlPayload needs parameters");
-   }
-
-   protected String ifNullDefaultTo(String value, String defaultValue) {
-      return value != null ? value : checkNotNull(defaultValue, "defaultValue");
-   }
-
-   @Override
-   public URI apply(Object from) {
-      return VApp.class.cast(checkNotNull(from, "from")).getHref();
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameAndCatalogNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameAndCatalogNameToEndpoint.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameAndCatalogNameToEndpoint.java
deleted file mode 100644
index 12ebed5..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameAndCatalogNameToEndpoint.java
+++ /dev/null
@@ -1,78 +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.trmk.vcloud_0_8.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.trmk.vcloud_0_8.domain.Org;
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.trmk.vcloud_0_8.endpoints.Catalog;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.Iterables;
-
-/**
- * 
- * @author Adrian Cole
- */
-@Singleton
-public class OrgNameAndCatalogNameToEndpoint implements MapBinder {
-   private final Supplier<Map<String, ? extends Org>> orgMap;
-   private final Supplier<ReferenceType> defaultOrg;
-   private final Supplier<ReferenceType> defaultCatalog;
-
-   @Inject
-   public OrgNameAndCatalogNameToEndpoint(Supplier<Map<String, ? extends Org>> orgMap,
-         @org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<ReferenceType> defaultOrg, @Catalog Supplier<ReferenceType> defaultCatalog) {
-      this.orgMap = orgMap;
-      this.defaultOrg = defaultOrg;
-      this.defaultCatalog = defaultCatalog;
-   }
-
-   @SuppressWarnings("unchecked")
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
-      Object org = postParams.get("orgName");
-      Object catalog = postParams.get("catalogName");
-      if (org == null && catalog == null)
-         return (R) request.toBuilder().endpoint(defaultCatalog.get().getHref()).build();
-      else if (org == null)
-         org = defaultOrg.get().getName();
-
-      try {
-         Map<String, ReferenceType> catalogs = checkNotNull(orgMap.get().get(org)).getCatalogs();
-         URI endpoint = catalog == null ? Iterables.getLast(catalogs.values()).getHref() : catalogs.get(catalog).getHref();
-         return (R) request.toBuilder().endpoint(endpoint).build();
-      } catch (NullPointerException e) {
-         throw new NoSuchElementException(org + "/" + catalog + " not found in " + orgMap.get());
-      }
-   }
-
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
-      throw new IllegalStateException(getClass() + " needs parameters");
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameAndTasksListNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameAndTasksListNameToEndpoint.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameAndTasksListNameToEndpoint.java
deleted file mode 100644
index 830dfd5..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameAndTasksListNameToEndpoint.java
+++ /dev/null
@@ -1,78 +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.trmk.vcloud_0_8.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.trmk.vcloud_0_8.domain.Org;
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.trmk.vcloud_0_8.endpoints.TasksList;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.Iterables;
-
-/**
- * 
- * @author Adrian Cole
- */
-@Singleton
-public class OrgNameAndTasksListNameToEndpoint implements MapBinder {
-   private final Supplier<Map<String, ? extends Org>> orgMap;
-   private final Supplier<ReferenceType> defaultOrg;
-   private final Supplier<ReferenceType> defaultTasksList;
-
-   @Inject
-   public OrgNameAndTasksListNameToEndpoint(Supplier<Map<String, ? extends Org>> orgMap,
-         @org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<ReferenceType> defaultOrg, @TasksList Supplier<ReferenceType> defaultTasksList) {
-      this.orgMap = orgMap;
-      this.defaultOrg = defaultOrg;
-      this.defaultTasksList = defaultTasksList;
-   }
-
-   @SuppressWarnings("unchecked")
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
-      Object org = postParams.get("orgName");
-      Object tasksList = postParams.get("tasksListName");
-      if (org == null && tasksList == null)
-         return (R) request.toBuilder().endpoint(defaultTasksList.get().getHref()).build();
-      else if (org == null)
-         org = defaultOrg.get().getName();
-
-      try {
-         Map<String, ReferenceType> tasksLists = checkNotNull(orgMap.get().get(org)).getTasksLists();
-         URI endpoint = tasksList == null ? Iterables.getLast(tasksLists.values()).getHref() : tasksLists.get(tasksList).getHref();
-         return (R) request.toBuilder().endpoint(endpoint).build();
-      } catch (NullPointerException e) {
-         throw new NoSuchElementException(org + "/" + tasksList + " not found in " + orgMap.get());
-      }
-   }
-
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
-      throw new IllegalStateException(getClass() + " needs parameters");
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameAndVDCNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameAndVDCNameToEndpoint.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameAndVDCNameToEndpoint.java
deleted file mode 100644
index cd484df..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameAndVDCNameToEndpoint.java
+++ /dev/null
@@ -1,78 +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.trmk.vcloud_0_8.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.trmk.vcloud_0_8.domain.Org;
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.trmk.vcloud_0_8.endpoints.VDC;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.Iterables;
-
-/**
- * 
- * @author Adrian Cole
- */
-@Singleton
-public class OrgNameAndVDCNameToEndpoint implements MapBinder {
-   private final Supplier<Map<String, ? extends Org>> orgNameToVDCEndpoint;
-   private final Supplier<ReferenceType> defaultOrg;
-   private final Supplier<ReferenceType> defaultVDC;
-
-   @Inject
-   public OrgNameAndVDCNameToEndpoint(Supplier<Map<String, ? extends Org>> orgNameToVDCEndpoint,
-         @org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<ReferenceType> defaultOrg, @VDC Supplier<ReferenceType> defaultVDC) {
-      this.orgNameToVDCEndpoint = orgNameToVDCEndpoint;
-      this.defaultOrg = defaultOrg;
-      this.defaultVDC = defaultVDC;
-   }
-
-   @SuppressWarnings("unchecked")
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
-      Object org = postParams.get("orgName");
-      Object vdc = postParams.get("vdcName");
-      if (org == null && vdc == null)
-         return (R) request.toBuilder().endpoint(defaultVDC.get().getHref()).build();
-      else if (org == null)
-         org = defaultOrg.get().getName();
-
-      try {
-         Map<String, ReferenceType> vdcs = checkNotNull(orgNameToVDCEndpoint.get().get(org)).getVDCs();
-         URI endpoint = vdc == null ? Iterables.getLast(vdcs.values()).getHref() : vdcs.get(vdc).getHref();
-         return (R) request.toBuilder().endpoint(endpoint).build();
-      } catch (NullPointerException e) {
-         throw new NoSuchElementException(org + "/" + vdc + " not found in " + orgNameToVDCEndpoint.get());
-      }
-   }
-
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
-      throw new IllegalStateException(getClass() + " needs parameters");
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameCatalogNameItemNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameCatalogNameItemNameToEndpoint.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameCatalogNameItemNameToEndpoint.java
deleted file mode 100644
index 45cd56c..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameCatalogNameItemNameToEndpoint.java
+++ /dev/null
@@ -1,77 +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.trmk.vcloud_0_8.binders;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-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.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.trmk.vcloud_0_8.endpoints.Catalog;
-import org.jclouds.trmk.vcloud_0_8.endpoints.Org;
-
-import com.google.common.base.Supplier;
-
-/**
- * 
- * @author Adrian Cole
- */
-@Singleton
-public class OrgNameCatalogNameItemNameToEndpoint implements MapBinder {
-   private final Supplier<Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.Catalog>>> orgCatalogMap;
-   private final Supplier<ReferenceType> defaultOrg;
-   private final Supplier<ReferenceType> defaultCatalog;
-
-   @Inject
-   public OrgNameCatalogNameItemNameToEndpoint(
-         Supplier<Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.Catalog>>> orgCatalogMap,
-         @Org Supplier<ReferenceType> defaultOrg, @Catalog Supplier<ReferenceType> defaultCatalog) {
-      this.orgCatalogMap = orgCatalogMap;
-      this.defaultOrg = defaultOrg;
-      this.defaultCatalog = defaultCatalog;
-   }
-
-   @SuppressWarnings("unchecked")
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
-      Object org = postParams.get("orgName");
-      Object catalog = postParams.get("catalogName");
-      Object catalogItem = postParams.get("itemName");
-      if (org == null)
-         org = defaultOrg.get().getName();
-      if (catalog == null)
-         catalog = defaultCatalog.get().getName();
-      try {
-         Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.Catalog> catalogs = checkNotNull(orgCatalogMap.get().get(org));
-         return (R) request.toBuilder().endpoint(catalogs.get(catalog).get(catalogItem).getHref()).build();
-      } catch (NullPointerException e) {
-         throw new NoSuchElementException(org + "/" + catalog + "/" + catalogItem + " not found in "
-               + orgCatalogMap.get());
-      }
-   }
-
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
-      throw new IllegalStateException(getClass() + " needs parameters");
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameCatalogNameVAppTemplateNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameCatalogNameVAppTemplateNameToEndpoint.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameCatalogNameVAppTemplateNameToEndpoint.java
deleted file mode 100644
index f58cc81..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameCatalogNameVAppTemplateNameToEndpoint.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.trmk.vcloud_0_8.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.trmk.vcloud_0_8.domain.CatalogItem;
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.trmk.vcloud_0_8.endpoints.Catalog;
-import org.jclouds.trmk.vcloud_0_8.endpoints.Org;
-
-import com.google.common.base.Supplier;
-
-/**
- * 
- * @author Adrian Cole
- */
-@Singleton
-public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements MapBinder {
-   private final Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.CatalogItem>>>> orgCatalogItemMap;
-   private final Supplier<ReferenceType> defaultOrg;
-   private final Supplier<ReferenceType> defaultCatalog;
-
-   @Inject
-   public OrgNameCatalogNameVAppTemplateNameToEndpoint(
-            Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.CatalogItem>>>> orgCatalogItemMap,
-            @Org Supplier<ReferenceType> defaultOrg, @Catalog Supplier<ReferenceType> defaultCatalog) {
-      this.orgCatalogItemMap = orgCatalogItemMap;
-      this.defaultOrg = defaultOrg;
-      this.defaultCatalog = defaultCatalog;
-   }
-
-   @SuppressWarnings("unchecked")
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
-      Object org = postParams.get("orgName");
-      Object catalog = postParams.get("catalogName");
-      Object catalogItem = postParams.get("itemName");
-      if (org == null)
-         org = defaultOrg.get().getName();
-      if (catalog == null)
-         catalog = defaultCatalog.get().getName();
-      Map<String, Map<String, Map<String, ? extends CatalogItem>>> orgCatalogItemMap = this.orgCatalogItemMap.get();
-
-      if (!orgCatalogItemMap.containsKey(org))
-         throw new NoSuchElementException("org: " + org + " not found in " + orgCatalogItemMap.keySet());
-      Map<String, Map<String, ? extends CatalogItem>> catalogs = orgCatalogItemMap.get(org);
-
-      if (!catalogs.containsKey(catalog))
-         throw new NoSuchElementException("catalog: " + org + "/" + catalog + " not found in " + catalogs.keySet());
-      Map<String, ? extends CatalogItem> catalogMap = catalogs.get(catalog);
-
-      if (!catalogMap.containsKey(catalogItem))
-         throw new NoSuchElementException("item: " + org + "/" + catalog + "/" + catalogItem + " not found in "
-                  + catalogMap.keySet());
-      CatalogItem item = catalogMap.get(catalogItem);
-
-      URI endpoint = checkNotNull(item.getEntity(),
-            "item: " + org + "/" + catalog + "/" + catalogItem + " has no entity").getHref();
-      return (R) request.toBuilder().endpoint(endpoint).build();
-   }
-
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
-      throw new IllegalStateException(getClass() + " needs parameters");
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameVDCNameNetworkNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameVDCNameNetworkNameToEndpoint.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameVDCNameNetworkNameToEndpoint.java
deleted file mode 100644
index 873ffea..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameVDCNameNetworkNameToEndpoint.java
+++ /dev/null
@@ -1,54 +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.trmk.vcloud_0_8.binders;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.trmk.vcloud_0_8.endpoints.Org;
-import org.jclouds.trmk.vcloud_0_8.endpoints.VDC;
-
-import com.google.common.base.Supplier;
-
-/**
- * 
- * @author Adrian Cole
- */
-@Singleton
-public class OrgNameVDCNameNetworkNameToEndpoint extends OrgNameVDCNameResourceNameToEndpoint {
-   @Inject
-   public OrgNameVDCNameNetworkNameToEndpoint(
-         Supplier<Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>>> orgVDCMap,
-         @Org Supplier<ReferenceType> defaultOrg, @VDC Supplier<ReferenceType> defaultVDC) {
-      super(orgVDCMap, defaultOrg, defaultVDC);
-   }
-
-   protected URI getEndpointOfResourceInVDC(Object org, Object vDC, Object resource,
-         org.jclouds.trmk.vcloud_0_8.domain.VDC vDCObject) {
-      ReferenceType resourceEntity = vDCObject.getAvailableNetworks().get(resource);
-      if (resourceEntity == null)
-         throw new NoSuchElementException("network " + resource + " in vdc " + vDC + ", org " + org + " not found in "
-               + vDCObject.getAvailableNetworks().keySet());
-      return resourceEntity.getHref();
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameVDCNameResourceEntityNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameVDCNameResourceEntityNameToEndpoint.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameVDCNameResourceEntityNameToEndpoint.java
deleted file mode 100644
index cca1b75..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameVDCNameResourceEntityNameToEndpoint.java
+++ /dev/null
@@ -1,54 +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.trmk.vcloud_0_8.binders;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.trmk.vcloud_0_8.endpoints.Org;
-import org.jclouds.trmk.vcloud_0_8.endpoints.VDC;
-
-import com.google.common.base.Supplier;
-
-/**
- * 
- * @author Adrian Cole
- */
-@Singleton
-public class OrgNameVDCNameResourceEntityNameToEndpoint extends OrgNameVDCNameResourceNameToEndpoint {
-   @Inject
-   public OrgNameVDCNameResourceEntityNameToEndpoint(
-         Supplier<Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>>> orgVDCMap,
-         @Org Supplier<ReferenceType> defaultOrg, @VDC Supplier<ReferenceType> defaultVDC) {
-      super(orgVDCMap, defaultOrg, defaultVDC);
-   }
-
-   protected URI getEndpointOfResourceInVDC(Object org, Object vDC, Object resource,
-         org.jclouds.trmk.vcloud_0_8.domain.VDC vDCObject) {
-      ReferenceType resourceEntity = vDCObject.getResourceEntities().get(resource);
-      if (resourceEntity == null)
-         throw new NoSuchElementException("entity " + resource + " in vdc " + vDC + ", org " + org + " not found in "
-               + vDCObject.getResourceEntities().keySet());
-      return resourceEntity.getHref();
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameVDCNameResourceNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameVDCNameResourceNameToEndpoint.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameVDCNameResourceNameToEndpoint.java
deleted file mode 100644
index e4fcfa4..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/binders/OrgNameVDCNameResourceNameToEndpoint.java
+++ /dev/null
@@ -1,81 +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.trmk.vcloud_0_8.binders;
-
-import static com.google.common.base.Preconditions.checkState;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.trmk.vcloud_0_8.domain.VDC;
-import org.jclouds.trmk.vcloud_0_8.endpoints.Org;
-
-import com.google.common.base.Supplier;
-/**
- * 
- * @author Adrian Cole
- */
-public abstract class OrgNameVDCNameResourceNameToEndpoint implements MapBinder {
-
-   protected final Supplier<Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>>> orgVDCMap;
-   protected final Supplier<ReferenceType> defaultOrg;
-   protected final Supplier<ReferenceType> defaultVDC;
-
-   @Inject
-   public OrgNameVDCNameResourceNameToEndpoint(
-         Supplier<Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>>> orgVDCMap,
-         @Org Supplier<ReferenceType> defaultOrg, @org.jclouds.trmk.vcloud_0_8.endpoints.VDC Supplier<ReferenceType> defaultVDC) {
-      this.orgVDCMap = orgVDCMap;
-      this.defaultOrg = defaultOrg;
-      this.defaultVDC = defaultVDC;
-   }
-
-   @SuppressWarnings("unchecked")
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
-      Object org = postParams.get("orgName");
-      Object vDC = postParams.get("vdcName");
-      Object resource = postParams.get("resourceName");
-      if (org == null)
-         org = defaultOrg.get().getName();
-      if (vDC == null)
-         vDC = defaultVDC.get().getName();
-      Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>> orgToVDCs = orgVDCMap.get();
-      checkState(orgToVDCs != null, "could not get map of org name to vdcs!");
-      Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC> vDCs = orgToVDCs.get(org);
-      if (vDCs == null)
-         throw new NoSuchElementException("org " + org + " not found in " + orgToVDCs.keySet());
-      org.jclouds.trmk.vcloud_0_8.domain.VDC vDCObject = vDCs.get(vDC);
-      if (vDCObject == null)
-         throw new NoSuchElementException("vdc " + vDC + " in org " + org + " not found in " + vDCs.keySet());
-      URI endpoint = getEndpointOfResourceInVDC(org, vDC, resource, vDCObject);
-      return (R) request.toBuilder().endpoint(endpoint).build();
-   }
-
-   protected abstract URI getEndpointOfResourceInVDC(Object org, Object vDC, Object resource, VDC vDCObject);
-
-   @Override
-   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
-      throw new IllegalStateException(getClass() + " needs parameters");
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/TerremarkVCloudComputeClient.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/TerremarkVCloudComputeClient.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/TerremarkVCloudComputeClient.java
deleted file mode 100644
index 3d21a7f..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/TerremarkVCloudComputeClient.java
+++ /dev/null
@@ -1,393 +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.trmk.vcloud_0_8.compute;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.getLast;
-import static org.jclouds.trmk.vcloud_0_8.options.AddInternetServiceOptions.Builder.withDescription;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.ComputeServiceAdapter;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.Credentials;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
-import org.jclouds.trmk.vcloud_0_8.domain.InternetService;
-import org.jclouds.trmk.vcloud_0_8.domain.Node;
-import org.jclouds.trmk.vcloud_0_8.domain.Protocol;
-import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress;
-import org.jclouds.trmk.vcloud_0_8.domain.Status;
-import org.jclouds.trmk.vcloud_0_8.domain.Task;
-import org.jclouds.trmk.vcloud_0_8.domain.TaskStatus;
-import org.jclouds.trmk.vcloud_0_8.domain.TasksList;
-import org.jclouds.trmk.vcloud_0_8.domain.VApp;
-import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate;
-import org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions;
-import org.jclouds.trmk.vcloud_0_8.suppliers.InternetServiceAndPublicIpAddressSupplier;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class TerremarkVCloudComputeClient {
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   protected final TerremarkVCloudApi client;
-   protected final Provider<String> passwordGenerator;
-   protected final InternetServiceAndPublicIpAddressSupplier internetServiceAndPublicIpAddressSupplier;
-   protected final Map<Status, NodeMetadata.Status> vAppStatusToNodeStatus;
-   protected final Predicate<URI> taskTester;
-
-   @Inject
-   protected TerremarkVCloudComputeClient(TerremarkVCloudApi client,
-         @Named("PASSWORD") Provider<String> passwordGenerator, Predicate<URI> successTester,
-         Map<Status, NodeMetadata.Status> vAppStatusToNodeStatus, Map<String, Credentials> credentialStore,
-         InternetServiceAndPublicIpAddressSupplier internetServiceAndPublicIpAddressSupplier) {
-      this.client = client;
-      this.passwordGenerator = passwordGenerator;
-      this.internetServiceAndPublicIpAddressSupplier = internetServiceAndPublicIpAddressSupplier;
-      this.vAppStatusToNodeStatus = vAppStatusToNodeStatus;
-      this.taskTester = successTester;
-   }
-
-   protected Status getStatus(VApp vApp) {
-      return vApp.getStatus();
-   }
-   
-   public ComputeServiceAdapter.NodeAndInitialCredentials<VApp> startAndReturnCredentials(@Nullable URI VDC, URI templateId, String name, InstantiateVAppTemplateOptions options,
-            int... portsToOpen) {
-      // we only get IP addresses after "deploy"
-      if (portsToOpen.length > 0 && !options.shouldBlock())
-         throw new IllegalArgumentException("We cannot open ports on terremark unless we can deploy the vapp");
-      String password = null;
-      VAppTemplate template = client.getVAppTemplate(templateId);
-      if (template.getDescription().indexOf("Windows") != -1) {
-         password = passwordGenerator.get();
-         options.getProperties().put("password", password);
-      }
-      checkNotNull(options, "options");
-      logger.debug(">> instantiating vApp vDC(%s) template(%s) name(%s) options(%s) ", VDC, templateId, name, options);
-
-      VApp vAppResponse = client.instantiateVAppTemplateInVDC(VDC, templateId, name, options);
-      logger.debug("<< instantiated VApp(%s)", vAppResponse.getName());
-      if (options.shouldDeploy()) {
-         logger.debug(">> deploying vApp(%s)", vAppResponse.getName());
-
-         Task task = client.deployVApp(vAppResponse.getHref());
-         if (options.shouldBlock()) {
-            if (!taskTester.apply(task.getHref())) {
-               throw new RuntimeException(String.format("failed to %s %s: %s", "deploy", vAppResponse.getName(), task));
-            }
-            logger.debug("<< deployed vApp(%s)", vAppResponse.getName());
-            if (options.shouldPowerOn()) {
-               logger.debug(">> powering vApp(%s)", vAppResponse.getName());
-               task = client.powerOnVApp(vAppResponse.getHref());
-               if (!taskTester.apply(task.getHref())) {
-                  throw new RuntimeException(String.format("failed to %s %s: %s", "powerOn", vAppResponse.getName(),
-                        task));
-               }
-               logger.debug("<< on vApp(%s)", vAppResponse.getName());
-            }
-         }
-      }
-      if (portsToOpen.length > 0)
-         createPublicAddressMappedToPorts(vAppResponse.getHref(), portsToOpen);
-      return new ComputeServiceAdapter.NodeAndInitialCredentials<VApp>(vAppResponse, vAppResponse.getHref().toASCIIString(), password!= null?LoginCredentials.builder().password(password).build():null);
-   }
-   
-   /**
-    * Runs through all commands necessary to startup a vApp, opening at least
-    * one ip address to the public network. These are the steps:
-    * <p/>
-    * instantiate -> deploy -> powerOn
-    * <p/>
-    * This command blocks until the vApp is in state {@code VAppStatus#ON}
-    * 
-    * @param VDC
-    *           id of the virtual datacenter {@code VCloudClient#getDefaultVDC}
-    * @param templateId
-    *           id of the vAppTemplate you wish to instantiate
-    * @param name
-    *           name of the vApp
-    * @param cores
-    *           amount of virtual cpu cores
-    * @param megs
-    *           amount of ram in megabytes
-    * @param options
-    *           options for instantiating the vApp; null is ok
-    * @param portsToOpen
-    *           opens the following ports on the public ip address
-    * @return map contains at least the following properties
-    *         <ol>
-    *         <li>id - vApp id</li> <li>username - console login user</li> <li>
-    *         password - console login password</li>
-    *         </ol>
-    */
-   public VApp start(@Nullable URI VDC, URI templateId, String name, InstantiateVAppTemplateOptions options,
-            int... portsToOpen) {
-      return startAndReturnCredentials(VDC, templateId, name, options, portsToOpen).getNode();
-   }
-
-   public String createPublicAddressMappedToPorts(URI vAppId, int... ports) {
-      VApp vApp = client.getVApp(vAppId);
-      PublicIpAddress ip = null;
-      String privateAddress = getLast(vApp.getNetworkToAddresses().values());
-      for (int port : ports) {
-         InternetService is = null;
-         Protocol protocol;
-         switch (port) {
-         case 22:
-            protocol = Protocol.TCP;
-            break;
-         case 80:
-         case 8080:
-            protocol = Protocol.HTTP;
-            break;
-         case 443:
-            protocol = Protocol.HTTPS;
-            break;
-         default:
-            protocol = Protocol.HTTP;
-            break;
-         }
-         if (ip == null) {
-
-            Entry<InternetService, PublicIpAddress> entry = internetServiceAndPublicIpAddressSupplier
-                  .getNewInternetServiceAndIp(vApp, port, protocol);
-            is = entry.getKey();
-            ip = entry.getValue();
-
-         } else {
-            logger.debug(">> adding InternetService %s:%s:%d", ip.getAddress(), protocol, port);
-            is = client.addInternetServiceToExistingIp(
-                  ip.getId(),
-                  vApp.getName() + "-" + port,
-                  protocol,
-                  port,
-                  withDescription(String.format("port %d access to serverId: %s name: %s", port, vApp.getName(),
-                        vApp.getName())));
-         }
-         logger.debug("<< created InternetService(%s) %s:%s:%d", is.getName(), is.getPublicIpAddress().getAddress(),
-               is.getProtocol(), is.getPort());
-         logger.debug(">> adding Node %s:%d -> %s:%d", is.getPublicIpAddress().getAddress(), is.getPort(),
-               privateAddress, port);
-         Node node = client.addNode(is.getId(), privateAddress, vApp.getName() + "-" + port, port);
-         logger.debug("<< added Node(%s)", node.getName());
-      }
-      return ip != null ? ip.getAddress() : null;
-   }
-
-   private Set<PublicIpAddress> deleteInternetServicesAndNodesAssociatedWithVApp(VApp vApp) {
-      checkNotNull(vApp.getVDC(), "VDC reference missing for vApp(%s)", vApp.getName());
-      Set<PublicIpAddress> ipAddresses = Sets.newHashSet();
-      SERVICE: for (InternetService service : client.getAllInternetServicesInVDC(vApp.getVDC().getHref())) {
-         for (Node node : client.getNodes(service.getId())) {
-            if (vApp.getNetworkToAddresses().containsValue(node.getIpAddress())) {
-               ipAddresses.add(service.getPublicIpAddress());
-               logger.debug(">> deleting Node(%s) %s:%d -> %s:%d", node.getName(), service.getPublicIpAddress()
-                     .getAddress(), service.getPort(), node.getIpAddress(), node.getPort());
-               client.deleteNode(node.getId());
-               logger.debug("<< deleted Node(%s)", node.getName());
-               Set<Node> nodes = client.getNodes(service.getId());
-               if (nodes.size() == 0) {
-                  logger.debug(">> deleting InternetService(%s) %s:%d", service.getName(), service.getPublicIpAddress()
-                        .getAddress(), service.getPort());
-                  client.deleteInternetService(service.getId());
-                  logger.debug("<< deleted InternetService(%s)", service.getName());
-                  continue SERVICE;
-               }
-            }
-         }
-      }
-      return ipAddresses;
-   }
-
-   private void deletePublicIpAddressesWithNoServicesAttached(Set<PublicIpAddress> ipAddresses) {
-      IPADDRESS: for (PublicIpAddress address : ipAddresses) {
-         Set<InternetService> services = client.getInternetServicesOnPublicIp(address.getId());
-         if (services.size() == 0) {
-            logger.debug(">> deleting PublicIpAddress(%s) %s", address.getId(), address.getAddress());
-            try {
-               client.deletePublicIp(address.getId());
-               logger.debug("<< deleted PublicIpAddress(%s)", address.getId());
-            } catch (Exception e) {
-               logger.trace("cannot delete PublicIpAddress(%s) as it is unsupported", address.getId());
-            }
-            continue IPADDRESS;
-         }
-      }
-   }
-
-   /**
-    * Destroys dependent resources, powers off and deletes the vApp, blocking
-    * until the following state transition is complete:
-    * <p/>
-    * current -> {@code VAppStatus#OFF} -> deleted
-    * <p/>
-    * * deletes the internet service and nodes associated with the vapp. Deletes
-    * the IP address, if there are no others using it. Finally, it powers off
-    * and deletes the vapp. Note that we do not call undeploy, as terremark does
-    * not support the command.
-    * 
-    * @param vAppId
-    *           vApp to stop
-    */
-   public void stop(URI id) {
-      VApp vApp = client.getVApp(id);
-      if (vApp == null)
-         return;
-      Set<PublicIpAddress> ipAddresses = deleteInternetServicesAndNodesAssociatedWithVApp(vApp);
-      deletePublicIpAddressesWithNoServicesAttached(ipAddresses);
-      if (vApp.getStatus() != Status.OFF) {
-         try {
-            powerOffAndWait(vApp);
-         } catch (IllegalStateException e) {
-            logger.warn("<< %s vApp(%s)", e.getMessage(), vApp.getName());
-            blockOnLastTask(vApp);
-            powerOffAndWait(vApp);
-         }
-         vApp = client.getVApp(id);
-         logger.debug("<< %s vApp(%s)", vApp.getStatus(), vApp.getName());
-      }
-      logger.debug(">> deleting vApp(%s)", vApp.getName());
-      client.deleteVApp(id);
-      logger.debug("<< deleted vApp(%s))", vApp.getName());
-   }
-
-   private void powerOffAndWait(VApp vApp) {
-      logger.debug(">> powering off vApp(%s), current status: %s", vApp.getName(), vApp.getStatus());
-      Task task = client.powerOffVApp(vApp.getHref());
-      if (!taskTester.apply(task.getHref()))
-         throw new RuntimeException(String.format("failed to %s %s: %s", "powerOff", vApp.getName(), task));
-   }
-
-   void blockOnLastTask(VApp vApp) {
-      TasksList list = client.findTasksListInOrgNamed(null, null);
-      try {
-         Task lastTask = getLast(filter(list.getTasks(), new Predicate<Task>() {
-
-            public boolean apply(Task input) {
-               return input.getStatus() == TaskStatus.QUEUED || input.getStatus() == TaskStatus.RUNNING;
-            }
-
-         }));
-         if (!taskTester.apply(lastTask.getHref()))
-            throw new RuntimeException(String.format("failed to %s %s: %s", "powerOff", vApp.getName(), lastTask));
-      } catch (NoSuchElementException ex) {
-
-      }
-   }
-
-   /**
-    * returns a set of addresses that are only visible to the private network.
-    * 
-    * @returns empty set if the node is not found
-    */
-   public Set<String> getPrivateAddresses(URI id) {
-      VApp vApp = client.getVApp(id);
-      if (vApp != null)
-         return Sets.newHashSet(vApp.getNetworkToAddresses().values());
-      else
-         return ImmutableSet.<String> of();
-   }
-
-   /**
-    * returns a set of addresses that are publically visible
-    * 
-    * @returns empty set if the node is not found
-    */
-   public Set<String> getPublicAddresses(URI id) {
-      VApp vApp = client.getVApp(id);
-      if (vApp != null) {
-         Set<String> ipAddresses = Sets.newHashSet();
-         for (InternetService service : client.getAllInternetServicesInVDC(vApp.getVDC().getHref())) {
-            for (Node node : client.getNodes(service.getId())) {
-               if (vApp.getNetworkToAddresses().containsValue(node.getIpAddress())) {
-                  ipAddresses.add(service.getPublicIpAddress().getAddress());
-               }
-            }
-         }
-         return ipAddresses;
-      } else {
-         return ImmutableSet.<String> of();
-      }
-   }
-
-   /**
-    * reboots the vApp, blocking until the following state transition is
-    * complete:
-    * <p/>
-    * current -> {@code VAppStatus#OFF} -> {@code VAppStatus#ON}
-    * 
-    * @param vAppId
-    *           vApp to reboot
-    */
-   public void reset(URI id) {
-      VApp vApp = refreshVApp(id);
-      logger.debug(">> resetting vApp(%s)", vApp.getName());
-      Task task = reset(vApp);
-      if (!taskTester.apply(task.getHref())) {
-         throw new RuntimeException(String.format("failed to %s %s: %s", "resetVApp", vApp.getName(), task));
-      }
-      logger.debug("<< on vApp(%s)", vApp.getName());
-   }
-
-   protected void deleteVApp(VApp vApp) {
-      logger.debug(">> deleting vApp(%s)", vApp.getName());
-      Task task = client.deleteVApp(vApp.getHref());
-      if (task != null)
-         if (!taskTester.apply(task.getHref()))
-            throw new RuntimeException(String.format("failed to %s %s: %s", "delete", vApp.getName(), task));
-   }
-
-   protected VApp refreshVApp(URI id) {
-      return client.getVApp(id);
-   }
-
-   protected Task powerOff(VApp vApp) {
-      return client.powerOffVApp(vApp.getHref());
-   }
-
-   protected Task reset(VApp vApp) {
-      return client.resetVApp(vApp.getHref());
-   }
-
-   protected Task undeploy(VApp vApp) {
-      return client.undeployVApp(vApp.getHref());
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/TerremarkVCloudComputeService.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/TerremarkVCloudComputeService.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/TerremarkVCloudComputeService.java
deleted file mode 100644
index b37e85e..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/TerremarkVCloudComputeService.java
+++ /dev/null
@@ -1,114 +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.trmk.vcloud_0_8.compute;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_SUSPENDED;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.collect.Memoized;
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.compute.callables.RunScriptOnNode;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.TemplateBuilder;
-import org.jclouds.compute.extensions.ImageExtension;
-import org.jclouds.compute.extensions.SecurityGroupExtension;
-import org.jclouds.compute.internal.BaseComputeService;
-import org.jclouds.compute.internal.PersistNodeCredentials;
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
-import org.jclouds.compute.strategy.CreateNodesInGroupThenAddToSet;
-import org.jclouds.compute.strategy.DestroyNodeStrategy;
-import org.jclouds.compute.strategy.GetImageStrategy;
-import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
-import org.jclouds.compute.strategy.InitializeRunScriptOnNodeOrPlaceInBadMap;
-import org.jclouds.compute.strategy.ListNodesStrategy;
-import org.jclouds.compute.strategy.RebootNodeStrategy;
-import org.jclouds.compute.strategy.ResumeNodeStrategy;
-import org.jclouds.compute.strategy.SuspendNodeStrategy;
-import org.jclouds.domain.Credentials;
-import org.jclouds.domain.Location;
-import org.jclouds.scriptbuilder.functions.InitAdminAccess;
-import org.jclouds.trmk.vcloud_0_8.compute.options.TerremarkVCloudTemplateOptions;
-import org.jclouds.trmk.vcloud_0_8.compute.strategy.CleanupOrphanKeys;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class TerremarkVCloudComputeService extends BaseComputeService {
-   private final CleanupOrphanKeys cleanupOrphanKeys;
-
-   @Inject
-   protected TerremarkVCloudComputeService(ComputeServiceContext context, Map<String, Credentials> credentialStore,
-            @Memoized Supplier<Set<? extends Image>> images, @Memoized Supplier<Set<? extends Hardware>> sizes,
-            @Memoized Supplier<Set<? extends Location>> locations, ListNodesStrategy listNodesStrategy,
-            GetImageStrategy getImageStrategy, GetNodeMetadataStrategy getNodeMetadataStrategy,
-            CreateNodesInGroupThenAddToSet runNodesAndAddToSetStrategy, RebootNodeStrategy rebootNodeStrategy,
-            DestroyNodeStrategy destroyNodeStrategy, ResumeNodeStrategy resumeNodeStrategy,
-            SuspendNodeStrategy suspendNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider,
-            @Named("DEFAULT") Provider<TemplateOptions> templateOptionsProvider,
-            @Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
-            @Named(TIMEOUT_NODE_TERMINATED) Predicate<AtomicReference<NodeMetadata>> nodeTerminated,
-            @Named(TIMEOUT_NODE_SUSPENDED) Predicate<AtomicReference<NodeMetadata>> nodeSuspended,
-            InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory,
-            RunScriptOnNode.Factory runScriptOnNodeFactory, InitAdminAccess initAdminAccess,
-            PersistNodeCredentials persistNodeCredentials, Timeouts timeouts,
-            @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, CleanupOrphanKeys cleanupOrphanKeys,
-            Optional<ImageExtension> imageExtension, Optional<SecurityGroupExtension> securityGroupExtension) {
-      super(context, credentialStore, images, sizes, locations, listNodesStrategy, getImageStrategy,
-               getNodeMetadataStrategy, runNodesAndAddToSetStrategy, rebootNodeStrategy, destroyNodeStrategy,
-               resumeNodeStrategy, suspendNodeStrategy, templateBuilderProvider, templateOptionsProvider, nodeRunning,
-               nodeTerminated, nodeSuspended, initScriptRunnerFactory, initAdminAccess, runScriptOnNodeFactory,
-               persistNodeCredentials, timeouts, userExecutor, imageExtension, securityGroupExtension);
-      this.cleanupOrphanKeys = cleanupOrphanKeys;
-   }
-
-   /**
-    * Cleans implicit keypairs.
-    */
-   @Override
-   protected void cleanUpIncidentalResourcesOfDeadNodes(Set<? extends NodeMetadata> deadNodes) {
-      cleanupOrphanKeys.execute(deadNodes);
-   }
-
-   /**
-    * returns template options, except of type
-    * {@link TerremarkVCloudTemplateOptions}.
-    */
-   @Override
-   public TerremarkVCloudTemplateOptions templateOptions() {
-      return TerremarkVCloudTemplateOptions.class.cast(super.templateOptions());
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/config/TerremarkBindComputeStrategiesByClass.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/config/TerremarkBindComputeStrategiesByClass.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/config/TerremarkBindComputeStrategiesByClass.java
deleted file mode 100644
index 5efc0e1..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/config/TerremarkBindComputeStrategiesByClass.java
+++ /dev/null
@@ -1,86 +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.trmk.vcloud_0_8.compute.config;
-
-import org.jclouds.compute.config.BindComputeStrategiesByClass;
-import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName;
-import org.jclouds.compute.strategy.CreateNodesInGroupThenAddToSet;
-import org.jclouds.compute.strategy.DestroyNodeStrategy;
-import org.jclouds.compute.strategy.GetImageStrategy;
-import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
-import org.jclouds.compute.strategy.ListNodesStrategy;
-import org.jclouds.compute.strategy.RebootNodeStrategy;
-import org.jclouds.compute.strategy.ResumeNodeStrategy;
-import org.jclouds.compute.strategy.SuspendNodeStrategy;
-import org.jclouds.trmk.vcloud_0_8.compute.strategy.StartVAppWithGroupEncodedIntoName;
-import org.jclouds.trmk.vcloud_0_8.compute.strategy.TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy;
-import org.jclouds.trmk.vcloud_0_8.compute.strategy.TerremarkVCloudDestroyNodeStrategy;
-import org.jclouds.trmk.vcloud_0_8.compute.strategy.TerremarkVCloudGetImageStrategy;
-import org.jclouds.trmk.vcloud_0_8.compute.strategy.TerremarkVCloudGetNodeMetadataStrategy;
-import org.jclouds.trmk.vcloud_0_8.compute.strategy.TerremarkVCloudLifeCycleStrategy;
-import org.jclouds.trmk.vcloud_0_8.compute.strategy.TerremarkVCloudListNodesStrategy;
-
-/**
- * @author Adrian Cole
- */
-public class TerremarkBindComputeStrategiesByClass extends BindComputeStrategiesByClass {
-
-   @Override
-   protected Class<? extends DestroyNodeStrategy> defineDestroyNodeStrategy() {
-      return TerremarkVCloudDestroyNodeStrategy.class;
-   }
-
-   @Override
-   protected Class<? extends GetNodeMetadataStrategy> defineGetNodeMetadataStrategy() {
-      return TerremarkVCloudGetNodeMetadataStrategy.class;
-   }
-
-   @Override
-   protected Class<? extends GetImageStrategy> defineGetImageStrategy() {
-      return TerremarkVCloudGetImageStrategy.class;
-   }
-
-   @Override
-   protected Class<? extends ListNodesStrategy> defineListNodesStrategy() {
-      return TerremarkVCloudListNodesStrategy.class;
-   }
-
-   @Override
-   protected Class<? extends RebootNodeStrategy> defineRebootNodeStrategy() {
-      return TerremarkVCloudLifeCycleStrategy.class;
-   }
-
-   @Override
-   protected Class<? extends ResumeNodeStrategy> defineStartNodeStrategy() {
-      return TerremarkVCloudLifeCycleStrategy.class;
-   }
-
-   @Override
-   protected Class<? extends SuspendNodeStrategy> defineStopNodeStrategy() {
-      return TerremarkVCloudLifeCycleStrategy.class;
-   }
-
-   @Override
-   protected Class<? extends CreateNodesInGroupThenAddToSet> defineRunNodesAndAddToSetStrategy() {
-      return TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy.class;
-   }
-
-   @Override
-   protected Class<? extends CreateNodeWithGroupEncodedIntoName> defineAddNodeWithTagStrategy() {
-      return StartVAppWithGroupEncodedIntoName.class;
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/config/TerremarkBindComputeSuppliersByClass.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/config/TerremarkBindComputeSuppliersByClass.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/config/TerremarkBindComputeSuppliersByClass.java
deleted file mode 100644
index 55fd77d..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/config/TerremarkBindComputeSuppliersByClass.java
+++ /dev/null
@@ -1,44 +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.trmk.vcloud_0_8.compute.config;
-
-
-import java.util.Set;
-
-import org.jclouds.compute.config.BindComputeSuppliersByClass;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.trmk.vcloud_0_8.compute.suppliers.StaticHardwareSupplier;
-import org.jclouds.trmk.vcloud_0_8.compute.suppliers.VAppTemplatesInOrgs;
-
-import com.google.common.base.Supplier;
-
-/**
- * @author Adrian Cole
- */
-public class TerremarkBindComputeSuppliersByClass extends BindComputeSuppliersByClass {
-   @Override
-   protected Class<? extends Supplier<Set<? extends Hardware>>> defineHardwareSupplier() {
-      return StaticHardwareSupplier.class;
-   }
-
-   @Override
-   protected Class<? extends Supplier<Set<? extends Image>>> defineImageSupplier() {
-      return VAppTemplatesInOrgs.class;
-   }
-
-}