org.apache.whirr.command
Class AbstractClusterCommand

java.lang.Object
  extended by org.apache.whirr.command.Command
      extended by org.apache.whirr.command.AbstractClusterCommand
Direct Known Subclasses:
CleanupClusterCommand, DestroyClusterCommand, DestroyInstanceCommand, LaunchClusterCommand, ListClusterCommand, ListProvidersCommand, RoleLifecycleCommand, RunScriptCommand

public abstract class AbstractClusterCommand
extends Command

An abstract command for interacting with clusters.


Field Summary
protected  ClusterControllerFactory factory
           
protected  joptsimple.OptionParser parser
           
protected  ClusterStateStoreFactory stateStoreFactory
           
 
Constructor Summary
AbstractClusterCommand(String name, String description, ClusterControllerFactory factory)
           
AbstractClusterCommand(String name, String description, ClusterControllerFactory factory, ClusterStateStoreFactory stateStoreFactory)
           
 
Method Summary
protected  ClusterController createClusterController(String serviceName)
          Create the specified service
protected  ClusterStateStore createClusterStateStore(ClusterSpec spec)
          Create the cluster state store object
protected  Cluster getCluster(ClusterSpec clusterSpec, ClusterController controller)
          Get the cluster instance together with NodeMetadata (through API calls)
protected  ClusterSpec getClusterSpec(joptsimple.OptionSet optionSet)
          Load the cluster spec by parsing the command line option set
protected  void printErrorAndHelpHint(PrintStream stream, Throwable e)
          Print command execution error and a hint to help the user get more help
protected  void printProviderInfo(PrintStream out, PrintStream err, ClusterSpec clusterSpec, joptsimple.OptionSet optionSet)
           
 void printUsage(PrintStream stream)
          Print a generic usage indication for commands
 
Methods inherited from class org.apache.whirr.command.Command
getDescription, getName, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

protected ClusterControllerFactory factory

stateStoreFactory

protected ClusterStateStoreFactory stateStoreFactory

parser

protected joptsimple.OptionParser parser
Constructor Detail

AbstractClusterCommand

public AbstractClusterCommand(String name,
                              String description,
                              ClusterControllerFactory factory)

AbstractClusterCommand

public AbstractClusterCommand(String name,
                              String description,
                              ClusterControllerFactory factory,
                              ClusterStateStoreFactory stateStoreFactory)
Method Detail

getClusterSpec

protected ClusterSpec getClusterSpec(joptsimple.OptionSet optionSet)
                              throws org.apache.commons.configuration.ConfigurationException
Load the cluster spec by parsing the command line option set

Throws:
org.apache.commons.configuration.ConfigurationException

getCluster

protected Cluster getCluster(ClusterSpec clusterSpec,
                             ClusterController controller)
                      throws IOException,
                             InterruptedException
Get the cluster instance together with NodeMetadata (through API calls)

Throws:
IOException
InterruptedException

createClusterController

protected ClusterController createClusterController(String serviceName)
Create the specified service


createClusterStateStore

protected ClusterStateStore createClusterStateStore(ClusterSpec spec)
Create the cluster state store object


printProviderInfo

protected void printProviderInfo(PrintStream out,
                                 PrintStream err,
                                 ClusterSpec clusterSpec,
                                 joptsimple.OptionSet optionSet)

printErrorAndHelpHint

protected void printErrorAndHelpHint(PrintStream stream,
                                     Throwable e)
Print command execution error and a hint to help the user get more help


printUsage

public void printUsage(PrintStream stream)
                throws IOException
Print a generic usage indication for commands

Specified by:
printUsage in class Command
Throws:
IOException


Copyright © 2010-2013 The Apache Software Foundation. All Rights Reserved.