com.buglabs.bug.base
Class ShellSession

java.lang.Object
  extended by com.buglabs.bug.base.ShellSession
All Implemented Interfaces:
IShellSession

public class ShellSession
extends java.lang.Object
implements IShellSession

Default implementation of ShellSession.


Field Summary
static java.lang.String LT
           
static java.lang.String TERMINATOR
          This terminator string is used to determine when content from the output stream is completed for a given command.
 
Constructor Summary
ShellSession(java.io.File root, java.io.Writer out)
           
 
Method Summary
 void dispose()
          Terminate the session and free any resources.
 java.lang.String execute(java.lang.String command)
           
 void execute(java.lang.String command, ICommandResponseHandler handler)
          Execute a command and pass in a ICommandResponseHandler to deal with the output.
 void execute(java.lang.String command, java.lang.String terminator, ICommandResponseHandler handler)
           
static java.lang.String getFilePath(java.lang.String file)
           
 void interrupt()
          Interrupt any running programs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TERMINATOR

public static final java.lang.String TERMINATOR
This terminator string is used to determine when content from the output stream is completed for a given command.

See Also:
Constant Field Values

LT

public static final java.lang.String LT
Constructor Detail

ShellSession

public ShellSession(java.io.File root,
                    java.io.Writer out)
             throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getFilePath

public static java.lang.String getFilePath(java.lang.String file)
                                    throws java.io.IOException
Throws:
java.io.IOException

execute

public java.lang.String execute(java.lang.String command)
                         throws java.io.IOException
Specified by:
execute in interface IShellSession
Returns:
stdout of command
Throws:
java.io.IOException - if any data on stderr is produced.

execute

public void execute(java.lang.String command,
                    ICommandResponseHandler handler)
             throws java.io.IOException
Description copied from interface: IShellSession
Execute a command and pass in a ICommandResponseHandler to deal with the output.

Specified by:
execute in interface IShellSession
Throws:
java.io.IOException

execute

public void execute(java.lang.String command,
                    java.lang.String terminator,
                    ICommandResponseHandler handler)
             throws java.io.IOException
Throws:
java.io.IOException

interrupt

public void interrupt()
Description copied from interface: IShellSession
Interrupt any running programs.

Specified by:
interrupt in interface IShellSession

dispose

public void dispose()
Description copied from interface: IShellSession
Terminate the session and free any resources.

Specified by:
dispose in interface IShellSession