com.maverick.sshd.platform
Class NativeExecutableCommand

java.lang.Object
  extended by com.maverick.sshd.platform.ExecutableCommand
      extended by com.maverick.sshd.platform.NativeExecutableCommand

public class NativeExecutableCommand
extends ExecutableCommand

A further extension of the ExecutableCommand that provides the ability to execute a native process. Caution should be taken with this current implementation as no processing of EOL is provided and results may vary on different platforms. It is recommended that only automated clients use this feature due to the many differences in user terminals which may cause problems with command output not performing as expected.

Author:
Lee David Painter

Field Summary
 
Fields inherited from class com.maverick.sshd.platform.ExecutableCommand
session, stderr, stdin, stdout, STILL_ACTIVE
 
Constructor Summary
NativeExecutableCommand()
           
 
Method Summary
 boolean createProcess(java.lang.String cmd, java.util.Map environment)
          Create the process but wait for the ExecutableCommand.onStart() method before performing any IO.
 int getExitCode()
          Get the exit code for this process.
 void kill()
          Kill the command.
 void onStart()
          Called once the command has been started.
 void processStdinData(byte[] data)
          Called by the session to pass incoming data into the process.
 
Methods inherited from class com.maverick.sshd.platform.ExecutableCommand
getInputStream, getOutputStream, getStderrOutputStream, init, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NativeExecutableCommand

public NativeExecutableCommand()
Method Detail

onStart

public void onStart()
Description copied from class: ExecutableCommand
Called once the command has been started. Operations within this method SHOULD NOT block as this will cause the connection to lockup.

Specified by:
onStart in class ExecutableCommand

getExitCode

public int getExitCode()
Description copied from class: ExecutableCommand
Get the exit code for this process. If the process has not completed return ExecutableCommand.STILL_ACTIVE.

Specified by:
getExitCode in class ExecutableCommand
Returns:
int

createProcess

public boolean createProcess(java.lang.String cmd,
                             java.util.Map environment)
Description copied from class: ExecutableCommand
Create the process but wait for the ExecutableCommand.onStart() method before performing any IO.

Specified by:
createProcess in class ExecutableCommand
Returns:
boolean

processStdinData

public void processStdinData(byte[] data)
                      throws java.io.IOException
Description copied from class: ExecutableCommand
Called by the session to pass incoming data into the process. This implementation will place the data into the processes InputStream however you may want to change this behaviour by overriding this method. If you override this method DO NOT block.

Overrides:
processStdinData in class ExecutableCommand
Throws:
java.io.IOException

kill

public void kill()
Description copied from class: ExecutableCommand
Kill the command.

Specified by:
kill in class ExecutableCommand


Copyright © 2003-2008 SSHTools LTD. All Rights Reserved.