public class ConnectionInfo extends AbstractLockable<ConnectionInfo>
OpenGridCluster
instance
has been created.Modifier and Type | Field and Description |
---|---|
private java.lang.String |
address |
private java.lang.String |
fingerprint |
private java.lang.String |
fingerPrintType |
private java.lang.String |
name |
private java.lang.String |
password |
private int |
port |
private java.lang.String |
privateKey |
private java.lang.String |
privateKeyFormat |
private java.lang.String |
privateKeyPassword |
private java.lang.String |
user |
Constructor and Description |
---|
ConnectionInfo()
Create a new connection information instance.
|
ConnectionInfo(ConnectionInfo clone)
Create a new connection information instance and clone the
connection information from the given instance.
|
ConnectionInfo(FileServer server)
Create a new connection information and use the information
in the file server for configuration.
|
Modifier and Type | Method and Description |
---|---|
org.json.simple.JSONObject |
asJSONObject(JSONOptions options)
Get the configuration information as a JSON object.
|
protected void |
checkValid(boolean forLock)
Address, fingerprint and user are required.
|
java.lang.String |
getAddress()
Get the internet address of the Open Grid Cluster
primary node.
|
java.lang.String |
getFingerPrint()
Get the public key SSH fingerprint of the Open Grid Cluster primary
node.
|
java.lang.String |
getFingerPrintType()
Get the fingerprint type.
|
java.lang.String |
getName()
Get the display name of the cluster.
|
java.lang.String |
getPassword()
Get the password to use when connecting to the Open Grid Cluster
primary node.
|
int |
getPort()
Get the port number to use for connecting to the
Open Grid Cluster primary node.
|
java.lang.String |
getPrivateKey()
Get the private key to use when connecting to the Open Grid Cluster
primary node.
|
java.lang.String |
getPrivateKeyFormat()
Get the format of the private key (null = auto-detect)
|
java.lang.String |
getPrivateKeyPassword()
Get the password for unlocking the private key.
|
java.lang.String |
getUser()
Get the username to use when connecting to the Open Grid Cluster
primary node.
|
void |
setAddress(java.lang.String address)
Set the internet address to the Open Grid Cluster
primary node.
|
void |
setFingerPrint(java.lang.String fingerprint)
Set the public key fingerprint for the host so we can verify that the
connection is made to the exepected SSH server.
|
void |
setName(java.lang.String name)
Set the display name of the cluster.
|
void |
setPassword(java.lang.String password)
Set the password to use for connecting to the
Open Grid Cluster primary node.
|
void |
setPort(int port)
Set the port number to use for connecting to the
Open Grid Cluster primary node.
|
void |
setPrivateKey(java.lang.String privateKey)
Set the private key to use for connecting to the
Open Grid Cluster primary node.
|
void |
setPrivateKeyFormat(java.lang.String privateKeyFormat)
Set the format of the private key (null = auto-detect).
|
void |
setPrivateKeyPassword(java.lang.String privateKeyPassword)
Set the password to use for unlocking the private key.
|
void |
setUser(java.lang.String user)
Set the username to use for connecting to the
Open Grid Cluster primary node.
|
java.lang.String |
toString() |
checkLocked, isLocked, isValid, lock
private java.lang.String name
private java.lang.String address
private int port
private java.lang.String fingerprint
private java.lang.String fingerPrintType
private java.lang.String user
private java.lang.String password
private java.lang.String privateKey
private java.lang.String privateKeyFormat
private java.lang.String privateKeyPassword
public ConnectionInfo()
OpenGridCluster
instance can be created.
After that this instance become locked and it is no longer
possible to modify the parameters.public ConnectionInfo(ConnectionInfo clone)
clone
- The instance to clone frompublic ConnectionInfo(FileServer server)
server
- A FileServer instance to take parameters frompublic java.lang.String getName()
public void setName(java.lang.String name)
java.lang.IllegalStateException
- If this instance has been lockedpublic java.lang.String getAddress()
public void setAddress(java.lang.String address)
java.lang.IllegalStateException
- If this instance has been lockedpublic int getPort()
public void setPort(int port)
java.lang.IllegalStateException
- If this instance has been lockedpublic java.lang.String getFingerPrint()
public void setFingerPrint(java.lang.String fingerprint)
java.lang.IllegalStateException
- If this instance has been lockedjava.lang.IllegalArgumentException
- If the fingerprint is not 16 pairs
of hexadecimal numbers separated with colonpublic java.lang.String getFingerPrintType()
setFingerPrint(String)
method.public java.lang.String getUser()
public void setUser(java.lang.String user)
java.lang.IllegalStateException
- If this instance has been lockedpublic java.lang.String getPassword()
public void setPassword(java.lang.String password)
java.lang.IllegalStateException
- If this instance has been lockedpublic java.lang.String getPrivateKey()
public void setPrivateKey(java.lang.String privateKey)
java.lang.IllegalStateException
- If this instance has been lockedpublic java.lang.String getPrivateKeyFormat()
public void setPrivateKeyFormat(java.lang.String privateKeyFormat)
java.lang.IllegalStateException
- If this instance has been lockedpublic java.lang.String getPrivateKeyPassword()
public void setPrivateKeyPassword(java.lang.String privateKeyPassword)
java.lang.IllegalStateException
- If this instance has been lockedprotected void checkValid(boolean forLock)
SshUtil.FINGERPRINT_PATTERN
). The port number must be a positive
integer.checkValid
in class AbstractLockable<ConnectionInfo>
forLock
- If TRUE, the instance will be locked after validationpublic java.lang.String toString()
toString
in class java.lang.Object
public org.json.simple.JSONObject asJSONObject(JSONOptions options)
JSONOption.CONNECTION_PASSWORD
option is enabled
the password is also included.
If the JSONOption.PRIVATE_KEY
option is enabled
the private key (and password) is also included.