org.browsecode.helpers.controlcomputer
Class ControlThisComputer
java.lang.Object
org.browsecode.helpers.controlcomputer.ControlThisComputer
- All Implemented Interfaces:
- ControlComputerInterface
public class ControlThisComputer
- extends java.lang.Object
- implements ControlComputerInterface
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ControlThisComputer
public ControlThisComputer()
isRunningOnMacOS
public static boolean isRunningOnMacOS()
isRunningOnWindows
public static boolean isRunningOnWindows()
getOperatingSystem
public int getOperatingSystem()
- Description copied from interface:
ControlComputerInterface
- Operating System Checks may or may not be implemented. (i.e. it works with local controls but not over SSH, at least not yet)
- Specified by:
getOperatingSystem
in interface ControlComputerInterface
- Returns:
getOS
public static int getOS()
getUnixVariant
public int getUnixVariant()
- Specified by:
getUnixVariant
in interface ControlComputerInterface
getUnixVariantStatic
public static int getUnixVariantStatic()
getOSVersion
public java.lang.String getOSVersion()
- Specified by:
getOSVersion
in interface ControlComputerInterface
getOSVersionStatic
public static java.lang.String getOSVersionStatic()
getDirectorySeparatorStatic
public static java.lang.String getDirectorySeparatorStatic()
getDirectorySeparator
public java.lang.String getDirectorySeparator()
- Description copied from interface:
ControlComputerInterface
- Usually this is '\' for Windows and '/' for everything else.
- Specified by:
getDirectorySeparator
in interface ControlComputerInterface
- Returns:
getTempDirectory
public java.lang.String getTempDirectory()
- Description copied from interface:
ControlComputerInterface
- Get a path for temporary files.
- Specified by:
getTempDirectory
in interface ControlComputerInterface
- Returns:
getLastErrorMessage
public java.lang.String getLastErrorMessage()
- Specified by:
getLastErrorMessage
in interface ControlComputerInterface
runCommand
public boolean runCommand(java.lang.String line)
- Specified by:
runCommand
in interface ControlComputerInterface
runCommand
public boolean runCommand(java.lang.String[] line)
- Specified by:
runCommand
in interface ControlComputerInterface
runCommand
public int runCommand(java.lang.String[] line,
java.lang.String[] phrasesToWaitFor)
- Specified by:
runCommand
in interface ControlComputerInterface
runCommand
public int runCommand(java.lang.String line,
java.lang.String[] phrasesToWaitFor)
- Specified by:
runCommand
in interface ControlComputerInterface
runCommand
public boolean runCommand(java.lang.String[] line,
boolean waitForFinish)
- Specified by:
runCommand
in interface ControlComputerInterface
runCommand
public boolean runCommand(java.lang.String line,
boolean waitForFinish)
- Specified by:
runCommand
in interface ControlComputerInterface
isStillRunningLastCommand
public boolean isStillRunningLastCommand()
- Specified by:
isStillRunningLastCommand
in interface ControlComputerInterface
dispose
public void dispose()
- Specified by:
dispose
in interface ControlComputerInterface
restart
public void restart()
- Specified by:
restart
in interface ControlComputerInterface
closeCurrentCommand
public void closeCurrentCommand()
waitForResponse
public int waitForResponse(java.lang.String[] waitFor)
- Specified by:
waitForResponse
in interface ControlComputerInterface
willSpecialUnixCharactersBeConverted
public boolean willSpecialUnixCharactersBeConverted()
- Description copied from interface:
ControlComputerInterface
- 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.
- Specified by:
willSpecialUnixCharactersBeConverted
in interface ControlComputerInterface
getAllOutput
public java.lang.String getAllOutput()
- Specified by:
getAllOutput
in interface ControlComputerInterface
copyTo
public boolean copyTo(java.io.File[] files,
java.lang.String toDir)
- Specified by:
copyTo
in interface ControlComputerInterface
searchForFile
public ControlComputerInterface.SearchForFile searchForFile(ControlComputerInterface.FileMatches fileMatches,
ControlComputerInterface.ConfirmationHandler confirmationHandler,
java.lang.Runnable runWhenDone)
- Description copied from interface:
ControlComputerInterface
- This may return null if it's not possible to search for files on this operating system.
- Specified by:
searchForFile
in interface ControlComputerInterface
- Returns:
main
public static final void main(java.lang.String[] args)
getHostname
public java.lang.String getHostname()
- Specified by:
getHostname
in interface ControlComputerInterface