public final class StreamBaseURI
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_CONTAINER
The default container ("default")
|
static java.lang.String |
DEFAULT_HOST
The default StreamBase server ("localhost").
|
static int |
DEFAULT_PORT
The default StreamBase TCP port number (10000).
|
static StreamBaseURI |
DEFAULT_URI
The default URI (sb://localhost:10000/) pointing to localhost, no container, port 10000).
|
static java.lang.String |
KEY_PASS_PARAM
URI parameter used for the passphrase for a key within a keystore for SSL with client authentication (2-way ssl).
|
static java.lang.String |
KEYSTORE_PARAM
URI parameter used for a keystore for SSL with client authentication (2-way ssl).
|
static java.lang.String |
KEYSTORE_PASS_PARAM
URI parameter used for the passphrase for a keystore for SSL with client authentication (2-way ssl).
|
static java.lang.String |
NO_CONTAINER
No container specified ("")
|
static java.lang.String |
PASSWORD_PARAM
URI parameter used for password.
|
static java.lang.String |
QT_PARAM
URI parameter used internally as part of container table connection logic
|
static java.lang.String |
SECONDARY_HOST_PARAM
URI parameter used for secondary host name.
|
static java.lang.String |
SECONDARY_PORT_PARAM
URI parameter used for secondary port name.
|
static java.lang.String |
STREAM_PARAM
URI parameter used internally (only) as part of container stream connection logic
|
static java.lang.String |
SYSTEM_CONTAINER
The system container ("system")
|
static java.lang.String |
URI_ENVIRONMENT_VARIABLE
That environment variable used to define the uri to the server
|
static java.lang.String |
URI_PROPERTY_NAME
That java property used to define the uri to the server
|
static java.lang.String |
USER_PARAM
URI parameter used for username.
|
Constructor and Description |
---|
StreamBaseURI(java.lang.String uri)
Constructor that parses a StreamBase URI passed in as a String.
|
StreamBaseURI(java.lang.String host,
int port)
Constructor roughly equivalent to
new
StreamBaseURI("sb://host:port/") . |
StreamBaseURI(java.lang.String host,
int port,
java.util.Map<java.lang.String,java.lang.String> params)
Equivalent to StreamBaseURI(host, NO_CONTAINER, port, params)
|
StreamBaseURI(java.lang.String host,
java.lang.String container,
int port)
Constructor roughly equivalent to
new
StreamBaseURI("sb://host:port/container") . |
StreamBaseURI(java.lang.String host,
java.lang.String container,
int port,
boolean useSSL,
java.util.Map<java.lang.String,java.lang.String> params)
Constructor roughly equivalent to
new
StreamBaseURI("scheme://host:port/container;param1=value1(...)") ,
where scheme is either "sb" or "sbs" depending on whether useSSL is true or false, and param1=value1(...)
stands for every entry in the params Map |
StreamBaseURI(java.lang.String host,
java.lang.String container,
int port,
java.util.Map<java.lang.String,java.lang.String> params)
Equivalent to StreamBaseURI(host, container, port, false, params)
|
StreamBaseURI(java.lang.String host,
java.lang.String container,
int port,
java.lang.String user,
java.lang.String password)
Constructor roughly equivalent to
new
StreamBaseURI("sb://host:port/container;user=user;password=password") . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares this URI against the supplied one.
|
static StreamBaseURI |
fromEnvironment()
Returns the URI found by searching the following property and environment variables:
Using the string value found in the
streambase.uri system property, if set
Using the string value found in the STREAMBASE_URI environment variable, if set
Using the string value found in the STREAMBASE_SERVER environment variable, if set
StreamBaseURI.DEFAULT_URI if no value has been found above
|
StreamBaseURI |
getBaseURI()
Return a copy of this URI without any params
|
java.lang.String |
getBasicAuthenticationString()
Returns a Base64-encoded username + password if authentication
is enabled, or null otherwise.
|
java.lang.String |
getContainer()
Returns the container name component of the URI.
|
java.lang.String |
getHost()
Returns the host name component of the URI.
|
java.lang.String |
getKeyPassphrase()
Return the passphrase for the key within the keystore for the connection.
|
java.lang.String |
getKeystore()
Return the keystore for the connection.
|
java.lang.String |
getKeystorePassphrase()
Return the passphrase for the keystore for the connection.
|
int |
getNumParameters()
Return the number of URI parameters
|
java.lang.String |
getParam(java.lang.String key)
Returns a parameter with a given key, or null if none exists.
|
java.lang.String |
getParameter(java.lang.String key)
Returns a parameter with a given key, or null if none exists.
|
java.util.Map<java.lang.String,java.lang.String> |
getParams()
Returns an unmodifiable map of all parameters.
|
java.lang.String |
getPassword()
Return the password for the connection.
|
int |
getPort()
Returns the port number.
|
java.lang.String |
getUser()
Return the user name for the connection.
|
static boolean |
hasPrefix(java.lang.String s) |
boolean |
isSSL() |
static java.util.List<StreamBaseURI> |
listFromEnvironment()
Returns the list of URIs found by searching the following property and environment variables for a
comma separated URI list:
Using the string value found in the
streambase.uri system property, if set
Using the string value found in the STREAMBASE_URI environment variable, if set
Using the string value found in the STREAMBASE_SERVER environment variable, if set
StreamBaseURI.DEFAULT_URI if no value has been above
The supplied URIs must conform to a valid High Availability URI list, for example they
must all reference the same container. |
static java.util.List<StreamBaseURI> |
listFromString(java.lang.String uriStrings)
Parse a comma-separated list of URIs in a string into a List<StreamBaseURI>.
|
java.lang.String |
toString()
Returns a string representation of the URI.
|
static java.lang.String |
toString(java.util.Collection<StreamBaseURI> uris)
Create a string representation of a list of uris.
|
public static final int DEFAULT_PORT
public static final java.lang.String DEFAULT_HOST
public static final java.lang.String DEFAULT_CONTAINER
public static final java.lang.String SYSTEM_CONTAINER
public static final java.lang.String NO_CONTAINER
public static final StreamBaseURI DEFAULT_URI
public static final java.lang.String USER_PARAM
public static final java.lang.String PASSWORD_PARAM
public static final java.lang.String SECONDARY_HOST_PARAM
public static final java.lang.String SECONDARY_PORT_PARAM
public static final java.lang.String KEYSTORE_PARAM
public static final java.lang.String KEYSTORE_PASS_PARAM
public static final java.lang.String KEY_PASS_PARAM
public static final java.lang.String STREAM_PARAM
public static final java.lang.String QT_PARAM
public static final java.lang.String URI_PROPERTY_NAME
public static final java.lang.String URI_ENVIRONMENT_VARIABLE
public StreamBaseURI(java.lang.String uri) throws URIException
scheme://host[:port][/container][/][[;param=value]...]
sb
or sbs
, the latter to enable a secure SSL connectionDEFAULT_PORT
NO_CONTAINER
uri
- a URI to parseURIException
- if the URI syntax is invalid, or if an unknown parameter name is foundpublic StreamBaseURI(java.lang.String host, java.lang.String container, int port)
new
StreamBaseURI("sb://host:port/container")
.host
- a host name to connect tocontainer
- a container to connect toport
- a port number to connect toStreamBaseURI.StreamBaseURI(String)
public StreamBaseURI(java.lang.String host, int port)
new
StreamBaseURI("sb://host:port/")
.host
- a host name to connect toport
- a port number to connect toStreamBaseURI.StreamBaseURI(String)
public StreamBaseURI(java.lang.String host, java.lang.String container, int port, java.lang.String user, java.lang.String password)
new
StreamBaseURI("sb://host:port/container;user=user;password=password")
.host
- a host name to connect tocontainer
- a container to connect toport
- a port number to connect touser
- a user name for the connectionpassword
- a password for the connectionStreamBaseURI.StreamBaseURI(String)
public StreamBaseURI(java.lang.String host, java.lang.String container, int port, boolean useSSL, java.util.Map<java.lang.String,java.lang.String> params)
new
StreamBaseURI("scheme://host:port/container;param1=value1(...)")
,
where scheme is either "sb" or "sbs" depending on whether useSSL is true or false, and param1=value1(...)
stands for every entry in the params
Maphost
- a host name to connect tocontainer
- a container to connect toport
- a port number to connect touseSSL
- whether to use an SSL connection to the server or notparams
- a Map of String parameters for the URI, or null to indicate no parameters. This map is not checked for correctness.public StreamBaseURI(java.lang.String host, java.lang.String container, int port, java.util.Map<java.lang.String,java.lang.String> params)
host
- a host name to connect tocontainer
- a container to connect toport
- a port number to connect toparams
- a Map of String parameters for the URI, or null to indicate no parameters. This map is not checked for correctness.StreamBaseURI.StreamBaseURI(String, String, int, boolean, Map)
public StreamBaseURI(java.lang.String host, int port, java.util.Map<java.lang.String,java.lang.String> params)
host
- a host name to connect toport
- a port number to connect toparams
- a Map of String parameters for the URI, or null to indicate no parameters. This map is not checked for correctness.StreamBaseURI.StreamBaseURI(String, String, int, Map)
public static java.util.List<StreamBaseURI> listFromString(java.lang.String uriStrings) throws URIException
uriStrings
- URIException
public static java.lang.String toString(java.util.Collection<StreamBaseURI> uris)
uris
- public java.lang.String toString()
toString
in class java.lang.Object
public StreamBaseURI getBaseURI()
public java.lang.String getHost()
public java.lang.String getContainer()
public int getPort()
public java.lang.String getParam(java.lang.String key)
key
- the key for the parameter or null if not foundpublic java.lang.String getParameter(java.lang.String key)
key
- the key for the parameter or null if not foundpublic int getNumParameters()
public java.util.Map<java.lang.String,java.lang.String> getParams()
public java.lang.String getUser()
null
if none.public java.lang.String getPassword()
null
if none.public java.lang.String getKeystore()
null
if none.public java.lang.String getKeystorePassphrase()
null
if none.public java.lang.String getKeyPassphrase()
null
if none.public boolean isSSL()
public static StreamBaseURI fromEnvironment() throws URIException
streambase.uri
system property, if setSTREAMBASE_URI
environment variable, if setSTREAMBASE_SERVER
environment variable, if setStreamBaseURI.DEFAULT_URI
if no value has been found above
URIException
- if the URI found in any of the search locations is invalidpublic static java.util.List<StreamBaseURI> listFromEnvironment() throws URIException
streambase.uri
system property, if setSTREAMBASE_URI
environment variable, if setSTREAMBASE_SERVER
environment variable, if setStreamBaseURI.DEFAULT_URI
if no value has been above
URIException
- if any URI found is invalidpublic java.lang.String getBasicAuthenticationString()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public static boolean hasPrefix(java.lang.String s)
s
-