public class HostInfo extends Object implements DatabaseUrlContainer
| Modifier and Type | Field and Description |
|---|---|
private String |
host |
private static String |
HOST_PORT_SEPARATOR |
private Map<String,String> |
hostProperties |
static int |
NO_PORT |
private DatabaseUrlContainer |
originalUrl |
private String |
password |
private int |
port |
private String |
user |
| Constructor and Description |
|---|
HostInfo()
Constructs an empty
HostInfo instance. |
HostInfo(DatabaseUrlContainer url,
String host,
int port,
String user,
String password)
Constructs a
HostInfo instance initialized with the provided host, port and user info. |
HostInfo(DatabaseUrlContainer url,
String host,
int port,
String user,
String password,
Map<String,String> properties)
Constructs a
HostInfo instance initialized with the provided host, port, user, password and connection arguments. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equalHostPortPair(HostInfo hi)
|
Properties |
exposeAsProperties()
Exposes this host info as a single properties instance.
|
String |
getDatabase()
Shortcut to the database connection argument.
|
String |
getDatabaseUrl()
Returns the original database URL that produced this host info.
|
String |
getHost()
Returns the host.
|
String |
getHostPortPair()
Returns a host:port representation of this host.
|
Map<String,String> |
getHostProperties()
Returns the properties specific to this host.
|
String |
getPassword()
Returns the password.
|
int |
getPort()
Returns the port.
|
String |
getProperty(String key)
Returns the connection argument for the given key.
|
String |
getUser()
Returns the user name.
|
String |
toString()
Returns a string representation of this object.
|
public static final int NO_PORT
private static final String HOST_PORT_SEPARATOR
private final DatabaseUrlContainer originalUrl
private final String host
private final int port
private final String user
private final String password
public HostInfo()
HostInfo instance.public HostInfo(DatabaseUrlContainer url, String host, int port, String user, String password)
HostInfo instance initialized with the provided host, port and user info.url - a reference to the original database URL that produced this host infohost - the host ip or nameport - the portuser - the user namepassword - the user's passwordpublic HostInfo(DatabaseUrlContainer url, String host, int port, String user, String password, Map<String,String> properties)
HostInfo instance initialized with the provided host, port, user, password and connection arguments.url - a reference to the original database URL that produced this host infohost - the host ip or nameport - the portuser - the user namepassword - this user's passwordproperties - a connection arguments map.public String getHost()
public int getPort()
public String getHostPortPair()
public String getUser()
public String getPassword()
public Map<String,String> getHostProperties()
public String getProperty(String key)
key - keypublic String getDatabase()
public Properties exposeAsProperties()
Properties instance containing the full host information.public String getDatabaseUrl()
getDatabaseUrl in interface DatabaseUrlContainerpublic boolean equalHostPortPair(HostInfo hi)
hi - the HostInfo to compare with.true if both objects have equal host and port pairs, false otherwise.