You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whirr.apache.org by to...@apache.org on 2011/04/13 06:45:09 UTC
svn commit: r1091646 [1/2] - in /incubator/whirr/trunk: ./
cli/src/main/java/org/apache/whirr/cli/command/
cli/src/test/java/org/apache/whirr/cli/command/
core/src/main/java/org/apache/whirr/
core/src/main/java/org/apache/whirr/actions/ core/src/main/j...
Author: tomwhite
Date: Wed Apr 13 04:45:06 2011
New Revision: 1091646
URL: http://svn.apache.org/viewvc?rev=1091646&view=rev
Log:
WHIRR-245. Clearly demarcate the user and service provider APIs.
Added:
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/Cluster.java
- copied, changed from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/Cluster.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterAction.java
- copied, changed from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterAction.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterController.java
- copied, changed from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/Service.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterControllerFactory.java
- copied, changed from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ServiceFactory.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterSpec.java
- copied, changed from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterSpec.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/HandlerMapFactory.java
- copied, changed from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/HandlerMapFactory.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/InstanceTemplate.java
- copied, changed from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/InstanceTemplate.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/RolePredicates.java
- copied, changed from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/RolePredicates.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/
- copied from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/cluster/actions/
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/package-info.java (with props)
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/util/
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/util/DnsUtil.java
- copied, changed from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/net/DnsUtil.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/util/KeyPair.java
- copied, changed from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ssh/KeyPair.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/util/package-info.java
- copied, changed from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/net/package-info.java
incubator/whirr/trunk/core/src/test/java/org/apache/whirr/ClusterControllerFactoryTest.java
- copied, changed from r1091639, incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/ServiceFactoryTest.java
incubator/whirr/trunk/core/src/test/java/org/apache/whirr/ClusterSpecTest.java
- copied, changed from r1091639, incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/ClusterSpecTest.java
incubator/whirr/trunk/core/src/test/java/org/apache/whirr/actions/
- copied from r1091639, incubator/whirr/trunk/core/src/test/java/org/apache/whirr/cluster/actions/
incubator/whirr/trunk/core/src/test/java/org/apache/whirr/util/
incubator/whirr/trunk/core/src/test/java/org/apache/whirr/util/KeyPairTest.java
- copied, changed from r1091639, incubator/whirr/trunk/core/src/test/java/org/apache/whirr/ssh/KeyPairTest.java
incubator/whirr/trunk/core/src/test/java/org/apache/whirr/util/integration/
incubator/whirr/trunk/core/src/test/java/org/apache/whirr/util/integration/DnsUtilTest.java
- copied, changed from r1091639, incubator/whirr/trunk/core/src/test/java/org/apache/whirr/net/integration/DnsUtilTest.java
incubator/whirr/trunk/core/src/test/resources/META-INF/services/org.apache.whirr.ClusterController
- copied, changed from r1091639, incubator/whirr/trunk/core/src/test/resources/META-INF/services/org.apache.whirr.service.Service
Removed:
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/cluster/actions/
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/net/
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/Cluster.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterAction.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterSpec.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/HandlerMapFactory.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/InstanceTemplate.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/RolePredicates.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/Service.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ServiceFactory.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ssh/
incubator/whirr/trunk/core/src/test/java/org/apache/whirr/cluster/actions/
incubator/whirr/trunk/core/src/test/java/org/apache/whirr/net/integration/DnsUtilTest.java
incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/ClusterSpecTest.java
incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/ServiceFactoryTest.java
incubator/whirr/trunk/core/src/test/java/org/apache/whirr/ssh/KeyPairTest.java
incubator/whirr/trunk/core/src/test/resources/META-INF/services/org.apache.whirr.service.Service
incubator/whirr/trunk/services/cassandra/src/main/java/org/apache/whirr/service/cassandra/CassandraService.java
incubator/whirr/trunk/services/cassandra/src/main/resources/META-INF/services/org.apache.whirr.service.Service
incubator/whirr/trunk/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopService.java
incubator/whirr/trunk/services/hadoop/src/main/resources/META-INF/services/org.apache.whirr.service.Service
incubator/whirr/trunk/services/zookeeper/src/main/java/org/apache/whirr/service/zookeeper/ZooKeeperService.java
incubator/whirr/trunk/services/zookeeper/src/main/resources/META-INF/services/org.apache.whirr.service.Service
Modified:
incubator/whirr/trunk/CHANGES.txt
incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java
incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/DestroyClusterCommand.java
incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/DestroyInstanceCommand.java
incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/LaunchClusterCommand.java
incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/ListClusterCommand.java
incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/AbstractClusterSpecCommandTest.java
incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/DestroyClusterCommandTest.java
incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/DestroyInstanceCommandTest.java
incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/LaunchClusterCommandTest.java
incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/ListClusterCommandTest.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/BootstrapClusterAction.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/ConfigureClusterAction.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/DestroyClusterAction.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/ScriptBasedClusterAction.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/package-info.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterActionEvent.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterActionHandlerSupport.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ComputeServiceContextBuilder.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/FirewallManager.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/jclouds/FirewallSettings.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/jclouds/TakeLoginCredentialsFromWhirrProperties.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/jclouds/TemplateBuilderStrategy.java
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/package-info.java
incubator/whirr/trunk/core/src/test/java/org/apache/whirr/actions/BootstrapClusterActionTest.java
incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/TemplateBuilderStrategyTest.java
incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/jclouds/TakeLoginCredentialsFromWhirrPropertiesTest.java
incubator/whirr/trunk/services/cassandra/src/main/java/org/apache/whirr/service/cassandra/CassandraClusterActionHandler.java
incubator/whirr/trunk/services/cassandra/src/test/java/org/apache/whirr/service/cassandra/CassandraClusterActionHandlerTest.java
incubator/whirr/trunk/services/cassandra/src/test/java/org/apache/whirr/service/cassandra/integration/CassandraServiceTest.java
incubator/whirr/trunk/services/cdh/src/test/java/org/apache/whirr/service/cdh/integration/CdhHadoopServiceTest.java
incubator/whirr/trunk/services/elasticsearch/src/main/java/org/apache/whirr/service/elasticsearch/ElasticSearchConfigurationBuilder.java
incubator/whirr/trunk/services/elasticsearch/src/main/java/org/apache/whirr/service/elasticsearch/ElasticSearchHandler.java
incubator/whirr/trunk/services/elasticsearch/src/test/java/org/apache/whirr/service/elasticsearch/ElasticSearchConfigurationBuilderTest.java
incubator/whirr/trunk/services/elasticsearch/src/test/java/org/apache/whirr/service/elasticsearch/integration/ElasticSearchTest.java
incubator/whirr/trunk/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopCluster.java
incubator/whirr/trunk/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopClusterActionHandler.java
incubator/whirr/trunk/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopConfigurationBuilder.java
incubator/whirr/trunk/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopDataNodeClusterActionHandler.java
incubator/whirr/trunk/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopNameNodeClusterActionHandler.java
incubator/whirr/trunk/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopProxy.java
incubator/whirr/trunk/services/hadoop/src/test/java/org/apache/whirr/service/hadoop/HadoopConfigurationBuilderTest.java
incubator/whirr/trunk/services/hadoop/src/test/java/org/apache/whirr/service/hadoop/integration/HadoopServiceController.java
incubator/whirr/trunk/services/hbase/src/main/java/org/apache/whirr/service/hbase/BasicServerClusterActionHandler.java
incubator/whirr/trunk/services/hbase/src/main/java/org/apache/whirr/service/hbase/HBaseCluster.java
incubator/whirr/trunk/services/hbase/src/main/java/org/apache/whirr/service/hbase/HBaseClusterActionHandler.java
incubator/whirr/trunk/services/hbase/src/main/java/org/apache/whirr/service/hbase/HBaseMasterClusterActionHandler.java
incubator/whirr/trunk/services/hbase/src/main/java/org/apache/whirr/service/hbase/HBaseRegionServerClusterActionHandler.java
incubator/whirr/trunk/services/hbase/src/test/java/org/apache/whirr/service/hbase/integration/HBaseServiceController.java
incubator/whirr/trunk/services/voldemort/src/main/java/org/apache/whirr/service/voldemort/VoldemortClusterActionHandler.java
incubator/whirr/trunk/services/voldemort/src/test/java/org/apache/whirr/service/voldemort/integration/VoldemortServiceTest.java
incubator/whirr/trunk/services/zookeeper/src/main/java/org/apache/whirr/service/zookeeper/ZooKeeperCluster.java
incubator/whirr/trunk/services/zookeeper/src/main/java/org/apache/whirr/service/zookeeper/ZooKeeperClusterActionHandler.java
incubator/whirr/trunk/services/zookeeper/src/test/java/org/apache/whirr/service/zookeeper/integration/ZooKeeperServiceTest.java
Modified: incubator/whirr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/CHANGES.txt?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/CHANGES.txt (original)
+++ incubator/whirr/trunk/CHANGES.txt Wed Apr 13 04:45:06 2011
@@ -16,7 +16,16 @@ Trunk (unreleased changes)
WHIRR-275. Improve firewall API for services. (tomwhite)
- WHIRR-278. Refactor ClusterSpec and extract InstanceTemplate class
+ WHIRR-278. Refactor ClusterSpec and extract InstanceTemplate class. (asavu)
+
+ WHIRR-245. Clearly demarcate the user and service provider APIs. There
+ are some incompatible API changes which affect clients and service writers:
+ * The client API has moved from the org.apache.whirr.service package to the
+ org.apache.whirr package.
+ * Service(Factory) has been renamed to ClusterController(Factory).
+ * org.apache.whirr.cluster.actions has been renamed to
+ org.apache.whirr.actions.
+ (tomwhite)
BUG FIXES
Modified: incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java (original)
+++ incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java Wed Apr 13 04:45:06 2011
@@ -18,8 +18,10 @@
package org.apache.whirr.cli.command;
-import static org.apache.whirr.service.ClusterSpec.Property.CLUSTER_NAME;
-import static org.apache.whirr.service.ClusterSpec.Property.IDENTITY;
+import static org.apache.whirr.ClusterSpec.Property.CLUSTER_NAME;
+import static org.apache.whirr.ClusterSpec.Property.IDENTITY;
+
+import com.google.common.collect.Maps;
import java.util.EnumSet;
import java.util.Map;
@@ -33,20 +35,18 @@ import org.apache.commons.configuration.
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.whirr.ClusterController;
+import org.apache.whirr.ClusterControllerFactory;
+import org.apache.whirr.ClusterSpec;
+import org.apache.whirr.ClusterSpec.Property;
import org.apache.whirr.cli.Command;
-import org.apache.whirr.service.ClusterSpec;
-import org.apache.whirr.service.ClusterSpec.Property;
-import org.apache.whirr.service.Service;
-import org.apache.whirr.service.ServiceFactory;
-
-import com.google.common.collect.Maps;
/**
* An abstract command for interacting with clusters.
*/
public abstract class AbstractClusterSpecCommand extends Command {
- protected ServiceFactory factory;
+ protected ClusterControllerFactory factory;
protected OptionParser parser = new OptionParser();
private Map<Property, OptionSpec> optionSpecs;
@@ -57,7 +57,7 @@ public abstract class AbstractClusterSpe
.describedAs("config.properties")
.ofType(String.class);
- public AbstractClusterSpecCommand(String name, String description, ServiceFactory factory) {
+ public AbstractClusterSpecCommand(String name, String description, ClusterControllerFactory factory) {
super(name, description);
this.factory = factory;
@@ -105,17 +105,15 @@ public abstract class AbstractClusterSpe
/**
* Create the specified service
- * @param serviceName
- * @return
* @throws IllegalArgumentException if serviceName is not found
*/
- protected Service createService(String serviceName) {
- Service service = factory.create(serviceName);
- if (service == null) {
+ protected ClusterController createClusterController(String serviceName) {
+ ClusterController controller = factory.create(serviceName);
+ if (controller == null) {
throw new IllegalArgumentException("Unable to find service "
+ serviceName + ", exiting");
}
- return service;
+ return controller;
}
}
Modified: incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/DestroyClusterCommand.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/DestroyClusterCommand.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/DestroyClusterCommand.java (original)
+++ incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/DestroyClusterCommand.java Wed Apr 13 04:45:06 2011
@@ -26,9 +26,9 @@ import java.util.List;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
-import org.apache.whirr.service.ClusterSpec;
-import org.apache.whirr.service.Service;
-import org.apache.whirr.service.ServiceFactory;
+import org.apache.whirr.ClusterController;
+import org.apache.whirr.ClusterControllerFactory;
+import org.apache.whirr.ClusterSpec;
/**
* A command to destroy a running cluster (terminate and cleanup).
@@ -36,10 +36,10 @@ import org.apache.whirr.service.ServiceF
public class DestroyClusterCommand extends AbstractClusterSpecCommand {
public DestroyClusterCommand() throws IOException {
- this(new ServiceFactory());
+ this(new ClusterControllerFactory());
}
- public DestroyClusterCommand(ServiceFactory factory) {
+ public DestroyClusterCommand(ClusterControllerFactory factory) {
super("destroy-cluster", "Terminate and cleanup resources for a running cluster.", factory);
}
@@ -56,8 +56,8 @@ public class DestroyClusterCommand exten
try {
ClusterSpec clusterSpec = getClusterSpec(optionSet);
- Service service = createService(clusterSpec.getServiceName());
- service.destroyCluster(clusterSpec);
+ ClusterController controller = createClusterController(clusterSpec.getServiceName());
+ controller.destroyCluster(clusterSpec);
return 0;
} catch (IllegalArgumentException e) {
err.println(e.getMessage());
Modified: incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/DestroyInstanceCommand.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/DestroyInstanceCommand.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/DestroyInstanceCommand.java (original)
+++ incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/DestroyInstanceCommand.java Wed Apr 13 04:45:06 2011
@@ -18,13 +18,6 @@
package org.apache.whirr.cli.command;
-import joptsimple.OptionParser;
-import joptsimple.OptionSet;
-import joptsimple.OptionSpec;
-import org.apache.whirr.service.ClusterSpec;
-import org.apache.whirr.service.Service;
-import org.apache.whirr.service.ServiceFactory;
-
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
@@ -35,6 +28,14 @@ import java.io.PrintStream;
import java.io.Writer;
import java.util.List;
+import joptsimple.OptionParser;
+import joptsimple.OptionSet;
+import joptsimple.OptionSpec;
+
+import org.apache.whirr.ClusterController;
+import org.apache.whirr.ClusterControllerFactory;
+import org.apache.whirr.ClusterSpec;
+
/**
* A command to destroy an instance from a cluster
*/
@@ -46,10 +47,10 @@ public class DestroyInstanceCommand exte
.ofType(String.class);
public DestroyInstanceCommand() throws IOException {
- this(new ServiceFactory());
+ this(new ClusterControllerFactory());
}
- public DestroyInstanceCommand(ServiceFactory factory) {
+ public DestroyInstanceCommand(ClusterControllerFactory factory) {
super("destroy-instance", "Terminate and cleanup resources " +
"for a single instance.", factory);
}
@@ -68,10 +69,10 @@ public class DestroyInstanceCommand exte
throw new IllegalArgumentException("You need to specify an instance ID.");
}
ClusterSpec clusterSpec = getClusterSpec(optionSet);
- Service service = createService(clusterSpec.getServiceName());
+ ClusterController controller = createClusterController(clusterSpec.getServiceName());
String instanceId = optionSet.valueOf(instanceOption);
- service.destroyInstance(clusterSpec, instanceId);
+ controller.destroyInstance(clusterSpec, instanceId);
updateInstancesFile(clusterSpec, instanceId);
return 0;
Modified: incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/LaunchClusterCommand.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/LaunchClusterCommand.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/LaunchClusterCommand.java (original)
+++ incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/LaunchClusterCommand.java Wed Apr 13 04:45:06 2011
@@ -26,10 +26,10 @@ import java.util.List;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
-import org.apache.whirr.service.Cluster;
-import org.apache.whirr.service.ClusterSpec;
-import org.apache.whirr.service.Service;
-import org.apache.whirr.service.ServiceFactory;
+import org.apache.whirr.Cluster;
+import org.apache.whirr.ClusterController;
+import org.apache.whirr.ClusterControllerFactory;
+import org.apache.whirr.ClusterSpec;
/**
* A command to launch a new cluster.
@@ -37,10 +37,10 @@ import org.apache.whirr.service.ServiceF
public class LaunchClusterCommand extends AbstractClusterSpecCommand {
public LaunchClusterCommand() throws IOException {
- this(new ServiceFactory());
+ this(new ClusterControllerFactory());
}
- public LaunchClusterCommand(ServiceFactory factory) {
+ public LaunchClusterCommand(ClusterControllerFactory factory) {
super("launch-cluster", "Launch a new cluster running a service.", factory);
}
@@ -57,8 +57,8 @@ public class LaunchClusterCommand extend
try {
ClusterSpec clusterSpec = getClusterSpec(optionSet);
- Service service = createService(clusterSpec.getServiceName());
- Cluster cluster = service.launchCluster(clusterSpec);
+ ClusterController controller = createClusterController(clusterSpec.getServiceName());
+ Cluster cluster = controller.launchCluster(clusterSpec);
out.printf("Started cluster of %s instances\n",
cluster.getInstances().size());
out.println(cluster);
Modified: incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/ListClusterCommand.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/ListClusterCommand.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/ListClusterCommand.java (original)
+++ incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/ListClusterCommand.java Wed Apr 13 04:45:06 2011
@@ -30,9 +30,9 @@ import java.util.Set;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
-import org.apache.whirr.service.ClusterSpec;
-import org.apache.whirr.service.Service;
-import org.apache.whirr.service.ServiceFactory;
+import org.apache.whirr.ClusterController;
+import org.apache.whirr.ClusterControllerFactory;
+import org.apache.whirr.ClusterSpec;
import org.jclouds.compute.domain.NodeMetadata;
/**
@@ -41,10 +41,10 @@ import org.jclouds.compute.domain.NodeMe
public class ListClusterCommand extends AbstractClusterSpecCommand {
public ListClusterCommand() throws IOException {
- this(new ServiceFactory());
+ this(new ClusterControllerFactory());
}
- public ListClusterCommand(ServiceFactory factory) {
+ public ListClusterCommand(ClusterControllerFactory factory) {
super("list-cluster", "List the nodes in a cluster.", factory);
}
@@ -61,8 +61,8 @@ public class ListClusterCommand extends
try {
ClusterSpec clusterSpec = getClusterSpec(optionSet);
- Service service = createService(clusterSpec.getServiceName());
- Set<? extends NodeMetadata> nodes = service.getNodes(clusterSpec);
+ ClusterController controller = createClusterController(clusterSpec.getServiceName());
+ Set<? extends NodeMetadata> nodes = controller.getNodes(clusterSpec);
for (NodeMetadata node : nodes) {
out.println(Joiner.on('\t').join(node.getId(), node.getImageId(),
getFirstAddress(node.getPublicAddresses()),
Modified: incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/AbstractClusterSpecCommandTest.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/AbstractClusterSpecCommandTest.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/AbstractClusterSpecCommandTest.java (original)
+++ incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/AbstractClusterSpecCommandTest.java Wed Apr 13 04:45:06 2011
@@ -29,9 +29,9 @@ import java.util.Map;
import joptsimple.OptionSet;
-import org.apache.whirr.service.ClusterSpec;
-import org.apache.whirr.service.ServiceFactory;
-import org.apache.whirr.ssh.KeyPair;
+import org.apache.whirr.ClusterControllerFactory;
+import org.apache.whirr.ClusterSpec;
+import org.apache.whirr.util.KeyPair;
import org.junit.Test;
public class AbstractClusterSpecCommandTest {
@@ -39,7 +39,7 @@ public class AbstractClusterSpecCommandT
@Test
public void testOverrides() throws Exception {
AbstractClusterSpecCommand clusterSpecCommand = new AbstractClusterSpecCommand("name",
- "description", new ServiceFactory()) {
+ "description", new ClusterControllerFactory()) {
@Override
public int run(InputStream in, PrintStream out, PrintStream err,
List<String> args) throws Exception {
@@ -62,9 +62,9 @@ public class AbstractClusterSpecCommandT
* Ensure that an invalid service name causes failure
*/
@Test(expected=IllegalArgumentException.class)
- public void testCreateServerWithInvalidServiceName() throws Exception {
+ public void testCreateServerWithInvalidClusterControllerName() throws Exception {
AbstractClusterSpecCommand clusterSpecCommand = new AbstractClusterSpecCommand("name",
- "description", new ServiceFactory()) {
+ "description", new ClusterControllerFactory()) {
@Override
public int run(InputStream in, PrintStream out, PrintStream err,
List<String> args) throws Exception {
@@ -80,6 +80,6 @@ public class AbstractClusterSpecCommandT
);
ClusterSpec clusterSpec = clusterSpecCommand.getClusterSpec(optionSet);
// this should fail - non-existent service
- clusterSpecCommand.createService("bar");
+ clusterSpecCommand.createClusterController("bar");
}
}
Modified: incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/DestroyClusterCommandTest.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/DestroyClusterCommandTest.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/DestroyClusterCommandTest.java (original)
+++ incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/DestroyClusterCommandTest.java Wed Apr 13 04:45:06 2011
@@ -35,10 +35,10 @@ import java.util.Map;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.whirr.service.ClusterSpec;
-import org.apache.whirr.service.Service;
-import org.apache.whirr.service.ServiceFactory;
-import org.apache.whirr.ssh.KeyPair;
+import org.apache.whirr.ClusterController;
+import org.apache.whirr.ClusterControllerFactory;
+import org.apache.whirr.ClusterSpec;
+import org.apache.whirr.util.KeyPair;
import org.hamcrest.Matcher;
import org.junit.Before;
import org.junit.Test;
@@ -74,9 +74,9 @@ public class DestroyClusterCommandTest {
@Test
public void testAllOptions() throws Exception {
- ServiceFactory factory = mock(ServiceFactory.class);
- Service service = mock(Service.class);
- when(factory.create((String) any())).thenReturn(service);
+ ClusterControllerFactory factory = mock(ClusterControllerFactory.class);
+ ClusterController controller = mock(ClusterController.class);
+ when(factory.create((String) any())).thenReturn(controller);
DestroyClusterCommand command = new DestroyClusterCommand(factory);
Map<String, File> keys = KeyPair.generateTemporaryFiles();
@@ -106,7 +106,7 @@ public class DestroyClusterCommandTest {
verify(factory).create("test-service");
- verify(service).destroyCluster(expectedClusterSpec);
+ verify(controller).destroyCluster(expectedClusterSpec);
}
}
Modified: incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/DestroyInstanceCommandTest.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/DestroyInstanceCommandTest.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/DestroyInstanceCommandTest.java (original)
+++ incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/DestroyInstanceCommandTest.java Wed Apr 13 04:45:06 2011
@@ -18,13 +18,16 @@
package org.apache.whirr.cli.command;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.is;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
import com.google.common.collect.Lists;
-import org.apache.whirr.service.ClusterSpec;
-import org.apache.whirr.service.Service;
-import org.apache.whirr.service.ServiceFactory;
-import org.apache.whirr.ssh.KeyPair;
-import org.junit.Before;
-import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -32,14 +35,12 @@ import java.io.PrintStream;
import java.util.Collections;
import java.util.Map;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsString;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.hamcrest.Matchers.is;
+import org.apache.whirr.ClusterController;
+import org.apache.whirr.ClusterControllerFactory;
+import org.apache.whirr.ClusterSpec;
+import org.apache.whirr.util.KeyPair;
+import org.junit.Before;
+import org.junit.Test;
public class DestroyInstanceCommandTest {
@@ -73,9 +74,9 @@ public class DestroyInstanceCommandTest
@Test
public void testDestroyInstanceById() throws Exception {
- ServiceFactory factory = mock(ServiceFactory.class);
- Service service = mock(Service.class);
- when(factory.create((String) any())).thenReturn(service);
+ ClusterControllerFactory factory = mock(ClusterControllerFactory.class);
+ ClusterController controller = mock(ClusterController.class);
+ when(factory.create((String) any())).thenReturn(controller);
DestroyInstanceCommand command = new DestroyInstanceCommand(factory);
Map<String, File> keys = KeyPair.generateTemporaryFiles();
@@ -91,7 +92,7 @@ public class DestroyInstanceCommandTest
));
assertThat(rc, is(0));
- verify(service).destroyInstance((ClusterSpec) any(),
+ verify(controller).destroyInstance((ClusterSpec) any(),
eq("region/instanceid"));
}
}
Modified: incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/LaunchClusterCommandTest.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/LaunchClusterCommandTest.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/LaunchClusterCommandTest.java (original)
+++ incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/LaunchClusterCommandTest.java Wed Apr 13 04:45:06 2011
@@ -38,12 +38,12 @@ import java.util.Map;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.whirr.service.Cluster;
-import org.apache.whirr.service.ClusterSpec;
-import org.apache.whirr.service.InstanceTemplate;
-import org.apache.whirr.service.Service;
-import org.apache.whirr.service.ServiceFactory;
-import org.apache.whirr.ssh.KeyPair;
+import org.apache.whirr.Cluster;
+import org.apache.whirr.ClusterController;
+import org.apache.whirr.ClusterControllerFactory;
+import org.apache.whirr.ClusterSpec;
+import org.apache.whirr.InstanceTemplate;
+import org.apache.whirr.util.KeyPair;
import org.hamcrest.Matcher;
import org.junit.Before;
import org.junit.Test;
@@ -79,11 +79,11 @@ public class LaunchClusterCommandTest {
@Test
public void testAllOptions() throws Exception {
- ServiceFactory factory = mock(ServiceFactory.class);
- Service service = mock(Service.class);
+ ClusterControllerFactory factory = mock(ClusterControllerFactory.class);
+ ClusterController controller = mock(ClusterController.class);
Cluster cluster = mock(Cluster.class);
- when(factory.create((String) any())).thenReturn(service);
- when(service.launchCluster((ClusterSpec) any())).thenReturn(cluster);
+ when(factory.create((String) any())).thenReturn(controller);
+ when(controller.launchCluster((ClusterSpec) any())).thenReturn(cluster);
LaunchClusterCommand command = new LaunchClusterCommand(factory);
Map<String, File> keys = KeyPair.generateTemporaryFiles();
@@ -118,7 +118,7 @@ public class LaunchClusterCommandTest {
verify(factory).create("test-service");
- verify(service).launchCluster(expectedClusterSpec);
+ verify(controller).launchCluster(expectedClusterSpec);
assertThat(outBytes.toString(), containsString("Started cluster of 0 instances"));
@@ -127,11 +127,11 @@ public class LaunchClusterCommandTest {
@Test
public void testMaxPercentFailure() throws Exception {
- ServiceFactory factory = mock(ServiceFactory.class);
- Service service = mock(Service.class);
+ ClusterControllerFactory factory = mock(ClusterControllerFactory.class);
+ ClusterController controller = mock(ClusterController.class);
Cluster cluster = mock(Cluster.class);
- when(factory.create((String) any())).thenReturn(service);
- when(service.launchCluster((ClusterSpec) any())).thenReturn(cluster);
+ when(factory.create((String) any())).thenReturn(controller);
+ when(controller.launchCluster((ClusterSpec) any())).thenReturn(cluster);
LaunchClusterCommand command = new LaunchClusterCommand(factory);
Map<String, File> keys = KeyPair.generateTemporaryFiles();
@@ -168,7 +168,7 @@ public class LaunchClusterCommandTest {
verify(factory).create("hadoop");
- verify(service).launchCluster(expectedClusterSpec);
+ verify(controller).launchCluster(expectedClusterSpec);
assertThat(outBytes.toString(), containsString("Started cluster of 0 instances"));
}
Modified: incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/ListClusterCommandTest.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/ListClusterCommandTest.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/ListClusterCommandTest.java (original)
+++ incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/ListClusterCommandTest.java Wed Apr 13 04:45:06 2011
@@ -35,10 +35,10 @@ import java.util.Collections;
import java.util.Map;
import java.util.Set;
-import org.apache.whirr.service.ClusterSpec;
-import org.apache.whirr.service.Service;
-import org.apache.whirr.service.ServiceFactory;
-import org.apache.whirr.ssh.KeyPair;
+import org.apache.whirr.ClusterController;
+import org.apache.whirr.ClusterControllerFactory;
+import org.apache.whirr.ClusterSpec;
+import org.apache.whirr.util.KeyPair;
import org.hamcrest.Matcher;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadataBuilder;
@@ -79,9 +79,9 @@ public class ListClusterCommandTest {
@Test
public void testAllOptions() throws Exception {
- ServiceFactory factory = mock(ServiceFactory.class);
- Service service = mock(Service.class);
- when(factory.create((String) any())).thenReturn(service);
+ ClusterControllerFactory factory = mock(ClusterControllerFactory.class);
+ ClusterController controller = mock(ClusterController.class);
+ when(factory.create((String) any())).thenReturn(controller);
NodeMetadata node1 = new NodeMetadataBuilder().name("name1").ids("id1")
.location(new LocationBuilder().scope(LocationScope.PROVIDER)
.id("location-id1").description("location-desc1").build())
@@ -94,7 +94,7 @@ public class ListClusterCommandTest {
.imageId("image-id").state(NodeState.RUNNING)
.publicAddresses(Lists.newArrayList("100.0.0.2"))
.privateAddresses(Lists.newArrayList("10.0.0.2")).build();
- when(service.getNodes((ClusterSpec) any())).thenReturn(
+ when(controller.getNodes((ClusterSpec) any())).thenReturn(
(Set) Sets.newLinkedHashSet(Lists.newArrayList(node1, node2)));
ListClusterCommand command = new ListClusterCommand(factory);
Copied: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/Cluster.java (from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/Cluster.java)
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/Cluster.java?p2=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/Cluster.java&p1=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/Cluster.java&r1=1091639&r2=1091646&rev=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/Cluster.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/Cluster.java Wed Apr 13 04:45:06 2011
@@ -16,16 +16,10 @@
* limitations under the License.
*/
-package org.apache.whirr.service;
-import static com.google.common.base.Preconditions.*;
+package org.apache.whirr;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.whirr.net.DnsUtil;
-import org.jclouds.domain.Credentials;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Objects;
import com.google.common.base.Predicate;
@@ -33,6 +27,15 @@ import com.google.common.collect.Iterabl
import com.google.common.collect.Sets;
import com.google.common.net.InetAddresses;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.whirr.Cluster.Instance;
+import org.apache.whirr.util.DnsUtil;
+import org.jclouds.domain.Credentials;
+
/**
* This class represents a real cluster of {@link Instance}s.
*
Copied: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterAction.java (from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterAction.java)
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterAction.java?p2=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterAction.java&p1=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterAction.java&r1=1091639&r2=1091646&rev=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterAction.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterAction.java Wed Apr 13 04:45:06 2011
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.whirr.service;
+package org.apache.whirr;
import java.io.IOException;
Copied: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterController.java (from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/Service.java)
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterController.java?p2=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterController.java&p1=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/Service.java&r1=1091639&r2=1091646&rev=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/Service.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterController.java Wed Apr 13 04:45:06 2011
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.whirr.service;
+package org.apache.whirr;
import com.google.common.base.Charsets;
import com.google.common.base.Joiner;
@@ -28,10 +28,12 @@ import java.io.IOException;
import java.util.Map;
import java.util.Set;
-import org.apache.whirr.cluster.actions.BootstrapClusterAction;
-import org.apache.whirr.cluster.actions.ConfigureClusterAction;
-import org.apache.whirr.cluster.actions.DestroyClusterAction;
-import org.apache.whirr.service.Cluster.Instance;
+import org.apache.whirr.Cluster.Instance;
+import org.apache.whirr.actions.BootstrapClusterAction;
+import org.apache.whirr.actions.ConfigureClusterAction;
+import org.apache.whirr.actions.DestroyClusterAction;
+import org.apache.whirr.service.ClusterActionHandler;
+import org.apache.whirr.service.ComputeServiceContextBuilder;
import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.ComputeMetadata;
@@ -41,12 +43,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * This class represents a service that a client wants to use. This class is
- * used to start and stop clusters that provide the service.
+ * This class is used to start and stop clusters.
*/
-public class Service {
+public class ClusterController {
- private static final Logger LOG = LoggerFactory.getLogger(Service.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ClusterController.class);
/**
* @return the unique name of the service.
Copied: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterControllerFactory.java (from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ServiceFactory.java)
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterControllerFactory.java?p2=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterControllerFactory.java&p1=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ServiceFactory.java&r1=1091639&r2=1091646&rev=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ServiceFactory.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterControllerFactory.java Wed Apr 13 04:45:06 2011
@@ -16,49 +16,49 @@
* limitations under the License.
*/
-package org.apache.whirr.service;
+package org.apache.whirr;
+
+import com.google.common.collect.Sets;
import java.util.ServiceLoader;
import java.util.Set;
-import com.google.common.collect.Sets;
-
/**
- * This class is used to create {@link Service} instances.
+ * This class is used to create {@link ClusterController} instances.
* <p>
- * <i>Implementation note.</i> {@link Service} implementations are discovered
+ * <i>Implementation note.</i> {@link ClusterController} implementations are discovered
* using a Service Provider
* Interface (SPI), described in {@link ServiceLoader}.
*/
-public class ServiceFactory {
+public class ClusterControllerFactory {
- private ServiceLoader<Service> serviceLoader =
- ServiceLoader.load(Service.class);
+ private ServiceLoader<ClusterController> serviceLoader =
+ ServiceLoader.load(ClusterController.class);
/**
- * Create an instance of a {@link Service} according to the given
- * name. If the name is <code>null</code> then the default {@link Service}
+ * Create an instance of a {@link ClusterController} according to the given
+ * name. If the name is <code>null</code> then the default {@link ClusterController}
* is returned.
*/
- public Service create(String serviceName) {
+ public ClusterController create(String serviceName) {
if (serviceName == null) {
- return new Service();
+ return new ClusterController();
}
- for (Service service : serviceLoader) {
- if (service.getName().equals(serviceName)) {
- return service;
+ for (ClusterController controller : serviceLoader) {
+ if (controller.getName().equals(serviceName)) {
+ return controller;
}
}
return null;
}
/**
- * Return a collection of available services.
+ * Return a collection of available {@link ClusterController} names.
* @return the available service names
*/
public Set<String> availableServices() {
Set<String> result = Sets.newLinkedHashSet();
- for (Service s : serviceLoader) {
+ for (ClusterController s : serviceLoader) {
result.add(s.getName());
}
return result;
Copied: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterSpec.java (from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterSpec.java)
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterSpec.java?p2=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterSpec.java&p1=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterSpec.java&r1=1091639&r2=1091646&rev=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterSpec.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterSpec.java Wed Apr 13 04:45:06 2011
@@ -16,12 +16,19 @@
* limitations under the License.
*/
-package org.apache.whirr.service;
+package org.apache.whirr;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.apache.whirr.util.KeyPair.sameKeyPair;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Objects;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.KeyPair;
import java.io.File;
import java.io.FileReader;
@@ -31,10 +38,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.JSchException;
-import com.jcraft.jsch.KeyPair;
-
import org.apache.commons.configuration.CompositeConfiguration;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
@@ -46,10 +49,6 @@ import org.apache.commons.lang.text.StrL
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.apache.whirr.ssh.KeyPair.sameKeyPair;
-
/**
* This class represents the specification of a cluster. It is used to describe
* the properties of a cluster before it is launched.
@@ -184,7 +183,7 @@ public class ClusterSpec {
public static ClusterSpec withTemporaryKeys(Configuration conf)
throws ConfigurationException, JSchException, IOException {
if (!conf.containsKey(Property.PRIVATE_KEY_FILE.getConfigName())) {
- Map<String, File> keys = org.apache.whirr.ssh.KeyPair.generateTemporaryFiles();
+ Map<String, File> keys = org.apache.whirr.util.KeyPair.generateTemporaryFiles();
LoggerFactory.getLogger(ClusterSpec.class).debug("ssh keys: " +
keys.toString());
Copied: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/HandlerMapFactory.java (from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/HandlerMapFactory.java)
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/HandlerMapFactory.java?p2=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/HandlerMapFactory.java&p1=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/HandlerMapFactory.java&r1=1091639&r2=1091646&rev=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/HandlerMapFactory.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/HandlerMapFactory.java Wed Apr 13 04:45:06 2011
@@ -16,13 +16,14 @@
* limitations under the License.
*/
-package org.apache.whirr.service;
+package org.apache.whirr;
+
+import com.google.common.collect.Maps;
import java.util.Map;
import java.util.ServiceLoader;
-
-import com.google.common.collect.Maps;
+import org.apache.whirr.service.ClusterActionHandler;
/**
* HandlerMapFactory used in ScriptBasedClusterAction classes to
Copied: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/InstanceTemplate.java (from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/InstanceTemplate.java)
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/InstanceTemplate.java?p2=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/InstanceTemplate.java&p1=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/InstanceTemplate.java&r1=1091639&r2=1091646&rev=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/InstanceTemplate.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/InstanceTemplate.java Wed Apr 13 04:45:06 2011
@@ -1,21 +1,38 @@
-package org.apache.whirr.service;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.whirr;
+
+import static com.google.common.base.Preconditions.checkArgument;
import com.google.common.base.Objects;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-import org.apache.commons.configuration.CompositeConfiguration;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import static com.google.common.base.Preconditions.checkArgument;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This class describes the type of instances that should be in the cluster.
Copied: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/RolePredicates.java (from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/RolePredicates.java)
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/RolePredicates.java?p2=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/RolePredicates.java&p1=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/RolePredicates.java&r1=1091639&r2=1091646&rev=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/RolePredicates.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/RolePredicates.java Wed Apr 13 04:45:06 2011
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.whirr.service;
+package org.apache.whirr;
import com.google.common.base.Predicate;
import com.google.common.collect.Sets;
@@ -24,7 +24,7 @@ import com.google.common.collect.Sets;
import java.util.Collections;
import java.util.Set;
-import org.apache.whirr.service.Cluster.Instance;
+import org.apache.whirr.Cluster.Instance;
/**
* {@link Predicate}s for matching {@link Instance}s with certain cluster roles.
Modified: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/BootstrapClusterAction.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/BootstrapClusterAction.java?rev=1091646&r1=1091639&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/BootstrapClusterAction.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/BootstrapClusterAction.java Wed Apr 13 04:45:06 2011
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.whirr.cluster.actions;
+package org.apache.whirr.actions;
import static org.jclouds.compute.options.TemplateOptions.Builder.runScript;
import static org.jclouds.scriptbuilder.domain.Statements.appendFile;
@@ -45,12 +45,12 @@ import java.util.concurrent.ExecutorServ
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
-import org.apache.whirr.service.Cluster;
-import org.apache.whirr.service.Cluster.Instance;
+import org.apache.whirr.Cluster;
+import org.apache.whirr.Cluster.Instance;
+import org.apache.whirr.ClusterSpec;
+import org.apache.whirr.InstanceTemplate;
import org.apache.whirr.service.ClusterActionEvent;
import org.apache.whirr.service.ClusterActionHandler;
-import org.apache.whirr.service.ClusterSpec;
-import org.apache.whirr.service.InstanceTemplate;
import org.apache.whirr.service.ComputeServiceContextBuilder;
import org.apache.whirr.service.jclouds.StatementBuilder;
import org.apache.whirr.service.jclouds.TemplateBuilderStrategy;
@@ -68,7 +68,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * A {@link org.apache.whirr.service.ClusterAction} that starts instances in a cluster in parallel and
+ * A {@link org.apache.whirr.ClusterAction} that starts instances in a cluster in parallel and
* runs bootstrap scripts on them.
*/
public class BootstrapClusterAction extends ScriptBasedClusterAction {
Modified: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/ConfigureClusterAction.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/ConfigureClusterAction.java?rev=1091646&r1=1091639&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/ConfigureClusterAction.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/ConfigureClusterAction.java Wed Apr 13 04:45:06 2011
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.whirr.cluster.actions;
+package org.apache.whirr.actions;
import com.google.common.base.Predicate;
import com.google.common.collect.Maps;
@@ -26,14 +26,14 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import org.apache.whirr.service.Cluster;
-import org.apache.whirr.service.Cluster.Instance;
+import org.apache.whirr.Cluster;
+import org.apache.whirr.Cluster.Instance;
+import org.apache.whirr.ClusterSpec;
+import org.apache.whirr.InstanceTemplate;
+import org.apache.whirr.RolePredicates;
import org.apache.whirr.service.ClusterActionEvent;
import org.apache.whirr.service.ClusterActionHandler;
-import org.apache.whirr.service.ClusterSpec;
-import org.apache.whirr.service.InstanceTemplate;
import org.apache.whirr.service.ComputeServiceContextBuilder;
-import org.apache.whirr.service.RolePredicates;
import org.apache.whirr.service.jclouds.StatementBuilder;
import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContext;
@@ -47,7 +47,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * A {@link org.apache.whirr.service.ClusterAction} for running a configuration script on instances
+ * A {@link org.apache.whirr.ClusterAction} for running a configuration script on instances
* in the cluster after it has been bootstrapped.
*/
public class ConfigureClusterAction extends ScriptBasedClusterAction {
Modified: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/DestroyClusterAction.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/DestroyClusterAction.java?rev=1091646&r1=1091639&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/DestroyClusterAction.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/DestroyClusterAction.java Wed Apr 13 04:45:06 2011
@@ -16,16 +16,16 @@
* limitations under the License.
*/
-package org.apache.whirr.cluster.actions;
+package org.apache.whirr.actions;
import static org.jclouds.compute.predicates.NodePredicates.inGroup;
import java.io.IOException;
-import org.apache.whirr.service.Cluster;
-import org.apache.whirr.service.ClusterAction;
+import org.apache.whirr.Cluster;
+import org.apache.whirr.ClusterAction;
+import org.apache.whirr.ClusterSpec;
import org.apache.whirr.service.ClusterActionHandler;
-import org.apache.whirr.service.ClusterSpec;
import org.apache.whirr.service.ComputeServiceContextBuilder;
import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContextFactory;
Modified: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/ScriptBasedClusterAction.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/ScriptBasedClusterAction.java?rev=1091646&r1=1091639&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/ScriptBasedClusterAction.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/ScriptBasedClusterAction.java Wed Apr 13 04:45:06 2011
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.whirr.cluster.actions;
+package org.apache.whirr.actions;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
@@ -24,14 +24,14 @@ import com.google.common.collect.Maps;
import java.io.IOException;
import java.util.Map;
-import org.apache.whirr.service.Cluster;
-import org.apache.whirr.service.ClusterAction;
+import org.apache.whirr.Cluster;
+import org.apache.whirr.ClusterAction;
+import org.apache.whirr.ClusterSpec;
+import org.apache.whirr.InstanceTemplate;
import org.apache.whirr.service.ClusterActionEvent;
import org.apache.whirr.service.ClusterActionHandler;
-import org.apache.whirr.service.ClusterSpec;
import org.apache.whirr.service.ComputeServiceContextBuilder;
import org.apache.whirr.service.FirewallManager;
-import org.apache.whirr.service.InstanceTemplate;
import org.apache.whirr.service.jclouds.StatementBuilder;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory;
Modified: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/package-info.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/package-info.java?rev=1091646&r1=1091639&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/package-info.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/actions/package-info.java Wed Apr 13 04:45:06 2011
@@ -18,7 +18,7 @@
*/
/**
* <p>
- * A collection of {@link org.apache.whirr.service.ClusterAction} implementations.
+ * A collection of {@link org.apache.whirr.ClusterAction} implementations.
* </p>
*/
-package org.apache.whirr.cluster.actions;
+package org.apache.whirr.actions;
Added: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/package-info.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/package-info.java?rev=1091646&view=auto
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/package-info.java (added)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/package-info.java Wed Apr 13 04:45:06 2011
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+/**
+ * <p>
+ * The Whirr client API.
+ * </p>
+ */
+package org.apache.whirr;
Propchange: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterActionEvent.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterActionEvent.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterActionEvent.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterActionEvent.java Wed Apr 13 04:45:06 2011
@@ -18,11 +18,13 @@
package org.apache.whirr.service;
+import org.apache.whirr.Cluster;
+import org.apache.whirr.ClusterSpec;
import org.apache.whirr.service.jclouds.StatementBuilder;
import org.apache.whirr.service.jclouds.TemplateBuilderStrategy;
/**
- * An event object which is fired when a {@link ClusterAction} occurs.
+ * An event object which is fired when a {@link org.apache.whirr.ClusterAction} occurs.
*/
public class ClusterActionEvent {
Modified: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterActionHandlerSupport.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterActionHandlerSupport.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterActionHandlerSupport.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterActionHandlerSupport.java Wed Apr 13 04:45:06 2011
@@ -22,6 +22,7 @@ import java.io.IOException;
import org.apache.commons.configuration.CompositeConfiguration;
import org.apache.commons.configuration.Configuration;
+import org.apache.whirr.ClusterSpec;
import org.apache.whirr.service.jclouds.RunUrlStatement;
import org.jclouds.scriptbuilder.domain.Statement;
Modified: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ComputeServiceContextBuilder.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ComputeServiceContextBuilder.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ComputeServiceContextBuilder.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ComputeServiceContextBuilder.java Wed Apr 13 04:45:06 2011
@@ -26,6 +26,7 @@ import java.util.Set;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationConverter;
+import org.apache.whirr.ClusterSpec;
import org.apache.whirr.service.jclouds.TakeLoginCredentialsFromWhirrProperties;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory;
Modified: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/FirewallManager.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/FirewallManager.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/FirewallManager.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/FirewallManager.java Wed Apr 13 04:45:06 2011
@@ -27,7 +27,9 @@ import java.util.Collections;
import java.util.List;
import java.util.Set;
-import org.apache.whirr.service.Cluster.Instance;
+import org.apache.whirr.Cluster;
+import org.apache.whirr.Cluster.Instance;
+import org.apache.whirr.ClusterSpec;
import org.apache.whirr.service.jclouds.FirewallSettings;
import org.jclouds.compute.ComputeServiceContext;
import org.slf4j.Logger;
Modified: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/jclouds/FirewallSettings.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/jclouds/FirewallSettings.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/jclouds/FirewallSettings.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/jclouds/FirewallSettings.java Wed Apr 13 04:45:06 2011
@@ -18,6 +18,9 @@
package org.apache.whirr.service.jclouds;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
@@ -26,20 +29,16 @@ import java.util.List;
import java.util.Set;
import org.apache.commons.io.IOUtils;
-import org.apache.whirr.service.Cluster.Instance;
-import org.apache.whirr.service.ClusterSpec;
-import org.apache.whirr.service.FirewallManager;
+import org.apache.whirr.Cluster.Instance;
+import org.apache.whirr.ClusterSpec;
import org.jclouds.aws.util.AWSUtils;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.ec2.EC2Client;
import org.jclouds.ec2.domain.IpProtocol;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
/**
* Utility functions for controlling firewall settings for a cluster.
- * @deprecated Use {@link FirewallManager} instead.
+ * @deprecated Use {@link org.apache.whirr.service.FirewallManager} instead.
*/
@Deprecated
public class FirewallSettings {
Modified: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/jclouds/TakeLoginCredentialsFromWhirrProperties.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/jclouds/TakeLoginCredentialsFromWhirrProperties.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/jclouds/TakeLoginCredentialsFromWhirrProperties.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/jclouds/TakeLoginCredentialsFromWhirrProperties.java Wed Apr 13 04:45:06 2011
@@ -18,15 +18,15 @@
package org.apache.whirr.service.jclouds;
+import com.google.common.base.Splitter;
+import com.google.common.collect.Lists;
+
import java.util.List;
import javax.inject.Singleton;
-import org.jclouds.ec2.compute.strategy.EC2PopulateDefaultLoginCredentialsForImageStrategy;
import org.jclouds.domain.Credentials;
-
-import com.google.common.base.Splitter;
-import com.google.common.collect.Lists;
+import org.jclouds.ec2.compute.strategy.EC2PopulateDefaultLoginCredentialsForImageStrategy;
@Singleton
// patch until jclouds 1.0-beta-10
Modified: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/jclouds/TemplateBuilderStrategy.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/jclouds/TemplateBuilderStrategy.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/jclouds/TemplateBuilderStrategy.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/jclouds/TemplateBuilderStrategy.java Wed Apr 13 04:45:06 2011
@@ -18,7 +18,7 @@
package org.apache.whirr.service.jclouds;
-import org.apache.whirr.service.ClusterSpec;
+import org.apache.whirr.ClusterSpec;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.TemplateBuilder;
Modified: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/package-info.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/package-info.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/package-info.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/package-info.java Wed Apr 13 04:45:06 2011
@@ -33,14 +33,14 @@
* required.
* </p>
* <p>
- * An <i>instance template</i> ({@link InstanceTemplate}) is a specification of the role sets and
+ * An <i>instance template</i> ({@link org.apache.whirr.InstanceTemplate}) is a specification of the role sets and
* cardinalities that make up a cluster. For example,
* <tt>1 role-a+role-b,4 role-c</tt>
* specifies a cluster in which one node is in roles <tt>role-a</tt> and
* <tt>role-b</tt>, and four nodes are in role <tt>role-c</tt>.
* </p>
* <p>
- * A <i>cluster action</i> ({@link org.apache.whirr.service.ClusterAction}) is an action that is performed on a set of machines
+ * A <i>cluster action</i> ({@link org.apache.whirr.ClusterAction}) is an action that is performed on a set of machines
* in a cluster. Examples of cluster actions include 'bootstrap' and 'configure'.
* </p>
*
@@ -48,11 +48,11 @@
*
* <p>
* You can launch or destroy clusters using an instance of
- * {@link org.apache.whirr.service.Service}.
+ * {@link org.apache.whirr.ClusterController}.
* </p>
*
* <p>
- * Whirr {@link org.apache.whirr.service.Service#launchCluster(ClusterSpec) launches a cluster} by running the bootstrap action, followed by the
+ * Whirr {@link org.apache.whirr.ClusterController#launchCluster(ClusterSpec) launches a cluster} by running the bootstrap action, followed by the
* configure action. For each of these actions Whirr follows these rules:
* </p>
*
@@ -76,7 +76,7 @@
* </p>
*
* <p>
- * A cluster is {@link org.apache.whirr.service.Service#destroyCluster(ClusterSpec) destroyed} by running the destroy action.
+ * A cluster is {@link org.apache.whirr.ClusterController#destroyCluster(ClusterSpec) destroyed} by running the destroy action.
* </p>
*
* <h3>Writing a New Service</h3>
Copied: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/util/DnsUtil.java (from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/net/DnsUtil.java)
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/util/DnsUtil.java?p2=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/util/DnsUtil.java&p1=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/net/DnsUtil.java&r1=1091639&r2=1091646&rev=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/net/DnsUtil.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/util/DnsUtil.java Wed Apr 13 04:45:06 2011
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.whirr.net;
+package org.apache.whirr.util;
import java.io.IOException;
Copied: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/util/KeyPair.java (from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ssh/KeyPair.java)
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/util/KeyPair.java?p2=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/util/KeyPair.java&p1=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ssh/KeyPair.java&r1=1091639&r2=1091646&rev=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ssh/KeyPair.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/util/KeyPair.java Wed Apr 13 04:45:06 2011
@@ -16,27 +16,28 @@
* limitations under the License.
*/
-package org.apache.whirr.ssh;
+package org.apache.whirr.util;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.io.Files;
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
import java.io.FileInputStream;
import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.security.GeneralSecurityException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.interfaces.RSAPublicKey;
-import java.security.GeneralSecurityException;
import java.util.Map;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.io.Files;
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.JSchException;
+import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.apache.commons.ssl.PKCS8Key;
-import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Copied: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/util/package-info.java (from r1091639, incubator/whirr/trunk/core/src/main/java/org/apache/whirr/net/package-info.java)
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/util/package-info.java?p2=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/util/package-info.java&p1=incubator/whirr/trunk/core/src/main/java/org/apache/whirr/net/package-info.java&r1=1091639&r2=1091646&rev=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/net/package-info.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/util/package-info.java Wed Apr 13 04:45:06 2011
@@ -18,7 +18,7 @@
*/
/**
* <p>
- * Network-related classes.
+ * Utility classes.
* </p>
*/
-package org.apache.whirr.net;
+package org.apache.whirr.util;
Copied: incubator/whirr/trunk/core/src/test/java/org/apache/whirr/ClusterControllerFactoryTest.java (from r1091639, incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/ServiceFactoryTest.java)
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/test/java/org/apache/whirr/ClusterControllerFactoryTest.java?p2=incubator/whirr/trunk/core/src/test/java/org/apache/whirr/ClusterControllerFactoryTest.java&p1=incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/ServiceFactoryTest.java&r1=1091639&r2=1091646&rev=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/ServiceFactoryTest.java (original)
+++ incubator/whirr/trunk/core/src/test/java/org/apache/whirr/ClusterControllerFactoryTest.java Wed Apr 13 04:45:06 2011
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.whirr.service;
+package org.apache.whirr;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertThat;
@@ -25,9 +25,9 @@ import java.io.IOException;
import org.junit.Test;
-public class ServiceFactoryTest {
+public class ClusterControllerFactoryTest {
- public static class TestService extends Service {
+ public static class TestClusterController extends ClusterController {
@Override
public String getName() {
return "test-service";
@@ -40,15 +40,15 @@ public class ServiceFactoryTest {
@Test
public void testServiceFactoryIsCreatedFromWhirrProperties() throws IOException {
- ServiceFactory factory = new ServiceFactory();
- Service service = factory.create("test-service");
- assertThat(service, instanceOf(TestService.class));
+ ClusterControllerFactory factory = new ClusterControllerFactory();
+ ClusterController controller = factory.create("test-service");
+ assertThat(controller, instanceOf(TestClusterController.class));
}
@Test
public void testServiceFactoryWithNullServiceName() throws IOException {
- ServiceFactory factory = new ServiceFactory();
- Service service = factory.create(null);
- assertThat(service, instanceOf(Service.class));
+ ClusterControllerFactory factory = new ClusterControllerFactory();
+ ClusterController controller = factory.create(null);
+ assertThat(controller, instanceOf(ClusterController.class));
}
}
Copied: incubator/whirr/trunk/core/src/test/java/org/apache/whirr/ClusterSpecTest.java (from r1091639, incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/ClusterSpecTest.java)
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/test/java/org/apache/whirr/ClusterSpecTest.java?p2=incubator/whirr/trunk/core/src/test/java/org/apache/whirr/ClusterSpecTest.java&p1=incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/ClusterSpecTest.java&r1=1091639&r2=1091646&rev=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/ClusterSpecTest.java (original)
+++ incubator/whirr/trunk/core/src/test/java/org/apache/whirr/ClusterSpecTest.java Wed Apr 13 04:45:06 2011
@@ -16,10 +16,9 @@
* limitations under the License.
*/
-package org.apache.whirr.service;
+package org.apache.whirr;
import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertThat;
import com.google.common.collect.Iterables;
@@ -43,7 +42,7 @@ import org.apache.commons.configuration.
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.io.IOUtils;
-import org.apache.whirr.ssh.KeyPair;
+import org.apache.whirr.util.KeyPair;
import org.junit.Assert;
import org.junit.Test;
Modified: incubator/whirr/trunk/core/src/test/java/org/apache/whirr/actions/BootstrapClusterActionTest.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/test/java/org/apache/whirr/actions/BootstrapClusterActionTest.java?rev=1091646&r1=1091639&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/test/java/org/apache/whirr/actions/BootstrapClusterActionTest.java (original)
+++ incubator/whirr/trunk/core/src/test/java/org/apache/whirr/actions/BootstrapClusterActionTest.java Wed Apr 13 04:45:06 2011
@@ -16,9 +16,17 @@
* limitations under the License.
*/
-package org.apache.whirr.cluster.actions;
+package org.apache.whirr.actions;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+import com.google.inject.Module;
import java.io.IOException;
import java.net.URI;
@@ -31,15 +39,11 @@ import java.util.Set;
import java.util.Stack;
import java.util.concurrent.atomic.AtomicInteger;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
import org.apache.commons.configuration.CompositeConfiguration;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.whirr.ClusterSpec;
import org.apache.whirr.service.ClusterActionHandler;
-import org.apache.whirr.service.ClusterSpec;
import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory;
@@ -66,10 +70,6 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import com.google.inject.Module;
-
public class BootstrapClusterActionTest {
private static final Logger LOG =
Modified: incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/TemplateBuilderStrategyTest.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/TemplateBuilderStrategyTest.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/TemplateBuilderStrategyTest.java (original)
+++ incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/TemplateBuilderStrategyTest.java Wed Apr 13 04:45:06 2011
@@ -22,14 +22,16 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import com.jcraft.jsch.JSchException;
+
+import java.io.IOException;
+
import org.apache.commons.configuration.ConfigurationException;
+import org.apache.whirr.ClusterSpec;
import org.apache.whirr.service.jclouds.TemplateBuilderStrategy;
import org.jclouds.compute.domain.TemplateBuilder;
import org.junit.Before;
import org.junit.Test;
-import java.io.IOException;
-
public class TemplateBuilderStrategyTest {
private TemplateBuilderStrategy strategy = new TemplateBuilderStrategy();
Modified: incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/jclouds/TakeLoginCredentialsFromWhirrPropertiesTest.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/jclouds/TakeLoginCredentialsFromWhirrPropertiesTest.java?rev=1091646&r1=1091645&r2=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/jclouds/TakeLoginCredentialsFromWhirrPropertiesTest.java (original)
+++ incubator/whirr/trunk/core/src/test/java/org/apache/whirr/service/jclouds/TakeLoginCredentialsFromWhirrPropertiesTest.java Wed Apr 13 04:45:06 2011
@@ -33,6 +33,7 @@ public class TakeLoginCredentialsFromWhi
@Test
public synchronized void testNotSetIsDefault() throws IOException {
try {
+ System.getProperties().remove("whirr.login-user");
assertThat(
strat.execute(null),
equalTo(new Credentials("root", null)));
Copied: incubator/whirr/trunk/core/src/test/java/org/apache/whirr/util/KeyPairTest.java (from r1091639, incubator/whirr/trunk/core/src/test/java/org/apache/whirr/ssh/KeyPairTest.java)
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/test/java/org/apache/whirr/util/KeyPairTest.java?p2=incubator/whirr/trunk/core/src/test/java/org/apache/whirr/util/KeyPairTest.java&p1=incubator/whirr/trunk/core/src/test/java/org/apache/whirr/ssh/KeyPairTest.java&r1=1091639&r2=1091646&rev=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/test/java/org/apache/whirr/ssh/KeyPairTest.java (original)
+++ incubator/whirr/trunk/core/src/test/java/org/apache/whirr/util/KeyPairTest.java Wed Apr 13 04:45:06 2011
@@ -16,11 +16,11 @@
* limitations under the License.
*/
-package org.apache.whirr.ssh;
+package org.apache.whirr.util;
-import static org.apache.whirr.ssh.KeyPair.sameKeyPair;
-import static org.apache.whirr.ssh.KeyPair.generate;
-import static org.apache.whirr.ssh.KeyPair.generateTemporaryFiles;
+import static org.apache.whirr.util.KeyPair.sameKeyPair;
+import static org.apache.whirr.util.KeyPair.generate;
+import static org.apache.whirr.util.KeyPair.generateTemporaryFiles;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
Copied: incubator/whirr/trunk/core/src/test/java/org/apache/whirr/util/integration/DnsUtilTest.java (from r1091639, incubator/whirr/trunk/core/src/test/java/org/apache/whirr/net/integration/DnsUtilTest.java)
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/test/java/org/apache/whirr/util/integration/DnsUtilTest.java?p2=incubator/whirr/trunk/core/src/test/java/org/apache/whirr/util/integration/DnsUtilTest.java&p1=incubator/whirr/trunk/core/src/test/java/org/apache/whirr/net/integration/DnsUtilTest.java&r1=1091639&r2=1091646&rev=1091646&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/test/java/org/apache/whirr/net/integration/DnsUtilTest.java (original)
+++ incubator/whirr/trunk/core/src/test/java/org/apache/whirr/util/integration/DnsUtilTest.java Wed Apr 13 04:45:06 2011
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.whirr.net.integration;
+package org.apache.whirr.util.integration;
import static org.junit.Assert.*;
import static java.lang.System.out;
@@ -29,7 +29,7 @@ import java.net.UnknownHostException;
import java.util.Collections;
import java.util.Enumeration;
-import org.apache.whirr.net.DnsUtil;
+import org.apache.whirr.util.DnsUtil;
import org.junit.Test;
import org.xbill.DNS.Address;