private static class ConnectionUrlTest.ConnectionStringGenerator
extends java.lang.Object
implements java.util.Iterator<java.lang.String>, java.lang.Iterable<java.lang.String>
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
ConnectionUrlTest.ConnectionStringGenerator.UrlMode |
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String[] |
ADDRESS_EQUALS_HOST |
private int[] |
ceiling |
private int[] |
current |
private static java.lang.String[] |
DB |
(package private) boolean |
hasNext |
private static java.lang.String[] |
HOST |
private static java.lang.String[] |
KEY_VALUE_HOST |
private int[] |
next |
private int |
numberOfHosts |
private static java.lang.String[] |
PARAMS |
private static java.lang.String[] |
PROTOCOL |
private static java.lang.String[] |
STD_HOST |
private static java.lang.String[] |
STD_PORT |
(package private) ConnectionUrlTest.ConnectionStringGenerator.UrlMode |
urlMode |
private static java.lang.String[] |
USER |
| Constructor and Description |
|---|
ConnectionStringGenerator(ConnectionUrlTest.ConnectionStringGenerator.UrlMode urlMode)
Create an instance of
ConnectionUrlTest.ConnectionStringGenerator and initializes internal data for the iterator. |
| Modifier and Type | Method and Description |
|---|---|
private java.lang.String |
buildConnectionString()
Builds a connection string with the parts corresponding to the current counter position.
|
private java.lang.String |
decode(java.lang.String text)
Utility method to URL decode the given string.
|
java.lang.String |
getDatabase()
Returns the database part for the current position.
|
java.lang.String |
getHostInfo(int fromHostIndex)
Returns the host info part for the current position and the given host.
|
int |
getHostParamsCount(int hostIndex)
Returns the number of host specific parameters existing in the current position and the given host.
|
java.lang.String |
getParams()
Returns the connection parameters part for the current position.
|
int |
getParamsCount()
Returns the number of connection parameters existing the the current position.
|
java.lang.String |
getProtocol()
Returns the protocol part (scheme) for the current position.
|
java.lang.String |
getUserInfo(int fromHostIndex)
Returns the user info part for the current position and the given host.
|
boolean |
hasHostParam(int hostIndex,
java.lang.String key,
java.lang.String value)
Checks if current host info contains the given key & value parameter.
|
boolean |
hasNext() |
boolean |
hasParam(java.lang.String key,
java.lang.String value)
Checks if the current connection properties contain the given key & value.
|
private boolean |
incrementCounter(int i)
Increments the counter recursively for each connection string part.
|
java.util.Iterator<java.lang.String> |
iterator() |
java.lang.String |
next() |
java.lang.String |
toString() |
private static final java.lang.String[] PROTOCOL
private static final java.lang.String[] USER
private static final java.lang.String[] STD_HOST
private static final java.lang.String[] STD_PORT
private static final java.lang.String[] KEY_VALUE_HOST
private static final java.lang.String[] ADDRESS_EQUALS_HOST
private static final java.lang.String[] HOST
private static final java.lang.String[] DB
private static final java.lang.String[] PARAMS
ConnectionUrlTest.ConnectionStringGenerator.UrlMode urlMode
private int numberOfHosts
private int[] current
private int[] next
private int[] ceiling
boolean hasNext
public ConnectionStringGenerator(ConnectionUrlTest.ConnectionStringGenerator.UrlMode urlMode)
ConnectionUrlTest.ConnectionStringGenerator and initializes internal data for the iterator.urlMode - private boolean incrementCounter(int i)
i - the part where to increment the counterprivate java.lang.String buildConnectionString()
public boolean hasNext()
hasNext in interface java.util.Iterator<java.lang.String>public java.lang.String next()
next in interface java.util.Iterator<java.lang.String>public java.lang.String getProtocol()
public java.lang.String getUserInfo(int fromHostIndex)
fromHostIndex - the host from where to get user infopublic java.lang.String getHostInfo(int fromHostIndex)
fromHostIndex - the host from where to get host infopublic java.lang.String getDatabase()
public java.lang.String getParams()
public boolean hasHostParam(int hostIndex,
java.lang.String key,
java.lang.String value)
hostIndex - the host from where the given information will be checked againstkey - the key to checkvalue - the value to checkpublic int getHostParamsCount(int hostIndex)
hostIndex - the host from where to get the countpublic boolean hasParam(java.lang.String key,
java.lang.String value)
key - the key to checkvalue - the value to checkpublic int getParamsCount()
private java.lang.String decode(java.lang.String text)
text - the text to decodepublic java.util.Iterator<java.lang.String> iterator()
iterator in interface java.lang.Iterable<java.lang.String>public java.lang.String toString()
toString in class java.lang.Object