public class ConnectionUrlParser extends java.lang.Object implements DatabaseUrlContainer
scheme://authority/path?query#fragment
This results in splitting the connection string URL and processing its internal parts:
Modifier and Type | Class and Description |
---|---|
static class |
ConnectionUrlParser.Pair<T,U>
This class is a simple container for two elements.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAuthority()
Returns the authority section.
|
java.lang.String |
getDatabaseUrl()
Returns the original database URL that produced this connection string parser.
|
java.util.List<HostInfo> |
getHosts()
Returns the hosts information.
|
java.lang.String |
getPath()
Returns the path section.
|
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Returns the properties map contained in this connection string.
|
java.lang.String |
getQuery()
Returns the query section.
|
java.lang.String |
getScheme()
Returns the scheme section.
|
static boolean |
isConnectionStringSupported(java.lang.String connString)
Checks if the scheme part of given connection string matches one of the
ConnectionUrl.Type s supported by Connector/J. |
static ConnectionUrlParser |
parseConnectionString(java.lang.String connString)
Static factory method for constructing instances of this class.
|
static ConnectionUrlParser.Pair<java.lang.String,java.lang.Integer> |
parseHostPortPair(java.lang.String hostInfo)
Parses a host:port pair and returns the two elements in a
ConnectionUrlParser.Pair |
static ConnectionUrlParser.Pair<java.lang.String,java.lang.String> |
parseUserInfo(java.lang.String userInfo)
Parses the given user information which is formed by the parts [user][:password].
|
java.lang.String |
toString()
Returns a string representation of this object.
|
public static ConnectionUrlParser parseConnectionString(java.lang.String connString)
connString
- The connection string to parse.ConnectionUrlParser
public static boolean isConnectionStringSupported(java.lang.String connString)
ConnectionUrl.Type
s supported by Connector/J.
Throws WrongArgumentException
if connString is null.connString
- connection stringpublic static ConnectionUrlParser.Pair<java.lang.String,java.lang.String> parseUserInfo(java.lang.String userInfo)
userInfo
- the string containing the user informationConnectionUrlParser.Pair
containing the user and password information or null if the user information can't be parsedpublic static ConnectionUrlParser.Pair<java.lang.String,java.lang.Integer> parseHostPortPair(java.lang.String hostInfo)
ConnectionUrlParser.Pair
hostInfo
- the host:pair to parseConnectionUrlParser.Pair
containing the host and port information or null if the host information can't be parsedpublic java.lang.String getDatabaseUrl()
getDatabaseUrl
in interface DatabaseUrlContainer
public java.lang.String getScheme()
public java.lang.String getAuthority()
public java.lang.String getPath()
public java.lang.String getQuery()
public java.util.List<HostInfo> getHosts()
public java.util.Map<java.lang.String,java.lang.String> getProperties()
public java.lang.String toString()
toString
in class java.lang.Object