org.apache.sshd.server
Interface Command

All Known Implementing Classes:
InvertedShellWrapper, ScpCommand, SftpSubsystem, UnknownCommand

public interface Command

Represents a command, shell or subsystem that can be used to send command. This command have direct streams, meaning those streams will be provided by the ssh server for the shell to use directy. This interface is suitable for implementing commands in java, rather than using external processes. For wrapping such processes or using inverted streams, see InvertedShellWrapper.


Method Summary
 void destroy()
          Destroy the shell.
 void setErrorStream(OutputStream err)
          Set the error stream that can be used by the shell to write its errors.
 void setExitCallback(ExitCallback callback)
          Set the callback that the shell has to call when it is closed.
 void setInputStream(InputStream in)
          Set the input stream that can be used by the shell to read input.
 void setOutputStream(OutputStream out)
          Set the output stream that can be used by the shell to write its output.
 void start(Environment env)
          Starts the shell.
 

Method Detail

setInputStream

void setInputStream(InputStream in)
Set the input stream that can be used by the shell to read input.

Parameters:
in -

setOutputStream

void setOutputStream(OutputStream out)
Set the output stream that can be used by the shell to write its output.

Parameters:
out -

setErrorStream

void setErrorStream(OutputStream err)
Set the error stream that can be used by the shell to write its errors.

Parameters:
err -

setExitCallback

void setExitCallback(ExitCallback callback)
Set the callback that the shell has to call when it is closed.

Parameters:
callback -

start

void start(Environment env)
           throws IOException
Starts the shell. All streams must have been set before calling this method. The command should implement Runnable, and this method should spawn a new thread like:
 Thread(this).start();
 
 

Parameters:
env -
Throws:
IOException

destroy

void destroy()
Destroy the shell. This method can be called by the SSH server to destroy the shell because the client has disconnected somehow.



Copyright © 2008-2012 Apache Software Foundation. All Rights Reserved.