public final class SSHTunnelConfiguration
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
SSH_ENABLED
Property used to identify whether SSH tunneling has been enabled for
the given connection.
|
static java.lang.String |
SSH_HOST
The property name for the SSH hostname.
|
static java.lang.String |
SSH_KEY_FILE
The property name for the local ssh identity/key file to use for
authentication.
|
static java.lang.String |
SSH_PASSWORD
The property name for the SSH password.
|
static java.lang.String |
SSH_PORT
The property name for the SSH port.
|
static java.lang.String |
SSH_USE_PROXY
Property used to identify whether a proxy should be used when creating
the SSH tunnel.
|
static java.lang.String |
SSH_USER
The property name for the SSH username.
|
| Constructor and Description |
|---|
SSHTunnelConfiguration(java.lang.String url,
java.lang.String host,
int[] hostOffsets,
int port,
int[] portOffsets)
Creates a new tunnel configuration.
|
| Modifier and Type | Method and Description |
|---|---|
static SSHTunnelConfiguration |
createFromMatcher(java.lang.String url,
java.util.regex.Matcher m,
int hostGroup,
int portGroup)
Creates a new SSHTunnelConfiguration from the given Matcher.
|
static SSHTunnelConfiguration |
getConfiguration(DatabaseProvider pro)
Gets the SSHTunnelConfiguration for the given DatabaseProvider.
|
java.lang.String |
getLocalConnectionURL(SSHTunnel tunnel)
Gets a local version of the URL given the local port/host information
from the given tunnel.
|
java.lang.String |
getRemoteHost()
Gets the remote host (i.e.
|
int |
getRemotePort()
Gets the remote port (i.e.
|
static SSHTunnelConfiguration |
parseAddressSyntax(java.lang.String url)
Looks in the given URL for (host=...) and (port=...) and creates a
tunnel config with the found host/port information.
|
static int |
parsePort(java.lang.String port)
Utility method to parses the given String as a port number.
|
static boolean |
requiresTunnel(DatabaseProvider pro)
Tests whether the connection details for the given database connection
definition require an SSH tunnel to be open.
|
public static final java.lang.String SSH_ENABLED
public static final java.lang.String SSH_USER
public static final java.lang.String SSH_PASSWORD
public static final java.lang.String SSH_HOST
public static final java.lang.String SSH_PORT
public static final java.lang.String SSH_KEY_FILE
public static final java.lang.String SSH_USE_PROXY
public SSHTunnelConfiguration(java.lang.String url,
java.lang.String host,
int[] hostOffsets,
int port,
int[] portOffsets)
url - the original JDBC url containing the remote hostname and
port details (i.e. the host/port that the tunnel should forward
to via the ssh host/port).host - the remote hostnamehostOffsets - the start/end offset of the remote hostname in the
urlport - the remote portportOffsets - the start/end offset of the remote port in the urlpublic java.lang.String getRemoteHost()
public int getRemotePort()
public java.lang.String getLocalConnectionURL(SSHTunnel tunnel)
tunnel - the tunnel to get the url forpublic static int parsePort(java.lang.String port)
throws SSHTunnelException
port - the port as a StringSSHTunnelException - if the String doesn't contain a valid port
number.public static SSHTunnelConfiguration createFromMatcher(java.lang.String url, java.util.regex.Matcher m, int hostGroup, int portGroup) throws SSHTunnelException
url - the base connection URLm - the matcher that has matched the URL and has groups for the
host and porthostGroup - the host groupportGroup - the port groupSSHTunnelExceptionpublic static SSHTunnelConfiguration parseAddressSyntax(java.lang.String url) throws SSHTunnelException
url - the url to parse for description syntaxSSHTunnelException - if the URL doesn't match, or if multiple
host/port information is found.public static SSHTunnelConfiguration getConfiguration(DatabaseProvider pro) throws java.sql.SQLException
pro - the connection details to get the tunnel configuration forjava.sql.SQLExceptionpublic static final boolean requiresTunnel(DatabaseProvider pro)
pro - the database connection definition