public interface OverthereConnection
extends java.io.Closeable
Modifier and Type | Method and Description |
---|---|
boolean |
canStartProcess()
Checks whether a process can be started on this connection.
|
void |
close()
Closes the connection.
|
int |
execute(CmdLine commandLine)
Executes a command with its arguments and prints all the output on stdout and stderr to the console.
|
int |
execute(OverthereExecutionOutputHandler stdoutHandler,
OverthereExecutionOutputHandler stderrHandler,
CmdLine commandLine)
Executes a command with its arguments.
|
int |
execute(OverthereProcessOutputHandler handler,
CmdLine commandLine)
|
OverthereFile |
getFile(OverthereFile parent,
java.lang.String child)
Creates a reference to a file in a directory on the host.
|
OverthereFile |
getFile(java.lang.String hostPath)
Creates a reference to a file on the host.
|
OperatingSystemFamily |
getHostOperatingSystem()
Return the OS family of the host.
|
OverthereFile |
getTempFile(java.lang.String nameTemplate)
Creates a reference to a temporary file on the host.
|
OverthereFile |
getTempFile(java.lang.String prefix,
java.lang.String suffix)
Creates a reference to a temporary file on the host.
|
OverthereFile |
getWorkingDirectory()
Returns the working directory.
|
void |
setWorkingDirectory(OverthereFile workingDirectory)
Sets the working directory in which commands are executed.
|
OverthereProcess |
startProcess(CmdLine commandLine)
Starts a command with its argument and returns control to the caller.
|
java.lang.String |
toString()
Implementations MUST implement toString properly.
|
OperatingSystemFamily getHostOperatingSystem()
OverthereFile getFile(java.lang.String hostPath)
hostPath
- the path of the hostOverthereFile getFile(OverthereFile parent, java.lang.String child)
parent
- the reference to the directory on the hostchild
- the name of the file in the directoryOverthereFile getTempFile(java.lang.String nameTemplate)
nameTemplate
- the template on which to base the name of the temporary file. May be null
.OverthereFile getTempFile(java.lang.String prefix, java.lang.String suffix) throws RuntimeIOException
prefix
- the prefix string to be used in generating the file's name; must be at least three characters longsuffix
- the suffix string to be used in generating the file's name; may be null
, in which case
the suffix ".tmp" will be usedRuntimeIOException
OverthereFile getWorkingDirectory()
null
.void setWorkingDirectory(OverthereFile workingDirectory)
null
, the working directory
that is used depends on the connection implementation.workingDirectory
- the working directory, may be null
.int execute(OverthereProcessOutputHandler handler, CmdLine commandLine)
handler
- the handler that will be invoked when the executed command generated output.commandLine
- the command line to execute.int execute(CmdLine commandLine)
commandLine
- the command line to execute.int execute(OverthereExecutionOutputHandler stdoutHandler, OverthereExecutionOutputHandler stderrHandler, CmdLine commandLine)
stdoutHandler
- the handler that will be invoked when the executed command generated output on stdout.stderrHandler
- the handler that will be invoked when the executed command generated output on stderr.commandLine
- the command line to execute.OverthereProcess startProcess(CmdLine commandLine)
commandLine
- the command line to execute.boolean canStartProcess()
true
if a process can be started on this connection, false
otherwisevoid close()
IOException
but can throw RuntimeIOException
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
java.lang.String toString()
toString
in class java.lang.Object