public class ConnectionInfo extends AbstractLockable<ConnectionInfo>
OpenGridCluster
instance
has been created.Modifier and Type | Field and Description |
---|---|
private String |
address |
private String |
fingerprint |
private String |
fingerPrintType |
private String |
name |
private String |
password |
private int |
port |
private 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.
|
String |
getAddress()
Get the internet address of the Open Grid Cluster
primary node.
|
String |
getFingerPrint()
Get the public key SSH fingerprint of the Open Grid Cluster primary
node.
|
String |
getFingerPrintType()
Get the fingerprint type.
|
String |
getName()
Get the display name of the cluster.
|
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.
|
String |
getUser()
Get the username to use when connecting to the Open Grid Cluster
primary node.
|
void |
setAddress(String address)
Set the internet address to the Open Grid Cluster
primary node.
|
void |
setFingerPrint(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(String name)
Set the display name of the cluster.
|
void |
setPassword(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 |
setUser(String user)
Set the username to use for connecting to the
Open Grid Cluster primary node.
|
String |
toString() |
checkLocked, isLocked, isValid, lock
private String name
private String address
private int port
private String fingerprint
private String fingerPrintType
private String user
private String password
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 String getName()
public void setName(String name)
IllegalStateException
- If this instance has been lockedpublic String getAddress()
public void setAddress(String address)
IllegalStateException
- If this instance has been lockedpublic int getPort()
public void setPort(int port)
IllegalStateException
- If this instance has been lockedpublic String getFingerPrint()
public void setFingerPrint(String fingerprint)
IllegalStateException
- If this instance has been lockedIllegalArgumentException
- If the fingerprint is not 16 pairs
of hexadecimal numbers separated with colonpublic String getFingerPrintType()
setFingerPrint(String)
method.public String getUser()
public void setUser(String user)
IllegalStateException
- If this instance has been lockedpublic String getPassword()
public void setPassword(String password)
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 org.json.simple.JSONObject asJSONObject(JSONOptions options)
JSONOption.CONNECTION_PASSWORD
options is enabled
the password is also included.