org.apache.whirr.actions
Class ScriptBasedClusterAction

java.lang.Object
  extended by org.apache.whirr.ClusterAction
      extended by org.apache.whirr.actions.ScriptBasedClusterAction
Direct Known Subclasses:
BootstrapClusterAction, ByonClusterAction, CleanupClusterAction, ConfigureServicesAction, DestroyClusterAction, StartServicesAction, StopServicesAction

public abstract class ScriptBasedClusterAction
extends ClusterAction

A ClusterAction that provides the base functionality for running scripts on instances in the cluster.


Constructor Summary
protected ScriptBasedClusterAction(com.google.common.base.Function<ClusterSpec,org.jclouds.compute.ComputeServiceContext> getCompute, com.google.common.cache.LoadingCache<String,ClusterActionHandler> handlerMap)
           
protected ScriptBasedClusterAction(com.google.common.base.Function<ClusterSpec,org.jclouds.compute.ComputeServiceContext> getCompute, com.google.common.cache.LoadingCache<String,ClusterActionHandler> handlerMap, Set<String> targetRoles, Set<String> targetInstanceIds)
           
 
Method Summary
protected  void doAction(Map<InstanceTemplate,ClusterActionEvent> eventMap)
           
protected  void eventSpecificActions(Map.Entry<InstanceTemplate,ClusterActionEvent> entry)
           
 Cluster execute(ClusterSpec clusterSpec, Cluster cluster)
           
protected  com.google.common.base.Predicate<Cluster.Instance> instanceIsNotInTarget()
           
protected  void postRunScriptsActions(Map<InstanceTemplate,ClusterActionEvent> eventMap)
           
protected  boolean roleIsInTarget(String role)
           
protected  void runScripts(Map<InstanceTemplate,ClusterActionEvent> eventMap)
           
 com.google.common.util.concurrent.ListenableFuture<org.jclouds.compute.domain.ExecResponse> runStatementOnInstanceInCluster(StatementBuilder statementBuilder, Cluster.Instance instance, ClusterSpec clusterSpec, org.jclouds.compute.options.RunScriptOptions options)
           
protected  boolean shouldIgnoreInstanceTemplate(InstanceTemplate template)
           
 
Methods inherited from class org.apache.whirr.ClusterAction
getAction, getCompute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptBasedClusterAction

protected ScriptBasedClusterAction(com.google.common.base.Function<ClusterSpec,org.jclouds.compute.ComputeServiceContext> getCompute,
                                   com.google.common.cache.LoadingCache<String,ClusterActionHandler> handlerMap)

ScriptBasedClusterAction

protected ScriptBasedClusterAction(com.google.common.base.Function<ClusterSpec,org.jclouds.compute.ComputeServiceContext> getCompute,
                                   com.google.common.cache.LoadingCache<String,ClusterActionHandler> handlerMap,
                                   Set<String> targetRoles,
                                   Set<String> targetInstanceIds)
Method Detail

execute

public Cluster execute(ClusterSpec clusterSpec,
                       Cluster cluster)
                throws IOException,
                       InterruptedException
Specified by:
execute in class ClusterAction
Throws:
IOException
InterruptedException

doAction

protected void doAction(Map<InstanceTemplate,ClusterActionEvent> eventMap)
                 throws InterruptedException,
                        IOException
Throws:
InterruptedException
IOException

runScripts

protected void runScripts(Map<InstanceTemplate,ClusterActionEvent> eventMap)
                   throws InterruptedException,
                          IOException
Throws:
InterruptedException
IOException

runStatementOnInstanceInCluster

public com.google.common.util.concurrent.ListenableFuture<org.jclouds.compute.domain.ExecResponse> runStatementOnInstanceInCluster(StatementBuilder statementBuilder,
                                                                                                                                   Cluster.Instance instance,
                                                                                                                                   ClusterSpec clusterSpec,
                                                                                                                                   org.jclouds.compute.options.RunScriptOptions options)

shouldIgnoreInstanceTemplate

protected boolean shouldIgnoreInstanceTemplate(InstanceTemplate template)

roleIsInTarget

protected boolean roleIsInTarget(String role)

instanceIsNotInTarget

protected com.google.common.base.Predicate<Cluster.Instance> instanceIsNotInTarget()

eventSpecificActions

protected void eventSpecificActions(Map.Entry<InstanceTemplate,ClusterActionEvent> entry)
                             throws IOException
Throws:
IOException

postRunScriptsActions

protected void postRunScriptsActions(Map<InstanceTemplate,ClusterActionEvent> eventMap)
                              throws IOException
Throws:
IOException


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