org.apache.whirr.cli.command
Class RoleLifecycleCommand

java.lang.Object
  extended by org.apache.whirr.command.Command
      extended by org.apache.whirr.command.AbstractClusterCommand
          extended by org.apache.whirr.cli.command.RoleLifecycleCommand
Direct Known Subclasses:
ConfigureServicesCommand, RestartServicesCommand, StartServicesCommand, StopServicesCommand

public abstract class RoleLifecycleCommand
extends AbstractClusterCommand


Field Summary
 
Fields inherited from class org.apache.whirr.command.AbstractClusterCommand
factory, parser, stateStoreFactory
 
Constructor Summary
RoleLifecycleCommand(String name, String description, ClusterControllerFactory factory, ClusterStateStoreFactory stateStoreFactory)
           
 
Method Summary
protected  Set<String> getTargetInstanceIdsOrEmpty(joptsimple.OptionSet optionSet)
          Get the list of targeted instance IDs for this command or an empty set
protected  Set<String> getTargetRolesOrEmpty(joptsimple.OptionSet optionSet)
          Get the list of targeted roles for this command or an empty set
 void printUsage(PrintStream stream)
          Print a generic usage indication for this class of commands
 int run(InputStream in, PrintStream out, PrintStream err, List<String> args)
           
abstract  int runLifecycleStep(ClusterSpec clusterSpec, ClusterController controller, joptsimple.OptionSet optionSet)
          Implement this method to trigger the relevant role lifecycle action
 
Methods inherited from class org.apache.whirr.command.AbstractClusterCommand
createClusterController, createClusterStateStore, getCluster, getClusterSpec, printErrorAndHelpHint, printProviderInfo
 
Methods inherited from class org.apache.whirr.command.Command
getDescription, getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoleLifecycleCommand

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

runLifecycleStep

public abstract int runLifecycleStep(ClusterSpec clusterSpec,
                                     ClusterController controller,
                                     joptsimple.OptionSet optionSet)
                              throws IOException,
                                     InterruptedException
Implement this method to trigger the relevant role lifecycle action

Throws:
IOException
InterruptedException

run

public int run(InputStream in,
               PrintStream out,
               PrintStream err,
               List<String> args)
        throws Exception
Specified by:
run in class Command
Throws:
Exception

getTargetRolesOrEmpty

protected Set<String> getTargetRolesOrEmpty(joptsimple.OptionSet optionSet)
Get the list of targeted roles for this command or an empty set


getTargetInstanceIdsOrEmpty

protected Set<String> getTargetInstanceIdsOrEmpty(joptsimple.OptionSet optionSet)
Get the list of targeted instance IDs for this command or an empty set


printUsage

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

Overrides:
printUsage in class AbstractClusterCommand
Throws:
IOException


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