Issue 130: clarified method names

git-svn-id: http://jclouds.googlecode.com/svn/trunk@2731 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2010-01-28 08:21:10 +00:00
parent 3521c47029
commit 99dd7c1638
7 changed files with 34 additions and 26 deletions

View File

@ -149,7 +149,7 @@ public class EC2ComputeService implements ComputeService {
}
@Override
public NodeSet runNodes(String tag, int count, Template template) {
public NodeSet runNodesWithTag(String tag, int count, Template template) {
checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens");
checkArgument(template.getSize() instanceof EC2Size,
"unexpected image type. should be EC2Size, was: " + template.getSize().getClass());
@ -303,7 +303,7 @@ public class EC2ComputeService implements ComputeService {
}
@Override
public void destroyNodes(String tag) { // TODO parallel
public void destroyNodesWithTag(String tag) { // TODO parallel
logger.debug(">> terminating servers by tag(%s)", tag);
Set<ListenableFuture<Void>> responses = Sets.newHashSet();
for (final NodeMetadata node : doGetNodes(tag)) {
@ -325,7 +325,7 @@ public class EC2ComputeService implements ComputeService {
}
@Override
public NodeSet getNodes(String tag) {
public NodeSet getNodesWithTag(String tag) {
logger.debug(">> listing servers by tag(%s)", tag);
NodeSet nodes = doGetNodes(tag);
logger.debug("<< list(%d)", nodes.size());

View File

@ -42,7 +42,12 @@ public interface ComputeService {
TemplateBuilder templateBuilder();
/**
* all sizes available to the current user by id
* The get sizes command shows you the options including virtual cpu count, memory, and disks.
* cpu count is not a portable quantity across clouds, as they are measured differently. However,
* it is a good indicator of relative speed within a cloud. memory is measured in megabytes and
* disks in gigabytes.
*
* @retun a map of sizes by ID, conceding that in some clouds the "id" is not used.
*/
Map<String, ? extends Size> getSizes();
@ -58,7 +63,10 @@ public interface ComputeService {
Map<String, ? extends ComputeMetadata> getNodes();
/**
* all nodes available to the current user by id
* The get locations command returns all the valid locations for nodes. A location has a scope,
* which is typically region or zone. A region is a general area, like eu-west, where a zone is
* similar to a datacenter. If a location has a parent, that implies it is within that location.
* For example a location can be a rack, whose parent is likely to be a zone.
*/
Map<String, ? extends Location> getLocations();
@ -69,13 +77,13 @@ public interface ComputeService {
*
* @param tag
* - common identifier to group nodes by, cannot contain hyphens
* @param maxNodes
* @param count
* - how many to fire up.
* @param template
* - how to configure the nodes
*
*/
NodeSet runNodes(String tag, int maxNodes, Template template);
NodeSet runNodesWithTag(String tag, int count, Template template);
/**
* destroy the node. If it is the only node in a tag set, the dependent resources will also be
@ -86,7 +94,7 @@ public interface ComputeService {
/**
* destroy the nodes identified by this tag.
*/
void destroyNodes(String tag);
void destroyNodesWithTag(String tag);
/**
* Find a node by its id
@ -98,6 +106,6 @@ public interface ComputeService {
*
* @param tag
*/
NodeSet getNodes(String tag);
NodeSet getNodesWithTag(String tag);
}

View File

@ -112,7 +112,7 @@ public abstract class BaseComputeServiceLiveTest {
@Test(enabled = true)
public void testCreate() throws Exception {
try {
client.destroyNodes(tag);
client.destroyNodesWithTag(tag);
} catch (HttpResponseException e) {
// TODO hosting.com throws 400 when we try to delete a vApp
} catch (NoSuchElementException e) {
@ -144,7 +144,7 @@ public abstract class BaseComputeServiceLiveTest {
//
.build(org.jclouds.scriptbuilder.domain.OsFamily.UNIX)
.getBytes());
nodes = Sets.newTreeSet(client.runNodes(tag, 2, template));
nodes = Sets.newTreeSet(client.runNodesWithTag(tag, 2, template));
assertEquals(nodes.size(), 2);
for (NodeMetadata node : nodes) {
assertNotNull(node.getId());
@ -171,7 +171,7 @@ public abstract class BaseComputeServiceLiveTest {
@Test(enabled = true, dependsOnMethods = "testCreate")
public void testGet() throws Exception {
NodeSet metadataSet = client.getNodes(tag);
NodeSet metadataSet = client.getNodesWithTag(tag);
for (NodeMetadata node : nodes) {
metadataSet.remove(node);
NodeMetadata metadata = client.getNodeMetadata(node);
@ -267,8 +267,8 @@ public abstract class BaseComputeServiceLiveTest {
@AfterTest
protected void cleanup() throws InterruptedException, ExecutionException, TimeoutException {
if (nodes != null) {
client.destroyNodes(tag);
for (NodeMetadata node : client.getNodes(tag)) {
client.destroyNodesWithTag(tag);
for (NodeMetadata node : client.getNodesWithTag(tag)) {
assert node.getState() == NodeState.TERMINATED : node;
}
}

View File

@ -155,7 +155,7 @@ public class CloudServersComputeService implements ComputeService {
.put(ServerStatus.UNKNOWN, NodeState.UNKNOWN).build();
@Override
public NodeSet runNodes(final String tag, int max, final Template template) {
public NodeSet runNodesWithTag(final String tag, int max, final Template template) {
checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens");
logger.debug(">> running server image(%s) flavor(%s)", template.getImage().getId(), template
.getSize().getId());
@ -251,7 +251,7 @@ public class CloudServersComputeService implements ComputeService {
}
@Override
public void destroyNodes(String tag) { // TODO parallel
public void destroyNodesWithTag(String tag) { // TODO parallel
logger.debug(">> terminating servers by tag(%s)", tag);
Set<ListenableFuture<Void>> responses = Sets.newHashSet();
for (final NodeMetadata node : doGetNodes(tag)) {
@ -273,7 +273,7 @@ public class CloudServersComputeService implements ComputeService {
}
@Override
public NodeSet getNodes(String tag) {
public NodeSet getNodesWithTag(String tag) {
logger.debug(">> listing servers by tag(%s)", tag);
NodeSet nodes = doGetNodes(tag);
logger.debug("<< list(%d)", nodes.size());

View File

@ -139,7 +139,7 @@ public class RimuHostingComputeService implements ComputeService {
}
@Override
public NodeSet runNodes(final String tag, int max, final Template template) {
public NodeSet runNodesWithTag(final String tag, int max, final Template template) {
checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens");
logger.debug(">> running server image(%s) flavor(%s)", template.getImage().getId(), template
.getSize().getId());
@ -238,7 +238,7 @@ public class RimuHostingComputeService implements ComputeService {
}
@Override
public void destroyNodes(String tag) { // TODO parallel
public void destroyNodesWithTag(String tag) { // TODO parallel
logger.debug(">> terminating servers by tag(%s)", tag);
Set<ListenableFuture<Void>> responses = Sets.newHashSet();
for (final NodeMetadata node : doGetNodes(tag)) {
@ -260,7 +260,7 @@ public class RimuHostingComputeService implements ComputeService {
}
@Override
public NodeSet getNodes(String tag) {
public NodeSet getNodesWithTag(String tag) {
logger.debug(">> listing servers by tag(%s)", tag);
NodeSet nodes = doGetNodes(tag);
logger.debug("<< list(%d)", nodes.size());

View File

@ -192,7 +192,7 @@ public class ComputeTask extends Task {
Template template = createTemplateFromElement(nodeElement, computeService);
NodeMetadata createdNode = Iterables.getOnlyElement(computeService.runNodes(tag, nodeElement
NodeMetadata createdNode = Iterables.getOnlyElement(computeService.runNodesWithTag(tag, nodeElement
.getCount(), template));
logNodeDetails(createdNode);
@ -230,12 +230,12 @@ public class ComputeTask extends Task {
private void destroy(ComputeService computeService) {
log(String.format("destroy tag: %s", nodeElement.getTag()));
computeService.destroyNodes(nodeElement.getTag());
computeService.destroyNodesWithTag(nodeElement.getTag());
}
private void get(ComputeService computeService) {
log(String.format("get tag: %s", nodeElement.getTag()));
for (ComputeMetadata node : computeService.getNodes(nodeElement.getTag())) {
for (ComputeMetadata node : computeService.getNodesWithTag(nodeElement.getTag())) {
logDetails(computeService, node);
}
}

View File

@ -132,7 +132,7 @@ public class VCloudComputeService implements ComputeService, VCloudComputeClient
}
@Override
public NodeSet runNodes(final String tag, int max, final Template template) {
public NodeSet runNodesWithTag(final String tag, int max, final Template template) {
checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens");
checkNotNull(template.getLocation(), "location");
// TODO: find next id
@ -354,7 +354,7 @@ public class VCloudComputeService implements ComputeService, VCloudComputeClient
}
@Override
public void destroyNodes(String tag) { // TODO parallel
public void destroyNodesWithTag(String tag) { // TODO parallel
logger.debug(">> terminating servers by tag(%s)", tag);
Set<ListenableFuture<Void>> responses = Sets.newHashSet();
for (final NodeMetadata node : doGetNodes(tag)) {
@ -376,7 +376,7 @@ public class VCloudComputeService implements ComputeService, VCloudComputeClient
}
@Override
public NodeSet getNodes(String tag) {
public NodeSet getNodesWithTag(String tag) {
logger.debug(">> listing servers by tag(%s)", tag);
NodeSet nodes = doGetNodes(tag);
logger.debug("<< list(%d)", nodes.size());