public class HostInfo extends java.lang.Object implements DatabaseUrlContainer
| Modifier and Type | Field and Description |
|---|---|
static int |
NO_PORT |
| Constructor and Description |
|---|
HostInfo()
Constructs an empty
HostInfo instance. |
HostInfo(DatabaseUrlContainer url,
java.lang.String host,
int port,
java.lang.String user,
java.lang.String password)
Constructs a
HostInfo instance initialized with the provided host, port and user info. |
HostInfo(DatabaseUrlContainer url,
java.lang.String host,
int port,
java.lang.String user,
java.lang.String password,
boolean isPasswordless,
java.util.Map<java.lang.String,java.lang.String> properties)
Constructs a
HostInfo instance initialized with the provided host, port, user, password and connection arguments. |
HostInfo(DatabaseUrlContainer url,
java.lang.String host,
int port,
java.lang.String user,
java.lang.String password,
java.util.Map<java.lang.String,java.lang.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)
|
java.util.Properties |
exposeAsProperties()
Exposes this host info as a single properties instance.
|
java.lang.String |
getDatabase()
Shortcut to the database connection argument.
|
java.lang.String |
getDatabaseUrl()
Returns the original database URL that produced this host info.
|
java.lang.String |
getHost()
Returns the host.
|
java.lang.String |
getHostPortPair()
Returns a host:port representation of this host.
|
java.util.Map<java.lang.String,java.lang.String> |
getHostProperties()
Returns the properties specific to this host.
|
java.lang.String |
getPassword()
Returns the password.
|
int |
getPort()
Returns the port.
|
java.lang.String |
getProperty(java.lang.String key)
Returns the connection argument for the given key.
|
java.lang.String |
getUser()
Returns the user name.
|
boolean |
isPasswordless()
Returns true if the is the default one, i.e., no password was provided in the connection URL or arguments.
|
java.lang.String |
toString()
Returns a string representation of this object.
|
public static final int NO_PORT
public HostInfo()
HostInfo instance.public HostInfo(DatabaseUrlContainer url, java.lang.String host, int port, java.lang.String user, java.lang.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, java.lang.String host, int port, java.lang.String user, java.lang.String password, java.util.Map<java.lang.String,java.lang.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 HostInfo(DatabaseUrlContainer url, java.lang.String host, int port, java.lang.String user, java.lang.String password, boolean isPasswordless, java.util.Map<java.lang.String,java.lang.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 passwordisPasswordless - no password was provided in the connection URL or arguments?properties - a connection arguments map.public java.lang.String getHost()
public int getPort()
public java.lang.String getHostPortPair()
public java.lang.String getUser()
public java.lang.String getPassword()
public boolean isPasswordless()
public java.util.Map<java.lang.String,java.lang.String> getHostProperties()
public java.lang.String getProperty(java.lang.String key)
key - keypublic java.lang.String getDatabase()
public java.util.Properties exposeAsProperties()
Properties instance containing the full host information.public java.lang.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.public java.lang.String toString()
toString in class java.lang.Object