org.jclouds.compute.callables
Class RunScriptOnNodeAsInitScriptUsingSsh

java.lang.Object
  extended by org.jclouds.compute.callables.RunScriptOnNodeAsInitScriptUsingSsh
All Implemented Interfaces:
Callable<ExecResponse>, RunScriptOnNode
Direct Known Subclasses:
RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilComplete

public class RunScriptOnNodeAsInitScriptUsingSsh
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  Statement init
           
protected  Logger logger
           
protected  String name
           
protected  NodeMetadata node
           
protected  boolean runAsRoot
           
protected  SshClient ssh
           
protected  com.google.common.base.Function<NodeMetadata,SshClient> sshFactory
           
 
Constructor Summary
RunScriptOnNodeAsInitScriptUsingSsh(com.google.common.base.Function<NodeMetadata,SshClient> sshFactory, NodeMetadata node, Statement script, RunScriptOptions options)
           
 
Method Summary
 ExecResponse call()
          Note that RunScriptOnNode.init() must be called first.
static InitBuilder createInitScript(String name, Statement script)
           
protected  ExecResponse doCall()
          ssh client is initialized through this call.
protected  String execScriptAsDefaultUser(String action)
           
 String execScriptAsRoot(String action)
           
 NodeMetadata getNode()
          the node this command is being executed on.
 RunScriptOnNode init()
          verifies that the command can execute on the node.
protected  ExecResponse runAction(String action)
           
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

logger

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

sshFactory

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

node

protected final NodeMetadata node

init

protected final Statement init

name

protected final String name

runAsRoot

protected final boolean runAsRoot

ssh

protected SshClient ssh
Constructor Detail

RunScriptOnNodeAsInitScriptUsingSsh

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

createInitScript

public static InitBuilder createInitScript(String name,
                                           Statement script)

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

doCall

protected ExecResponse doCall()
ssh client is initialized through this call.


runAction

protected ExecResponse runAction(String action)

runCommand

protected ExecResponse runCommand(String command)

execScriptAsRoot

public String execScriptAsRoot(String action)

execScriptAsDefaultUser

protected String execScriptAsDefaultUser(String action)

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


Copyright © 2009-2011 jclouds. All Rights Reserved.