Package net.sf.basedb.opengrid
Class AbstractHost<T extends AbstractSession<?>>
java.lang.Object
net.sf.basedb.opengrid.AbstractHost<T>
- Type Parameters:
T
- The type of sessions that are created when connecting to the host
- Direct Known Subclasses:
OpenGridCluster
,RemoteHost
public abstract class AbstractHost<T extends AbstractSession<?>> extends Object
An abstract host that can be reached via SSH.
- Since:
- 1.0
- Author:
- nicklas
-
Field Summary
Fields Modifier and Type Field Description private ConnectionInfo
ci
private static ExtensionsLogger
logger
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractHost(ConnectionInfo ci)
-
Method Summary
Modifier and Type Method Description abstract T
connect(int timeout)
Connect to the cluster.private net.schmizz.sshj.userauth.keyprovider.KeyProvider
createFileKeyProvider(net.schmizz.sshj.Config config, String privateKey, String password, String format)
Create and initialize a private key provider.ConnectionInfo
getConnectionInfo()
Get the connection information for this host.protected net.schmizz.sshj.SSHClient
internalConnect(int timeout)
String
toString()
-
Field Details
-
logger
-
ci
-
-
Constructor Details
-
AbstractHost
-
-
Method Details
-
getConnectionInfo
Get the connection information for this host. -
connect
Connect to the cluster. The returned session can be used to send commands or transfer files to/from the cluster. Do not forget toAbstractSession.close()
the session after use.- Parameters:
timeout
- Timeout in seconds for the connection to be established
-
internalConnect
protected net.schmizz.sshj.SSHClient internalConnect(int timeout) -
toString
-
createFileKeyProvider
private net.schmizz.sshj.userauth.keyprovider.KeyProvider createFileKeyProvider(net.schmizz.sshj.Config config, String privateKey, String password, String format) throws net.schmizz.sshj.common.SSHException, IOExceptionCreate and initialize a private key provider.- Parameters:
config
- Required since we get supported key file formats from thisprivateKey
- The private key file as a string (required)password
- Optionalformat
- Optional (if not specified, auto-detection will be attempted)- Throws:
net.schmizz.sshj.common.SSHException
IOException
-