|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ipworks.Rexec
The Rexec class is used to execute commands on a remote UNIX machine using the rexec mechanism.
The Rexec class allows remote execution of commands on UNIX hosts, or any other system with the rexec interface. Using the class is very simple. The destination is specified by the RemoteHost property, the login information is given by the RemoteUser and RemotePassword properties, and the command to execute by the Command property. Further input can be supplied to the command by assigning data to the Stdin property.
The output of the command is returned through the Stdout event. If an error happens on the protocol level, the error message can be found in the ErrorMessage property. Errors during command execution (the stderr stream) are given by the Stderr event.
To be able to successfully use the class, the remote host must be set up to allow execution of commands via rexec from the machine the class runs on.
Constructor Summary | |
Rexec()
|
Method Summary | |
void |
addRexecEventListener(RexecEventListener l)
|
void |
fireConnected(int statusCode,
java.lang.String description)
Fired immediately after a connection completes (or fails). |
void |
fireDisconnected(int statusCode,
java.lang.String description)
Fired when a connection is closed. |
void |
fireError(int errorCode,
java.lang.String description)
Information about errors during data delivery. |
void |
fireStderr(byte[] text,
boolean EOL)
Fired when data (complete lines) come in through stderr. |
void |
fireStdout(byte[] text,
boolean EOL)
Fired when data (complete lines) come in through stdout. |
int |
getBytesSent()
The number of bytes actually sent after an assignment to Stdin. |
java.lang.String |
getCommand()
The command to be sent to the remote host. |
byte[] |
getEOL()
Used to break the stdout data stream into chunks separated by its value. |
byte[] |
getErrEOL()
Used to break the stderr data stream into chunks separated by its value. |
java.lang.String |
getErrorMessage()
The error message returned when any of the steps prior to command execution fail. |
java.lang.String |
getLocalHost()
The name of the local host. |
java.lang.String |
getRemoteHost()
The address of the RemoteHost. |
java.lang.String |
getRemotePassword()
The password of the user on the remote host. |
int |
getRemotePort()
The remote exec service port (default is 512). |
java.lang.String |
getRemoteUser()
The id of the user on the remote host. |
void |
removeRexecEventListener(RexecEventListener l)
|
void |
setCommand(java.lang.String command)
The command to be sent to the remote host. |
void |
setEOL(byte[] EOL)
Used to break the stdout data stream into chunks separated by its value. |
void |
setErrEOL(byte[] errEOL)
Used to break the stderr data stream into chunks separated by its value. |
void |
setRemoteHost(java.lang.String remoteHost)
The address of the RemoteHost. |
void |
setRemotePassword(java.lang.String remotePassword)
The password of the user on the remote host. |
void |
setRemotePort(int remotePort)
The remote exec service port (default is 512). |
void |
setRemoteUser(java.lang.String remoteUser)
The id of the user on the remote host. |
void |
setStdin(byte[] stdin)
A string of data to be sent to the remote host while connected. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public Rexec()
Method Detail |
public int getBytesSent()
public java.lang.String getCommand()
If "" (empty string) is assigned to the Command property, the current connection is broken.
public void setCommand(java.lang.String command) throws IPWorksException
If "" (empty string) is assigned to the Command property, the current connection is broken.
public byte[] getEOL()
public void setEOL(byte[] EOL) throws IPWorksException
public byte[] getErrEOL()
public void setErrEOL(byte[] errEOL) throws IPWorksException
public java.lang.String getErrorMessage()
public java.lang.String getLocalHost()
If the class is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).
public java.lang.String getRemoteHost()
If the RemoteHost property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the RemoteHost property is set to the corresponding address. If the search is not successful, an error is returned.
public void setRemoteHost(java.lang.String remoteHost) throws IPWorksException
If the RemoteHost property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the RemoteHost property is set to the corresponding address. If the search is not successful, an error is returned.
public java.lang.String getRemotePassword()
public void setRemotePassword(java.lang.String remotePassword) throws IPWorksException
public int getRemotePort()
A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before command execution is attempted.
public void setRemotePort(int remotePort) throws IPWorksException
A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before command execution is attempted.
public java.lang.String getRemoteUser()
public void setRemoteUser(java.lang.String remoteUser) throws IPWorksException
public void setStdin(byte[] stdin) throws IPWorksException
If you are sending data to the remote host faster than it can process it, or faster than the network bandwidth allows, the outgoing queue might fill up. When this happens, Stdin
public void fireConnected(int statusCode, java.lang.String description)
RexecConnectedEvent
public void fireDisconnected(int statusCode, java.lang.String description)
RexecDisconnectedEvent
public void fireError(int errorCode, java.lang.String description)
RexecErrorEvent
public void fireStderr(byte[] text, boolean EOL)
RexecStderrEvent
public void fireStdout(byte[] text, boolean EOL)
RexecStdoutEvent
public void addRexecEventListener(RexecEventListener l) throws java.util.TooManyListenersException
public void removeRexecEventListener(RexecEventListener l)
|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |