com.ace.moab.api.connect
Class LocalConnection

java.lang.Object
  extended by com.ace.moab.api.connect.LocalConnection
All Implemented Interfaces:
IMoabConnection

public class LocalConnection
extends java.lang.Object
implements IMoabConnection

Provides a local connection to an instance of Moab running locally (the same machine). As with all MoabConnection objects, this class provides a way to execute commands and return the results.

Author:
Scott Brown
See Also:
IMoabConnection

Constructor Summary
LocalConnection()
          Creates a connection with the local machine.
 
Method Summary
 MoabInputStream executeCommand(java.lang.String command, boolean isMoabCommand)
          Same as connect(command, isMoabCommand, null).
 MoabInputStream executeCommand(java.lang.String command, boolean isMoabCommand, org.apache.log4j.Level log4jLevel)
           Runs a command on the local machine and returns back a reference to the intputStream which will output the results of that command.
 ConnectionType getConnectionType()
          Returns the connection type of LOCAL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalConnection

public LocalConnection()
Creates a connection with the local machine. This method does not run any commands.

Method Detail

getConnectionType

public ConnectionType getConnectionType()
Returns the connection type of LOCAL.

Specified by:
getConnectionType in interface IMoabConnection
Returns:
the ConnectionType.LOCAL enum value.
See Also:
ConnectionType

executeCommand

public MoabInputStream executeCommand(java.lang.String command,
                                      boolean isMoabCommand)
                               throws MoabCommunicationException
Same as connect(command, isMoabCommand, null).

Specified by:
executeCommand in interface IMoabConnection
Parameters:
command - the command to be run on the machine where Moab is running
isMoabCommand - whether the command is a Moab command.
Returns:
see comments for the executeCommand(String, boolean, Level) method.
Throws:
MoabCommunicationException - If the command is invalid or the connection has issues, a MoabCommunciationException is thrown.

executeCommand

public MoabInputStream executeCommand(java.lang.String command,
                                      boolean isMoabCommand,
                                      org.apache.log4j.Level log4jLevel)
                               throws MoabCommunicationException

Runs a command on the local machine and returns back a reference to the intputStream which will output the results of that command. This can be a moab command, or any other command that can be run on the local machine

Specified by:
executeCommand in interface IMoabConnection
Parameters:
command - the command to be run on the local machine
isMoabCommand - whether the command is a Moab command. (i.e. 'showq')
log4jLevel - (can be null) the log4j level at which this Moab command and it's output should be written to the log file. This allows users the ability to prevent the logs from becoming unnecessarily cluttered by frequently called Moab commands.
Returns:
the inputStream which will contain the results of the command.
Throws:
MoabCommunicationException - If the command is invalid or the connection has issues, a MoabCommunciationException is thrown.


Copyright © 2001-2009 Cluster Resources, Inc. All Rights Reserved.