diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/config/EC2ComputeServiceContextModule.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/config/EC2ComputeServiceContextModule.java index 70b94cf92e..478972254e 100755 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/config/EC2ComputeServiceContextModule.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/config/EC2ComputeServiceContextModule.java @@ -229,12 +229,12 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule { } @Override - public NodeMetadata execute(String handle) { - String[] parts = parseHandle(handle); + public NodeMetadata execute(String id) { + String[] parts = parseHandle(id); String region = parts[0]; - String id = parts[1]; + String instanceId = parts[1]; RunningInstance runningInstance = Iterables.getOnlyElement(getAllRunningInstancesInRegion( - client, region, id)); + client, region, instanceId)); return runningInstanceToNodeMetadata.apply(runningInstance); } @@ -250,11 +250,11 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule { } @Override - public boolean execute(String handle) { - String[] parts = parseHandle(handle); + public boolean execute(String id) { + String[] parts = parseHandle(id); String region = parts[0]; - String id = parts[1]; - client.rebootInstancesInRegion(region, id); + String instanceId = parts[1]; + client.rebootInstancesInRegion(region, instanceId); return true; } @@ -389,7 +389,9 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule { .describeImagesInRegion(region, ownedBy(amiOwners))) { Image image = parser.apply(from); if (image != null) - images.put(new RegionAndName(region, image.getProviderId()), image); + images + .put(new RegionAndName(region, image.getProviderId()), + image); else if (from.getImageType() == ImageType.MACHINE) holder.logger.trace("<< image(%s) didn't parse", from.getId()); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/EC2DestroyNodeStrategy.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/EC2DestroyNodeStrategy.java index d5330c0827..6931b5388b 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/EC2DestroyNodeStrategy.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/EC2DestroyNodeStrategy.java @@ -59,12 +59,12 @@ public class EC2DestroyNodeStrategy implements DestroyNodeStrategy { } @Override - public boolean execute(String handle) { - String[] parts = parseHandle(handle); + public boolean execute(String id) { + String[] parts = parseHandle(id); String region = parts[0]; - String id = parts[1]; - ec2Client.getInstanceServices().terminateInstancesInRegion(region, id); + String instanceId = parts[1]; + ec2Client.getInstanceServices().terminateInstancesInRegion(region, instanceId); return instanceStateTerminated.apply(Iterables.getOnlyElement(Iterables.concat(ec2Client - .getInstanceServices().describeInstancesInRegion(region, id)))); + .getInstanceServices().describeInstancesInRegion(region, instanceId)))); } } \ No newline at end of file diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/util/EC2Utils.java b/aws/core/src/main/java/org/jclouds/aws/ec2/util/EC2Utils.java index 26e63b744e..19b8e9e7c6 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/util/EC2Utils.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/util/EC2Utils.java @@ -64,9 +64,9 @@ public class EC2Utils { return Iterables.concat(client.describeInstancesInRegion(region, id)); } - public static String[] parseHandle(String handle) { - String[] parts = checkNotNull(handle, "handle").split("/"); - checkArgument(parts.length == 2, "handle syntax is region/id"); + public static String[] parseHandle(String id) { + String[] parts = checkNotNull(id, "id").split("/"); + checkArgument(parts.length == 2, "id syntax is region/instanceid"); return parts; } diff --git a/compute/src/main/java/org/jclouds/compute/ComputeService.java b/compute/src/main/java/org/jclouds/compute/ComputeService.java index 6ee2f21bc8..26aa0827ae 100755 --- a/compute/src/main/java/org/jclouds/compute/ComputeService.java +++ b/compute/src/main/java/org/jclouds/compute/ComputeService.java @@ -146,10 +146,10 @@ public interface ComputeService { Set runNodesWithTag(String tag, int count) throws RunNodesException; /** - * destroy the node, given its handle. If it is the only node in a tag set, the dependent + * destroy the node, given its id. If it is the only node in a tag set, the dependent * resources will also be destroyed. */ - void destroyNode(String handle); + void destroyNode(String id); /** * nodes matching the filter are treated as a logical set. Using the delete command, you can save @@ -161,9 +161,9 @@ public interface ComputeService { Set destroyNodesMatching(Predicate filter); /** - * reboot the node, given its handle. + * reboot the node, given its id. */ - void rebootNode(String handle); + void rebootNode(String id); /** * nodes matching the filter are treated as a logical set. Using this command, you can save time @@ -172,9 +172,9 @@ public interface ComputeService { void rebootNodesMatching(Predicate filter); /** - * Find a node by its handle. + * Find a node by its id. */ - NodeMetadata getNodeMetadata(String handle); + NodeMetadata getNodeMetadata(String id); /** * get all nodes including details such as image and ip addresses even if it incurs extra diff --git a/compute/src/main/java/org/jclouds/compute/domain/internal/ComputeMetadataImpl.java b/compute/src/main/java/org/jclouds/compute/domain/internal/ComputeMetadataImpl.java index fcedb64397..d758bdaab2 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/internal/ComputeMetadataImpl.java +++ b/compute/src/main/java/org/jclouds/compute/domain/internal/ComputeMetadataImpl.java @@ -37,12 +37,12 @@ public class ComputeMetadataImpl extends ResourceMetadataImpl imple /** The serialVersionUID */ private static final long serialVersionUID = 7374704415964898694L; - private final String handle; + private final String id; - public ComputeMetadataImpl(ComputeType type, String id, String name, String handle, + public ComputeMetadataImpl(ComputeType type, String providerId, String name, String id, Location location, URI uri, Map userMetadata) { - super(type, id, name, location, uri, userMetadata); - this.handle = checkNotNull(handle, "handle"); + super(type, providerId, name, location, uri, userMetadata); + this.id = checkNotNull(id, "id"); } /** @@ -50,7 +50,7 @@ public class ComputeMetadataImpl extends ResourceMetadataImpl imple */ @Override public String getId() { - return handle; + return id; } } diff --git a/compute/src/main/java/org/jclouds/compute/domain/internal/ImageImpl.java b/compute/src/main/java/org/jclouds/compute/domain/internal/ImageImpl.java index e9354706c6..794f23e3a4 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/internal/ImageImpl.java +++ b/compute/src/main/java/org/jclouds/compute/domain/internal/ImageImpl.java @@ -52,11 +52,11 @@ public class ImageImpl extends ComputeMetadataImpl implements Image { private final Architecture architecture; private final Credentials defaultCredentials; - public ImageImpl(String id, String name, String handle, Location location, URI uri, + public ImageImpl(String providerId, String name, String id, Location location, URI uri, Map userMetadata, String description, String version, @Nullable OsFamily osFamily, String osDescription, Architecture architecture, Credentials defaultCredentials) { - super(ComputeType.IMAGE, id, name, handle, location, uri, userMetadata); + super(ComputeType.IMAGE, providerId, name, id, location, uri, userMetadata); this.version = checkNotNull(version, "version"); this.osFamily = osFamily; this.description = checkNotNull(description, "description"); @@ -115,9 +115,10 @@ public class ImageImpl extends ComputeMetadataImpl implements Image { @Override public String toString() { - return "[id=" + getProviderId() + ", name=" + getName() + ", locationId=" + getLocation() - + ", architecture=" + architecture + ", osDescription=" + osDescription - + ", osFamily=" + osFamily + ", version=" + version + "]"; + return "[id=" + getId() + ", providerId=" + getProviderId() + ", name=" + getName() + + ", locationId=" + getLocation() + ", architecture=" + architecture + + ", osDescription=" + osDescription + ", osFamily=" + osFamily + ", version=" + + version + "]"; } @Override diff --git a/compute/src/main/java/org/jclouds/compute/domain/internal/NodeMetadataImpl.java b/compute/src/main/java/org/jclouds/compute/domain/internal/NodeMetadataImpl.java index 1d715109d3..f8b7ad7b6a 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/internal/NodeMetadataImpl.java +++ b/compute/src/main/java/org/jclouds/compute/domain/internal/NodeMetadataImpl.java @@ -54,12 +54,12 @@ public class NodeMetadataImpl extends ComputeMetadataImpl implements NodeMetadat private final String tag; private final Image image; - public NodeMetadataImpl(String id, String name, String handle, Location location, URI uri, + public NodeMetadataImpl(String providerId, String name, String id, Location location, URI uri, Map userMetadata, @Nullable String tag, @Nullable Image image, NodeState state, Iterable publicAddresses, Iterable privateAddresses, Map extra, @Nullable Credentials credentials) { - super(ComputeType.NODE, id, name, handle, location, uri, userMetadata); + super(ComputeType.NODE, providerId, name, id, location, uri, userMetadata); this.tag = tag; this.image = image; this.state = checkNotNull(state, "state"); @@ -128,10 +128,11 @@ public class NodeMetadataImpl extends ComputeMetadataImpl implements NodeMetadat @Override public String toString() { - return "[id=" + getProviderId() + ", tag=" + getTag() + ", name=" + getName() + ", location=" - + getLocation() + ", uri=" + getUri() + ", image=" + getImage() + ", userMetadata=" - + getUserMetadata() + ", state=" + getState() + ", privateAddresses=" - + privateAddresses + ", publicAddresses=" + publicAddresses + "]"; + return "[id=" + getId() + ", providerId=" + getProviderId() + ", tag=" + getTag() + ", name=" + + getName() + ", location=" + getLocation() + ", uri=" + getUri() + ", image=" + + getImage() + ", userMetadata=" + getUserMetadata() + ", state=" + getState() + + ", privateAddresses=" + privateAddresses + ", publicAddresses=" + publicAddresses + + "]"; } @Override diff --git a/compute/src/main/java/org/jclouds/compute/domain/internal/SizeImpl.java b/compute/src/main/java/org/jclouds/compute/domain/internal/SizeImpl.java index 91aeedaf36..9b7fde3361 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/internal/SizeImpl.java +++ b/compute/src/main/java/org/jclouds/compute/domain/internal/SizeImpl.java @@ -48,10 +48,10 @@ public class SizeImpl extends ComputeMetadataImpl implements Size { private final Set supportedArchitectures = Sets.newHashSet(); - public SizeImpl(String id, String name, String handle, @Nullable Location location, URI uri, + public SizeImpl(String providerId, String name, String id, @Nullable Location location, URI uri, Map userMetadata, double cores, int ram, int disk, Iterable supportedArchitectures) { - super(ComputeType.SIZE, id, name, handle, location, uri, userMetadata); + super(ComputeType.SIZE, providerId, name, id, location, uri, userMetadata); this.cores = cores; this.ram = ram; this.disk = disk; @@ -103,8 +103,9 @@ public class SizeImpl extends ComputeMetadataImpl implements Size { */ @Override public String toString() { - return "[id=" + getProviderId() + ", cores=" + cores + ", ram=" + ram + ", disk=" + disk - + ", supportedArchitectures=" + supportedArchitectures + "]"; + return "[id=" + getId() + ", providerId=" + getProviderId() + ", cores=" + cores + ", ram=" + + ram + ", disk=" + disk + ", supportedArchitectures=" + supportedArchitectures + + "]"; } /** diff --git a/compute/src/main/java/org/jclouds/compute/internal/BaseComputeService.java b/compute/src/main/java/org/jclouds/compute/internal/BaseComputeService.java index 64bfc82bd0..e2ca251c38 100755 --- a/compute/src/main/java/org/jclouds/compute/internal/BaseComputeService.java +++ b/compute/src/main/java/org/jclouds/compute/internal/BaseComputeService.java @@ -147,7 +147,8 @@ public class BaseComputeService implements ComputeService { checkNotNull(template.getLocation(), "location"); logger.debug(">> running %d node%s tag(%s) location(%s) image(%s) size(%s) options(%s)", count, count > 1 ? "s" : "", tag, template.getLocation().getId(), template - .getImage().getProviderId(), template.getSize().getProviderId(), template.getOptions()); + .getImage().getProviderId(), template.getSize().getProviderId(), template + .getOptions()); Set nodes = Sets.newHashSet(); Map badNodes = Maps.newLinkedHashMap(); Map> responses = runNodesAndAddToSetStrategy.execute(tag, count, @@ -182,11 +183,11 @@ public class BaseComputeService implements ComputeService { * {@inheritDoc} */ @Override - public void destroyNode(String handle) { - checkNotNull(handle, "handle"); - logger.debug(">> destroying node(%s)", handle); - boolean successful = destroyNodeStrategy.execute(handle); - logger.debug("<< destroyed node(%s) success(%s)", handle, successful); + public void destroyNode(String id) { + checkNotNull(id, "id"); + logger.debug(">> destroying node(%s)", id); + boolean successful = destroyNodeStrategy.execute(id); + logger.debug("<< destroyed node(%s) success(%s)", id, successful); } /** @@ -278,20 +279,20 @@ public class BaseComputeService implements ComputeService { * {@inheritDoc} */ @Override - public NodeMetadata getNodeMetadata(String handle) { - checkNotNull(handle, "handle"); - return getNodeMetadataStrategy.execute(handle); + public NodeMetadata getNodeMetadata(String id) { + checkNotNull(id, "id"); + return getNodeMetadataStrategy.execute(id); } /** * {@inheritDoc} */ @Override - public void rebootNode(String handle) { - checkNotNull(handle, "handle"); - logger.debug(">> rebooting node(%s)", handle); - boolean successful = rebootNodeStrategy.execute(handle); - logger.debug("<< rebooted node(%s) success(%s)", handle, successful); + public void rebootNode(String id) { + checkNotNull(id, "id"); + logger.debug(">> rebooting node(%s)", id); + boolean successful = rebootNodeStrategy.execute(id); + logger.debug("<< rebooted node(%s) success(%s)", id, successful); } /** diff --git a/compute/src/main/java/org/jclouds/compute/strategy/DestroyNodeStrategy.java b/compute/src/main/java/org/jclouds/compute/strategy/DestroyNodeStrategy.java index 6a6e6ad2a1..90ad5eef72 100644 --- a/compute/src/main/java/org/jclouds/compute/strategy/DestroyNodeStrategy.java +++ b/compute/src/main/java/org/jclouds/compute/strategy/DestroyNodeStrategy.java @@ -28,6 +28,6 @@ package org.jclouds.compute.strategy; */ public interface DestroyNodeStrategy { - boolean execute(String handle); + boolean execute(String id); } \ No newline at end of file diff --git a/compute/src/main/java/org/jclouds/compute/strategy/GetNodeMetadataStrategy.java b/compute/src/main/java/org/jclouds/compute/strategy/GetNodeMetadataStrategy.java index be56098c35..17ba1267ef 100644 --- a/compute/src/main/java/org/jclouds/compute/strategy/GetNodeMetadataStrategy.java +++ b/compute/src/main/java/org/jclouds/compute/strategy/GetNodeMetadataStrategy.java @@ -28,6 +28,6 @@ import org.jclouds.compute.domain.NodeMetadata; */ public interface GetNodeMetadataStrategy { - NodeMetadata execute(String handle); + NodeMetadata execute(String id); } \ No newline at end of file diff --git a/compute/src/main/java/org/jclouds/compute/strategy/RebootNodeStrategy.java b/compute/src/main/java/org/jclouds/compute/strategy/RebootNodeStrategy.java index b928f6ce2a..058d7565a9 100644 --- a/compute/src/main/java/org/jclouds/compute/strategy/RebootNodeStrategy.java +++ b/compute/src/main/java/org/jclouds/compute/strategy/RebootNodeStrategy.java @@ -27,6 +27,6 @@ package org.jclouds.compute.strategy; */ public interface RebootNodeStrategy { - boolean execute(String handle); + boolean execute(String id); } \ No newline at end of file diff --git a/core/src/main/java/org/jclouds/domain/internal/ResourceMetadataImpl.java b/core/src/main/java/org/jclouds/domain/internal/ResourceMetadataImpl.java index eed882c074..5da8688d80 100644 --- a/core/src/main/java/org/jclouds/domain/internal/ResourceMetadataImpl.java +++ b/core/src/main/java/org/jclouds/domain/internal/ResourceMetadataImpl.java @@ -42,7 +42,7 @@ public class ResourceMetadataImpl> implements ResourceMetadata private final T type; @Nullable - private final String id; + private final String providerId; @Nullable private final String name; @Nullable @@ -51,10 +51,10 @@ public class ResourceMetadataImpl> implements ResourceMetadata private final URI uri; private final Map userMetadata = Maps.newLinkedHashMap(); - public ResourceMetadataImpl(T type, @Nullable String id, @Nullable String name, + public ResourceMetadataImpl(T type, @Nullable String providerId, @Nullable String name, @Nullable Location location, @Nullable URI uri, Map userMetadata) { this.type = checkNotNull(type, "type"); - this.id = id; + this.providerId = providerId; this.name = name; this.location = location; this.uri = uri; @@ -84,7 +84,7 @@ public class ResourceMetadataImpl> implements ResourceMetadata */ @Override public String getProviderId() { - return id; + return providerId; } /** @@ -121,7 +121,7 @@ public class ResourceMetadataImpl> implements ResourceMetadata @Override public String toString() { - return "[type=" + type + ", id=" + id + ", name=" + name + ", location=" + location + return "[type=" + type + ", providerId=" + providerId + ", name=" + name + ", location=" + location + ", uri=" + uri + ", userMetadata=" + userMetadata + "]"; } @@ -129,7 +129,7 @@ public class ResourceMetadataImpl> implements ResourceMetadata public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((providerId == null) ? 0 : providerId.hashCode()); result = prime * result + ((location == null) ? 0 : location.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); @@ -146,10 +146,10 @@ public class ResourceMetadataImpl> implements ResourceMetadata if (getClass() != obj.getClass()) return false; ResourceMetadataImpl other = (ResourceMetadataImpl) obj; - if (id == null) { - if (other.id != null) + if (providerId == null) { + if (other.providerId != null) return false; - } else if (!id.equals(other.id)) + } else if (!providerId.equals(other.providerId)) return false; if (location == null) { if (other.location != null) diff --git a/gogrid/src/main/java/org/jclouds/gogrid/compute/config/GoGridComputeServiceContextModule.java b/gogrid/src/main/java/org/jclouds/gogrid/compute/config/GoGridComputeServiceContextModule.java index 1b8b925658..0b61a3df4c 100755 --- a/gogrid/src/main/java/org/jclouds/gogrid/compute/config/GoGridComputeServiceContextModule.java +++ b/gogrid/src/main/java/org/jclouds/gogrid/compute/config/GoGridComputeServiceContextModule.java @@ -138,9 +138,9 @@ public class GoGridComputeServiceContextModule extends GoGridContextModule { } @Override - public boolean execute(String handle) { + public boolean execute(String id) { Server server = Iterables.getOnlyElement(client.getServerServices().getServersById( - new Long(handle))); + new Long(id))); client.getServerServices().power(server.getName(), PowerCommand.RESTART); serverLatestJobCompleted.apply(server); client.getServerServices().power(server.getName(), PowerCommand.START); @@ -186,9 +186,9 @@ public class GoGridComputeServiceContextModule extends GoGridContextModule { } @Override - public NodeMetadata execute(String handle) { + public NodeMetadata execute(String id) { Server server = Iterables.getOnlyElement(client.getServerServices().getServersById( - new Long(checkNotNull(handle, "handle")))); + new Long(checkNotNull(id, "id")))); return server == null ? null : serverToNodeMetadata.apply(server); } } @@ -206,9 +206,9 @@ public class GoGridComputeServiceContextModule extends GoGridContextModule { } @Override - public boolean execute(String handle) { + public boolean execute(String id) { Server server = Iterables.getOnlyElement(client.getServerServices().getServersById( - new Long(handle))); + new Long(id))); client.getServerServices().deleteByName(server.getName()); return serverLatestJobCompleted.apply(server); } diff --git a/rackspace/src/main/java/org/jclouds/rackspace/cloudservers/compute/config/CloudServersComputeServiceContextModule.java b/rackspace/src/main/java/org/jclouds/rackspace/cloudservers/compute/config/CloudServersComputeServiceContextModule.java index 48171e3e18..a5dc8ce413 100755 --- a/rackspace/src/main/java/org/jclouds/rackspace/cloudservers/compute/config/CloudServersComputeServiceContextModule.java +++ b/rackspace/src/main/java/org/jclouds/rackspace/cloudservers/compute/config/CloudServersComputeServiceContextModule.java @@ -142,8 +142,8 @@ public class CloudServersComputeServiceContextModule extends CloudServersContext } @Override - public boolean execute(String handle) { - int serverId = Integer.parseInt(handle); + public boolean execute(String id) { + int serverId = Integer.parseInt(id); // if false server wasn't around in the first place client.rebootServer(serverId, RebootType.HARD); Server server = client.getServer(serverId); @@ -165,8 +165,8 @@ public class CloudServersComputeServiceContextModule extends CloudServersContext } @Override - public boolean execute(String handle) { - int serverId = Integer.parseInt(handle); + public boolean execute(String id) { + int serverId = Integer.parseInt(id); // if false server wasn't around in the first place if (!client.deleteServer(serverId)) return false; @@ -243,8 +243,8 @@ public class CloudServersComputeServiceContextModule extends CloudServersContext } @Override - public NodeMetadata execute(String handle) { - int serverId = Integer.parseInt(handle); + public NodeMetadata execute(String id) { + int serverId = Integer.parseInt(id); Server server = client.getServer(serverId); return server == null ? null : serverToNodeMetadata.apply(server); } diff --git a/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/compute/config/RimuHostingComputeServiceContextModule.java b/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/compute/config/RimuHostingComputeServiceContextModule.java index a2aa47349a..d62054ca74 100755 --- a/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/compute/config/RimuHostingComputeServiceContextModule.java +++ b/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/compute/config/RimuHostingComputeServiceContextModule.java @@ -140,8 +140,8 @@ public class RimuHostingComputeServiceContextModule extends RimuHostingContextMo } @Override - public boolean execute(String handle) { - Long serverId = Long.parseLong(handle); + public boolean execute(String id) { + Long serverId = Long.parseLong(id); // if false server wasn't around in the first place return client.restartServer(serverId).getState() == RunningState.RUNNING; } @@ -161,8 +161,8 @@ public class RimuHostingComputeServiceContextModule extends RimuHostingContextMo } @Override - public boolean execute(String handle) { - Long serverId = Long.parseLong(handle); + public boolean execute(String id) { + Long serverId = Long.parseLong(id); client.destroyServer(serverId); return serverDestroyed.apply(client.getServer(serverId)); } @@ -247,8 +247,8 @@ public class RimuHostingComputeServiceContextModule extends RimuHostingContextMo } @Override - public NodeMetadata execute(String handle) { - long serverId = Long.parseLong(handle); + public NodeMetadata execute(String id) { + long serverId = Long.parseLong(id); Server server = client.getServer(serverId); return server == null ? null : serverToNodeMetadata.apply(server); }