public class LocalConnection extends BaseOverthereConnection implements OverthereConnectionBuilder
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LOCAL_PROTOCOL
Name of the protocol handled by this connection builder, i.e.
|
canStartProcess, connectionTemporaryDirectory, connectionTimeoutMillis, deleteTemporaryDirectoryOnDisconnect, mapper, options, os, protocol, random, temporaryDirectoryPath, temporaryFileCreationRetries, workingDirectory
Constructor and Description |
---|
LocalConnection(java.lang.String protocol,
ConnectionOptions options)
Constructs a connection to the local host.
|
LocalConnection(java.lang.String protocol,
ConnectionOptions options,
AddressPortMapper mapper)
Constructs a connection to the local host.
|
Modifier and Type | Method and Description |
---|---|
OverthereConnection |
connect()
Creates the connection that corresponds to the arguments that were passed in the two-arg constructor of this
class.
|
void |
doClose()
To be overridden by a base class to implement connection specific disconnection logic.
|
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 path)
Creates a reference to a file on the host.
|
protected OverthereFile |
getFileForTempFile(OverthereFile parent,
java.lang.String name)
Invoked by
BaseOverthereConnection.getTempFile(String) and BaseOverthereConnection.createConnectionTemporaryDirectory() to create an
OverthereFile object for a file or directory in the system or connection temporary directory. |
static OverthereConnection |
getLocalConnection()
Creates a connection to the local host.
|
OverthereProcess |
startProcess(CmdLine cmd)
Starts a command with its argument and returns control to the caller.
|
java.lang.String |
toString()
Subclasses MUST implement toString properly.
|
canStartProcess, close, equals, execute, execute, execute, getHostOperatingSystem, getOptions, getTempFile, getTempFile, getWorkingDirectory, hashCode, setWorkingDirectory
public static final java.lang.String LOCAL_PROTOCOL
public LocalConnection(java.lang.String protocol, ConnectionOptions options, AddressPortMapper mapper)
public LocalConnection(java.lang.String protocol, ConnectionOptions options)
public OverthereConnection connect()
OverthereConnectionBuilder
String
that specifies the type (and is identical to the name field of the
Protocol
annotation). The second argument is the ConnectionOptions
.connect
in interface OverthereConnectionBuilder
public void doClose()
BaseOverthereConnection
doClose
in class BaseOverthereConnection
public OverthereFile getFile(java.lang.String path) throws RuntimeIOException
OverthereConnection
getFile
in interface OverthereConnection
path
- the path of the hostRuntimeIOException
public OverthereFile getFile(OverthereFile parent, java.lang.String child) throws RuntimeIOException
OverthereConnection
getFile
in interface OverthereConnection
parent
- the reference to the directory on the hostchild
- the name of the file in the directoryRuntimeIOException
protected OverthereFile getFileForTempFile(OverthereFile parent, java.lang.String name)
BaseOverthereConnection
BaseOverthereConnection.getTempFile(String)
and BaseOverthereConnection.createConnectionTemporaryDirectory()
to create an
OverthereFile
object for a file or directory in the system or connection temporary directory.getFileForTempFile
in class BaseOverthereConnection
parent
- parent of the file to createname
- name of the file to create.public OverthereProcess startProcess(CmdLine cmd)
BaseOverthereConnection
startProcess
in interface OverthereConnection
startProcess
in class BaseOverthereConnection
cmd
- the command line to execute.public java.lang.String toString()
BaseOverthereConnection
toString
in interface OverthereConnection
toString
in class BaseOverthereConnection
public static OverthereConnection getLocalConnection()