@ComponentProfile(summary="Connect using a database using a JDBC driver supporting database failover in a vendor neutral fashion", tag="connections,jdbc") public class FailoverJdbcConnection extends DatabaseConnection
An AdaptrisConnection
implementation for a failover database connection.
This class simply proxies com.adaptris.jdbc.connection.FailoverConnection
with the required AdaptrisConnection
methods.
FailoverConnection
In the adapter configuration file this class is aliased as failover-jdbc-connection which is the preferred alternative to the fully qualified classname when building your configuration.
log
Constructor and Description |
---|
FailoverJdbcConnection()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addConnectUrl(java.lang.String s)
Add a Connection URL to the configured list.
|
protected void |
closeDatabaseConnection()
Initialise the underlying database connection.
|
boolean |
equals(java.lang.Object o)
Force implementations to over-ride equals with a semantic implementation.
|
protected java.lang.String |
getConnectionName()
Returns a name for this connection for logging purposes.
|
java.util.List<java.lang.String> |
getConnectUrls()
Get the configured list of URLs.
|
int |
hashCode()
Force implementations to over-ride hashcode.
|
protected void |
initialiseDatabaseConnection()
Initialise the underlying database connection.
|
protected java.sql.Connection |
makeConnection()
Make the connection.
|
void |
setConnectUrls(java.util.List<java.lang.String> l)
Set the configured list of URLs.
|
protected void |
startDatabaseConnection()
Initialise the underlying database connection.
|
protected void |
stopDatabaseConnection()
Initialise the underlying database connection.
|
alwaysValidateConnection, asDataSource, autoCommit, checkInternalState, closeConnection, connect, connectionProperties, debugMode, getAlwaysValidateConnection, getAutoCommit, getConnectionProperties, getDebugMode, getDriverImp, getPassword, getTestStatement, getUsername, initConnection, prepareConnection, setAlwaysValidateConnection, setAutoCommit, setConnectionProperties, setDebugMode, setDriverImp, setPassword, setTestStatement, setUsername, startConnection, stopConnection
connectionAttempts, connectionRetryInterval, createLoggingStatement, getConnectionAttempts, getConnectionRetryInterval, logWarning, setConnectionAttempts, setConnectionRetryInterval
addExceptionListener, addMessageConsumer, addMessageProducer, changeState, cloneForTesting, close, connectionErrorHandler, getConnectionErrorHandler, getLookupName, getUniqueId, getWorkersFirstOnShutdown, init, prepare, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveConnection, retrieveExceptionListeners, retrieveMessageConsumers, retrieveMessageProducers, setConnectionErrorHandler, setLookupName, setUniqueId, setWorkersFirstOnShutdown, start, stop, workersFirstOnShutdown
public FailoverJdbcConnection()
Creates a new instance.
protected java.sql.Connection makeConnection() throws java.sql.SQLException
DatabaseConnection
Make the connection.
This abstract method should be implemented by concrete sub-classes to make or check the current connection to the Jdbc source.
makeConnection
in class DatabaseConnection
java.sql.SQLException
- if the connection could not be made.DatabaseConnection.makeConnection()
protected void stopDatabaseConnection()
DatabaseConnection
Initialise the underlying database connection.
This abstract method should be implemented by concrete sub-classes to stop any components other than the DriverManager.
stopDatabaseConnection
in class DatabaseConnection
protected void closeDatabaseConnection()
DatabaseConnection
Initialise the underlying database connection.
This abstract method should be implemented by concrete sub-classes to close any components.
closeDatabaseConnection
in class DatabaseConnection
AdaptrisConnectionImp.closeConnection()
protected void startDatabaseConnection() throws CoreException
DatabaseConnection
Initialise the underlying database connection.
This abstract method should be implemented by concrete sub-classes to initialise any components other than the DriverManager.
startDatabaseConnection
in class DatabaseConnection
CoreException
- wrapping any underlying exception.DatabaseConnection.initConnection()
protected void initialiseDatabaseConnection() throws CoreException
DatabaseConnection
Initialise the underlying database connection.
This abstract method should be implemented by concrete sub-classes to initialise any components other than the DriverManager.
initialiseDatabaseConnection
in class DatabaseConnection
CoreException
- wrapping any underlying exception.DatabaseConnection.initConnection()
public void addConnectUrl(java.lang.String s)
s
- a connection urlpublic java.util.List<java.lang.String> getConnectUrls()
public void setConnectUrls(java.util.List<java.lang.String> l)
l
- the list of urlspublic boolean equals(java.lang.Object o)
DatabaseConnection
Force implementations to over-ride equals with a semantic implementation.
equals
in class DatabaseConnection
Object.equals(java.lang.Object)
public int hashCode()
DatabaseConnection
Force implementations to over-ride hashcode.
hashCode
in class DatabaseConnection
Object.hashCode()
protected java.lang.String getConnectionName()
DatabaseConnection
Returns a name for this connection for logging purposes.
getConnectionName
in class DatabaseConnection
DatabaseConnection.getConnectionName()