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:35 UTC

[15/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/compute/config/TerremarkVCloudComputeServiceContextModule.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/config/TerremarkVCloudComputeServiceContextModule.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/config/TerremarkVCloudComputeServiceContextModule.java
deleted file mode 100644
index 09749fd..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/config/TerremarkVCloudComputeServiceContextModule.java
+++ /dev/null
@@ -1,135 +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.security.SecureRandom;
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.config.BaseComputeServiceContextModule;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
-import org.jclouds.trmk.vcloud_0_8.compute.TerremarkVCloudComputeService;
-import org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName;
-import org.jclouds.trmk.vcloud_0_8.compute.functions.ImageForVCloudExpressVAppTemplate;
-import org.jclouds.trmk.vcloud_0_8.compute.functions.ImagesInVCloudExpressOrg;
-import org.jclouds.trmk.vcloud_0_8.compute.functions.NodeMetadataToOrgAndName;
-import org.jclouds.trmk.vcloud_0_8.compute.functions.ParseOsFromVAppTemplateName;
-import org.jclouds.trmk.vcloud_0_8.compute.functions.VAppToNodeMetadata;
-import org.jclouds.trmk.vcloud_0_8.compute.options.TerremarkVCloudTemplateOptions;
-import org.jclouds.trmk.vcloud_0_8.compute.strategy.ParseVAppTemplateDescriptionToGetDefaultLoginCredentials;
-import org.jclouds.trmk.vcloud_0_8.domain.Org;
-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.VAppTemplate;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableMap;
-import com.google.inject.Provides;
-import com.google.inject.TypeLiteral;
-
-/**
- * Configures the {@link TerremarkVCloudComputeServiceContext}; requires
- * {@link TerremarkVCloudComputeClientImpl} bound.
- * 
- * @author Adrian Cole
- */
-public class TerremarkVCloudComputeServiceContextModule extends BaseComputeServiceContextModule {
-
-   @VisibleForTesting
-   public static final Map<Status, NodeMetadata.Status> toPortableNodeStatus = ImmutableMap
-            .<Status, NodeMetadata.Status> builder()
-            .put(Status.OFF, NodeMetadata.Status.SUSPENDED)
-            .put(Status.ON, NodeMetadata.Status.RUNNING)
-            .put(Status.RESOLVED, NodeMetadata.Status.PENDING)
-            .put(Status.UNRECOGNIZED, NodeMetadata.Status.UNRECOGNIZED)
-            .put(Status.DEPLOYED, NodeMetadata.Status.PENDING)
-            .put(Status.SUSPENDED, NodeMetadata.Status.SUSPENDED)
-            .put(Status.UNRESOLVED, NodeMetadata.Status.PENDING).build();
-
-   @Singleton
-   @Provides
-   protected Map<Status, NodeMetadata.Status> toPortableNodeStatus() {
-      return toPortableNodeStatus;
-   }
-   
-   @VisibleForTesting
-   public static final Map<Status, Image.Status> toPortableImageStatus = ImmutableMap
-            .<Status, Image.Status> builder()
-            .put(Status.RESOLVED, Image.Status.AVAILABLE)
-            .put(Status.OFF, Image.Status.AVAILABLE)
-            .put(Status.UNRECOGNIZED, Image.Status.UNRECOGNIZED)
-            .put(Status.DEPLOYED, Image.Status.PENDING)
-            .put(Status.UNRESOLVED, Image.Status.PENDING).build();
-
-   @Singleton
-   @Provides
-   protected Map<Status, Image.Status> toPortableImageStatus() {
-      return toPortableImageStatus;
-   }
-   
-   @Override
-   protected void configure() {
-      super.configure();
-      bind(new TypeLiteral<Function<NodeMetadata, OrgAndName>>() {
-      }).to(new TypeLiteral<NodeMetadataToOrgAndName>() {
-      });
-      bind(TemplateOptions.class).to(TerremarkVCloudTemplateOptions.class);
-      bind(ComputeService.class).to(TerremarkVCloudComputeService.class);
-      bind(PopulateDefaultLoginCredentialsForImageStrategy.class).to(
-            ParseVAppTemplateDescriptionToGetDefaultLoginCredentials.class);
-      bind(SecureRandom.class).toInstance(new SecureRandom());
-      install(new TerremarkBindComputeStrategiesByClass());
-      install(new TerremarkBindComputeSuppliersByClass());
-      bind(new TypeLiteral<Function<VApp, NodeMetadata>>() {
-      }).to(VAppToNodeMetadata.class);
-      bind(new TypeLiteral<Function<VAppTemplate, Image>>() {
-      }).to(ImageForVCloudExpressVAppTemplate.class);
-      bind(new TypeLiteral<Function<Org, Iterable<? extends Image>>>() {
-      }).to(new TypeLiteral<ImagesInVCloudExpressOrg>() {
-      });
-      bind(new TypeLiteral<Function<String, OperatingSystem>>() {
-      }).to(ParseOsFromVAppTemplateName.class);
-   }
-
-   @Provides
-   @Singleton
-   Supplier<String> provideSuffix(final SecureRandom random) {
-      return new Supplier<String>() {
-         @Override
-         public String get() {
-            return random.nextInt(4096) + "";
-         }
-      };
-
-   }
-
-   @Named("PASSWORD")
-   @Provides
-   String providePassword(SecureRandom random) {
-      return random.nextLong() + "";
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/domain/OrgAndName.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/domain/OrgAndName.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/domain/OrgAndName.java
deleted file mode 100644
index a90a37f..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/domain/OrgAndName.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.compute.domain;
-
-import java.net.URI;
-
-/**
- * 
- * @author Adrian Cole
- */
-public class OrgAndName {
-   protected final URI org;
-   protected final String name;
-
-   public OrgAndName(URI org, String name) {
-      this.org = org;
-      this.name = name;
-   }
-
-   @Override
-   public int hashCode() {
-      final int prime = 31;
-      int result = 1;
-      result = prime * result + ((org == null) ? 0 : org.hashCode());
-      result = prime * result + ((name == null) ? 0 : name.hashCode());
-      return result;
-   }
-
-   @Override
-   public boolean equals(Object obj) {
-      if (this == obj)
-         return true;
-      if (obj == null)
-         return false;
-      if (getClass() != obj.getClass())
-         return false;
-      OrgAndName other = (OrgAndName) obj;
-      if (org == null) {
-         if (other.org != null)
-            return false;
-      } else if (!org.equals(other.org))
-         return false;
-      if (name == null) {
-         if (other.name != null)
-            return false;
-      } else if (!name.equals(other.name))
-         return false;
-      return true;
-   }
-
-   public URI getOrg() {
-      return org;
-   }
-
-   public String getName() {
-      return name;
-   }
-
-   @Override
-   public String toString() {
-      return "OrgTag [org=" + org + ", name=" + name + "]";
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/CreateUniqueKeyPair.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/CreateUniqueKeyPair.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/CreateUniqueKeyPair.java
deleted file mode 100644
index aab12b4..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/CreateUniqueKeyPair.java
+++ /dev/null
@@ -1,84 +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.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
-import org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName;
-import org.jclouds.trmk.vcloud_0_8.domain.KeyPair;
-import org.jclouds.util.Throwables2;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-
-/**
- * 
- * @author Adrian Cole
- */
-@Singleton
-public class CreateUniqueKeyPair implements Function<OrgAndName, KeyPair> {
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-   protected final TerremarkVCloudApi trmkClient;
-   protected Supplier<String> randomSuffix;
-
-   @Inject
-   CreateUniqueKeyPair(TerremarkVCloudApi trmkClient, Supplier<String> randomSuffix) {
-      this.trmkClient = trmkClient;
-      this.randomSuffix = randomSuffix;
-   }
-
-   @Override
-   public KeyPair apply(OrgAndName from) {
-      return createNewKeyPairInOrg(from.getOrg(), from.getName());
-   }
-
-   private KeyPair createNewKeyPairInOrg(URI org, String keyPairName) {
-      checkNotNull(org, "org");
-      checkNotNull(keyPairName, "keyPairName");
-      logger.debug(">> creating keyPair org(%s) name(%s)", org, keyPairName);
-      KeyPair keyPair = null;
-      while (keyPair == null) {
-         try {
-            keyPair = trmkClient.generateKeyPairInOrg(org, getNextName(keyPairName), false);
-            logger.debug("<< created keyPair(%s)", keyPair.getName());
-         } catch (RuntimeException e) {
-            HttpResponseException ht = Throwables2.getFirstThrowableOfType(e, HttpResponseException.class);
-            if (ht == null || ht.getContent() == null
-                  || ht.getContent().indexOf("Security key with same name exists") == -1)
-               throw e;
-         }
-      }
-      return keyPair;
-   }
-
-   private String getNextName(String keyPairName) {
-      return "jclouds_" + keyPairName.replaceAll("-", "_") + "_" + randomSuffix.get();
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/FindLocationForResource.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/FindLocationForResource.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/FindLocationForResource.java
deleted file mode 100644
index 99f53c8..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/FindLocationForResource.java
+++ /dev/null
@@ -1,69 +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.functions;
-
-import java.net.URI;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.collect.Memoized;
-import org.jclouds.domain.Location;
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class FindLocationForResource implements Function<ReferenceType, Location> {
-
-   @Resource
-   protected Logger logger = Logger.NULL;
-
-   final Supplier<Set<? extends Location>> locations;
-
-   @Inject
-   public FindLocationForResource(@Memoized Supplier<Set<? extends Location>> locations) {
-      this.locations = locations;
-   }
-
-   /**
-    * searches for a location associated with this resource.
-    * 
-    * @throws NoSuchElementException
-    *            if not found
-    */
-   public Location apply(ReferenceType resource) {
-      for (Location input : locations.get()) {
-         do {
-            // The "name" isn't always present, ex inside a vApp we have a rel
-            // link that only includes href and type.
-            if (URI.create(input.getId()).equals(resource.getHref()))
-               return input;
-         } while ((input = input.getParent()) != null);
-      }
-      throw new NoSuchElementException(String.format("resource: %s not found in locations: %s", resource,
-            locations.get()));
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/HardwareForVCloudExpressVApp.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/HardwareForVCloudExpressVApp.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/HardwareForVCloudExpressVApp.java
deleted file mode 100644
index 995686e..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/HardwareForVCloudExpressVApp.java
+++ /dev/null
@@ -1,70 +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.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.NoSuchElementException;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-
-import org.jclouds.cim.functions.HardwareBuilderFromResourceAllocations;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.HardwareBuilder;
-import org.jclouds.compute.predicates.ImagePredicates;
-import org.jclouds.domain.Location;
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.trmk.vcloud_0_8.domain.VApp;
-
-import com.google.common.base.Function;
-
-/**
- * @author Adrian Cole
- */
-public class HardwareForVCloudExpressVApp implements Function<VApp, Hardware> {
-
-   @Resource
-   protected Logger logger = Logger.NULL;
-
-   private final Function<ReferenceType, Location> findLocationForResource;
-   private final HardwareBuilderFromResourceAllocations rasdToHardwareBuilder;
-
-   @Inject
-   protected HardwareForVCloudExpressVApp(Function<ReferenceType, Location> findLocationForResource,
-         HardwareBuilderFromResourceAllocations rasdToHardwareBuilder) {
-      this.findLocationForResource = checkNotNull(findLocationForResource, "findLocationForResource");
-      this.rasdToHardwareBuilder = checkNotNull(rasdToHardwareBuilder, "rasdToHardwareBuilder");
-   }
-
-   @Override
-   public Hardware apply(VApp from) {
-      checkNotNull(from, "VApp");
-      try {
-         HardwareBuilder builder = rasdToHardwareBuilder.apply(from.getResourceAllocations());
-         builder.location(findLocationForResource.apply(checkNotNull(from, "from").getVDC()));
-         builder.ids(from.getHref().toASCIIString()).name(from.getName())
-               .supportsImage(ImagePredicates.idEquals(from.getHref().toASCIIString()));
-         builder.hypervisor("VMware");
-         return builder.build();
-      } catch (NoSuchElementException e) {
-         logger.debug("incomplete data to form vApp %s", from.getHref());
-         return null;
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/ImageForVCloudExpressVAppTemplate.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/ImageForVCloudExpressVAppTemplate.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/ImageForVCloudExpressVAppTemplate.java
deleted file mode 100644
index 9e46652..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/ImageForVCloudExpressVAppTemplate.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.trmk.vcloud_0_8.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.ImageBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.trmk.vcloud_0_8.domain.Status;
-import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate;
-
-import com.google.common.base.Function;
-
-/**
- * @author Adrian Cole
- */
-public class ImageForVCloudExpressVAppTemplate implements Function<VAppTemplate, Image> {
-   private final Map<Status, org.jclouds.compute.domain.Image.Status> toPortableImageStatus;
-   private final FindLocationForResource findLocationForResource;
-   private final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider;
-   private final Function<String, OperatingSystem> osParser;
-
-   private ReferenceType parent;
-
-   @Inject
-   protected ImageForVCloudExpressVAppTemplate(Map<Status, Image.Status> toPortableImageStatus, FindLocationForResource findLocationForResource,
-            PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider, Function<String, OperatingSystem> osParser) {
-      this.toPortableImageStatus = checkNotNull(toPortableImageStatus, "toPortableImageStatus");
-      this.findLocationForResource = checkNotNull(findLocationForResource, "findLocationForResource");
-      this.credentialsProvider = checkNotNull(credentialsProvider, "credentialsProvider");
-      this.osParser = osParser;
-   }
-
-   public ImageForVCloudExpressVAppTemplate withParent(ReferenceType parent) {
-      this.parent = parent;
-      return this;
-   }
-
-   @Override
-   public Image apply(@Nullable VAppTemplate from) {
-      if (from == null)
-         return null;
-      ImageBuilder builder = new ImageBuilder();
-      builder.ids(from.getHref().toASCIIString());
-      builder.uri(from.getHref());
-      builder.name(from.getName());
-      builder.location(findLocationForResource.apply(checkNotNull(parent, "parent")));
-      builder.description(from.getDescription() != null ? from.getDescription() : from.getName());
-      builder.operatingSystem(osParser.apply(from.getName()));
-      builder.status(toPortableImageStatus.get(from.getStatus()));
-      builder.defaultCredentials(credentialsProvider.apply(from));
-      return builder.build();
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/ImagesInVCloudExpressOrg.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/ImagesInVCloudExpressOrg.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/ImagesInVCloudExpressOrg.java
deleted file mode 100644
index 0550dbf..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/ImagesInVCloudExpressOrg.java
+++ /dev/null
@@ -1,62 +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.functions;
-
-import static com.google.common.base.Predicates.notNull;
-
-import javax.inject.Inject;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem;
-import org.jclouds.trmk.vcloud_0_8.domain.Org;
-import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate;
-import org.jclouds.trmk.vcloud_0_8.functions.AllCatalogItemsInOrg;
-
-import com.google.common.base.Function;
-import com.google.common.collect.FluentIterable;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class ImagesInVCloudExpressOrg implements Function<Org, Iterable<? extends Image>> {
-
-   private final AllCatalogItemsInOrg allCatalogItemsInOrg;
-   private final Function<Iterable<? extends CatalogItem>, Iterable<? extends VAppTemplate>> vAppTemplatesForCatalogItems;
-   private final Provider<ImageForVCloudExpressVAppTemplate> imageForVAppTemplateProvider;
-
-   @Inject
-   ImagesInVCloudExpressOrg(AllCatalogItemsInOrg allCatalogItemsInOrg,
-            Provider<ImageForVCloudExpressVAppTemplate> imageForVAppTemplateProvider,
-            Function<Iterable<? extends CatalogItem>, Iterable<? extends VAppTemplate>> vAppTemplatesForCatalogItems) {
-      this.imageForVAppTemplateProvider = imageForVAppTemplateProvider;
-      this.allCatalogItemsInOrg = allCatalogItemsInOrg;
-      this.vAppTemplatesForCatalogItems = vAppTemplatesForCatalogItems;
-   }
-
-   @Override
-   public Iterable<? extends Image> apply(Org from) {
-      Iterable<? extends CatalogItem> catalogs = allCatalogItemsInOrg.apply(from);
-      Iterable<? extends VAppTemplate> vAppTemplates = vAppTemplatesForCatalogItems.apply(catalogs);
-      return FluentIterable.from(vAppTemplates)
-                           .transform(imageForVAppTemplateProvider.get().withParent(from))
-                           .filter(notNull());
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/ImagesInVCloudExpressVDC.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/ImagesInVCloudExpressVDC.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/ImagesInVCloudExpressVDC.java
deleted file mode 100644
index c0fa47d..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/ImagesInVCloudExpressVDC.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.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate;
-import org.jclouds.trmk.vcloud_0_8.domain.VDC;
-import org.jclouds.trmk.vcloud_0_8.functions.VAppTemplatesForResourceEntities;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class ImagesInVCloudExpressVDC implements Function<VDC, Iterable<? extends Image>> {
-   private final VAppTemplatesForResourceEntities vAppTemplatesForResourceEntities;
-   private final ImageForVCloudExpressVAppTemplate imageForVAppTemplateProvider;
-
-   @Inject
-   public ImagesInVCloudExpressVDC(VAppTemplatesForResourceEntities vAppTemplatesForResourceEntities,
-            ImageForVCloudExpressVAppTemplate imageForVAppTemplateProvider) {
-      this.vAppTemplatesForResourceEntities = checkNotNull(vAppTemplatesForResourceEntities, "vAppTemplatesForResourceEntities");
-      this.imageForVAppTemplateProvider = checkNotNull(imageForVAppTemplateProvider, "imageForVAppTemplateProvider");
-   }
-
-   @Override
-   public Iterable<? extends Image> apply(VDC from) {
-      Iterable<? extends VAppTemplate> vAppTemplates = vAppTemplatesForResourceEntities.apply(checkNotNull(from, "vdc")
-               .getResourceEntities().values());
-      return Iterables.transform(vAppTemplates, imageForVAppTemplateProvider.withParent(from));
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/NodeMetadataToOrgAndName.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/NodeMetadataToOrgAndName.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/NodeMetadataToOrgAndName.java
deleted file mode 100644
index 95840b8..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/NodeMetadataToOrgAndName.java
+++ /dev/null
@@ -1,71 +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.functions;
-
-import java.util.Map;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
-import org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName;
-import org.jclouds.trmk.vcloud_0_8.domain.Org;
-import org.jclouds.trmk.vcloud_0_8.endpoints.VDC;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-
-/**
- * 
- * @author Adrian Cole
- * 
- */
-@Singleton
-public class NodeMetadataToOrgAndName implements Function<NodeMetadata, OrgAndName> {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   final Supplier<Map<String, String>> vdcToOrg;
-
-   private final TerremarkVCloudApi client;
-
-   @Inject
-   NodeMetadataToOrgAndName(TerremarkVCloudApi client, @VDC Supplier<Map<String, String>> vdcToOrg) {
-      this.vdcToOrg = vdcToOrg;
-      this.client = client;
-   }
-
-   @Override
-   public OrgAndName apply(NodeMetadata from) {
-      if (from.getGroup() != null) {
-         Org org = client.findOrgNamed(vdcToOrg.get().get(from.getLocation().getId()));
-         if (org == null) {
-            logger.warn("did not find an association for vdc %s in %s", from.getLocation().getId(), vdcToOrg);
-         } else {
-            return new OrgAndName(org.getHref(), from.getGroup());
-         }
-      }
-      return null;
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/ParseOsFromVAppTemplateName.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/ParseOsFromVAppTemplateName.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/ParseOsFromVAppTemplateName.java
deleted file mode 100644
index 41a99ba..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/ParseOsFromVAppTemplateName.java
+++ /dev/null
@@ -1,62 +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.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.compute.util.ComputeServiceUtils.parseOsFamilyOrUnrecognized;
-
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.util.ComputeServiceUtils;
-
-import com.google.common.base.Function;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class ParseOsFromVAppTemplateName implements Function<String, OperatingSystem> {
-   protected static final Pattern OS_PATTERN = Pattern.compile("(([^ ]*) ([0-9.]+) ?.*)");
-
-   protected final Map<OsFamily, Map<String, String>> osVersionMap;
-
-   @Inject
-   protected ParseOsFromVAppTemplateName(Map<OsFamily, Map<String, String>> osVersionMap) {
-      this.osVersionMap = checkNotNull(osVersionMap, "osVersionMap");
-   }
-
-   @Override
-   public OperatingSystem apply(String from) {
-      OperatingSystem.Builder builder = OperatingSystem.builder();
-      OsFamily osFamily = parseOsFamilyOrUnrecognized(checkNotNull(from, "vapp template name"));
-      builder.family(osFamily);
-      builder.description(from);
-      builder.is64Bit(from.indexOf("64") != -1);
-      Matcher matcher = OS_PATTERN.matcher(from);
-      if (matcher.find()) {
-         builder.version(ComputeServiceUtils.parseVersionOrReturnEmptyString(osFamily, matcher.group(3), osVersionMap));
-      }
-      return builder.build();
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/TemplateToInstantiateOptions.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/TemplateToInstantiateOptions.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/TemplateToInstantiateOptions.java
deleted file mode 100644
index c072e97..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/TemplateToInstantiateOptions.java
+++ /dev/null
@@ -1,47 +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.functions;
-
-import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
-import static org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions.Builder.processorCount;
-
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.Template;
-import org.jclouds.trmk.vcloud_0_8.compute.options.TerremarkVCloudTemplateOptions;
-import org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions;
-
-import com.google.common.base.Function;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class TemplateToInstantiateOptions implements Function<Template, InstantiateVAppTemplateOptions> {
-
-   @Override
-   public InstantiateVAppTemplateOptions apply(Template from) {
-      InstantiateVAppTemplateOptions options = processorCount(Double.valueOf(getCores(from.getHardware())).intValue())
-            .memory(from.getHardware().getRam());
-      if (!from.getOptions().shouldBlockUntilRunning())
-         options.block(false);
-      String sshKeyFingerprint = TerremarkVCloudTemplateOptions.class.cast(from.getOptions()).getSshKeyFingerprint();
-      if (sshKeyFingerprint != null)
-         options.sshKeyFingerprint(sshKeyFingerprint);
-      return options;
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/VAppToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/VAppToNodeMetadata.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/VAppToNodeMetadata.java
deleted file mode 100644
index 5d9e402..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/VAppToNodeMetadata.java
+++ /dev/null
@@ -1,105 +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.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.cim.OSType;
-import org.jclouds.collect.Memoized;
-import org.jclouds.compute.domain.CIMOperatingSystem;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.compute.util.ComputeServiceUtils;
-import org.jclouds.domain.Credentials;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.trmk.vcloud_0_8.compute.TerremarkVCloudComputeClient;
-import org.jclouds.trmk.vcloud_0_8.domain.Status;
-import org.jclouds.trmk.vcloud_0_8.domain.VApp;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class VAppToNodeMetadata implements Function<VApp, NodeMetadata> {
-
-   protected final TerremarkVCloudComputeClient computeClient;
-   protected final Map<String, Credentials> credentialStore;
-   protected final Supplier<Set<? extends Image>> images;
-   protected final FindLocationForResource findLocationForResourceInVDC;
-   protected final HardwareForVCloudExpressVApp hardwareForVCloudExpressVApp;
-   protected final Map<Status, NodeMetadata.Status> vAppStatusToNodeStatus;
-   protected final GroupNamingConvention nodeNamingConvention;
-
-   @Inject
-   protected VAppToNodeMetadata(TerremarkVCloudComputeClient computeClient, Map<String, Credentials> credentialStore,
-            Map<Status, NodeMetadata.Status> vAppStatusToNodeStatus, HardwareForVCloudExpressVApp hardwareForVCloudExpressVApp,
-            FindLocationForResource findLocationForResourceInVDC, @Memoized Supplier<Set<? extends Image>> images,
-            GroupNamingConvention.Factory namingConvention) {
-      this.nodeNamingConvention = checkNotNull(namingConvention, "namingConvention").createWithoutPrefix();
-      this.images = checkNotNull(images, "images");
-      this.hardwareForVCloudExpressVApp = checkNotNull(hardwareForVCloudExpressVApp, "hardwareForVCloudExpressVApp");
-      this.findLocationForResourceInVDC = checkNotNull(findLocationForResourceInVDC, "findLocationForResourceInVDC");
-      this.credentialStore = checkNotNull(credentialStore, "credentialStore");
-      this.computeClient = checkNotNull(computeClient, "computeClient");
-      this.vAppStatusToNodeStatus = checkNotNull(vAppStatusToNodeStatus, "vAppStatusToNodeStatus");
-   }
-
-   @Override
-   public NodeMetadata apply(VApp from) {
-      NodeMetadataBuilder builder = new NodeMetadataBuilder();
-      builder.ids(from.getHref().toASCIIString());
-      builder.uri(from.getHref());
-      builder.name(from.getName());
-      builder.hostname(from.getName());
-      Location vdcLocation = findLocationForResourceInVDC.apply(from.getVDC());
-      builder.location(vdcLocation);
-      if (from.getOsType() != null && OSType.fromValue(from.getOsType()) != OSType.UNRECOGNIZED) {
-         builder.operatingSystem(new CIMOperatingSystem(OSType.fromValue(from.getOsType()), "", null, from
-                  .getOperatingSystemDescription()));
-      } else if (from.getOperatingSystemDescription() != null) {
-         OperatingSystem.Builder osBuilder = new OperatingSystem.Builder();
-         if (from.getOsType() != null)
-            osBuilder.name(from.getOsType() + "");
-         osBuilder.family(ComputeServiceUtils.parseOsFamilyOrUnrecognized(from.getOperatingSystemDescription()));
-         osBuilder.version("");
-         osBuilder.is64Bit(from.getOperatingSystemDescription().indexOf("64") != -1);
-         osBuilder.description(from.getOperatingSystemDescription());
-         builder.operatingSystem(osBuilder.build());
-      }
-      builder.hardware(hardwareForVCloudExpressVApp.apply(from));
-      builder.status(vAppStatusToNodeStatus.get(from.getStatus()));
-      builder.publicAddresses(computeClient.getPublicAddresses(from.getHref()));
-      builder.privateAddresses(computeClient.getPrivateAddresses(from.getHref()));
-      builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getName()));
-      builder.credentials(LoginCredentials.fromCredentials(credentialStore
-               .get("node#" + from.getHref().toASCIIString())));
-      return builder.build();
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/options/TerremarkVCloudTemplateOptions.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/options/TerremarkVCloudTemplateOptions.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/options/TerremarkVCloudTemplateOptions.java
deleted file mode 100644
index c1d9f42..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/options/TerremarkVCloudTemplateOptions.java
+++ /dev/null
@@ -1,270 +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.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.base.Strings.emptyToNull;
-
-import java.util.Map;
-
-import org.jclouds.compute.options.TemplateOptions;
-
-/**
- * Contains options supported in the {@code ComputeService#runNode} operation on
- * the "trmk-vcloudexpress" provider. <h2>
- * Usage</h2> The recommended way to instantiate a
- * TerremarkVCloudTemplateOptions object is to statically import
- * TerremarkVCloudTemplateOptions.* and invoke a static creation method followed
- * by an instance mutator (if needed):
- * <p/>
- * <code>
- * import static org.jclouds.vcloud.terremark.compute.options.TerremarkVCloudTemplateOptions.Builder.*;
- * <p/>
- * ComputeService client = // get connection
- * templateBuilder.options(inboundPorts(22, 80, 8080, 443));
- * Set<? extends NodeMetadata> set = client.runNodesWithTag(tag, 2, templateBuilder.build());
- * <code>
- * 
- * @author Adrian Cole
- */
-public class TerremarkVCloudTemplateOptions extends TemplateOptions implements Cloneable {
-   @Override
-   public TerremarkVCloudTemplateOptions clone() {
-      TerremarkVCloudTemplateOptions options = new TerremarkVCloudTemplateOptions();
-      copyTo(options);
-      return options;
-   }
-
-   @Override
-   public void copyTo(TemplateOptions to) {
-      super.copyTo(to);
-      if (to instanceof TerremarkVCloudTemplateOptions) {
-         TerremarkVCloudTemplateOptions eTo = TerremarkVCloudTemplateOptions.class.cast(to);
-         if (noKeyPair)
-            eTo.noKeyPair();
-         if (keyPair != null)
-            eTo.keyPair = keyPair;
-      }
-   }
-
-   private String keyPair = null;
-   private boolean noKeyPair;
-
-   public static final TerremarkVCloudTemplateOptions NONE = new TerremarkVCloudTemplateOptions();
-
-   /**
-    * Specifies the keypair used to run instances with
-    */
-   public TerremarkVCloudTemplateOptions sshKeyFingerprint(String keyPair) {
-      checkState(!noKeyPair, "you cannot specify both options keyPair and noKeyPair");
-      this.keyPair = checkNotNull(emptyToNull(keyPair), "use noKeyPair option to request boot without a keypair");
-      return this;
-   }
-
-   /**
-    * Do not use a keypair on instances
-    */
-   public TerremarkVCloudTemplateOptions noKeyPair() {
-      checkState(keyPair == null, "you cannot specify both options keyPair and noKeyPair");
-      this.noKeyPair = true;
-      return this;
-   }
-
-   public static class Builder {
-
-      /**
-       * @see TerremarkVCloudTemplateOptions#sshKeyFingerprint
-       */
-      public static TerremarkVCloudTemplateOptions sshKeyFingerprint(String keyPair) {
-         TerremarkVCloudTemplateOptions options = new TerremarkVCloudTemplateOptions();
-         return TerremarkVCloudTemplateOptions.class.cast(options.sshKeyFingerprint(keyPair));
-      }
-
-      /**
-       * @see TerremarkVCloudTemplateOptions#noKeyPair
-       */
-      public static TerremarkVCloudTemplateOptions noKeyPair() {
-         TerremarkVCloudTemplateOptions options = new TerremarkVCloudTemplateOptions();
-         return TerremarkVCloudTemplateOptions.class.cast(options.noKeyPair());
-      }
-
-      // methods that only facilitate returning the correct object type
-      /**
-       * @see TemplateOptions#inboundPorts
-       */
-      public static TerremarkVCloudTemplateOptions inboundPorts(int... ports) {
-         TerremarkVCloudTemplateOptions options = new TerremarkVCloudTemplateOptions();
-         return TerremarkVCloudTemplateOptions.class.cast(options.inboundPorts(ports));
-      }
-
-      /**
-       * @see TemplateOptions#port
-       */
-      public static TerremarkVCloudTemplateOptions blockOnPort(int port, int seconds) {
-         TerremarkVCloudTemplateOptions options = new TerremarkVCloudTemplateOptions();
-         return TerremarkVCloudTemplateOptions.class.cast(options.blockOnPort(port, seconds));
-      }
-
-      /**
-       * @see TemplateOptions#blockUntilRunning
-       */
-      public static TerremarkVCloudTemplateOptions blockUntilRunning(boolean blockUntilRunning) {
-         TerremarkVCloudTemplateOptions options = new TerremarkVCloudTemplateOptions();
-         return TerremarkVCloudTemplateOptions.class.cast(options.blockUntilRunning(blockUntilRunning));
-      }
-
-      /**
-       * @see TemplateOptions#installPrivateKey
-       */
-      public static TerremarkVCloudTemplateOptions installPrivateKey(String rsaKey) {
-         TerremarkVCloudTemplateOptions options = new TerremarkVCloudTemplateOptions();
-         return TerremarkVCloudTemplateOptions.class.cast(options.installPrivateKey(rsaKey));
-      }
-
-      /**
-       * @see TemplateOptions#authorizePublicKey
-       */
-      public static TerremarkVCloudTemplateOptions authorizePublicKey(String rsaKey) {
-         TerremarkVCloudTemplateOptions options = new TerremarkVCloudTemplateOptions();
-         return TerremarkVCloudTemplateOptions.class.cast(options.authorizePublicKey(rsaKey));
-      }
-
-      /**
-       * @see TemplateOptions#userMetadata(Map)
-       */
-      public static TerremarkVCloudTemplateOptions userMetadata(Map<String, String> userMetadata) {
-         TerremarkVCloudTemplateOptions options = new TerremarkVCloudTemplateOptions();
-         return TerremarkVCloudTemplateOptions.class.cast(options.userMetadata(userMetadata));
-      }
-
-      /**
-       * @see TemplateOptions#userMetadata(String, String)
-       */
-      public static TerremarkVCloudTemplateOptions userMetadata(String key, String value) {
-         TerremarkVCloudTemplateOptions options = new TerremarkVCloudTemplateOptions();
-         return TerremarkVCloudTemplateOptions.class.cast(options.userMetadata(key, value));
-      }
-   }
-
-   // methods that only facilitate returning the correct object type
-
-   /**
-    * @see TemplateOptions#blockOnPort
-    */
-   @Override
-   public TerremarkVCloudTemplateOptions blockOnPort(int port, int seconds) {
-      return TerremarkVCloudTemplateOptions.class.cast(super.blockOnPort(port, seconds));
-   }
-
-   /**
-    * 
-    * special thing is that we do assume if you are passing groups that you have
-    * everything you need already defined. for example, our option inboundPorts
-    * normally creates ingress rules accordingly but if we notice you've
-    * specified securityGroups, we do not mess with rules at all
-    * 
-    * @see TemplateOptions#inboundPorts
-    */
-   @Override
-   public TerremarkVCloudTemplateOptions inboundPorts(int... ports) {
-      return TerremarkVCloudTemplateOptions.class.cast(super.inboundPorts(ports));
-   }
-
-   /**
-    * @see TemplateOptions#authorizePublicKey(String)
-    */
-   @Override
-   public TerremarkVCloudTemplateOptions authorizePublicKey(String publicKey) {
-      return TerremarkVCloudTemplateOptions.class.cast(super.authorizePublicKey(publicKey));
-   }
-
-   /**
-    * @see TemplateOptions#installPrivateKey(String)
-    */
-   @Override
-   public TerremarkVCloudTemplateOptions installPrivateKey(String privateKey) {
-      return TerremarkVCloudTemplateOptions.class.cast(super.installPrivateKey(privateKey));
-   }
-
-   /**
-    * @see TemplateOptions#userMetadata
-    */
-   public TerremarkVCloudTemplateOptions userMetadata(Map<String, String> userMetadata) {
-      return TerremarkVCloudTemplateOptions.class.cast(super.userMetadata(userMetadata));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public TerremarkVCloudTemplateOptions userMetadata(String key, String value) {
-      return TerremarkVCloudTemplateOptions.class.cast(super.userMetadata(key, value));
-   }
-
-   /**
-    * @return keyPair to use when running the instance or null, to generate a
-    *         keypair.
-    */
-   public String getSshKeyFingerprint() {
-      return keyPair;
-   }
-
-   /**
-    * @return true (default) if we are supposed to use a keypair
-    */
-   public boolean shouldAutomaticallyCreateKeyPair() {
-      return !noKeyPair;
-   }
-
-   @Override
-   public int hashCode() {
-      final int prime = 31;
-      int result = super.hashCode();
-      result = prime * result + ((keyPair == null) ? 0 : keyPair.hashCode());
-      result = prime * result + (noKeyPair ? 1231 : 1237);
-      return result;
-   }
-
-   @Override
-   public boolean equals(Object obj) {
-      if (this == obj)
-         return true;
-      if (!super.equals(obj))
-         return false;
-      if (getClass() != obj.getClass())
-         return false;
-      TerremarkVCloudTemplateOptions other = (TerremarkVCloudTemplateOptions) obj;
-      if (keyPair == null) {
-         if (other.keyPair != null)
-            return false;
-      } else if (!keyPair.equals(other.keyPair))
-         return false;
-      if (noKeyPair != other.noKeyPair)
-         return false;
-      return true;
-   }
-
-   @Override
-   public String toString() {
-      return "TerremarkVCloudTemplateOptions [keyPair=" + keyPair + ", noKeyPair=" + noKeyPair + ", inboundPorts="
-            + inboundPorts + ", privateKey=" + (privateKey != null) + ", publicKey="
-            + (publicKey != null) + ", runScript=" + (script != null) + ", port:seconds=" + port + ":" + seconds
-            + ", userMetadata: " + userMetadata + "]";
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/CleanupOrphanKeys.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/CleanupOrphanKeys.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/CleanupOrphanKeys.java
deleted file mode 100644
index c73197f..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/CleanupOrphanKeys.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.trmk.vcloud_0_8.compute.strategy;
-
-import static com.google.common.base.Predicates.notNull;
-import static com.google.common.collect.Iterables.all;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.size;
-import static com.google.common.collect.Iterables.transform;
-import static org.jclouds.compute.predicates.NodePredicates.TERMINATED;
-import static org.jclouds.compute.predicates.NodePredicates.inGroup;
-import static org.jclouds.compute.predicates.NodePredicates.parentLocationId;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.strategy.ListNodesStrategy;
-import org.jclouds.domain.Credentials;
-import org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName;
-
-import com.google.common.base.Function;
-
-/**
- * 
- * @author Adrian Cole
- * 
- */
-@Singleton
-public class CleanupOrphanKeys {
-   final Function<NodeMetadata, OrgAndName> nodeToOrgAndName;
-   final DeleteKeyPair deleteKeyPair;
-   final ListNodesStrategy listNodes;
-   final Map<String, Credentials> credentialStore;
-
-   @Inject
-   CleanupOrphanKeys(Function<NodeMetadata, OrgAndName> nodeToOrgAndName, DeleteKeyPair deleteKeyPair,
-            Map<String, Credentials> credentialStore, ListNodesStrategy listNodes) {
-      this.nodeToOrgAndName = nodeToOrgAndName;
-      this.deleteKeyPair = deleteKeyPair;
-      this.listNodes = listNodes;
-      this.credentialStore = credentialStore;
-   }
-
-   public void execute(Iterable<? extends NodeMetadata> deadOnes) {
-      for (NodeMetadata node : deadOnes){
-         credentialStore.remove("node#" + node.getId());
-      }
-      Iterable<OrgAndName> orgGroups = filter(transform(deadOnes, nodeToOrgAndName), notNull());
-      for (OrgAndName orgGroup : orgGroups) {
-         Iterable<? extends NodeMetadata> nodesInOrg = listNodes.listDetailsOnNodesMatching(parentLocationId(orgGroup
-                  .getOrg().toASCIIString()));
-         Iterable<? extends NodeMetadata> nodesInGroup = filter(nodesInOrg, inGroup(orgGroup.getName()));
-         if (size(nodesInGroup) == 0 || all(nodesInGroup, TERMINATED)){
-            deleteKeyPair.execute(orgGroup);
-         }
-      }
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/CreateNewKeyPairUnlessUserSpecifiedOtherwise.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/CreateNewKeyPairUnlessUserSpecifiedOtherwise.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/CreateNewKeyPairUnlessUserSpecifiedOtherwise.java
deleted file mode 100644
index f320195..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/CreateNewKeyPairUnlessUserSpecifiedOtherwise.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.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkState;
-
-import java.net.URI;
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.domain.Credentials;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.ssh.SshKeys;
-import org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName;
-import org.jclouds.trmk.vcloud_0_8.compute.functions.CreateUniqueKeyPair;
-import org.jclouds.trmk.vcloud_0_8.compute.options.TerremarkVCloudTemplateOptions;
-import org.jclouds.trmk.vcloud_0_8.domain.KeyPair;
-
-import com.google.common.annotations.VisibleForTesting;
-
-/**
- * 
- * @author Adrian Cole
- * 
- */
-@Singleton
-public class CreateNewKeyPairUnlessUserSpecifiedOtherwise {
-   final Map<String, Credentials> credentialStore;
-   @VisibleForTesting
-   final CreateUniqueKeyPair createUniqueKeyPair;
-
-   @Inject
-   CreateNewKeyPairUnlessUserSpecifiedOtherwise(Map<String, Credentials> credentialStore,
-            CreateUniqueKeyPair createUniqueKeyPair) {
-      this.credentialStore = credentialStore;
-      this.createUniqueKeyPair = createUniqueKeyPair;
-   }
-
-   @VisibleForTesting
-   public void execute(URI org, String group, String identity, TerremarkVCloudTemplateOptions options) {
-      String sshKeyFingerprint = options.getSshKeyFingerprint();
-      boolean shouldAutomaticallyCreateKeyPair = options.shouldAutomaticallyCreateKeyPair();
-      if (sshKeyFingerprint == null && shouldAutomaticallyCreateKeyPair) {
-
-         // make sure that we don't request multiple keys simultaneously
-         synchronized (credentialStore) {
-            // if there is already a keypair for the group specified, use it
-            if (credentialStore.containsKey("group#" + group)) {
-               LoginCredentials creds = LoginCredentials.fromCredentials(credentialStore.get("group#" + group));
-               checkState(creds.getOptionalPrivateKey().isPresent(),
-                        "incorrect state: should have private key for: %s", creds);
-               options.sshKeyFingerprint(SshKeys.fingerprintPrivateKey(creds.getPrivateKey()));
-            } else {
-               // otherwise create a new keypair and key it under the group
-               KeyPair keyPair = createUniqueKeyPair.apply(new OrgAndName(org, group));
-               credentialStore.put("group#" + group, LoginCredentials.builder().user(identity).privateKey(
-                        keyPair.getPrivateKey()).build());
-               options.sshKeyFingerprint(keyPair.getFingerPrint());
-            }
-         }
-
-      }
-
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/DeleteKeyPair.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/DeleteKeyPair.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/DeleteKeyPair.java
deleted file mode 100644
index 43dcd55..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/DeleteKeyPair.java
+++ /dev/null
@@ -1,63 +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.strategy;
-
-import java.util.Map;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.Credentials;
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
-import org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName;
-import org.jclouds.trmk.vcloud_0_8.domain.KeyPair;
-
-/**
- * 
- * @author Adrian Cole
- * 
- */
-@Singleton
-public class DeleteKeyPair {
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   final TerremarkVCloudApi terremarkClient;
-   final Map<String, Credentials> credentialStore;
-
-   @Inject
-   DeleteKeyPair(TerremarkVCloudApi terremarkClient, Map<String, Credentials> credentialStore) {
-      this.terremarkClient = terremarkClient;
-      this.credentialStore = credentialStore;
-   }
-
-   public void execute(OrgAndName orgTag) {
-      for (KeyPair keyPair : terremarkClient.listKeyPairsInOrg(orgTag.getOrg())) {
-         if (keyPair.getName().matches("jclouds_" + orgTag.getName().replaceAll("-", "_") + "_[0-9a-f]+")) {
-            logger.debug(">> deleting keyPair(%s)", keyPair.getName());
-            terremarkClient.deleteKeyPair(keyPair.getId());
-            logger.debug("<< deleted keyPair(%s)", keyPair.getName());
-            credentialStore.remove("group#" + orgTag.getName());
-         }
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/ParseVAppTemplateDescriptionToGetDefaultLoginCredentials.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/ParseVAppTemplateDescriptionToGetDefaultLoginCredentials.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/ParseVAppTemplateDescriptionToGetDefaultLoginCredentials.java
deleted file mode 100644
index 1b0947b..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/ParseVAppTemplateDescriptionToGetDefaultLoginCredentials.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.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.compute.strategy.impl.ReturnCredentialsBoundToImage;
-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.domain.VAppTemplate;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class ParseVAppTemplateDescriptionToGetDefaultLoginCredentials extends ReturnCredentialsBoundToImage {
-   @Inject
-   public ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(@Nullable @Named("image") LoginCredentials creds,
-            Map<String, Credentials> credentialStore, Map<OsFamily, LoginCredentials> osFamilyToCredentials) {
-      super(creds, credentialStore, osFamilyToCredentials);
-   }
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   public static final Pattern USER_PASSWORD_PATTERN = Pattern
-         .compile(".*[Uu]sername: ([a-z]+) ?.*\n[Pp]assword: ([^ \n\r]+) ?\r?\n.*");
-
-   @Override
-   public LoginCredentials apply(Object resourceToAuthenticate) {
-      if (creds != null)
-         return creds;
-      checkNotNull(resourceToAuthenticate);
-      checkArgument(resourceToAuthenticate instanceof VAppTemplate, "Resource must be an VAppTemplate (for Terremark)");
-      VAppTemplate template = (VAppTemplate) resourceToAuthenticate;
-      String search = template.getDescription() != null ? template.getDescription() : template.getName();
-      if (search.indexOf("Windows") >= 0) {
-         return LoginCredentials.builder().user("Administrator").build();
-      } else {
-         Matcher matcher = USER_PASSWORD_PATTERN.matcher(search);
-         if (matcher.find()) {
-            return LoginCredentials.builder().user(matcher.group(1)).password(matcher.group(2)).authenticateSudo(true).build();
-         } else {
-            logger.warn("could not parse username/password for image: " + template.getHref() + "\n" + search);
-            return null;
-         }
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/StartVAppWithGroupEncodedIntoName.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/StartVAppWithGroupEncodedIntoName.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/StartVAppWithGroupEncodedIntoName.java
deleted file mode 100644
index 861b5ae..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/StartVAppWithGroupEncodedIntoName.java
+++ /dev/null
@@ -1,79 +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.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName;
-import org.jclouds.compute.strategy.PrioritizeCredentialsFromTemplate;
-import org.jclouds.domain.Credentials;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.trmk.vcloud_0_8.compute.TerremarkVCloudComputeClient;
-import org.jclouds.trmk.vcloud_0_8.compute.functions.TemplateToInstantiateOptions;
-import org.jclouds.trmk.vcloud_0_8.domain.VApp;
-import org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions;
-
-import com.google.common.base.Function;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class StartVAppWithGroupEncodedIntoName implements CreateNodeWithGroupEncodedIntoName {
-   protected final TerremarkVCloudComputeClient computeClient;
-   protected final TemplateToInstantiateOptions getOptions;
-   protected final Function<VApp, NodeMetadata> vAppToNodeMetadata;
-   protected final Map<String, Credentials> credentialStore;
-   protected final PrioritizeCredentialsFromTemplate prioritizeCredentialsFromTemplate;
-
-
-   @Inject
-   protected StartVAppWithGroupEncodedIntoName(TerremarkVCloudComputeClient computeClient,
-            Function<VApp, NodeMetadata> vAppToNodeMetadata, TemplateToInstantiateOptions getOptions,
-            Map<String, Credentials> credentialStore, PrioritizeCredentialsFromTemplate prioritizeCredentialsFromTemplate) {
-      this.computeClient = computeClient;
-      this.vAppToNodeMetadata = vAppToNodeMetadata;
-      this.getOptions = checkNotNull(getOptions, "getOptions");
-      this.credentialStore = checkNotNull(credentialStore, "credentialStore");
-      this.prioritizeCredentialsFromTemplate = checkNotNull(prioritizeCredentialsFromTemplate, "prioritizeCredentialsFromTemplate");
-   }
-   @Override
-   public NodeMetadata createNodeWithGroupEncodedIntoName(String group, String name, Template template) {
-      InstantiateVAppTemplateOptions options = getOptions.apply(template);
-      NodeAndInitialCredentials<VApp> from = computeClient.startAndReturnCredentials(URI.create(template.getLocation().getId()), URI.create(template
-               .getImage().getId()), name, options, template.getOptions().getInboundPorts());
-      LoginCredentials fromNode = from.getCredentials();
-      if (credentialStore.containsKey("group#" + group)) {
-         fromNode = fromNode == null ? LoginCredentials.fromCredentials(credentialStore.get("group#" + group))
-                  : fromNode.toBuilder().privateKey(credentialStore.get("group#" + group).credential).build();
-      }
-      LoginCredentials creds = prioritizeCredentialsFromTemplate.apply(template, fromNode);
-      if (creds != null)
-         credentialStore.put("node#" + from.getNodeId(), creds);
-      return vAppToNodeMetadata.apply(from.getNode());
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy.java
deleted file mode 100644
index a45201f..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy.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.compute.strategy;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.compute.config.CustomizationResponse;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName;
-import org.jclouds.compute.strategy.CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap;
-import org.jclouds.compute.strategy.ListNodesStrategy;
-import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.trmk.vcloud_0_8.compute.options.TerremarkVCloudTemplateOptions;
-
-import com.google.common.collect.Multimap;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- * creates futures that correlate to
- * 
- * @author Adrian Cole
- */
-@Singleton
-public class TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy extends CreateNodesWithGroupEncodedIntoNameThenAddToSet {
-
-   private final CreateNewKeyPairUnlessUserSpecifiedOtherwise createNewKeyPairUnlessUserSpecifiedOtherwise;
-
-   @Inject
-   protected TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy(
-            CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy,
-            ListNodesStrategy listNodesStrategy,
-            GroupNamingConvention.Factory namingConvention,
-            CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory,
-            @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
-            CreateNewKeyPairUnlessUserSpecifiedOtherwise createNewKeyPairUnlessUserSpecifiedOtherwise) {
-      super(addNodeWithTagStrategy, listNodesStrategy, namingConvention, userExecutor,
-               customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory);
-      this.createNewKeyPairUnlessUserSpecifiedOtherwise = createNewKeyPairUnlessUserSpecifiedOtherwise;
-   }
-
-   @Override
-   public Map<?, ListenableFuture<Void>> execute(String tag, int count, Template template, Set<NodeMetadata> goodNodes,
-            Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {
-      assert template.getLocation().getParent().getScope() == LocationScope.REGION : "template location should have a parent of org, which should be mapped to region: "
-               + template.getLocation();
-      String orgId = template.getLocation().getParent().getId();
-      assert orgId.startsWith("http") : "parent id should be a rest url: " + template.getLocation().getParent();
-      createNewKeyPairUnlessUserSpecifiedOtherwise.execute(URI.create(orgId), tag, template.getImage()
-               .getDefaultCredentials().identity, template.getOptions().as(TerremarkVCloudTemplateOptions.class));
-      return super.execute(tag, count, template, goodNodes, badNodes, customizationResponses);
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudDestroyNodeStrategy.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudDestroyNodeStrategy.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudDestroyNodeStrategy.java
deleted file mode 100644
index 5e7538c..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudDestroyNodeStrategy.java
+++ /dev/null
@@ -1,52 +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.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.strategy.DestroyNodeStrategy;
-import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
-import org.jclouds.trmk.vcloud_0_8.compute.TerremarkVCloudComputeClient;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class TerremarkVCloudDestroyNodeStrategy implements DestroyNodeStrategy {
-   protected final TerremarkVCloudComputeClient computeClient;
-   protected final GetNodeMetadataStrategy getNode;
-
-   @Inject
-   protected TerremarkVCloudDestroyNodeStrategy(TerremarkVCloudComputeClient computeClient, GetNodeMetadataStrategy getNode) {
-      this.computeClient = computeClient;
-      this.getNode = getNode;
-
-   }
-
-   @Override
-   public NodeMetadata destroyNode(String id) {
-      computeClient.stop(URI.create(checkNotNull(id, "node.id")));
-      return getNode.getNode(id);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudGetImageStrategy.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudGetImageStrategy.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudGetImageStrategy.java
deleted file mode 100644
index 498866d..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudGetImageStrategy.java
+++ /dev/null
@@ -1,57 +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.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.strategy.GetImageStrategy;
-import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
-import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate;
-
-import com.google.common.base.Function;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class TerremarkVCloudGetImageStrategy implements GetImageStrategy {
-
-   protected final TerremarkVCloudApi client;
-   protected final Function<VAppTemplate, Image> vAppToImage;
-
-   @Inject
-   protected TerremarkVCloudGetImageStrategy(TerremarkVCloudApi client, Function<VAppTemplate, Image> vAppToImage) {
-      this.client = checkNotNull(client, "client");
-      this.vAppToImage = vAppToImage;
-   }
-
-   @Override
-   public Image getImage(String in) {
-      URI id = URI.create(in);
-      VAppTemplate from = client.getVAppTemplate(id);
-      if (from == null)
-         return null;
-      return vAppToImage.apply(from);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudGetNodeMetadataStrategy.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudGetNodeMetadataStrategy.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudGetNodeMetadataStrategy.java
deleted file mode 100644
index ec20983..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudGetNodeMetadataStrategy.java
+++ /dev/null
@@ -1,57 +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.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
-import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
-import org.jclouds.trmk.vcloud_0_8.domain.VApp;
-
-import com.google.common.base.Function;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class TerremarkVCloudGetNodeMetadataStrategy implements GetNodeMetadataStrategy {
-
-   protected final TerremarkVCloudApi client;
-   protected final Function<VApp, NodeMetadata> vAppToNodeMetadata;
-
-   @Inject
-   protected TerremarkVCloudGetNodeMetadataStrategy(TerremarkVCloudApi client,
-         Function<VApp, NodeMetadata> vAppToNodeMetadata) {
-      this.client = checkNotNull(client, "client");
-      this.vAppToNodeMetadata = vAppToNodeMetadata;
-   }
-
-   public NodeMetadata getNode(String in) {
-      URI id = URI.create(in);
-      VApp from = client.getVApp(id);
-      if (from == null)
-         return null;
-      return vAppToNodeMetadata.apply(from);
-   }
-
-}