You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2014/12/23 05:27:11 UTC

[47/51] [partial] stratos git commit: dropping jclouds 1.8.0 clone

http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/loaders/CreateSecurityGroupIfNeeded.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/loaders/CreateSecurityGroupIfNeeded.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/loaders/CreateSecurityGroupIfNeeded.java
deleted file mode 100644
index 191f965..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/loaders/CreateSecurityGroupIfNeeded.java
+++ /dev/null
@@ -1,102 +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.ec2.compute.loaders;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-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.ec2.EC2Api;
-import org.jclouds.ec2.compute.domain.RegionAndName;
-import org.jclouds.ec2.compute.domain.RegionNameAndIngressRules;
-import org.jclouds.ec2.domain.UserIdGroupPair;
-import org.jclouds.ec2.features.SecurityGroupApi;
-import org.jclouds.logging.Logger;
-import org.jclouds.net.domain.IpProtocol;
-
-import com.google.common.base.Predicate;
-import com.google.common.cache.CacheLoader;
-import com.google.common.collect.Iterables;
-
-@Singleton
-public class CreateSecurityGroupIfNeeded extends CacheLoader<RegionAndName, String> {
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-   protected final SecurityGroupApi securityClient;
-   protected final Predicate<RegionAndName> securityGroupEventualConsistencyDelay;
-
-   @Inject
-   public CreateSecurityGroupIfNeeded(EC2Api ec2Api,
-         @Named("SECURITY") Predicate<RegionAndName> securityGroupEventualConsistencyDelay) {
-      this(checkNotNull(ec2Api, "ec2Api").getSecurityGroupApi().get(), securityGroupEventualConsistencyDelay);
-   }
-
-   public CreateSecurityGroupIfNeeded(SecurityGroupApi securityClient,
-         @Named("SECURITY") Predicate<RegionAndName> securityGroupEventualConsistencyDelay) {
-      this.securityClient = checkNotNull(securityClient, "securityClient");
-      this.securityGroupEventualConsistencyDelay = checkNotNull(securityGroupEventualConsistencyDelay,
-            "securityGroupEventualConsistencyDelay");
-   }
-
-   @Override
-   public String load(RegionAndName from) {
-      RegionNameAndIngressRules realFrom = RegionNameAndIngressRules.class.cast(from);
-      createSecurityGroupInRegion(from.getRegion(), from.getName(), realFrom.getPorts());
-      return from.getName();
-   }
-
-   private void createSecurityGroupInRegion(String region, String name, int... ports) {
-      checkNotNull(region, "region");
-      checkNotNull(name, "name");
-      logger.debug(">> creating securityGroup region(%s) name(%s)", region, name);
-      try {
-         securityClient.createSecurityGroupInRegion(region, name, name);
-         boolean created = securityGroupEventualConsistencyDelay.apply(new RegionAndName(region, name));
-         if (!created)
-            throw new RuntimeException(String.format("security group %s/%s is not available after creating", region,
-                  name));
-         logger.debug("<< created securityGroup(%s)", name);
-         for (int port : ports) {
-            createIngressRuleForTCPPort(region, name, port);
-         }
-         if (ports.length > 0) {
-            authorizeGroupToItself(region, name);
-         }
-      } catch (IllegalStateException e) {
-         logger.debug("<< reused securityGroup(%s)", name);
-      }
-   }
-
-   protected void createIngressRuleForTCPPort(String region, String name, int port) {
-      logger.debug(">> authorizing securityGroup region(%s) name(%s) port(%s)", region, name, port);
-      securityClient.authorizeSecurityGroupIngressInRegion(region, name, IpProtocol.TCP, port, port, "0.0.0.0/0");
-      logger.debug("<< authorized securityGroup(%s)", name);
-   }
-
-   protected void authorizeGroupToItself(String region, String name) {
-      logger.debug(">> authorizing securityGroup region(%s) name(%s) permission to itself", region, name);
-      String myOwnerId = Iterables.get(securityClient.describeSecurityGroupsInRegion(region, name), 0).getOwnerId();
-      securityClient.authorizeSecurityGroupIngressInRegion(region, name, new UserIdGroupPair(myOwnerId, name));
-      logger.debug("<< authorized securityGroup(%s)", name);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/loaders/LoadPublicIpForInstanceOrNull.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/loaders/LoadPublicIpForInstanceOrNull.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/loaders/LoadPublicIpForInstanceOrNull.java
deleted file mode 100644
index dd21344..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/loaders/LoadPublicIpForInstanceOrNull.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.ec2.compute.loaders;
-
-import java.util.NoSuchElementException;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.ec2.EC2Api;
-import org.jclouds.ec2.compute.domain.RegionAndName;
-import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
-
-import com.google.common.base.Predicate;
-import com.google.common.cache.CacheLoader;
-import com.google.common.collect.Iterables;
-
-@Singleton
-public class LoadPublicIpForInstanceOrNull extends CacheLoader<RegionAndName, String> {
-   private final EC2Api client;
-
-   @Inject
-   public LoadPublicIpForInstanceOrNull(EC2Api client) {
-      this.client = client;
-   }
-
-   @Override
-   public String load(final RegionAndName key) throws Exception {
-      try {
-         return Iterables.find(client.getElasticIPAddressApi().get().describeAddressesInRegion(key.getRegion()),
-                  new Predicate<PublicIpInstanceIdPair>() {
-
-                     @Override
-                     public boolean apply(PublicIpInstanceIdPair input) {
-                        return key.getName().equals(input.getInstanceId());
-                     }
-
-                  }).getPublicIp();
-      } catch (NoSuchElementException e) {
-         return null;
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/loaders/RegionAndIdToImage.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/loaders/RegionAndIdToImage.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/loaders/RegionAndIdToImage.java
deleted file mode 100644
index c28d0c5..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/loaders/RegionAndIdToImage.java
+++ /dev/null
@@ -1,64 +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.ec2.compute.loaders;
-
-import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.imageIds;
-
-import java.util.concurrent.ExecutionException;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.ec2.EC2Api;
-import org.jclouds.ec2.compute.domain.RegionAndName;
-import org.jclouds.ec2.compute.functions.EC2ImageParser;
-import org.jclouds.logging.Logger;
-
-import com.google.common.cache.CacheLoader;
-import com.google.common.collect.Iterables;
-
-@Singleton
-public class RegionAndIdToImage extends CacheLoader<RegionAndName, Image> {
-   @Resource
-   protected Logger logger = Logger.NULL;
-
-   private final EC2ImageParser parser;
-   private final EC2Api sync;
-
-   @Inject
-   public RegionAndIdToImage(EC2ImageParser parser, EC2Api sync) {
-      this.parser = parser;
-      this.sync = sync;
-   }
-
-   @Override
-   public Image load(RegionAndName key) throws ExecutionException {
-      try {
-         org.jclouds.ec2.domain.Image image = Iterables.getOnlyElement(sync.getAMIApi().get()
-               .describeImagesInRegion(key.getRegion(), imageIds(key.getName())));
-         return parser.apply(image);
-      } catch (Exception e) {
-         throw new ExecutionException(message(key, e), e);
-      }
-   }
-
-   public static String message(RegionAndName key, Exception e) {
-      return String.format("could not find image %s/%s: %s", key.getRegion(), key.getName(), e.getMessage());
-   }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/options/EC2TemplateOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/options/EC2TemplateOptions.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/options/EC2TemplateOptions.java
deleted file mode 100644
index 64c1ccd..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/options/EC2TemplateOptions.java
+++ /dev/null
@@ -1,686 +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.ec2.compute.options;
-
-import static com.google.common.base.Objects.equal;
-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.base.Strings.emptyToNull;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.hash.Hashing;
-import com.google.common.primitives.Bytes;
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.ec2.domain.BlockDeviceMapping;
-import org.jclouds.ec2.domain.BlockDeviceMapping.MapEBSSnapshotToDevice;
-import org.jclouds.ec2.domain.BlockDeviceMapping.MapEphemeralDeviceToDevice;
-import org.jclouds.ec2.domain.BlockDeviceMapping.MapNewVolumeToDevice;
-import org.jclouds.ec2.domain.BlockDeviceMapping.UnmapDeviceNamed;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.scriptbuilder.domain.Statement;
-
-/**
- * Contains options supported in the {@code ComputeService#runNode} operation on
- * the "ec2" provider. <h2>
- * Usage</h2> The recommended way to instantiate a EC2TemplateOptions object is
- * to statically import EC2TemplateOptions.* and invoke a static creation method
- * followed by an instance mutator (if needed):
- * <p/>
- * <code>
- * import static org.jclouds.aws.ec2.compute.options.EC2TemplateOptions.Builder.*;
- * <p/>
- * ComputeService client = // get connection
- * templateBuilder.options(inboundPorts(22, 80, 8080, 443));
- * Set<? extends NodeMetadata> set = client.createNodesInGroup(tag, 2, templateBuilder.build());
- * <code>
- */
-public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
-   @Override
-   public EC2TemplateOptions clone() {
-      EC2TemplateOptions options = new EC2TemplateOptions();
-      copyTo(options);
-      return options;
-   }
-
-   @Override
-   public void copyTo(TemplateOptions to) {
-      super.copyTo(to);
-      if (to instanceof EC2TemplateOptions) {
-         EC2TemplateOptions eTo = EC2TemplateOptions.class.cast(to);
-         if (getGroups().size() > 0)
-            eTo.securityGroups(getGroups());
-         if (getKeyPair() != null)
-            eTo.keyPair(getKeyPair());
-         if (getBlockDeviceMappings().size() > 0)
-            eTo.blockDeviceMappings(getBlockDeviceMappings());
-         if (!shouldAutomaticallyCreateKeyPair())
-            eTo.noKeyPair();
-         if (getUserData() != null)
-            eTo.userData(getUserData());
-         if (getMaxCount() > 0)
-            eTo.maxCount(getMaxCount());
-         if (getClientToken() != null)
-            eTo.clientToken(getClientToken());
-      }
-   }
-
-   private Set<String> groupNames = ImmutableSet.of();
-   private String keyPair = null;
-   private boolean noKeyPair;
-   private List<Byte> userData;
-   private ImmutableSet.Builder<BlockDeviceMapping> blockDeviceMappings = ImmutableSet.builder();
-   private Integer maxCount;
-   private String clientToken = null;
-
-   @Override
-   public boolean equals(Object o) {
-      if (this == o)
-         return true;
-      if (o == null || getClass() != o.getClass())
-         return false;
-      EC2TemplateOptions that = EC2TemplateOptions.class.cast(o);
-      return super.equals(that) && equal(this.groupNames, that.groupNames) && equal(this.keyPair, that.keyPair)
-              && equal(this.noKeyPair, that.noKeyPair) && equal(this.userData, that.userData)
-              && equal(this.blockDeviceMappings, that.blockDeviceMappings)
-              && equal(this.maxCount, that.maxCount)
-              && equal(this.clientToken, that.clientToken);
-   }
-
-   @Override
-   public int hashCode() {
-      return Objects
-               .hashCode(super.hashCode(), groupNames, keyPair, noKeyPair, userData, userData, blockDeviceMappings,
-                       maxCount, clientToken);
-   }
-
-   @Override
-   public ToStringHelper string() {
-      ToStringHelper toString = super.string();
-      if (groupNames.size() != 0)
-         toString.add("groupNames", groupNames);
-      if (noKeyPair)
-         toString.add("noKeyPair", noKeyPair);
-      toString.add("keyPair", keyPair);
-      if (userData != null && userData.size() > 0)
-         toString.add("userDataCksum", Hashing.crc32().hashBytes(Bytes.toArray(userData)));
-      ImmutableSet<BlockDeviceMapping> mappings = blockDeviceMappings.build();
-      if (mappings.size() != 0)
-         toString.add("blockDeviceMappings", mappings);
-      if (maxCount != null && maxCount.intValue() > 0)
-         toString.add("maxCount", maxCount);
-      if (clientToken != null)
-         toString.add("clientToken", clientToken);
-      return toString;
-   }
-
-   public static final EC2TemplateOptions NONE = new EC2TemplateOptions();
-
-   /**
-    * 
-    * @see EC2TemplateOptions#securityGroups(Iterable<String>)
-    */
-   public EC2TemplateOptions securityGroups(String... groupNames) {
-      return securityGroups(ImmutableSet.copyOf(groupNames));
-   }
-
-   /**
-    * Specifies the security groups to be used for nodes with this template
-    */
-   public EC2TemplateOptions securityGroups(Iterable<String> groupNames) {
-      checkArgument(Iterables.size(groupNames) > 0, "you must specify at least one security group");
-      for (String groupId : groupNames)
-         checkNotNull(emptyToNull(groupId), "all security groups must be non-empty");
-      this.groupNames = ImmutableSet.copyOf(groupNames);
-      return this;
-   }
-
-   /**
-    * Unencoded data
-    */
-   public EC2TemplateOptions userData(byte[] unencodedData) {
-      checkArgument(checkNotNull(unencodedData, "unencodedData").length <= 16 * 1024,
-            "userData cannot be larger than 16kb");
-      this.userData = Bytes.asList(unencodedData);
-      return this;
-   }
-
-   /**
-    * Specifies the keypair used to run instances with
-    */
-   public EC2TemplateOptions keyPair(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 EC2TemplateOptions noKeyPair() {
-      checkState(keyPair == null, "you cannot specify both options keyPair and noKeyPair");
-      this.noKeyPair = true;
-      return this;
-   }
-
-   public EC2TemplateOptions mapEBSSnapshotToDeviceName(String deviceName, String snapshotId,
-         @Nullable Integer sizeInGib, boolean deleteOnTermination) {
-      return mapEBSSnapshotToDeviceName(deviceName, snapshotId, sizeInGib, deleteOnTermination, null, null, false);
-   }
-
-   public EC2TemplateOptions mapEBSSnapshotToDeviceName(String deviceName, String snapshotId,
-                                                        @Nullable Integer sizeInGib, boolean deleteOnTermination,
-                                                        @Nullable String volumeType, @Nullable Integer iops,
-                                                        boolean encrypted) {
-      blockDeviceMappings.add(new MapEBSSnapshotToDevice(deviceName, snapshotId, sizeInGib, deleteOnTermination,
-              volumeType, iops, encrypted));
-      return this;
-   }
-
-   public EC2TemplateOptions mapNewVolumeToDeviceName(String deviceName, int sizeInGib, boolean deleteOnTermination) {
-      return mapNewVolumeToDeviceName(deviceName, sizeInGib, deleteOnTermination, null, null, false);
-   }
-
-   public EC2TemplateOptions mapNewVolumeToDeviceName(String deviceName, int sizeInGib, boolean deleteOnTermination,
-                                                      @Nullable String volumeType, @Nullable Integer iops,
-                                                      boolean encrypted) {
-      blockDeviceMappings.add(new MapNewVolumeToDevice(deviceName, sizeInGib, deleteOnTermination, volumeType,
-              iops, encrypted));
-      return this;
-   }
-
-   public EC2TemplateOptions mapEphemeralDeviceToDeviceName(String deviceName, String virtualName) {
-      blockDeviceMappings.add(new MapEphemeralDeviceToDevice(deviceName, virtualName));
-      return this;
-   }
-
-   public EC2TemplateOptions unmapDeviceNamed(String deviceName) {
-      blockDeviceMappings.add(new UnmapDeviceNamed(deviceName));
-      return this;
-   }
-
-   public EC2TemplateOptions blockDeviceMappings(Iterable<? extends BlockDeviceMapping> blockDeviceMappings) {
-      this.blockDeviceMappings.addAll(checkNotNull(blockDeviceMappings, "blockDeviceMappings"));
-      return this;
-   }
-
-   public EC2TemplateOptions maxCount(Integer maxCount) {
-      this.maxCount = maxCount;
-      return this;
-   }
-
-   public EC2TemplateOptions clientToken(String clientToken) {
-      this.clientToken = checkNotNull(clientToken, "clientToken");
-      return this;
-   }
-
-   public static class Builder extends TemplateOptions.Builder {
-      /**
-       * @see EC2TemplateOptions#blockDeviceMappings
-       */
-      public static EC2TemplateOptions blockDeviceMappings(Set<? extends BlockDeviceMapping> blockDeviceMappings) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.blockDeviceMappings(blockDeviceMappings);
-      }
-
-      /**
-       * @see EC2TemplateOptions#mapEBSSnapshotToDeviceName
-       */
-      public static EC2TemplateOptions mapEBSSnapshotToDeviceName(String deviceName, String snapshotId,
-            @Nullable Integer sizeInGib, boolean deleteOnTermination) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.mapEBSSnapshotToDeviceName(deviceName, snapshotId, sizeInGib, deleteOnTermination);
-      }
-
-      /**
-       * @see EC2TemplateOptions#mapNewVolumeToDeviceName
-       */
-      public static EC2TemplateOptions mapNewVolumeToDeviceName(String deviceName, int sizeInGib,
-            boolean deleteOnTermination) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.mapNewVolumeToDeviceName(deviceName, sizeInGib, deleteOnTermination);
-      }
-
-      /**
-       * @see EC2TemplateOptions#mapEphemeralDeviceToDeviceName
-       */
-      public static EC2TemplateOptions mapEphemeralDeviceToDeviceName(String deviceName, String virtualName) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.mapEphemeralDeviceToDeviceName(deviceName, virtualName);
-      }
-
-      /**
-       * @see EC2TemplateOptions#unmapDeviceNamed
-       */
-      public static EC2TemplateOptions unmapDeviceNamed(String deviceName) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.unmapDeviceNamed(deviceName);
-      }
-
-      /**
-       * @see EC2TemplateOptions#securityGroups(Iterable<String>)
-       */
-      public static EC2TemplateOptions securityGroups(String... groupNames) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return EC2TemplateOptions.class.cast(options.securityGroups(groupNames));
-      }
-
-      /**
-       * @see EC2TemplateOptions#securityGroups(Iterable<String>)
-       */
-      public static EC2TemplateOptions securityGroups(Iterable<String> groupNames) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return EC2TemplateOptions.class.cast(options.securityGroups(groupNames));
-      }
-
-      /**
-       * @see EC2TemplateOptions#keyPair
-       */
-      public static EC2TemplateOptions keyPair(String keyPair) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return EC2TemplateOptions.class.cast(options.keyPair(keyPair));
-      }
-
-      /**
-       * @see EC2TemplateOptions#userData
-       */
-      public static EC2TemplateOptions userData(byte[] unencodedData) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return EC2TemplateOptions.class.cast(options.userData(unencodedData));
-      }
-
-      /**
-       * @see EC2TemplateOptions#noKeyPair
-       */
-      public static EC2TemplateOptions noKeyPair() {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return EC2TemplateOptions.class.cast(options.noKeyPair());
-      }
-
-      // methods that only facilitate returning the correct object type
-      /**
-       * @see TemplateOptions#inboundPorts
-       */
-      public static EC2TemplateOptions inboundPorts(int... ports) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return EC2TemplateOptions.class.cast(options.inboundPorts(ports));
-      }
-
-      /**
-       * @see TemplateOptions#port
-       */
-      public static EC2TemplateOptions blockOnPort(int port, int seconds) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return EC2TemplateOptions.class.cast(options.blockOnPort(port, seconds));
-      }
-
-      /**
-       * @see TemplateOptions#installPrivateKey
-       */
-      public static EC2TemplateOptions installPrivateKey(String rsaKey) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return EC2TemplateOptions.class.cast(options.installPrivateKey(rsaKey));
-      }
-
-      /**
-       * @see TemplateOptions#authorizePublicKey
-       */
-      public static EC2TemplateOptions authorizePublicKey(String rsaKey) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return EC2TemplateOptions.class.cast(options.authorizePublicKey(rsaKey));
-      }
-
-      /**
-       * @see TemplateOptions#userMetadata(Map)
-       */
-      public static EC2TemplateOptions userMetadata(Map<String, String> userMetadata) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return EC2TemplateOptions.class.cast(options.userMetadata(userMetadata));
-      }
-
-      /**
-       * @see TemplateOptions#nodeNames(Iterable)
-       */
-      public static EC2TemplateOptions nodeNames(Iterable<String> nodeNames) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return EC2TemplateOptions.class.cast(options.nodeNames(nodeNames));
-      }
-
-      /**
-       * @see TemplateOptions#networks(Iterable)
-       */
-      public static EC2TemplateOptions networks(Iterable<String> networks) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return EC2TemplateOptions.class.cast(options.networks(networks));
-      }
-
-      public static EC2TemplateOptions overrideLoginUser(String user) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.overrideLoginUser(user);
-      }
-
-      public static EC2TemplateOptions overrideLoginPassword(String password) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.overrideLoginPassword(password);
-      }
-
-      public static EC2TemplateOptions overrideLoginPrivateKey(String privateKey) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.overrideLoginPrivateKey(privateKey);
-      }
-
-      public static EC2TemplateOptions overrideAuthenticateSudo(boolean authenticateSudo) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.overrideAuthenticateSudo(authenticateSudo);
-      }
-
-      public static EC2TemplateOptions overrideLoginCredentials(LoginCredentials credentials) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.overrideLoginCredentials(credentials);
-      }
-
-      public static EC2TemplateOptions nameTask(String name) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.nameTask(name);
-      }
-
-      public static EC2TemplateOptions runAsRoot(boolean value) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.runAsRoot(value);
-      }
-
-      public static EC2TemplateOptions tags(Iterable<String> tags) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.tags(tags);
-      }
-
-      public static EC2TemplateOptions blockUntilRunning(boolean blockUntilRunning) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.blockUntilRunning(blockUntilRunning);
-      }
-
-      public static EC2TemplateOptions runScript(Statement script) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.runScript(script);
-      }
-      
-      public static EC2TemplateOptions runScript(String script) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.runScript(script);
-      }
-
-      public static EC2TemplateOptions userMetadata(String key, String value) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.userMetadata(key, value);
-      }
-
-      public static EC2TemplateOptions blockOnComplete(boolean value) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.blockOnComplete(value);
-      }
-
-      public static EC2TemplateOptions maxCount(Integer maxCount) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.maxCount(maxCount);
-      }
-
-      public static EC2TemplateOptions clientToken(String clientToken) {
-         EC2TemplateOptions options = new EC2TemplateOptions();
-         return options.clientToken(clientToken);
-      }
-   }
-
-   // methods that only facilitate returning the correct object type
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions blockOnPort(int port, int seconds) {
-      return EC2TemplateOptions.class.cast(super.blockOnPort(port, seconds));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions inboundPorts(int... ports) {
-      return EC2TemplateOptions.class.cast(super.inboundPorts(ports));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions authorizePublicKey(String publicKey) {
-      return EC2TemplateOptions.class.cast(super.authorizePublicKey(publicKey));
-   }
-   
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions installPrivateKey(String privateKey) {
-      return EC2TemplateOptions.class.cast(super.installPrivateKey(privateKey));
-   }
-   
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions blockUntilRunning(boolean blockUntilRunning) {
-      return EC2TemplateOptions.class.cast(super.blockUntilRunning(blockUntilRunning));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions dontAuthorizePublicKey() {
-      return EC2TemplateOptions.class.cast(super.dontAuthorizePublicKey());
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions nameTask(String name) {
-      return EC2TemplateOptions.class.cast(super.nameTask(name));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions runAsRoot(boolean runAsRoot) {
-      return EC2TemplateOptions.class.cast(super.runAsRoot(runAsRoot));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions runScript(Statement script) {
-      return EC2TemplateOptions.class.cast(super.runScript(script));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials) {
-      return EC2TemplateOptions.class.cast(super.overrideLoginCredentials(overridingCredentials));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions overrideLoginPassword(String password) {
-      return EC2TemplateOptions.class.cast(super.overrideLoginPassword(password));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions overrideLoginPrivateKey(String privateKey) {
-      return EC2TemplateOptions.class.cast(super.overrideLoginPrivateKey(privateKey));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions overrideLoginUser(String loginUser) {
-      return EC2TemplateOptions.class.cast(super.overrideLoginUser(loginUser));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions overrideAuthenticateSudo(boolean authenticateSudo) {
-      return EC2TemplateOptions.class.cast(super.overrideAuthenticateSudo(authenticateSudo));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions userMetadata(Map<String, String> userMetadata) {
-      return EC2TemplateOptions.class.cast(super.userMetadata(userMetadata));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions userMetadata(String key, String value) {
-      return EC2TemplateOptions.class.cast(super.userMetadata(key, value));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions nodeNames(Iterable<String> nodeNames) {
-      return EC2TemplateOptions.class.cast(super.nodeNames(nodeNames));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions networks(Iterable<String> networks) {
-      return EC2TemplateOptions.class.cast(super.networks(networks));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions runScript(String script) {
-      return EC2TemplateOptions.class.cast(super.runScript(script));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions tags(Iterable<String> tags) {
-      return EC2TemplateOptions.class.cast(super.tags(tags));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions wrapInInitScript(boolean wrapInInitScript) {
-      return EC2TemplateOptions.class.cast(super.wrapInInitScript(wrapInInitScript));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public EC2TemplateOptions blockOnComplete(boolean blockOnComplete) {
-      return EC2TemplateOptions.class.cast(super.blockOnComplete(blockOnComplete));
-   }
-   
-   /**
-    * @return groupNames the user specified to run instances with, or zero
-    *         length set to create an implicit group
-    */
-   public Set<String> getGroups() {
-      return groupNames;
-   }
-
-   /**
-    * @return keyPair to use when running the instance or null, to generate a
-    *         keypair.
-    */
-   public String getKeyPair() {
-      return keyPair;
-   }
-
-   /**
-    * @return true (default) if we are supposed to use a keypair
-    */
-   public boolean shouldAutomaticallyCreateKeyPair() {
-      return !noKeyPair;
-   }
-
-   /**
-    * @return unencoded user data.
-    */
-   public byte[] getUserData() {
-      return userData == null ? null : Bytes.toArray(userData);
-   }
-
-   /**
-    * @return BlockDeviceMapping to use when running the instance or null.
-    */
-   public Set<BlockDeviceMapping> getBlockDeviceMappings() {
-      return blockDeviceMappings.build();
-   }
-
-   /**
-    * @return the maximum number of instances to create
-    */
-   public int getMaxCount() {
-      return maxCount != null ? maxCount.intValue() : 0;
-   }
-
-   /**
-    * See <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html">here</a> for more information.
-    *
-    * @return the optional client token string, used for idempotency
-    */
-   public String getClientToken() {
-      return clientToken;
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/predicates/EC2ImagePredicates.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/predicates/EC2ImagePredicates.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/predicates/EC2ImagePredicates.java
deleted file mode 100644
index 46808fa..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/predicates/EC2ImagePredicates.java
+++ /dev/null
@@ -1,48 +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.ec2.compute.predicates;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.predicates.ImagePredicates;
-import org.jclouds.ec2.domain.RootDeviceType;
-
-import com.google.common.base.Predicate;
-
-/**
- * Container for image filters (predicates).
- * 
- * This class has static methods that create customized predicates to use with
- * {@link org.jclouds.compute.ComputeService}.
- */
-public class EC2ImagePredicates {
-
-   /**
-    * evaluates true if the Image has the specified root device type
-    * 
-    * @param rootDeviceType
-    *           rootDeviceType of the images
-    * @return predicate
-    */
-   public static Predicate<Image> rootDeviceType(final RootDeviceType rootDeviceType) {
-      checkNotNull(rootDeviceType, "rootDeviceType must be defined");
-      return ImagePredicates.userMetadataContains("rootDeviceType", rootDeviceType.value());
-   }
-
-  
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/predicates/SecurityGroupPresent.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/predicates/SecurityGroupPresent.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/predicates/SecurityGroupPresent.java
deleted file mode 100644
index 7899478..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/predicates/SecurityGroupPresent.java
+++ /dev/null
@@ -1,64 +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.ec2.compute.predicates;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.NoSuchElementException;
-
-import javax.annotation.Resource;
-import javax.inject.Singleton;
-
-import org.jclouds.ec2.EC2Api;
-import org.jclouds.ec2.compute.domain.RegionAndName;
-import org.jclouds.ec2.domain.SecurityGroup;
-import org.jclouds.logging.Logger;
-import org.jclouds.rest.ResourceNotFoundException;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import com.google.inject.Inject;
-
-@Singleton
-public class SecurityGroupPresent implements Predicate<RegionAndName> {
-
-   private final EC2Api client;
-
-   @Resource
-   protected Logger logger = Logger.NULL;
-
-   @Inject
-   public SecurityGroupPresent(EC2Api client) {
-      this.client = checkNotNull(client, "client");
-   }
-
-   public boolean apply(RegionAndName securityGroup) {
-      logger.trace("looking for security group %s/%s", securityGroup.getRegion(), securityGroup.getName());
-      try {
-         return refresh(securityGroup) != null;
-      } catch (ResourceNotFoundException e) {
-         return false;
-      } catch (NoSuchElementException e) {
-         return false;
-      }
-   }
-
-   protected SecurityGroup refresh(RegionAndName securityGroup) {
-      return Iterables.getOnlyElement(client.getSecurityGroupApi().get().describeSecurityGroupsInRegion(
-            securityGroup.getRegion(), securityGroup.getName()));
-   }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.java
deleted file mode 100644
index 454172c..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.java
+++ /dev/null
@@ -1,199 +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.ec2.compute.strategy;
-
-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.ssh.SshKeys.fingerprintPrivateKey;
-import static org.jclouds.ssh.SshKeys.sha1PrivateKey;
-
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.ImmutableSet.Builder;
-import com.google.inject.Inject;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.compute.functions.GroupNamingConvention.Factory;
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.ec2.compute.domain.RegionAndName;
-import org.jclouds.ec2.compute.domain.RegionNameAndIngressRules;
-import org.jclouds.ec2.compute.options.EC2TemplateOptions;
-import org.jclouds.ec2.domain.BlockDeviceMapping;
-import org.jclouds.ec2.domain.KeyPair;
-import org.jclouds.ec2.options.RunInstancesOptions;
-import org.jclouds.javax.annotation.Nullable;
-
-@Singleton
-public class CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions {
-   @VisibleForTesting
-   public Function<RegionAndName, KeyPair> makeKeyPair;
-   @VisibleForTesting
-   public final ConcurrentMap<RegionAndName, KeyPair> credentialsMap;
-   @VisibleForTesting
-   public final LoadingCache<RegionAndName, String> securityGroupMap;
-   @VisibleForTesting
-   public final Provider<RunInstancesOptions> optionsProvider;
-   private final Factory namingConvention;
-
-   @Inject
-   public CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions(Function<RegionAndName, KeyPair> makeKeyPair,
-            ConcurrentMap<RegionAndName, KeyPair> credentialsMap,
-            @Named("SECURITY") LoadingCache<RegionAndName, String> securityGroupMap,
-            Provider<RunInstancesOptions> optionsProvider,
-            GroupNamingConvention.Factory namingConvention) {
-      this.makeKeyPair = checkNotNull(makeKeyPair, "makeKeyPair");
-      this.credentialsMap = checkNotNull(credentialsMap, "credentialsMap");
-      this.securityGroupMap = checkNotNull(securityGroupMap, "securityGroupMap");
-      this.optionsProvider = checkNotNull(optionsProvider, "optionsProvider");
-      this.namingConvention = checkNotNull(namingConvention, "namingConvention");
-   }
-
-   public RunInstancesOptions execute(String region, String group, Template template) {
-
-      RunInstancesOptions instanceOptions = getOptionsProvider().get().asType(template.getHardware().getId());
-
-      String keyPairName = createNewKeyPairUnlessUserSpecifiedOtherwise(region, group, template.getOptions());
-
-      addSecurityGroups(region, group, template, instanceOptions);
-      if (template.getOptions() instanceof EC2TemplateOptions) {
-
-         if (keyPairName != null)
-            instanceOptions.withKeyName(keyPairName);
-
-         byte[] userData = EC2TemplateOptions.class.cast(template.getOptions()).getUserData();
-
-         if (userData != null)
-            instanceOptions.withUserData(userData);
-
-         Set<BlockDeviceMapping> blockDeviceMappings = EC2TemplateOptions.class.cast(template.getOptions())
-                  .getBlockDeviceMappings();
-         if (blockDeviceMappings.size() > 0) {
-            checkState("ebs".equals(template.getImage().getUserMetadata().get("rootDeviceType")),
-                     "BlockDeviceMapping only available on ebs boot");
-            instanceOptions.withBlockDeviceMappings(blockDeviceMappings);
-         }
-
-         String clientToken = EC2TemplateOptions.class.cast(template.getOptions()).getClientToken();
-
-         if (clientToken != null) {
-            instanceOptions.withClientToken(clientToken);
-         }
-      }
-      return instanceOptions;
-   }
-
-   protected void addSecurityGroups(String region, String group, Template template, RunInstancesOptions instanceOptions) {
-      Set<String> groups = getSecurityGroupsForTagAndOptions(region, group, template.getOptions());
-      instanceOptions.withSecurityGroups(groups);
-   }
-
-   @VisibleForTesting
-   public String createNewKeyPairUnlessUserSpecifiedOtherwise(String region, String group, TemplateOptions options) {
-      String keyPairName = null;
-      boolean shouldAutomaticallyCreateKeyPair = true;
-
-      if (options instanceof EC2TemplateOptions) {
-         keyPairName = EC2TemplateOptions.class.cast(options).getKeyPair();
-         if (keyPairName == null)
-            shouldAutomaticallyCreateKeyPair = EC2TemplateOptions.class.cast(options)
-                     .shouldAutomaticallyCreateKeyPair();
-      }
-
-      if (keyPairName == null && shouldAutomaticallyCreateKeyPair) {
-         keyPairName = createOrImportKeyPair(region, group, options);
-      } else if (keyPairName != null) {
-         if (options.getLoginPrivateKey() != null) {
-            String pem = options.getLoginPrivateKey();
-            KeyPair keyPair = KeyPair.builder().region(region).keyName(keyPairName).fingerprint(
-                     fingerprintPrivateKey(pem)).sha1OfPrivateKey(sha1PrivateKey(pem)).keyMaterial(pem).build();
-            RegionAndName key = new RegionAndName(region, keyPairName);
-            credentialsMap.put(key, keyPair);
-         }
-      }
-
-      if (options.getRunScript() != null) {
-         RegionAndName regionAndName = new RegionAndName(region, keyPairName);
-         checkArgument(
-                  credentialsMap.containsKey(regionAndName),
-                  "no private key configured for: %s; please use options.overrideLoginCredentialWith(rsa_private_text)",
-                  regionAndName);
-      }
-      return keyPairName;
-   }
-
-   // base EC2 driver currently does not support key import
-   protected String createOrImportKeyPair(String region, String group, TemplateOptions options) {
-      RegionAndName regionAndGroup = new RegionAndName(region, group);
-      KeyPair keyPair;
-      // make sure that we don't request multiple keys simultaneously
-      synchronized (credentialsMap) {
-         // if there is already a keypair for the group specified, use it
-         if (credentialsMap.containsKey(regionAndGroup))
-            return credentialsMap.get(regionAndGroup).getKeyName();
-
-         // otherwise create a new keypair and key it under the group and also the regular keyname
-         keyPair = makeKeyPair.apply(new RegionAndName(region, group));
-         credentialsMap.put(regionAndGroup, keyPair);
-      }
-      credentialsMap.put(new RegionAndName(region, keyPair.getKeyName()), keyPair);
-      return keyPair.getKeyName();
-   }
-
-   @VisibleForTesting
-   public Set<String> getSecurityGroupsForTagAndOptions(String region, @Nullable String group, TemplateOptions options) {
-      Builder<String> groups = ImmutableSet.builder();
-
-      if (group != null) {
-         String markerGroup = namingConvention.create().sharedNameForGroup(group);
-
-         groups.add(markerGroup);
-
-         RegionNameAndIngressRules regionNameAndIngressRulesForMarkerGroup;
-
-         if (userSpecifiedTheirOwnGroups(options)) {
-            regionNameAndIngressRulesForMarkerGroup = new RegionNameAndIngressRules(region, markerGroup, new int[] {},
-                     false);
-            groups.addAll(EC2TemplateOptions.class.cast(options).getGroups());
-         } else {
-            regionNameAndIngressRulesForMarkerGroup = new RegionNameAndIngressRules(region, markerGroup, options
-                     .getInboundPorts(), true);
-         }
-         // this will create if not yet exists.
-         securityGroupMap.getUnchecked(regionNameAndIngressRulesForMarkerGroup);
-      }
-      return groups.build();
-   }
-
-   protected boolean userSpecifiedTheirOwnGroups(TemplateOptions options) {
-      return options instanceof EC2TemplateOptions && EC2TemplateOptions.class.cast(options).getGroups().size() > 0;
-   }
-
-   // allows us to mock this method
-   @VisibleForTesting
-   public javax.inject.Provider<RunInstancesOptions> getOptionsProvider() {
-      return optionsProvider;
-   }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/DescribeImagesParallel.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/DescribeImagesParallel.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/DescribeImagesParallel.java
deleted file mode 100644
index 9640e4b..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/DescribeImagesParallel.java
+++ /dev/null
@@ -1,82 +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.ec2.compute.strategy;
-
-import static com.google.common.collect.Iterables.concat;
-import static com.google.common.collect.Iterables.transform;
-import static com.google.common.util.concurrent.Futures.allAsList;
-import static com.google.common.util.concurrent.Futures.getUnchecked;
-
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.Callable;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.ec2.EC2Api;
-import org.jclouds.ec2.options.DescribeImagesOptions;
-import org.jclouds.logging.Logger;
-
-import com.google.common.base.Function;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-@Singleton
-public class DescribeImagesParallel implements
-         Function<Iterable<Entry<String, DescribeImagesOptions>>, Iterable<? extends org.jclouds.ec2.domain.Image>> {
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   protected final EC2Api api;
-   final ListeningExecutorService userExecutor;
-
-   @Inject
-   public DescribeImagesParallel(EC2Api api, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
-      this.api = api;
-      this.userExecutor = userExecutor;
-   }
-
-   @Override
-   public Iterable<? extends org.jclouds.ec2.domain.Image> apply(
-            final Iterable<Entry<String, DescribeImagesOptions>> queries) {
-      ListenableFuture<List<Set<? extends org.jclouds.ec2.domain.Image>>> futures
-         = allAsList(transform(
-                            queries,
-                            new Function<Entry<String, DescribeImagesOptions>,
-                            ListenableFuture<? extends Set<? extends org.jclouds.ec2.domain.Image>>>() {
-                               public ListenableFuture<Set<? extends org.jclouds.ec2.domain.Image>> apply(
-                                                                                                          final Entry<String, DescribeImagesOptions> from) {
-                                  return userExecutor.submit(new Callable<Set<? extends org.jclouds.ec2.domain.Image>>() {
-                                        @Override
-                                        public Set<? extends org.jclouds.ec2.domain.Image> call() throws Exception {
-                                           return api.getAMIApi().get().describeImagesInRegion(from.getKey(), from.getValue());
-                                        }
-                                     });
-                               }
-                            }));
-      logger.trace("amis");
-
-      return concat(getUnchecked(futures));
-   }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2CreateNodesInGroupThenAddToSet.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2CreateNodesInGroupThenAddToSet.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2CreateNodesInGroupThenAddToSet.java
deleted file mode 100644
index e41c0f8..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2CreateNodesInGroupThenAddToSet.java
+++ /dev/null
@@ -1,252 +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.ec2.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.concat;
-import static com.google.common.collect.Iterables.size;
-import static com.google.common.collect.Iterables.transform;
-import static com.google.common.collect.Sets.difference;
-import static com.google.common.util.concurrent.Atomics.newReference;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING;
-import static org.jclouds.compute.functions.DefaultCredentialsFromImageOrOverridingCredentials.overrideDefaultCredentialsWithOptionsIfPresent;
-import static org.jclouds.ec2.compute.util.EC2ComputeUtils.getZoneFromLocationOrNull;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Multimap;
-import com.google.common.util.concurrent.ListenableFuture;
-import org.jclouds.aws.util.AWSUtils;
-import org.jclouds.compute.config.CustomizationResponse;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.compute.strategy.CreateNodesInGroupThenAddToSet;
-import org.jclouds.compute.util.ComputeUtils;
-import org.jclouds.domain.Credentials;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.ec2.EC2Api;
-import org.jclouds.ec2.compute.domain.RegionAndName;
-import org.jclouds.ec2.compute.functions.PresentInstances;
-import org.jclouds.ec2.compute.options.EC2TemplateOptions;
-import org.jclouds.ec2.domain.RunningInstance;
-import org.jclouds.ec2.options.RunInstancesOptions;
-import org.jclouds.ec2.reference.EC2Constants;
-import org.jclouds.logging.Logger;
-
-/**
- * creates futures that correlate to
- */
-@Singleton
-public class EC2CreateNodesInGroupThenAddToSet implements CreateNodesInGroupThenAddToSet {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   @Inject
-   @Named(EC2Constants.PROPERTY_EC2_AUTO_ALLOCATE_ELASTIC_IPS)
-   @VisibleForTesting
-   boolean autoAllocateElasticIps = false;
-
-   @VisibleForTesting
-   final EC2Api client;
-   @VisibleForTesting
-   final Predicate<AtomicReference<NodeMetadata>> nodeRunning;
-   @VisibleForTesting
-   final LoadingCache<RegionAndName, String> elasticIpCache;
-   @VisibleForTesting
-   final CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturncustomize;
-   @VisibleForTesting
-   final Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata;
-   @VisibleForTesting
-   final ComputeUtils utils;
-   final PresentInstances presentInstances;
-   final LoadingCache<RunningInstance, Optional<LoginCredentials>> instanceToCredentials;
-   final Map<String, Credentials> credentialStore;
-
-   @Inject
-   protected EC2CreateNodesInGroupThenAddToSet(
-         EC2Api client,
-         @Named("ELASTICIP") LoadingCache<RegionAndName, String> elasticIpCache,
-         @Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
-         CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturncustomize,
-         PresentInstances presentInstances, Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata,
-         LoadingCache<RunningInstance, Optional<LoginCredentials>> instanceToCredentials,
-         Map<String, Credentials> credentialStore, ComputeUtils utils) {
-      this.client = checkNotNull(client, "client");
-      this.elasticIpCache = checkNotNull(elasticIpCache, "elasticIpCache");
-      this.nodeRunning = checkNotNull(nodeRunning, "nodeRunning");
-      this.presentInstances = checkNotNull(presentInstances, "presentInstances");
-      this.createKeyPairAndSecurityGroupsAsNeededAndReturncustomize = checkNotNull(
-            createKeyPairAndSecurityGroupsAsNeededAndReturncustomize,
-            "createKeyPairAndSecurityGroupsAsNeededAndReturncustomize");
-      this.runningInstanceToNodeMetadata = checkNotNull(runningInstanceToNodeMetadata, "runningInstanceToNodeMetadata");
-      this.instanceToCredentials = checkNotNull(instanceToCredentials, "instanceToCredentials");
-      this.credentialStore = checkNotNull(credentialStore, "credentialStore");
-      this.utils = checkNotNull(utils, "utils");
-   }
-
-   public static final Function<RunningInstance, RegionAndName> instanceToRegionAndName = new Function<RunningInstance, RegionAndName>() {
-      @Override
-      public RegionAndName apply(RunningInstance from) {
-         return new RegionAndName(from.getRegion(), from.getId());
-      }
-   };
-
-   @Override
-   public Map<?, ListenableFuture<Void>> execute(String group, int count, Template template, Set<NodeMetadata> goodNodes,
-         Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {
-
-      Template mutableTemplate = template.clone();
-
-      Set<RunningInstance> started = runInstancesAndWarnOnInvisible(group, count, mutableTemplate);
-      if (started.size() == 0) {
-         logger.warn("<< unable to start instances(%s)", mutableTemplate);
-         return ImmutableMap.of();
-      }
-      populateCredentials(started, template.getOptions());
-
-      if (autoAllocateElasticIps) // before customization as the elastic ips may be needed
-         blockUntilRunningAndAssignElasticIpsToInstancesOrPutIntoBadMap(started, badNodes);
-
-      return utils.customizeNodesAndAddToGoodMapOrPutExceptionIntoBadMap(mutableTemplate.getOptions(),
-            transform(started, runningInstanceToNodeMetadata), goodNodes, badNodes, customizationResponses);
-   }
-
-   /**
-    * attempts to start the specified count of instances. eventual consistency might cause a problem where instances
-    * aren't immediately visible to the api. This method will warn when that occurs.
-    */
-   private Set<RunningInstance> runInstancesAndWarnOnInvisible(String group, int count, Template mutableTemplate) {
-      Set<RunningInstance> started = createKeyPairAndSecurityGroupsAsNeededThenRunInstances(group, count,
-            mutableTemplate);
-      Set<RegionAndName> startedIds = ImmutableSet.copyOf(transform(started, instanceToRegionAndName));
-      if (startedIds.size() == 0) {
-         return ImmutableSet.copyOf(started);
-      }
-      logger.debug("<< started instances(%s)", startedIds);
-      Set<RunningInstance> visible = presentInstances.apply(startedIds);
-      Set<RegionAndName> visibleIds = ImmutableSet.copyOf(transform(visible, instanceToRegionAndName));
-      logger.trace("<< visible instances(%s)", visibleIds);
-
-      // add an exception for each of the nodes we cannot customize
-      Set<RegionAndName> invisibleIds = difference(startedIds, visibleIds);
-      if (invisibleIds.size() > 0) {
-         logger.warn("<< not api visible instances(%s)", invisibleIds);
-      }
-      return started;
-   }
-
-   private void populateCredentials(Set<RunningInstance> input, TemplateOptions options) {
-      LoginCredentials credentials = null;
-      for (RunningInstance instance : input) {
-         credentials = instanceToCredentials.getUnchecked(instance).orNull();
-         if (credentials != null)
-            break;
-      }
-      credentials = overrideDefaultCredentialsWithOptionsIfPresent(credentials, options);
-      if (credentials != null)
-         for (RegionAndName instance : transform(input, instanceToRegionAndName))
-            credentialStore.put("node#" + instance.slashEncode(), credentials);
-   }
-
-   private void blockUntilRunningAndAssignElasticIpsToInstancesOrPutIntoBadMap(Set<RunningInstance> input,
-         Map<NodeMetadata, Exception> badNodes) {
-      Map<RegionAndName, RunningInstance> instancesById = Maps.uniqueIndex(input, instanceToRegionAndName);
-      for (Map.Entry<RegionAndName, RunningInstance> entry : instancesById.entrySet()) {
-         RegionAndName id = entry.getKey();
-         RunningInstance instance = entry.getValue();
-         try {
-            logger.debug("<< allocating elastic IP instance(%s)", id);
-            String ip = client.getElasticIPAddressApi().get().allocateAddressInRegion(id.getRegion());
-            // block until instance is running
-            logger.debug(">> awaiting status running instance(%s)", id);
-            AtomicReference<NodeMetadata> node = newReference(runningInstanceToNodeMetadata
-                  .apply(instance));
-            nodeRunning.apply(node);
-            logger.trace("<< running instance(%s)", id);
-            logger.debug(">> associating elastic IP %s to instance %s", ip, id);
-            client.getElasticIPAddressApi().get().associateAddressInRegion(id.getRegion(), ip, id.getName());
-            logger.trace("<< associated elastic IP %s to instance %s", ip, id);
-            // add mapping of instance to ip into the cache
-            elasticIpCache.put(id, ip);
-         } catch (RuntimeException e) {
-            badNodes.put(runningInstanceToNodeMetadata.apply(instancesById.get(id)), e);
-         }
-      }
-   }
-
-   private Set<RunningInstance> createKeyPairAndSecurityGroupsAsNeededThenRunInstances(String group, int count,
-         Template template) {
-      String region = AWSUtils.getRegionFromLocationOrNull(template.getLocation());
-      String zone = getZoneFromLocationOrNull(template.getLocation());
-      RunInstancesOptions instanceOptions = createKeyPairAndSecurityGroupsAsNeededAndReturncustomize.execute(region,
-            group, template);
-      return createNodesInRegionAndZone(region, zone, group, count, template, instanceOptions);
-   }
-
-   protected Set<RunningInstance> createNodesInRegionAndZone(String region, String zone, String group,
-                                                             int count, Template template,
-                                                             RunInstancesOptions instanceOptions) {
-      int countStarted = 0;
-      int tries = 0;
-      Set<RunningInstance> started = ImmutableSet.<RunningInstance> of();
-
-      int maxCount = EC2TemplateOptions.class.cast(template.getOptions()).getMaxCount();
-      int countToProvision;
-
-      if (maxCount == 0) {
-         maxCount = count;
-         countToProvision = 1;
-      } else {
-         countToProvision = count;
-      }
-
-      while (countStarted < count && tries++ < count) {
-         if (logger.isDebugEnabled())
-            logger.debug(">> running %d instance region(%s) zone(%s) ami(%s) params(%s)", count - countStarted, region,
-                  zone, template.getImage().getProviderId(), instanceOptions.buildFormParameters());
-
-         started = ImmutableSet.copyOf(concat(
-               started,
-               client.getInstanceApi().get().runInstancesInRegion(region, zone, template.getImage().getProviderId(),
-                       countToProvision, maxCount - countStarted, instanceOptions)));
-
-         countStarted = size(started);
-         if (countStarted < count)
-            logger.debug(">> not enough instances (%d/%d) started, attempting again", countStarted, count);
-      }
-      return started;
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2DestroyNodeStrategy.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2DestroyNodeStrategy.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2DestroyNodeStrategy.java
deleted file mode 100644
index b8a1b5c..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2DestroyNodeStrategy.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.ec2.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.concurrent.ExecutionException;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.aws.util.AWSUtils;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.compute.strategy.DestroyNodeStrategy;
-import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
-import org.jclouds.ec2.EC2Api;
-import org.jclouds.ec2.compute.domain.RegionAndName;
-import org.jclouds.ec2.reference.EC2Constants;
-import org.jclouds.logging.Logger;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-
-@Singleton
-public class EC2DestroyNodeStrategy implements DestroyNodeStrategy {
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-   protected final EC2Api client;
-   protected final GetNodeMetadataStrategy getNode;
-   protected final LoadingCache<RegionAndName, String> elasticIpCache;
-
-   @Inject
-   @Named(EC2Constants.PROPERTY_EC2_AUTO_ALLOCATE_ELASTIC_IPS)
-   @VisibleForTesting
-   boolean autoAllocateElasticIps = false;
-
-   @Inject
-   protected EC2DestroyNodeStrategy(EC2Api client, GetNodeMetadataStrategy getNode,
-            @Named("ELASTICIP") LoadingCache<RegionAndName, String> elasticIpCache) {
-      this.client = checkNotNull(client, "client");
-      this.getNode = checkNotNull(getNode, "getNode");
-      this.elasticIpCache = checkNotNull(elasticIpCache, "elasticIpCache");
-   }
-
-   @Override
-   public NodeMetadata destroyNode(String id) {
-      String[] parts = AWSUtils.parseHandle(id);
-      String region = parts[0];
-      String instanceId = parts[1];
-
-      // TODO: can there be multiple?
-      releaseAnyPublicIpForInstanceInRegion(instanceId, region);
-      destroyInstanceInRegion(instanceId, region);
-      return getNode.getNode(id);
-   }
-
-   protected void releaseAnyPublicIpForInstanceInRegion(String instanceId, String region) {
-      if (!autoAllocateElasticIps)
-         return;
-      try {
-         String ip = elasticIpCache.get(new RegionAndName(region, instanceId));
-         logger.debug(">> disassociating elastic IP %s", ip);
-         client.getElasticIPAddressApi().get().disassociateAddressInRegion(region, ip);
-         logger.trace("<< disassociated elastic IP %s", ip);
-         elasticIpCache.invalidate(new RegionAndName(region, instanceId));
-         logger.debug(">> releasing elastic IP %s", ip);
-         client.getElasticIPAddressApi().get().releaseAddressInRegion(region, ip);
-         logger.trace("<< released elastic IP %s", ip);
-      } catch (CacheLoader.InvalidCacheLoadException e) {
-         // no ip was found
-         return;
-      } catch (ExecutionException e) {
-         // don't propagate as we need to clean up the node regardless
-         logger.warn(e, "error cleaning up elastic ip for instance %s/%s", region, instanceId);
-      }
-
-   }
-
-   protected void destroyInstanceInRegion(String instanceId, String region) {
-      client.getInstanceApi().get().terminateInstancesInRegion(region, instanceId);
-   }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2GetImageStrategy.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2GetImageStrategy.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2GetImageStrategy.java
deleted file mode 100644
index 55a7889..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2GetImageStrategy.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.ec2.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.getOnlyElement;
-
-import java.util.NoSuchElementException;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.aws.util.AWSUtils;
-import org.jclouds.compute.strategy.GetImageStrategy;
-import org.jclouds.ec2.EC2Api;
-import org.jclouds.ec2.domain.Image;
-import org.jclouds.ec2.options.DescribeImagesOptions;
-
-import com.google.common.base.Function;
-
-@Singleton
-public class EC2GetImageStrategy implements GetImageStrategy {
-
-   private final EC2Api client;
-   private final Function<Image, org.jclouds.compute.domain.Image> imageToImage;
-
-   @Inject
-   protected EC2GetImageStrategy(EC2Api client, Function<Image, org.jclouds.compute.domain.Image> imageToImage) {
-      this.client = checkNotNull(client, "client");
-      this.imageToImage = checkNotNull(imageToImage, "imageToImage");
-   }
-
-   @Override
-   public org.jclouds.compute.domain.Image getImage(String id) {
-      checkNotNull(id, "id");
-      String[] parts = AWSUtils.parseHandle(id);
-      String region = parts[0];
-      String instanceId = parts[1];
-      try {
-         Image image = getImageInRegion(region, instanceId);
-         return imageToImage.apply(image);
-      } catch (NoSuchElementException e) {
-         return null;
-      }
-   }
-
-   public Image getImageInRegion(String region, String id) {
-      return getOnlyElement(client.getAMIApi().get().describeImagesInRegion(region,
-               DescribeImagesOptions.Builder.imageIds(id)));
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2GetNodeMetadataStrategy.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2GetNodeMetadataStrategy.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2GetNodeMetadataStrategy.java
deleted file mode 100644
index 0d7fa77..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2GetNodeMetadataStrategy.java
+++ /dev/null
@@ -1,67 +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.ec2.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.getOnlyElement;
-
-import java.util.NoSuchElementException;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.aws.util.AWSUtils;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
-import org.jclouds.ec2.EC2Api;
-import org.jclouds.ec2.domain.RunningInstance;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
-
-@Singleton
-public class EC2GetNodeMetadataStrategy implements GetNodeMetadataStrategy {
-
-   private final EC2Api client;
-   private final Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata;
-
-   @Inject
-   protected EC2GetNodeMetadataStrategy(EC2Api client,
-            Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata) {
-      this.client = checkNotNull(client, "client");
-      this.runningInstanceToNodeMetadata = checkNotNull(runningInstanceToNodeMetadata, "runningInstanceToNodeMetadata");
-   }
-
-   @Override
-   public NodeMetadata getNode(String id) {
-      checkNotNull(id, "id");
-      String[] parts = AWSUtils.parseHandle(id);
-      String region = parts[0];
-      String instanceId = parts[1];
-      try {
-         RunningInstance runningInstance = getRunningInstanceInRegion(region, instanceId);
-         return runningInstanceToNodeMetadata.apply(runningInstance);
-      } catch (NoSuchElementException e) {
-         return null;
-      }
-   }
-
-   public RunningInstance getRunningInstanceInRegion(String region, String id) {
-      return getOnlyElement(Iterables.concat(client.getInstanceApi().get().describeInstancesInRegion(region, id)));
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2ListNodesStrategy.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2ListNodesStrategy.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2ListNodesStrategy.java
deleted file mode 100644
index 2f0204a..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2ListNodesStrategy.java
+++ /dev/null
@@ -1,160 +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.ec2.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.in;
-import static com.google.common.base.Predicates.notNull;
-import static com.google.common.collect.Iterables.concat;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.toArray;
-import static com.google.common.collect.Iterables.transform;
-import static com.google.common.collect.Multimaps.filterKeys;
-import static com.google.common.collect.Multimaps.index;
-import static com.google.common.collect.Multimaps.transformValues;
-
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.aws.util.AWSUtils;
-import org.jclouds.compute.domain.ComputeMetadata;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.predicates.NodePredicates;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.compute.strategy.ListNodesStrategy;
-import org.jclouds.ec2.EC2Api;
-import org.jclouds.ec2.domain.Reservation;
-import org.jclouds.ec2.domain.RunningInstance;
-import org.jclouds.location.Region;
-import org.jclouds.logging.Logger;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Multimap;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.inject.Inject;
-
-@Singleton
-public class EC2ListNodesStrategy implements ListNodesStrategy {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   @Inject(optional = true)
-   @Named(Constants.PROPERTY_REQUEST_TIMEOUT)
-   protected static Long maxTime;
-
-   protected final EC2Api client;
-   protected final Supplier<Set<String>> regions;
-   protected final Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata;
-   protected final ListeningExecutorService userExecutor;
-
-   @Inject
-   protected EC2ListNodesStrategy(EC2Api client, @Region Supplier<Set<String>> regions,
-            Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata,
-            @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
-      this.client =  checkNotNull(client, "client");
-      this.regions =  checkNotNull(regions, "regions");
-      this.runningInstanceToNodeMetadata = checkNotNull(runningInstanceToNodeMetadata, "runningInstanceToNodeMetadata");
-      this.userExecutor =  checkNotNull(userExecutor, "userExecutor");
-   }
-
-   @Override
-   public Set<? extends ComputeMetadata> listNodes() {
-      return listDetailsOnNodesMatching(NodePredicates.all());
-   }
-
-   @Override
-   public Set<? extends NodeMetadata> listNodesByIds(Iterable<String> ids) {
-      Multimap<String, String> idsByHandles = index(ids, splitHandle(1));
-      Multimap<String, String> idsByRegions = transformValues(idsByHandles, splitHandle(0));
-      Multimap<String, String> idsByConfiguredRegions = filterKeys(idsByRegions, in(regions.get()));
-
-      if (idsByConfiguredRegions.isEmpty()) {
-         return ImmutableSet.of();
-      }
-      
-      Iterable<? extends RunningInstance> instances = pollRunningInstancesByRegionsAndIds(idsByConfiguredRegions);
-      Iterable<? extends NodeMetadata> nodes = transform(filter(instances, notNull()),
-                                                         runningInstanceToNodeMetadata);
-      return ImmutableSet.copyOf(nodes);
-   }
-
-   @Override
-   public Set<? extends NodeMetadata> listDetailsOnNodesMatching(Predicate<ComputeMetadata> filter) {
-      Iterable<? extends RunningInstance> instances = pollRunningInstances();
-      Iterable<? extends NodeMetadata> nodes = filter(transform(filter(instances, notNull()),
-               runningInstanceToNodeMetadata), and(notNull(), filter));
-      return ImmutableSet.copyOf(nodes);
-   }
-
-   protected Iterable<? extends RunningInstance> pollRunningInstances() {
-      Iterable<? extends Set<? extends Reservation<? extends RunningInstance>>> reservations
-         = transform(regions.get(), allInstancesInRegion());
-      
-      return concat(concat(reservations));
-   }
-
-   protected Iterable<? extends RunningInstance> pollRunningInstancesByRegionsAndIds(final Multimap<String, String> idsByRegions) {
-      Iterable<? extends Set<? extends Reservation<? extends RunningInstance>>> reservations
-         = transform(idsByRegions.keySet(), instancesByIdInRegion(idsByRegions));
-      
-      return concat(concat(reservations));
-   }
-
-   protected Function<String, String> splitHandle(final int pos) {
-      return new Function<String, String>() {
-
-         @Override
-         public String apply(String handle) {
-            return AWSUtils.parseHandle(handle)[pos];
-         }
-      };
-   }
-
-   protected Function<String, Set<? extends Reservation<? extends RunningInstance>>> allInstancesInRegion() {
-      return new Function<String, Set<? extends Reservation<? extends RunningInstance>>>() {
-         
-         @Override
-         public Set<? extends Reservation<? extends RunningInstance>> apply(String from) {
-            return client.getInstanceApi().get().describeInstancesInRegion(from);
-         }
-         
-      };
-   }
-
-   protected Function<String, Set<? extends Reservation<? extends RunningInstance>>>
-                                                                  instancesByIdInRegion(final Multimap<String, String> idsByRegions) {
-      return new Function<String, Set<? extends Reservation<? extends RunningInstance>>>() {
-                 
-         @Override
-         public Set<? extends Reservation<? extends RunningInstance>> apply(String from) {
-            return client.getInstanceApi().get()
-               .describeInstancesInRegion(from, toArray(idsByRegions.get(from), String.class));
-         }
-         
-      };
-   }
-}