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  org.jclouds.scriptbuilder.InitBuilder init
           
protected  String initFile
           
protected  org.jclouds.logging.Logger logger
           
protected  NodeMetadata node
           
static String PROPERTY_INIT_SCRIPT_PATTERN
           
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, org.jclouds.scriptbuilder.domain.Statement script, RunScriptOptions options)
           
 
Method Summary
 ExecResponse call()
          Note that RunScriptOnNode.init() must be called first.
static org.jclouds.scriptbuilder.InitBuilder createInitScript(String name, org.jclouds.scriptbuilder.domain.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.
 org.jclouds.scriptbuilder.domain.Statement getStatement()
           
 RunScriptOnNode init()
          verifies that the command can execute on the node.
 void refreshSshIfNewAdminCredentialsConfigured(org.jclouds.scriptbuilder.statements.login.AdminAccess input)
           
protected  ExecResponse runAction(String action)
           
protected  ExecResponse runCommand(String command)
           
protected  void setupLinkToInitFile()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_INIT_SCRIPT_PATTERN

public static final String PROPERTY_INIT_SCRIPT_PATTERN
See Also:
Constant Field Values

logger

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

sshFactory

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

node

protected NodeMetadata node

init

protected final org.jclouds.scriptbuilder.InitBuilder init

runAsRoot

protected final boolean runAsRoot

initFile

protected final String initFile

ssh

protected SshClient ssh
Constructor Detail

RunScriptOnNodeAsInitScriptUsingSsh

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

createInitScript

public static org.jclouds.scriptbuilder.InitBuilder createInitScript(String name,
                                                                     org.jclouds.scriptbuilder.domain.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

refreshSshIfNewAdminCredentialsConfigured

public void refreshSshIfNewAdminCredentialsConfigured(org.jclouds.scriptbuilder.statements.login.AdminAccess input)

doCall

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


setupLinkToInitFile

protected void setupLinkToInitFile()

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

getStatement

public org.jclouds.scriptbuilder.domain.Statement getStatement()
Specified by:
getStatement in interface RunScriptOnNode
Returns:
statement that will be executed


Copyright © 2009-2011 jclouds. All Rights Reserved.