org.glassfish.cluster.ssh.connect
Class NodeRunner

java.lang.Object
  extended by org.glassfish.cluster.ssh.connect.NodeRunner

public class NodeRunner
extends java.lang.Object


Constructor Summary
NodeRunner(org.jvnet.hk2.component.Habitat habitat, java.util.logging.Logger logger)
           
 
Method Summary
 java.lang.String getLastCommandRun()
           
 boolean isDcomNode(Node node)
           
 boolean isSshNode(Node node)
           
 int runAdminCommandOnNode(Node node, java.lang.StringBuilder output, boolean waitForReaderThreads, java.util.List<java.lang.String> args)
           
 int runAdminCommandOnNode(Node node, java.lang.StringBuilder output, java.util.List<java.lang.String> args)
          Run an asadmin command on a Node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeRunner

public NodeRunner(org.jvnet.hk2.component.Habitat habitat,
                  java.util.logging.Logger logger)
Method Detail

getLastCommandRun

public java.lang.String getLastCommandRun()

isSshNode

public boolean isSshNode(Node node)

isDcomNode

public boolean isDcomNode(Node node)

runAdminCommandOnNode

public int runAdminCommandOnNode(Node node,
                                 java.lang.StringBuilder output,
                                 java.util.List<java.lang.String> args)
                          throws SSHCommandExecutionException,
                                 ProcessManagerException,
                                 java.lang.UnsupportedOperationException,
                                 java.lang.IllegalArgumentException
Run an asadmin command on a Node. The node may be local or remote. If it is remote then SSH is used to execute the command on the node. The args list is all parameters passed to "asadmin", but not "asadmin" itself. So an example args is: "--host", "mydashost.com", "start-local-instance", "--node", "n1", "i1"

Parameters:
node - The node to run the asadmin command on
output - A StringBuilder to hold the command's output in. Both stdout and stderr are placed in output. null if you don't want the output.
args - The arguments to the asadmin command. This includes parameters for asadmin (like --host) as well as the command (like start-local-instance) as well as an parameters for the command. It does not include the string "asadmin" itself.
Returns:
The status of the asadmin command. Typically 0 if the command was successful else 1.
Throws:
SSHCommandExecutionException - There was an error executing the command via SSH.
ProcessManagerException - There was an error executing the command locally.
java.lang.UnsupportedOperationException - The command needs to be run on a remote node, but the node is not of type SSH.
java.lang.IllegalArgumentException - The passed node is malformed.

runAdminCommandOnNode

public int runAdminCommandOnNode(Node node,
                                 java.lang.StringBuilder output,
                                 boolean waitForReaderThreads,
                                 java.util.List<java.lang.String> args)
                          throws SSHCommandExecutionException,
                                 ProcessManagerException,
                                 java.lang.UnsupportedOperationException,
                                 java.lang.IllegalArgumentException
Throws:
SSHCommandExecutionException
ProcessManagerException
java.lang.UnsupportedOperationException
java.lang.IllegalArgumentException


Copyright © 2012 GlassFish Community. All Rights Reserved.