org.jclouds.compute.callables
Class RunScriptOnNodeUsingSsh

java.lang.Object
  extended by org.jclouds.compute.callables.RunScriptOnNodeUsingSsh
All Implemented Interfaces:
Callable<ExecResponse>, RunScriptOnNode

public class RunScriptOnNodeUsingSsh
extends Object
implements RunScriptOnNode

Author:
Adrian Cole

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jclouds.compute.callables.RunScriptOnNode
RunScriptOnNode.Factory
 
Field Summary
protected  Logger logger
           
static String MARKER
           
protected  NodeMetadata node
           
protected  boolean runAsRoot
           
protected  SshClient ssh
           
protected  com.google.common.base.Function<NodeMetadata,SshClient> sshFactory
           
protected  Statement statement
           
 
Constructor Summary
RunScriptOnNodeUsingSsh(com.google.common.base.Function<NodeMetadata,SshClient> sshFactory, NodeMetadata node, Statement statement, RunScriptOptions options)
           
 
Method Summary
 ExecResponse call()
          Note that RunScriptOnNode.init() must be called first.
 String execAsRoot(String command)
           
protected  String execScriptAsDefaultUser(String command)
           
 NodeMetadata getNode()
          the node this command is being executed on.
 Statement getStatement()
           
 RunScriptOnNode init()
          verifies that the command can execute on the node.
protected  ExecResponse runCommand(String command)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MARKER

public static final String MARKER
See Also:
Constant Field Values

logger

@Named(value="jclouds.compute")
protected Logger logger

sshFactory

protected final com.google.common.base.Function<NodeMetadata,SshClient> sshFactory

node

protected final NodeMetadata node

statement

protected final Statement statement

runAsRoot

protected final boolean runAsRoot

ssh

protected SshClient ssh
Constructor Detail

RunScriptOnNodeUsingSsh

public RunScriptOnNodeUsingSsh(com.google.common.base.Function<NodeMetadata,SshClient> sshFactory,
                               NodeMetadata node,
                               Statement statement,
                               RunScriptOptions options)
Method Detail

call

public ExecResponse call()
Description copied from interface: RunScriptOnNode
Note that RunScriptOnNode.init() must be called first.

Specified by:
call in interface Callable<ExecResponse>
Specified by:
call in interface RunScriptOnNode

init

public RunScriptOnNode init()
Description copied from interface: RunScriptOnNode
verifies that the command can execute on the node. For example, if this is ssh, it may attempt to find a reachable socket. If this is using an API, it may attempt to validate that connection.

Specified by:
init in interface RunScriptOnNode

runCommand

protected ExecResponse runCommand(String command)

execAsRoot

public String execAsRoot(String command)

execScriptAsDefaultUser

protected String execScriptAsDefaultUser(String command)

getNode

public NodeMetadata getNode()
Description copied from interface: RunScriptOnNode
the node this command is being executed on.

Specified by:
getNode in interface RunScriptOnNode

toString

public String toString()
Overrides:
toString in class Object

getStatement

public Statement getStatement()
Specified by:
getStatement in interface RunScriptOnNode
Returns:
statement that will be executed


Copyright © 2009-2011 jclouds. All Rights Reserved.