You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ab...@apache.org on 2013/05/10 23:53:16 UTC
[07/18] JCLOUDS-25. Remove oprhaned sandbox-* from repo
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudClient.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudClient.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudClient.java
deleted file mode 100644
index ec7ff4a..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudClient.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud;
-
-import java.util.Date;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import org.jclouds.concurrent.Timeout;
-import org.jclouds.ibm.smartcloud.domain.Address;
-import org.jclouds.ibm.smartcloud.domain.Image;
-import org.jclouds.ibm.smartcloud.domain.Instance;
-import org.jclouds.ibm.smartcloud.domain.Key;
-import org.jclouds.ibm.smartcloud.domain.Location;
-import org.jclouds.ibm.smartcloud.domain.Offering;
-import org.jclouds.ibm.smartcloud.domain.StorageOffering;
-import org.jclouds.ibm.smartcloud.domain.Volume;
-import org.jclouds.ibm.smartcloud.options.CreateInstanceOptions;
-import org.jclouds.ibm.smartcloud.options.RestartInstanceOptions;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.ResourceNotFoundException;
-
-/**
- * Provides synchronous access to IBMSmartCloud.
- * <p/>
- *
- * @see IBMSmartCloudAsyncClient
- * @see <a href="http://www-180.ibm.com/cloud/enterprise/beta/support" />
- * @author Adrian Cole
- */
-@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
-public interface IBMSmartCloudClient {
- /**
- *
- * @return the list of Images available to be provisioned on the IBM
- * DeveloperCloud.
- */
- Set<? extends Image> listImages();
-
- /**
- * Returns the available Image identified by the supplied Image ID.
- *
- * @return null if image is not found
- * @throws AuthorizationException
- * code 401 if the user is not authorized to view this image to
- * section
- */
- Image getImage(String id);
-
- /**
- * Deletes Image identified by the supplied Image ID.
- *
- * @throws AuthorizationException
- * code 401 if the user is not authorized to delete this image
- * @throws IllegalStateException
- * code 412 if the image is in an invalid state to perform this
- * operation
- */
- void deleteImage(String id);
-
- String getManifestOfImage(String id);
-
- /**
- * If set to {@code Image.Visibility#PUBLIC}, makes the Image identified by
- * the supplied Image ID publicly available for all users to create Instances
- * of.
- *
- * @return modified image or null, if image was not found.
- *
- * @throws AuthorizationException
- * code 401 if the user is not authorized to change the visibility
- * of this image
- * @throws IllegalStateException
- * code 412 if the image is in an invalid state to perform this
- * operation
- */
- Image setImageVisibility(String id, Image.Visibility visibility);
-
- /**
- *
- * @return the list of Instances that the authenticated user manages.
- * @throws AuthorizationException
- * code 401 if the currently authenticated user is not authorized
- * to view this information
- */
- Set<? extends Instance> listInstances();
-
- /**
- *
- * @return the list of Instances that the authenticated user manages that
- * were created as part of the request specified by {@code requestId}
- * , or null if the request was not found
- * @throws AuthorizationException
- * code 401 if the currently authenticated user is not authorized
- * to view this request
- */
- Set<? extends Instance> listInstancesFromRequest(String requestId);
-
- /**
- * Returns the Instance that the authenticated user manages with the
- * specified {@code id}
- *
- * @return null if instance is not found
- * @throws AuthorizationException
- * code 401 if the currently authenticated user is not authorized
- * to view this instance
- */
- Instance getInstance(String id);
-
- /**
- * Requests a new Instance to be created.
- *
- * @param location
- * The id of the Location where this instance will be created
- * @param name
- * The alias to use to reference this instance
- * @param imageID
- * The ID of the image to create this instance from
- * @param instanceType
- * The instance type to use for this instance {SMALL, MEDIUM,
- * LARGE}
- * @param options
- * overrides default public key, mounts a volume, or attaches a
- * static ip
- * @throws AuthorizationException
- * code 401 if the authenticated user is not authorized to create
- * instances
- * <p/>
- * code 402 if payment is required before more instances may be
- * created
- * @throws IllegalStateException
- * code 409 if there are not enough resources in the cloud to
- * fulfill this request
- * <p/>
- * code 412 One or more of the supplied parameters are invalid for
- * this request
- */
- Instance createInstanceInLocation(String location, String name, String imageID, String instanceType,
- CreateInstanceOptions... options);
-
- /**
- * Sets the expiration time of the instance to the value specified
- *
- * @throws ResourceNotFoundException
- * code 404 The instance specified by {@code name} was not found
- * @throws AuthorizationException
- * code 401 if the user is not authorized to extend the expiration
- * time of this instance
- * <p/>
- * code 402 if payment is required before more instances may be
- * created
- * @throws IllegalStateException
- * <p>
- * code 406 The provided expiration date is not valid code 409 if
- * there are not enough resources in the cloud to fulfill this
- * request
- * <p/>
- * code 412 The instance is in an invalid state to perform this
- * operation
- */
- Date extendReservationForInstance(String id, Date expirationTime);
-
- /**
- * Restart the instance
- *
- * @param id
- * the instance to restart
- * @param options
- * allows you to specify a new public key for login
- * @throws ResourceNotFoundException
- * code 404 The instance specified by {@code name} was not found
- * @throws AuthorizationException
- * code 401 if the user is not authorized to extend the expiration
- * time of this instance
- * <p/>
- * code 402 if payment is required before more instances may be
- * created
- * @throws IllegalStateException
- * <p>
- * code 406 The provided expiration date is not valid code 409 if
- * there are not enough resources in the cloud to fulfill this
- * request
- * <p/>
- * code 412 The instance is in an invalid state to perform this
- * operation
- */
- void restartInstance(String id, RestartInstanceOptions... options);
-
- /**
- * Saves an instance to a private image
- *
- * @param id
- * the instance to save
- * @param toImageName
- * The name to associate with the captured image.
- * @param toImageDescription
- * The description to associate with the capture image.
- * @return a private image
- * @throws ResourceNotFoundException
- * code 404 The instance specified by {@code name} was not found
- * @throws AuthorizationException
- * code 401 if the user is not authorized to extend the expiration
- * time of this instance
- * <p/>
- * code 402 if payment is required before more instances may be
- * created
- * @throws IllegalStateException
- * <p>
- * code 406 The provided expiration date is not valid code 409 if
- * there are not enough resources in the cloud to fulfill this
- * request
- * <p/>
- * code 412 The instance is in an invalid state to perform this
- * operation
- */
- Image saveInstanceToImage(String id, String toImageName, String toImageDescription);
-
- /**
- * Deletes the Instance that the authenticated user manages with the
- * specified {@code id}
- *
- * @throws AuthorizationException
- * code 401 if the user is not authorized to delete this instance
- * @throws IllegalStateException
- * code 412 if the instance is in an invalid state to perform this
- * operation
- */
- void deleteInstance(String id);
-
- /**
- *
- * @return the set of Public Keys stored for the authenticated user.
- */
- Set<? extends Key> listKeys();
-
- /**
- * Returns the key with the specified key name from the set of Public Keys
- * stored for the authenticated user.
- *
- * @return null if key is not found
- */
- Key getKey(String name);
-
- /**
- * Used to generate a new SSH Key Pair for the authenticated user.
- *
- * @param name
- * The name to used to identify this key pair.
- * @return private key
- *
- * @throws IllegalStateException
- * code 409 A key with the specified {@code name} already exists
- *
- */
- Key generateKeyPair(String name);
-
- /**
- * Used to generate a new SSH Key Pair for the authenticated user.
- *
- * @param name
- * The name to used to identify this key pair.
- * @param publicKey
- * The RSA SSH Key to add
- *
- * @throws IllegalStateException
- * code 409 A key with the specified {@code name} already exists
- * <p/>
- * code 412 The supplied public key is invalid
- */
- void addPublicKey(String name, String publicKey);
-
- /**
- * Used to update the Public Key specified by the supplied key name stored
- * for the authenticated user.
- *
- * @param name
- * The name to used to identify this key pair.
- * @param publicKey
- * The public key to store
- * @throws ResourceNotFoundException
- * code 404 The key specified by {@code name} was not found
- * @throws IllegalStateException
- * code 412 The supplied public key is invalid
- */
- void updatePublicKey(String name, String publicKey);
-
- /**
- * Used to set the Public Key specified by the supplied key name as the
- * default key.
- *
- * @param name
- * The name to used to identify this key pair.
- * @param isDefault
- * A boolean representing the default state of this key
- * @throws ResourceNotFoundException
- * code 404 The key specified by {@code name} was not found
- */
- void setDefaultStatusOfKey(String name, boolean isDefault);
-
- /**
- * Deletes Key identified by the supplied key name.
- *
- * @throws AuthorizationException
- * code 401 if the user is not authorized to perform this action
- */
- void deleteKey(String name);
-
- /**
- * Used to retrieve the offerings of storage for the authenticated user.
- *
- * @return offerings or empty set if none
- * @throws AuthorizationException
- * code 401 if the currently authenticated user is not authorized
- * to view this information
- */
- Set<? extends StorageOffering> listStorageOfferings();
-
- /**
- *
- * @return the set of storage volumes for the authenticated user.
- * @throws AuthorizationException
- * code 401 if the currently authenticated user is not authorized
- * to view this information
- */
- Set<? extends Volume> listVolumes();
-
- /**
- * Creates a new storage volume for the authenticated user.
- *
- * @param location
- * The id of the Location where the storage volume will be created
- * @param name
- * The desired name of the newly created storage volume
- * @param format
- * The filesystem format for the new storage volume. Valid format
- * is: EXT3
- * @param size
- * The size of the new storage volume. Valid values may include
- * SMALL, MEDIUM, and LARGE. Actual values may depend on the
- * location used and may be discovered via the location service
- * @param offeringID
- * The offeringID which can be obtained from
- * {@link #listStorageOfferings}
- * @throws AuthorizationException
- * code 401 if the currently authenticated user is not authorized
- * to create a volume
- * <p/>
- * code 402 if payment is required before more storage volumes may
- * be created
- * @throws IllegalStateException
- * code 409 if there are not enough resources in the cloud to
- * fulfill this request
- * <p/>
- * code 412 One or more of the supplied parameters are invalid for
- * this request
- */
- Volume createVolumeInLocation(String location, String name, String format, String size, String offeringID);
-
- /**
- * Used to retrieve the specified storage volume for the authenticated user.
- *
- * @return null if volume is not found
- * @throws AuthorizationException
- * code 401 if the currently authenticated user is not authorized
- * to view this storage volume
- */
- Volume getVolume(String id);
-
- /**
- * Remove the specified storage volume for the authenticated user.
- *
- * @throws AuthorizationException
- * code 401 if the currently authenticated user is not authorized
- * to remove this storage volume
- * @throws IllegalStateException
- * code 412 if the storage volume is not in the correct state to
- * be deleted
- */
- void deleteVolume(String id);
-
- /**
- *
- * @return the list of Locations (Data Centers) that the user is entitled to
- * and their capabilities
- */
- Set<? extends Location> listLocations();
-
- /**
- * Returns the Location identified by the supplied Location ID
- *
- * @return null if location is not found
- *
- * @throws AuthorizationException
- * code 401 if the user is not authorized
- */
- Location getLocation(String id);
-
- /**
- *
- * @return the set of static IP addresses for the authenticated user.
- * @throws AuthorizationException
- * code 401 if the currently authenticated user is not authorized
- * to view this information
- */
- Set<? extends Address> listAddresses();
-
- /**
- *
- * Allocates a new static IP addresses for the authenticated user.
- *
- * @param locationId
- * the id of the Location where this address will be allocated
- * @param offeringID
- * The offeringID which can be obtained from
- * {@link #listAddressOfferings}
- * @throws AuthorizationException
- * code 401 if the currently authenticated user is not authorized
- * to remove this IP address
- * <p/>
- * code 402 if payment is required before more addresses may be
- * allocated
- *
- * @throws IllegalStateException
- * code 409 if there are not enough resources in the cloud to
- * fulfill this request
- */
- Address allocateAddressInLocation(String locationId, String offeringID);
-
- /**
- * Used to retrieve the offerings of addresses for the authenticated user.
- *
- * @return offerings or empty set if none
- * @throws AuthorizationException
- * code 401 if the currently authenticated user is not authorized
- * to view this information
- */
- Set<? extends Offering> listAddressOfferings();
-
- /**
- * Used to release the specified static IP addresses for the authenticated
- * user.
- *
- * @throws AuthorizationException
- * code 401 if the user is not authorized to release this address
- * @throws IllegalStateException
- * code 412 address is in an invalid state to perform this
- * operation
- */
- void releaseAddress(String id);
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudContextBuilder.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudContextBuilder.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudContextBuilder.java
deleted file mode 100644
index cfff163..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudContextBuilder.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.jclouds.compute.ComputeServiceContextBuilder;
-import org.jclouds.ibm.smartcloud.compute.config.IBMSmartCloudComputeServiceContextModule;
-import org.jclouds.ibm.smartcloud.config.IBMSmartCloudRestClientModule;
-
-import com.google.inject.Module;
-
-/**
- * @author Adrian Cole
- */
-public class IBMSmartCloudContextBuilder extends
- ComputeServiceContextBuilder<IBMSmartCloudClient, IBMSmartCloudAsyncClient> {
-
- public IBMSmartCloudContextBuilder(Properties props) {
- super(IBMSmartCloudClient.class, IBMSmartCloudAsyncClient.class, props);
- }
-
- protected void addClientModule(List<Module> modules) {
- modules.add(new IBMSmartCloudRestClientModule());
- }
-
- @Override
- protected void addContextModule(List<Module> modules) {
- modules.add(new IBMSmartCloudComputeServiceContextModule());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudPropertiesBuilder.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudPropertiesBuilder.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudPropertiesBuilder.java
deleted file mode 100644
index 137c90f..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudPropertiesBuilder.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud;
-
-import static org.jclouds.Constants.PROPERTY_API_VERSION;
-import static org.jclouds.Constants.PROPERTY_ENDPOINT;
-import static org.jclouds.Constants.PROPERTY_ISO3166_CODES;
-import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
-import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_TIMEOUT_NODE_RUNNING;
-import static org.jclouds.location.reference.LocationConstants.ISO3166_CODES;
-import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONE;
-import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONES;
-
-import java.util.Properties;
-
-import org.jclouds.PropertiesBuilder;
-
-/**
- * Builds properties used in IBMSmartCloud Clients
- *
- * @author Adrian Cole
- */
-public class IBMSmartCloudPropertiesBuilder extends PropertiesBuilder {
- @Override
- protected Properties defaultProperties() {
- Properties properties = super.defaultProperties();
- properties.setProperty(PROPERTY_ZONES, "41,61,82,101,121,141");
- properties.setProperty(PROPERTY_ISO3166_CODES, "US-NC,DE-BW,US-CO,CA-ON,JP-12,SG");
- properties.setProperty(PROPERTY_ZONE + ".41." + ISO3166_CODES, "US-NC");
- properties.setProperty(PROPERTY_ZONE + ".61." + ISO3166_CODES, "DE-BW");
- properties.setProperty(PROPERTY_ZONE + ".82." + ISO3166_CODES, "US-CO");
- properties.setProperty(PROPERTY_ZONE + ".101." + ISO3166_CODES, "CA-ON");
- properties.setProperty(PROPERTY_ZONE + ".121." + ISO3166_CODES, "JP-12");
- properties.setProperty(PROPERTY_ZONE + ".141." + ISO3166_CODES, "SG");
- properties.setProperty(PROPERTY_API_VERSION, IBMSmartCloudAsyncClient.VERSION);
- properties.setProperty(PROPERTY_ENDPOINT, "https://www-147.ibm.com/computecloud/enterprise/api/rest");
- properties.setProperty(PROPERTY_TIMEOUT_NODE_RUNNING, (15 * 60 * 1000) + "");
- properties.setProperty(PROPERTY_SESSION_INTERVAL, 60 * 5 + "");
- return properties;
- }
-
- public IBMSmartCloudPropertiesBuilder(Properties properties) {
- super(properties);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudBindComputeStrategiesByClass.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudBindComputeStrategiesByClass.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudBindComputeStrategiesByClass.java
deleted file mode 100644
index dc61b3e..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudBindComputeStrategiesByClass.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud.compute.config;
-
-import org.jclouds.compute.config.BindComputeStrategiesByClass;
-import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName;
-import org.jclouds.compute.strategy.DestroyNodeStrategy;
-import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
-import org.jclouds.compute.strategy.ListNodesStrategy;
-import org.jclouds.compute.strategy.RebootNodeStrategy;
-import org.jclouds.compute.strategy.ResumeNodeStrategy;
-import org.jclouds.compute.strategy.SuspendNodeStrategy;
-import org.jclouds.ibm.smartcloud.compute.strategy.IBMSmartCloudCreateNodeWithGroupEncodedIntoName;
-import org.jclouds.ibm.smartcloud.compute.strategy.IBMSmartCloudDestroyNodeStrategy;
-import org.jclouds.ibm.smartcloud.compute.strategy.IBMSmartCloudGetNodeMetadataStrategy;
-import org.jclouds.ibm.smartcloud.compute.strategy.IBMSmartCloudLifeCycleStrategy;
-import org.jclouds.ibm.smartcloud.compute.strategy.IBMSmartCloudListNodesStrategy;
-
-/**
- * @author Adrian Cole
- */
-public class IBMSmartCloudBindComputeStrategiesByClass extends BindComputeStrategiesByClass {
-
- @Override
- protected Class<? extends CreateNodeWithGroupEncodedIntoName> defineAddNodeWithTagStrategy() {
- return IBMSmartCloudCreateNodeWithGroupEncodedIntoName.class;
- }
-
- @Override
- protected Class<? extends DestroyNodeStrategy> defineDestroyNodeStrategy() {
- return IBMSmartCloudDestroyNodeStrategy.class;
- }
-
- @Override
- protected Class<? extends GetNodeMetadataStrategy> defineGetNodeMetadataStrategy() {
- return IBMSmartCloudGetNodeMetadataStrategy.class;
- }
-
- @Override
- protected Class<? extends ListNodesStrategy> defineListNodesStrategy() {
- return IBMSmartCloudListNodesStrategy.class;
- }
-
- @Override
- protected Class<? extends RebootNodeStrategy> defineRebootNodeStrategy() {
- return IBMSmartCloudLifeCycleStrategy.class;
- }
-
- @Override
- protected Class<? extends ResumeNodeStrategy> defineStartNodeStrategy() {
- return IBMSmartCloudLifeCycleStrategy.class;
- }
-
- @Override
- protected Class<? extends SuspendNodeStrategy> defineStopNodeStrategy() {
- return IBMSmartCloudLifeCycleStrategy.class;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudBindComputeSuppliersByClass.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudBindComputeSuppliersByClass.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudBindComputeSuppliersByClass.java
deleted file mode 100644
index 1a1d3a9..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudBindComputeSuppliersByClass.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud.compute.config;
-
-import java.util.Set;
-
-import org.jclouds.compute.config.BindComputeSuppliersByClass;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.domain.Location;
-import org.jclouds.ibm.smartcloud.compute.suppliers.IBMSmartCloudHardwareSupplier;
-import org.jclouds.ibm.smartcloud.compute.suppliers.IBMSmartCloudImageSupplier;
-import org.jclouds.ibm.smartcloud.compute.suppliers.IBMSmartCloudLocationSupplier;
-
-import com.google.common.base.Supplier;
-/**
- * @author Adrian Cole
- */
-public class IBMSmartCloudBindComputeSuppliersByClass extends BindComputeSuppliersByClass {
- @Override
- protected Class<? extends Supplier<Set<? extends Hardware>>> defineHardwareSupplier() {
- return IBMSmartCloudHardwareSupplier.class;
- }
-
- @Override
- protected Class<? extends Supplier<Set<? extends Image>>> defineImageSupplier() {
- return IBMSmartCloudImageSupplier.class;
- }
-
- @Override
- protected Class<? extends Supplier<Set<? extends Location>>> defineLocationSupplier() {
- return IBMSmartCloudLocationSupplier.class;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudComputeServiceContextModule.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudComputeServiceContextModule.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudComputeServiceContextModule.java
deleted file mode 100644
index 241ab70..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudComputeServiceContextModule.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud.compute.config;
-
-import org.jclouds.compute.config.BaseComputeServiceContextModule;
-import org.jclouds.compute.domain.TemplateBuilder;
-import org.jclouds.compute.internal.BaseComputeService;
-
-import com.google.inject.Injector;
-
-/**
- * Configures the {@link IBMSmartCloudComputeServiceContext}; requires
- * {@link BaseComputeService} bound.
- *
- * @author Adrian Cole
- */
-public class IBMSmartCloudComputeServiceContextModule extends BaseComputeServiceContextModule {
-
- @Override
- protected void configure() {
- install(new IBMSmartCloudComputeServiceDependenciesModule());
- install(new IBMSmartCloudBindComputeStrategiesByClass());
- install(new IBMSmartCloudBindComputeSuppliersByClass());
- super.configure();
- }
-
- /**
- * cheapest image in most available datacenter
- */
- @Override
- protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
- return template.imageNameMatches("^SUSE Linux Enterprise Server 11 SP1 for x86.*").locationId("101");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudComputeServiceDependenciesModule.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudComputeServiceDependenciesModule.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudComputeServiceDependenciesModule.java
deleted file mode 100644
index 8bae00b..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudComputeServiceDependenciesModule.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud.compute.config;
-
-import java.security.SecureRandom;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeState;
-import org.jclouds.compute.internal.ComputeServiceContextImpl;
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
-import org.jclouds.ibm.smartcloud.IBMSmartCloudAsyncClient;
-import org.jclouds.ibm.smartcloud.IBMSmartCloudClient;
-import org.jclouds.ibm.smartcloud.compute.functions.InstanceToNodeMetadata;
-import org.jclouds.ibm.smartcloud.compute.options.IBMSmartCloudTemplateOptions;
-import org.jclouds.ibm.smartcloud.compute.strategy.CreateKeyCreateNodesWithGroupEncodedIntoNameThenAddToSet;
-import org.jclouds.ibm.smartcloud.domain.Instance;
-import org.jclouds.rest.RestContext;
-import org.jclouds.rest.internal.RestContextImpl;
-
-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.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-import com.google.inject.TypeLiteral;
-
-/**
- * @author Adrian Cole
- */
-public class IBMSmartCloudComputeServiceDependenciesModule extends AbstractModule {
-
- @Override
- protected void configure() {
- bind(TemplateOptions.class).to(IBMSmartCloudTemplateOptions.class);
- bind(new TypeLiteral<Function<Instance, NodeMetadata>>() {
- }).to(InstanceToNodeMetadata.class);
- bind(new TypeLiteral<ComputeServiceContext>() {
- }).to(new TypeLiteral<ComputeServiceContextImpl<IBMSmartCloudClient, IBMSmartCloudAsyncClient>>() {
- }).in(Scopes.SINGLETON);
- bind(new TypeLiteral<RestContext<IBMSmartCloudClient, IBMSmartCloudAsyncClient>>() {
- }).to(new TypeLiteral<RestContextImpl<IBMSmartCloudClient, IBMSmartCloudAsyncClient>>() {
- }).in(Scopes.SINGLETON);
- bind(CreateNodesWithGroupEncodedIntoNameThenAddToSet.class).to(
- CreateKeyCreateNodesWithGroupEncodedIntoNameThenAddToSet.class);
- }
-
- @Provides
- @Singleton
- Supplier<String> provideSuffix() {
- return new Supplier<String>() {
- final SecureRandom random = new SecureRandom();
-
- @Override
- public String get() {
- return random.nextInt(100) + "";
- }
- };
-
- }
-
- @Provides
- @Singleton
- @Named("CREDENTIALS")
- Map<String, String> credentialsMap() {
- return new ConcurrentHashMap<String, String>();
- }
-
- @VisibleForTesting
- static final Map<Instance.Status, NodeState> instanceStatusToNodeState = ImmutableMap
- .<Instance.Status, NodeState> builder().put(Instance.Status.ACTIVE, NodeState.RUNNING)//
- .put(Instance.Status.STOPPED, NodeState.SUSPENDED)//
- .put(Instance.Status.REMOVED, NodeState.TERMINATED)//
- .put(Instance.Status.DEPROVISIONING, NodeState.PENDING)//
- .put(Instance.Status.FAILED, NodeState.ERROR)//
- .put(Instance.Status.NEW, NodeState.PENDING)//
- .put(Instance.Status.PROVISIONING, NodeState.PENDING)//
- .put(Instance.Status.REJECTED, NodeState.ERROR)//
- .put(Instance.Status.RESTARTING, NodeState.PENDING)//
- .put(Instance.Status.STARTING, NodeState.PENDING)//
- .put(Instance.Status.STOPPING, NodeState.PENDING)//
- .put(Instance.Status.DEPROVISION_PENDING, NodeState.PENDING)//
- .put(Instance.Status.UNKNOWN, NodeState.UNRECOGNIZED).build();
-
- @Singleton
- @Provides
- Map<Instance.Status, NodeState> provideServerToNodeState() {
- return instanceStatusToNodeState;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/functions/InstanceToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/functions/InstanceToNodeMetadata.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/functions/InstanceToNodeMetadata.java
deleted file mode 100644
index d7d1de4..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/functions/InstanceToNodeMetadata.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.compute.util.ComputeServiceUtils.parseGroupFromName;
-
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.domain.NodeState;
-import org.jclouds.domain.Credentials;
-import org.jclouds.domain.Location;
-import org.jclouds.ibm.smartcloud.domain.IP;
-import org.jclouds.ibm.smartcloud.domain.Instance;
-import org.jclouds.logging.Logger;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Predicates;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class InstanceToNodeMetadata implements Function<Instance, NodeMetadata> {
-
- @VisibleForTesting
- public static final Map<Instance.Status, NodeState> instanceStatusToNodeState = ImmutableMap
- .<Instance.Status, NodeState> builder().put(Instance.Status.ACTIVE, NodeState.RUNNING)//
- .put(Instance.Status.STOPPED, NodeState.SUSPENDED)//
- .put(Instance.Status.REMOVED, NodeState.TERMINATED)//
- .put(Instance.Status.DEPROVISIONING, NodeState.PENDING)//
- .put(Instance.Status.FAILED, NodeState.ERROR)//
- .put(Instance.Status.NEW, NodeState.PENDING)//
- .put(Instance.Status.PROVISIONING, NodeState.PENDING)//
- .put(Instance.Status.REJECTED, NodeState.ERROR)//
- .put(Instance.Status.RESTARTING, NodeState.PENDING)//
- .put(Instance.Status.STARTING, NodeState.PENDING)//
- .put(Instance.Status.STOPPING, NodeState.PENDING)//
- .put(Instance.Status.DEPROVISION_PENDING, NodeState.PENDING)//
- .put(Instance.Status.UNKNOWN, NodeState.UNRECOGNIZED).build();
- @Resource
- protected Logger logger = Logger.NULL;
- private final Map<Instance.Status, NodeState> instanceStateToNodeState;
- private final Supplier<Map<String, ? extends Image>> images;
- private final Map<String, String> credentialsMap;
- private final Supplier<Map<String, ? extends Location>> locations;
-
- @Inject
- InstanceToNodeMetadata(Map<Instance.Status, NodeState> instanceStateToNodeState,
- Supplier<Map<String, ? extends Image>> images, @Named("CREDENTIALS") Map<String, String> credentialsMap,
- Supplier<Map<String, ? extends Location>> locations) {
- this.instanceStateToNodeState = checkNotNull(instanceStateToNodeState, "instanceStateToNodeState");
- this.images = checkNotNull(images, "images");
- this.credentialsMap = checkNotNull(credentialsMap, "credentialsMap");
- this.locations = checkNotNull(locations, "locations");
- }
-
- private static Function<IP, String> ipFromIP = new Function<IP, String>() {
-
- @Override
- public String apply(IP arg0) {
- return arg0 != null ? arg0.getIP() : null;
- }
-
- };
-
- @Override
- public NodeMetadata apply(Instance from) {
- // TODO hardware
- String group = parseGroupFromName(from.getName());
- String ip = ipFromIP.apply(from.getPrimaryIP());
- Set<String> ipSet = ip != null ? ImmutableSet.of(ip) : ImmutableSet.<String> of();
- Image image = images.get().get(from.getImageId());
- String key = credentialsMap.get(from.getKeyName());
- return new NodeMetadataBuilder().ids(from.getId() + "").name(from.getName()).location(
- locations.get().get(image.getLocation())).group(group).imageId(from.getImageId()).state(
- instanceStateToNodeState.get(from.getStatus())).operatingSystem(
- image != null ? image.getOperatingSystem() : null).publicAddresses(ipSet).privateAddresses(
- Iterables.filter(Iterables.transform(from.getSecondaryIPs(), ipFromIP), Predicates.notNull()))
- .credentials(new Credentials(image.getDefaultCredentials().identity, key)).build();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/options/IBMSmartCloudTemplateOptions.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/options/IBMSmartCloudTemplateOptions.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/options/IBMSmartCloudTemplateOptions.java
deleted file mode 100644
index 857cb68..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/options/IBMSmartCloudTemplateOptions.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud.compute.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import java.util.Arrays;
-
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.domain.Credentials;
-import org.jclouds.ibm.smartcloud.options.CreateInstanceOptions;
-import org.jclouds.io.Payload;
-import org.jclouds.scriptbuilder.domain.Statement;
-import org.jclouds.util.Preconditions2;
-
-/**
- * Contains options supported in the {@code ComputeService#runNode} operation on the
- * "ibm.smartcloud" provider. <h2>
- * Usage</h2> The recommended way to instantiate a IBMSmartCloudTemplateOptions object is to
- * statically import IBMSmartCloudTemplateOptions.* and invoke a static creation method followed by
- * an instance mutator (if needed):
- * <p/>
- * <code>
- * import static org.jclouds.ibm.smartcloud.compute.options.IBMSmartCloudTemplateOptions.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 IBMSmartCloudTemplateOptions extends TemplateOptions implements Cloneable {
- @Override
- public IBMSmartCloudTemplateOptions clone() {
- IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions();
- copyTo(options);
- return options;
- }
-
- @Override
- public void copyTo(TemplateOptions to) {
- super.copyTo(to);
- if (to instanceof IBMSmartCloudTemplateOptions) {
- IBMSmartCloudTemplateOptions eTo = IBMSmartCloudTemplateOptions.class.cast(to);
- if (getKeyPair() != null)
- eTo.keyPair(getKeyPair());
- if (!shouldAutomaticallyCreateKeyPair())
- eTo.noKeyPair();
- if (!isMiniEphemeral)
- eTo.isMiniEphemeral(false);
- }
- }
-
- private String keyPair = null;
- private boolean noKeyPair;
- private boolean isMiniEphemeral = true;
-
- public static final IBMSmartCloudTemplateOptions NONE = new IBMSmartCloudTemplateOptions();
-
- /**
- * @see CreateInstanceOptions#isMiniEphemeral
- */
- public IBMSmartCloudTemplateOptions isMiniEphemeral(boolean isMiniEphemeral) {
- this.isMiniEphemeral = isMiniEphemeral;
- return this;
- }
-
- /**
- * Specifies the keypair used to run instances with
- */
- public IBMSmartCloudTemplateOptions keyPair(String keyPair) {
- checkNotNull(keyPair, "use noKeyPair option to request boot without a keypair");
- checkState(!noKeyPair, "you cannot specify both options keyPair and noKeyPair");
- Preconditions2.checkNotEmpty(keyPair, "keypair must be non-empty");
- this.keyPair = keyPair;
- return this;
- }
-
- /**
- * Do not use a keypair on instances
- */
- public IBMSmartCloudTemplateOptions noKeyPair() {
- checkState(keyPair == null, "you cannot specify both options keyPair and noKeyPair");
- this.noKeyPair = true;
- return this;
- }
-
- public static class Builder {
-
- /**
- * @see IBMSmartCloudTemplateOptions#isMiniEphemeral
- */
- public static IBMSmartCloudTemplateOptions isMiniEphemeral(boolean isMiniEphemeral) {
- IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions();
- return options.isMiniEphemeral(isMiniEphemeral);
- }
-
- /**
- * @see IBMSmartCloudTemplateOptions#keyPair
- */
- public static IBMSmartCloudTemplateOptions keyPair(String keyPair) {
- IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions();
- return IBMSmartCloudTemplateOptions.class.cast(options.keyPair(keyPair));
- }
-
- /**
- * @see IBMSmartCloudTemplateOptions#noKeyPair
- */
- public static IBMSmartCloudTemplateOptions noKeyPair() {
- IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions();
- return IBMSmartCloudTemplateOptions.class.cast(options.noKeyPair());
- }
-
-
- // methods that only facilitate returning the correct object type
- /**
- * @see TemplateOptions#inboundPorts
- */
- public static IBMSmartCloudTemplateOptions inboundPorts(int... ports) {
- IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions();
- return IBMSmartCloudTemplateOptions.class.cast(options.inboundPorts(ports));
- }
-
- /**
- * @see TemplateOptions#port
- */
- public static IBMSmartCloudTemplateOptions blockOnPort(int port, int seconds) {
- IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions();
- return IBMSmartCloudTemplateOptions.class.cast(options.blockOnPort(port, seconds));
- }
-
- /**
- * @see TemplateOptions#runScript
- */
- public static IBMSmartCloudTemplateOptions runScript(byte[] script) {
- IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions();
- return IBMSmartCloudTemplateOptions.class.cast(options.runScript(script));
- }
-
- /**
- * @see TemplateOptions#installPrivateKey
- */
- public static IBMSmartCloudTemplateOptions installPrivateKey(String rsaKey) {
- IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions();
- return IBMSmartCloudTemplateOptions.class.cast(options.installPrivateKey(rsaKey));
- }
-
- /**
- * @see TemplateOptions#authorizePublicKey
- */
- public static IBMSmartCloudTemplateOptions authorizePublicKey(String rsaKey) {
- IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions();
- return IBMSmartCloudTemplateOptions.class.cast(options.authorizePublicKey(rsaKey));
- }
-
- /**
- * @see TemplateOptions#withDetails
- */
- public static IBMSmartCloudTemplateOptions withDetails() {
- IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions();
- return IBMSmartCloudTemplateOptions.class.cast(options.withMetadata());
- }
-
- }
-
- // methods that only facilitate returning the correct object type
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IBMSmartCloudTemplateOptions blockOnPort(int port, int seconds) {
- return IBMSmartCloudTemplateOptions.class.cast(super.blockOnPort(port, seconds));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IBMSmartCloudTemplateOptions inboundPorts(int... ports) {
- return IBMSmartCloudTemplateOptions.class.cast(super.inboundPorts(ports));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IBMSmartCloudTemplateOptions authorizePublicKey(String publicKey) {
- return IBMSmartCloudTemplateOptions.class.cast(super.authorizePublicKey(publicKey));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- @Deprecated
- public IBMSmartCloudTemplateOptions authorizePublicKey(Payload publicKey) {
- return IBMSmartCloudTemplateOptions.class.cast(super.authorizePublicKey(publicKey));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IBMSmartCloudTemplateOptions installPrivateKey(String privateKey) {
- return IBMSmartCloudTemplateOptions.class.cast(super.installPrivateKey(privateKey));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- @Deprecated
- public IBMSmartCloudTemplateOptions installPrivateKey(Payload privateKey) {
- return IBMSmartCloudTemplateOptions.class.cast(super.installPrivateKey(privateKey));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IBMSmartCloudTemplateOptions runScript(Payload script) {
- return IBMSmartCloudTemplateOptions.class.cast(super.runScript(script));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- @Deprecated
- public IBMSmartCloudTemplateOptions runScript(byte[] script) {
- return IBMSmartCloudTemplateOptions.class.cast(super.runScript(script));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IBMSmartCloudTemplateOptions withMetadata() {
- return IBMSmartCloudTemplateOptions.class.cast(super.withMetadata());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IBMSmartCloudTemplateOptions blockUntilRunning(boolean blockUntilRunning) {
- return IBMSmartCloudTemplateOptions.class.cast(super.blockUntilRunning(blockUntilRunning));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IBMSmartCloudTemplateOptions dontAuthorizePublicKey() {
- return IBMSmartCloudTemplateOptions.class.cast(super.dontAuthorizePublicKey());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IBMSmartCloudTemplateOptions nameTask(String name) {
- return IBMSmartCloudTemplateOptions.class.cast(super.nameTask(name));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IBMSmartCloudTemplateOptions runAsRoot(boolean runAsRoot) {
- return IBMSmartCloudTemplateOptions.class.cast(super.runAsRoot(runAsRoot));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IBMSmartCloudTemplateOptions runScript(Statement script) {
- return IBMSmartCloudTemplateOptions.class.cast(super.runScript(script));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IBMSmartCloudTemplateOptions overrideCredentialsWith(Credentials overridingCredentials) {
- return IBMSmartCloudTemplateOptions.class.cast(super.overrideCredentialsWith(overridingCredentials));
- }
-
- /**
- * @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;
- }
-
- /**
- * @see CreateInstanceOptions#isMiniEphemeral
- */
- public boolean isMiniEphemeral() {
- return isMiniEphemeral;
- }
-
- @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;
- IBMSmartCloudTemplateOptions other = (IBMSmartCloudTemplateOptions) 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 "[keyPair=" + keyPair + ", noKeyPair=" + noKeyPair + ", isMiniEphemeral=" + isMiniEphemeral
- + ", inboundPorts=" + Arrays.toString(inboundPorts) + ", privateKey=" + (privateKey != null)
- + ", publicKey=" + (publicKey != null) + ", runScript=" + (script != null) + ", port:seconds=" + port
- + ":" + seconds + ", metadata/details: " + includeMetadata + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/CreateKeyCreateNodesWithGroupEncodedIntoNameThenAddToSet.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/CreateKeyCreateNodesWithGroupEncodedIntoNameThenAddToSet.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/CreateKeyCreateNodesWithGroupEncodedIntoNameThenAddToSet.java
deleted file mode 100644
index b5a54da..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/CreateKeyCreateNodesWithGroupEncodedIntoNameThenAddToSet.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-
-import javax.annotation.Resource;
-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.reference.ComputeServiceConstants;
-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.ibm.smartcloud.IBMSmartCloudClient;
-import org.jclouds.ibm.smartcloud.compute.options.IBMSmartCloudTemplateOptions;
-import org.jclouds.ibm.smartcloud.domain.Key;
-import org.jclouds.logging.Logger;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Supplier;
-import com.google.common.collect.Multimap;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class CreateKeyCreateNodesWithGroupEncodedIntoNameThenAddToSet extends
- CreateNodesWithGroupEncodedIntoNameThenAddToSet {
-
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- private final IBMSmartCloudClient client;
- private final Map<String, String> credentialsMap;
- private final Supplier<String> randomSuffix;
-
- @Inject
- protected CreateKeyCreateNodesWithGroupEncodedIntoNameThenAddToSet(
- CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy,
- ListNodesStrategy listNodesStrategy,
- @Named("NAMING_CONVENTION") String nodeNamingConvention,
- @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor,
- CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory,
- IBMSmartCloudClient client, @Named("CREDENTIALS") Map<String, String> credentialsMap,
- Supplier<String> randomSuffix) {
- super(addNodeWithTagStrategy, listNodesStrategy, nodeNamingConvention, executor,
- customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory);
- this.client = checkNotNull(client, "client");
- this.credentialsMap = checkNotNull(credentialsMap, "credentialsMap");
- this.randomSuffix = checkNotNull(randomSuffix, "randomSuffix");
- }
-
- @Override
- public Map<?, Future<Void>> execute(String group, int count, Template template, Set<NodeMetadata> goodNodes,
- Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {
- IBMSmartCloudTemplateOptions options = template.getOptions().as(IBMSmartCloudTemplateOptions.class);
- if (options.shouldAutomaticallyCreateKeyPair() && options.getKeyPair() == null) {
- Key key = createNewKey(group);
- options.keyPair(key.getName());
- credentialsMap.put(key.getName(), key.getKeyMaterial());
- }
- return super.execute(group, count, template, goodNodes, badNodes, customizationResponses);
- }
-
- @VisibleForTesting
- Key createNewKey(String group) {
- checkNotNull(group, "group");
- logger.debug(">> creating key group(%s)", group);
- Key key = null;
- while (key == null) {
- try {
- key = client.generateKeyPair(getNextName(group));
- logger.debug("<< created key(%s)", key.getName());
- } catch (IllegalStateException e) {
-
- }
- }
- return key;
- }
-
- private String getNextName(String group) {
- return String.format("jclouds#%s#%s", group, randomSuffix.get());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudCreateNodeWithGroupEncodedIntoName.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudCreateNodeWithGroupEncodedIntoName.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudCreateNodeWithGroupEncodedIntoName.java
deleted file mode 100644
index 2172d92..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudCreateNodeWithGroupEncodedIntoName.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.ibm.smartcloud.options.CreateInstanceOptions.Builder.authorizePublicKey;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName;
-import org.jclouds.ibm.smartcloud.IBMSmartCloudClient;
-import org.jclouds.ibm.smartcloud.compute.options.IBMSmartCloudTemplateOptions;
-import org.jclouds.ibm.smartcloud.domain.Instance;
-import org.jclouds.ibm.smartcloud.options.CreateInstanceOptions;
-
-import com.google.common.base.Function;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class IBMSmartCloudCreateNodeWithGroupEncodedIntoName implements CreateNodeWithGroupEncodedIntoName {
-
- private final IBMSmartCloudClient client;
- private final Function<Instance, NodeMetadata> instanceToNodeMetadata;
-
- @Inject
- protected IBMSmartCloudCreateNodeWithGroupEncodedIntoName(IBMSmartCloudClient client,
- Function<Instance, NodeMetadata> instanceToNodeMetadata) {
- this.client = checkNotNull(client, "client");
- this.instanceToNodeMetadata = checkNotNull(instanceToNodeMetadata, "instanceToNodeMetadata");
- }
-
- @Override
- public NodeMetadata createNodeWithGroupEncodedIntoName(String group, String name, Template template) {
- IBMSmartCloudTemplateOptions templateOptions = template.getOptions().as(IBMSmartCloudTemplateOptions.class);
- CreateInstanceOptions options = authorizePublicKey(templateOptions.getKeyPair()).isMiniEphemeral(
- IBMSmartCloudTemplateOptions.class.cast(template.getOptions()).isMiniEphemeral());
- Instance instance = client.createInstanceInLocation(template.getLocation().getId(), name, template.getImage()
- .getProviderId(), template.getHardware().getProviderId(), options);
- return instanceToNodeMetadata.apply(instance);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudDestroyNodeStrategy.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudDestroyNodeStrategy.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudDestroyNodeStrategy.java
deleted file mode 100644
index 18fe9b1..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudDestroyNodeStrategy.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.concurrent.TimeUnit;
-
-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.compute.strategy.DestroyNodeStrategy;
-import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
-import org.jclouds.ibm.smartcloud.IBMSmartCloudClient;
-import org.jclouds.ibm.smartcloud.domain.Instance;
-import org.jclouds.ibm.smartcloud.predicates.InstanceActiveOrFailed;
-import org.jclouds.logging.Logger;
-import org.jclouds.predicates.RetryablePredicate;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class IBMSmartCloudDestroyNodeStrategy implements DestroyNodeStrategy {
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- private final IBMSmartCloudClient client;
- private final GetNodeMetadataStrategy getNode;
-
- @Inject
- protected IBMSmartCloudDestroyNodeStrategy(IBMSmartCloudClient client, GetNodeMetadataStrategy getNode) {
- this.client = checkNotNull(client, "client");
- this.getNode = checkNotNull(getNode, "getNode");
- }
-
- @Override
- public NodeMetadata destroyNode(String id) {
- Instance instance = client.getInstance(id);
- if (instance != null && instance.getStatus() != Instance.Status.DEPROVISIONING
- && instance.getStatus() != Instance.Status.DEPROVISION_PENDING) {
- // often it takes 8 minutes to finish provisioning a suse host
- int timeout = (instance.getStatus() == Instance.Status.NEW || instance.getStatus() == Instance.Status.PROVISIONING) ? 600
- : 30;
- logger.debug(">> awaiting up to %s seconds for instance %s to be ready for delete", timeout, id);
- boolean ready = new RetryablePredicate<Instance>(new InstanceActiveOrFailed(client), timeout, 2,
- TimeUnit.SECONDS).apply(instance);
- logger.debug(">> instance state is %sready, deleting", ready ? "" : "not ", id);
- client.deleteInstance(instance.getId());
- }
- return instance != null ? getNode.getNode(id) : null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudGetNodeMetadataStrategy.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudGetNodeMetadataStrategy.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudGetNodeMetadataStrategy.java
deleted file mode 100644
index 3f7061d..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudGetNodeMetadataStrategy.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
-import org.jclouds.ibm.smartcloud.IBMSmartCloudClient;
-import org.jclouds.ibm.smartcloud.domain.Instance;
-
-import com.google.common.base.Function;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class IBMSmartCloudGetNodeMetadataStrategy implements GetNodeMetadataStrategy {
- private final IBMSmartCloudClient client;
- private final Function<Instance, NodeMetadata> instanceToNodeMetadata;
-
- @Inject
- protected IBMSmartCloudGetNodeMetadataStrategy(IBMSmartCloudClient client,
- Function<Instance, NodeMetadata> instanceToNodeMetadata) {
- this.client = client;
- this.instanceToNodeMetadata = instanceToNodeMetadata;
- }
-
- @Override
- public NodeMetadata getNode(String id) {
- Instance instance = client.getInstance(checkNotNull(id, "id"));
- return instance == null ? null : instanceToNodeMetadata.apply(instance);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudLifeCycleStrategy.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudLifeCycleStrategy.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudLifeCycleStrategy.java
deleted file mode 100644
index 13772c0..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudLifeCycleStrategy.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
-import org.jclouds.compute.strategy.RebootNodeStrategy;
-import org.jclouds.compute.strategy.ResumeNodeStrategy;
-import org.jclouds.compute.strategy.SuspendNodeStrategy;
-import org.jclouds.ibm.smartcloud.IBMSmartCloudClient;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class IBMSmartCloudLifeCycleStrategy implements RebootNodeStrategy, SuspendNodeStrategy, ResumeNodeStrategy {
-
- private final IBMSmartCloudClient client;
- private final GetNodeMetadataStrategy getNode;
-
- @Inject
- protected IBMSmartCloudLifeCycleStrategy(IBMSmartCloudClient client, GetNodeMetadataStrategy getNode) {
- this.client = checkNotNull(client, "client");
- this.getNode = checkNotNull(getNode, "getNode");
- }
-
- @Override
- public NodeMetadata rebootNode(String id) {
- client.restartInstance(id);
- return getNode.getNode(id);
- }
-
- @Override
- public NodeMetadata suspendNode(String id) {
- throw new UnsupportedOperationException("suspend not supported");
- }
-
- @Override
- public NodeMetadata resumeNode(String id) {
- throw new UnsupportedOperationException("resume not supported");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudListNodesStrategy.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudListNodesStrategy.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudListNodesStrategy.java
deleted file mode 100644
index 700c59c..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudListNodesStrategy.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud.compute.strategy;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.ComputeMetadata;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.predicates.NodePredicates;
-import org.jclouds.compute.strategy.ListNodesStrategy;
-import org.jclouds.ibm.smartcloud.IBMSmartCloudClient;
-import org.jclouds.ibm.smartcloud.domain.Instance;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class IBMSmartCloudListNodesStrategy implements ListNodesStrategy {
- private final IBMSmartCloudClient client;
- private final Function<Instance, NodeMetadata> instanceToNodeMetadata;
-
- @Inject
- protected IBMSmartCloudListNodesStrategy(IBMSmartCloudClient client,
- Function<Instance, NodeMetadata> instanceToNodeMetadata) {
- this.client = client;
- this.instanceToNodeMetadata = instanceToNodeMetadata;
- }
-
- @Override
- public Iterable<? extends ComputeMetadata> listNodes() {
- return listDetailsOnNodesMatching(NodePredicates.all());
- }
-
- @Override
- public Iterable<? extends NodeMetadata> listDetailsOnNodesMatching(Predicate<ComputeMetadata> filter) {
- return Iterables.filter(Iterables.transform(client.listInstances(), instanceToNodeMetadata), filter);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudHardwareSupplier.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudHardwareSupplier.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudHardwareSupplier.java
deleted file mode 100644
index f4f2d51..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudHardwareSupplier.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud.compute.suppliers;
-
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.HardwareBuilder;
-import org.jclouds.compute.domain.Processor;
-import org.jclouds.compute.domain.Volume;
-import org.jclouds.compute.domain.internal.VolumeImpl;
-import org.jclouds.compute.predicates.ImagePredicates;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.Location;
-import org.jclouds.ibm.smartcloud.IBMSmartCloudClient;
-import org.jclouds.ibm.smartcloud.domain.InstanceType;
-import org.jclouds.logging.Logger;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Sets;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class IBMSmartCloudHardwareSupplier implements Supplier<Set<? extends Hardware>> {
-
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
- private final IBMSmartCloudClient sync;
- private final Supplier<Map<String, ? extends Location>> locations;
-
- @Inject
- IBMSmartCloudHardwareSupplier(IBMSmartCloudClient sync, Supplier<Map<String, ? extends Location>> locations) {
- this.sync = sync;
- this.locations = locations;
- }
-
- @Override
- public Set<? extends Hardware> get() {
- final Set<Hardware> hardware = Sets.newHashSet();
- logger.debug(">> providing hardware");
- for (org.jclouds.ibm.smartcloud.domain.Image image : sync.listImages()) {
- for (InstanceType instanceType : image.getSupportedInstanceTypes()) {
- hardware.add(new HardwareBuilder()
- .id(image.getId() + "/" + instanceType.getId())
- .providerId(instanceType.getId())
- .name(instanceType.getLabel())
- .location(locations.get().get(image.getLocation()))
- .uri(image.getManifest())
- .processors(ImmutableList.of(new Processor((instanceType.getPrice().getRate() * 100), 1.0)))
- .ram((int) instanceType.getPrice().getRate() * 1024)
- .supportsImage(ImagePredicates.idEquals(image.getId()))
- .volumes(
- ImmutableList.<Volume> of(new VolumeImpl((float) (instanceType.getPrice().getRate() * 100d),
- true, true))).build());
-
- }
- }
- logger.debug("<< hardware(%d)", hardware.size());
- return hardware;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudImageSupplier.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudImageSupplier.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudImageSupplier.java
deleted file mode 100644
index 2f0b5a4..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudImageSupplier.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.ibm.smartcloud.compute.suppliers;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.ImageBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.Credentials;
-import org.jclouds.domain.Location;
-import org.jclouds.ibm.smartcloud.IBMSmartCloudClient;
-import org.jclouds.ibm.smartcloud.domain.Image.Architecture;
-import org.jclouds.logging.Logger;
-
-import com.google.common.base.Splitter;
-import com.google.common.base.Supplier;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class IBMSmartCloudImageSupplier implements Supplier<Set<? extends Image>> {
-
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
- private final IBMSmartCloudClient sync;
- private final Supplier<Map<String, ? extends Location>> locations;
-
- @Inject
- IBMSmartCloudImageSupplier(final IBMSmartCloudClient sync, Supplier<Map<String, ? extends Location>> locations) {
- this.sync = sync;
- this.locations = locations;
- }
-
- @Override
- public Set<? extends Image> get() {
- final Set<Image> images = Sets.newHashSet();
- logger.debug(">> providing images");
-
- for (org.jclouds.ibm.smartcloud.domain.Image image : sync.listImages()) {
-
- OperatingSystem.Builder osBuilder = OperatingSystem.builder();
- Iterable<String> osVersion = Splitter.on('/').split(checkNotNull(image.getPlatform(), "platform"));
- osBuilder.version(Iterables.get(osVersion, 1));
- osBuilder.name(image.getPlatform());
- osBuilder.description(image.getPlatform());
- if ("Red Hat Enterprise Linux".equals(Iterables.get(osVersion, 0)))
- osBuilder.family(OsFamily.RHEL);
- else if ("SUSE Linux Enterprise Server".equals(Iterables.get(osVersion, 0)))
- osBuilder.family(OsFamily.SUSE);
- else if ("Windows".equals(Iterables.get(osVersion, 0)))
- osBuilder.family(OsFamily.WINDOWS);
- else
- osBuilder.family(OsFamily.UNRECOGNIZED);
- osBuilder.arch(image.getArchitecture().toString());
- osBuilder.is64Bit(image.getArchitecture() == Architecture.X86_64);
-
- // TODO manifest fails to parse due to encoding issues in the path
- // TODO get correct default credentials
- // http://www-180.ibm.com/cloud/enterprise/beta/ram/community/_rlvid.jsp.faces?_rap=pc_DiscussionForum.doDiscussionTopic&_rvip=/community/discussionForum.jsp&guid={DA689AEE-783C-6FE7-6F9F-DFEE9763F806}&v=1&submission=false&fid=1068&tid=1527
- images.add(new ImageBuilder().ids(image.getId()).name(image.getName()).location(
- locations.get().get(image.getLocation())).operatingSystem(osBuilder.build()).description(
- image.getName()).version(image.getCreatedTime().getTime() + "").defaultCredentials(
- new Credentials("idcuser", null)).build());
- }
-
- logger.debug("<< images(%d)", images.size());
- return images;
- }
-}