org.browsecode.helpers.controlcomputer
Interface ControlComputerInterface

All Known Implementing Classes:
ControlThisComputer, J2SSHInterface, SSHInterface

public interface ControlComputerInterface


Nested Class Summary
static interface ControlComputerInterface.ConfirmationHandler
           
static interface ControlComputerInterface.FileMatches
           
static class ControlComputerInterface.RegexpFileMatches
           
static interface ControlComputerInterface.SearchForFile
           
 
Field Summary
static int NOT_UNIX
           
static int OS_UNKNOWN
           
static int UNIX
           
static int UNIX_LINUX
           
static int UNIX_MACOSX
           
static int UNIX_OTHER
           
static int WINDOWS
           
 
Method Summary
 boolean copyTo(java.io.File[] files, java.lang.String toDir)
           
 void dispose()
           
 java.lang.String getAllOutput()
           
 java.lang.String getDirectorySeparator()
          Usually this is '\' for Windows and '/' for everything else.
 java.lang.String getHostname()
           
 java.lang.String getLastErrorMessage()
           
 int getOperatingSystem()
          Operating System Checks may or may not be implemented.
 java.lang.String getOSVersion()
           
 java.lang.String getTempDirectory()
          Get a path for temporary files.
 int getUnixVariant()
           
 boolean isStillRunningLastCommand()
           
 void restart()
           
 boolean runCommand(java.lang.String line)
           
 boolean runCommand(java.lang.String[] line)
           
 boolean runCommand(java.lang.String[] line, boolean waitForFinish)
           
 int runCommand(java.lang.String[] line, java.lang.String[] phrasesToWaitFor)
           
 boolean runCommand(java.lang.String line, boolean waitForFinish)
           
 int runCommand(java.lang.String line, java.lang.String[] phrasesToWaitFor)
           
 ControlComputerInterface.SearchForFile searchForFile(ControlComputerInterface.FileMatches fileMatches, ControlComputerInterface.ConfirmationHandler confirmationHandler, java.lang.Runnable runWhenDone)
          This may return null if it's not possible to search for files on this operating system.
 int waitForResponse(java.lang.String[] waitFor)
           
 boolean willSpecialUnixCharactersBeConverted()
          On bash and other unix/linux shells, certain characters get changed to do something else besides themselves: - exclamation points get turned into old commands on the command prompt
 

Field Detail

OS_UNKNOWN

static final int OS_UNKNOWN
See Also:
Constant Field Values

WINDOWS

static final int WINDOWS
See Also:
Constant Field Values

UNIX

static final int UNIX
See Also:
Constant Field Values

NOT_UNIX

static final int NOT_UNIX
See Also:
Constant Field Values

UNIX_LINUX

static final int UNIX_LINUX
See Also:
Constant Field Values

UNIX_MACOSX

static final int UNIX_MACOSX
See Also:
Constant Field Values

UNIX_OTHER

static final int UNIX_OTHER
See Also:
Constant Field Values
Method Detail

getHostname

java.lang.String getHostname()

getOperatingSystem

int getOperatingSystem()
Operating System Checks may or may not be implemented. (i.e. it works with local controls but not over SSH, at least not yet)

Returns:

getUnixVariant

int getUnixVariant()

getOSVersion

java.lang.String getOSVersion()

getDirectorySeparator

java.lang.String getDirectorySeparator()
Usually this is '\' for Windows and '/' for everything else.

Returns:

getTempDirectory

java.lang.String getTempDirectory()
Get a path for temporary files.

Returns:

willSpecialUnixCharactersBeConverted

boolean willSpecialUnixCharactersBeConverted()
On bash and other unix/linux shells, certain characters get changed to do something else besides themselves: - exclamation points get turned into old commands on the command prompt. - > and >> will write to the file mentioned after this point - | will pipe to a new command Some ControlComputerInterfaces have this property (like SSH) and others don't (like ControlThisComputer, even on linux). Calling method needs to know in case it tries to do 'echo "Hi!" ' or or 'echo "test" >> file' -- both will fail on ones where this method returns false, and work on ones where this methods return true. It's hard to pull this out in a standard way and do something better.


runCommand

boolean runCommand(java.lang.String line)

runCommand

boolean runCommand(java.lang.String[] line)

runCommand

int runCommand(java.lang.String line,
               java.lang.String[] phrasesToWaitFor)

runCommand

int runCommand(java.lang.String[] line,
               java.lang.String[] phrasesToWaitFor)

runCommand

boolean runCommand(java.lang.String line,
                   boolean waitForFinish)

runCommand

boolean runCommand(java.lang.String[] line,
                   boolean waitForFinish)

waitForResponse

int waitForResponse(java.lang.String[] waitFor)

isStillRunningLastCommand

boolean isStillRunningLastCommand()

dispose

void dispose()

restart

void restart()

copyTo

boolean copyTo(java.io.File[] files,
               java.lang.String toDir)

getLastErrorMessage

java.lang.String getLastErrorMessage()

getAllOutput

java.lang.String getAllOutput()

searchForFile

ControlComputerInterface.SearchForFile searchForFile(ControlComputerInterface.FileMatches fileMatches,
                                                     ControlComputerInterface.ConfirmationHandler confirmationHandler,
                                                     java.lang.Runnable runWhenDone)
This may return null if it's not possible to search for files on this operating system.

Parameters:
filename -
Returns: