org.jclouds.compute.options
Class RunScriptOptions

java.lang.Object
  extended by org.jclouds.compute.options.RunScriptOptions
Direct Known Subclasses:
RunScriptOptions.ImmutableRunScriptOptions, TemplateOptions

public class RunScriptOptions
extends Object

Enables additional options for running a script.

Author:
Oleksiy Yarmula

Nested Class Summary
static class RunScriptOptions.Builder
           
static class RunScriptOptions.ImmutableRunScriptOptions
           
 
Field Summary
protected  boolean blockOnComplete
           
static RunScriptOptions NONE
          Default options.
protected  Credentials overridingCredentials
           
protected  int port
           
protected  boolean runAsRoot
           
protected  int seconds
           
protected  String taskName
           
protected  boolean wrapInInitScript
           
 
Constructor Summary
RunScriptOptions()
           
 
Method Summary
 RunScriptOptions blockOnComplete(boolean blockOnComplete)
          As of version 1.1.0, we cannot kick off a script unless a node is in RUNNING state.
 RunScriptOptions blockOnPort(int port, int seconds)
          When the node is started, wait until the following port is active
 Credentials getOverridingCredentials()
          Whether to override the credentials with ones supplied in call to org.jclouds.compute.ComputeService#runScriptOnNodesWithTag.
 int getPort()
           
 int getSeconds()
           
 String getTaskName()
           
 RunScriptOptions nameTask(String name)
           
 RunScriptOptions overrideCredentialsWith(Credentials overridingCredentials)
           
 RunScriptOptions overrideLoginCredentialWith(String loginCredential)
           
 RunScriptOptions overrideLoginUserWith(String loginUser)
           
 RunScriptOptions runAsRoot(boolean runAsRoot)
           
 boolean shouldBlockOnComplete()
           
 boolean shouldRunAsRoot()
          Whether to run the script as root (or run with current privileges).
 boolean shouldWrapInInitScript()
          Whether to wait until the script has completed.
 String toString()
           
 RunScriptOptions wrapInInitScript(boolean wrapInInitScript)
          default true

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final RunScriptOptions NONE
Default options. The default settings are:


port

protected int port

seconds

protected int seconds

taskName

protected String taskName

overridingCredentials

protected Credentials overridingCredentials

runAsRoot

protected boolean runAsRoot

blockOnComplete

protected boolean blockOnComplete

wrapInInitScript

protected boolean wrapInInitScript
Constructor Detail

RunScriptOptions

public RunScriptOptions()
Method Detail

overrideCredentialsWith

public RunScriptOptions overrideCredentialsWith(Credentials overridingCredentials)

overrideLoginUserWith

public RunScriptOptions overrideLoginUserWith(String loginUser)

overrideLoginCredentialWith

public RunScriptOptions overrideLoginCredentialWith(String loginCredential)

nameTask

public RunScriptOptions nameTask(String name)
Returns:
What to call the task relating to this script; default jclouds-script-timestamp where timestamp is millis since epoch

runAsRoot

public RunScriptOptions runAsRoot(boolean runAsRoot)

wrapInInitScript

public RunScriptOptions wrapInInitScript(boolean wrapInInitScript)
default true

Parameters:
wrapInInitScript - if the command is long-running, use this option to ensure it is wrapInInitScripted properly. (ex. have jclouds wrap it an init script, nohup, etc)
Returns:

blockOnComplete

public RunScriptOptions blockOnComplete(boolean blockOnComplete)
As of version 1.1.0, we cannot kick off a script unless a node is in RUNNING state.

Parameters:
blockOnComplete - (default true) false means kick off the script in the background, but don't wait for it to finish. (as of version 1.1.0, implemented as nohup)

blockOnPort

public RunScriptOptions blockOnPort(int port,
                                    int seconds)
When the node is started, wait until the following port is active


getTaskName

public String getTaskName()

getPort

public int getPort()

getSeconds

public int getSeconds()

getOverridingCredentials

public Credentials getOverridingCredentials()
Whether to override the credentials with ones supplied in call to org.jclouds.compute.ComputeService#runScriptOnNodesWithTag. By default, true.

Returns:
value

shouldRunAsRoot

public boolean shouldRunAsRoot()
Whether to run the script as root (or run with current privileges). By default, true.

Returns:
value

shouldBlockOnComplete

public boolean shouldBlockOnComplete()
See Also:
blockOnComplete(boolean)

shouldWrapInInitScript

public boolean shouldWrapInInitScript()
Whether to wait until the script has completed. By default, true.

Returns:
value

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009-2011 jclouds. All Rights Reserved.