Class FailoverJdbcConnection
- java.lang.Object
-
- com.adaptris.core.AdaptrisConnectionImp
-
- com.adaptris.core.AllowsRetriesConnection
-
- com.adaptris.core.jdbc.DatabaseConnection
-
- com.adaptris.core.jdbc.FailoverJdbcConnection
-
- All Implemented Interfaces:
AdaptrisComponent,AdaptrisConnection,ComponentLifecycle,ComponentLifecycleExtension,StateManagedComponent
@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 DatabaseConnectionAn
AdaptrisConnectionimplementation for a failover database connection.This class simply proxies
com.adaptris.jdbc.connection.FailoverConnectionwith the required AdaptrisConnection methods.- See Also:
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.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.AdaptrisConnectionImp
log
-
-
Constructor Summary
Constructors Constructor Description FailoverJdbcConnection()Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnectUrl(java.lang.String s)Add a Connection URL to the configured list.protected voidcloseDatabaseConnection()Initialise the underlying database connection.booleanequals(java.lang.Object o)Force implementations to over-ride equals with a semantic implementation.protected java.lang.StringgetConnectionName()Returns a name for this connection for logging purposes.java.util.List<java.lang.String>getConnectUrls()Get the configured list of URLs.inthashCode()Force implementations to over-ride hashcode.protected voidinitialiseDatabaseConnection()Initialise the underlying database connection.protected java.sql.ConnectionmakeConnection()Make the connection.voidsetConnectUrls(java.util.List<java.lang.String> l)Set the configured list of URLs.protected voidstartDatabaseConnection()Initialise the underlying database connection.protected voidstopDatabaseConnection()Initialise the underlying database connection.-
Methods inherited from class com.adaptris.core.jdbc.DatabaseConnection
alwaysValidateConnection, asDataSource, autoCommit, checkInternalState, closeConnection, connect, connectionProperties, debugMode, getAlwaysValidateConnection, getAutoCommit, getConnectionProperties, getDebugMode, getDriverImp, getPassword, getUsername, initConnection, loadDriverClass, prepareConnection, setAlwaysValidateConnection, setAutoCommit, setConnectionProperties, setDebugMode, setDriverImp, setPassword, setUsername, startConnection, stopConnection
-
Methods inherited from class com.adaptris.core.AllowsRetriesConnection
connectionAttempts, connectionRetryInterval, createLoggingStatement, getConnectionAttempts, getConnectionRetryInterval, logWarning, setConnectionAttempts, setConnectionRetryInterval
-
Methods inherited from class com.adaptris.core.AdaptrisConnectionImp
addExceptionListener, addMessageConsumer, addMessageProducer, changeState, cloneForTesting, close, connectionErrorHandler, getConnectionErrorHandler, getUniqueId, getWorkersFirstOnShutdown, init, prepare, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveConnection, retrieveExceptionListeners, retrieveMessageConsumers, retrieveMessageProducers, setConnectionErrorHandler, setUniqueId, setWorkersFirstOnShutdown, start, stop, workersFirstOnShutdown
-
-
-
-
Method Detail
-
makeConnection
protected java.sql.Connection makeConnection() throws java.sql.SQLExceptionDescription copied from class:DatabaseConnectionMake the connection.
This abstract method should be implemented by concrete sub-classes to make or check the current connection to the Jdbc source.
- Specified by:
makeConnectionin classDatabaseConnection- Returns:
- a java.sql.Connection
- Throws:
java.sql.SQLException- if the connection could not be made.- See Also:
DatabaseConnection.makeConnection()
-
stopDatabaseConnection
protected void stopDatabaseConnection()
Description copied from class:DatabaseConnectionInitialise the underlying database connection.
This abstract method should be implemented by concrete sub-classes to stop any components other than the DriverManager.
- Specified by:
stopDatabaseConnectionin classDatabaseConnection
-
closeDatabaseConnection
protected void closeDatabaseConnection()
Description copied from class:DatabaseConnectionInitialise the underlying database connection.
This abstract method should be implemented by concrete sub-classes to close any components.
- Specified by:
closeDatabaseConnectionin classDatabaseConnection- See Also:
AdaptrisConnectionImp.closeConnection()
-
startDatabaseConnection
protected void startDatabaseConnection() throws CoreExceptionDescription copied from class:DatabaseConnectionInitialise the underlying database connection.
This abstract method should be implemented by concrete sub-classes to initialise any components other than the DriverManager.
- Specified by:
startDatabaseConnectionin classDatabaseConnection- Throws:
CoreException- wrapping any underlying exception.- See Also:
DatabaseConnection.initConnection()
-
initialiseDatabaseConnection
protected void initialiseDatabaseConnection() throws CoreExceptionDescription copied from class:DatabaseConnectionInitialise the underlying database connection.
This abstract method should be implemented by concrete sub-classes to initialise any components other than the DriverManager.
- Specified by:
initialiseDatabaseConnectionin classDatabaseConnection- Throws:
CoreException- wrapping any underlying exception.- See Also:
DatabaseConnection.initConnection()
-
addConnectUrl
public void addConnectUrl(java.lang.String s)
Add a Connection URL to the configured list.- Parameters:
s- a connection url
-
getConnectUrls
public java.util.List<java.lang.String> getConnectUrls()
Get the configured list of URLs.- Returns:
- the list of urls
-
setConnectUrls
public void setConnectUrls(java.util.List<java.lang.String> l)
Set the configured list of URLs.- Parameters:
l- the list of urls
-
equals
public boolean equals(java.lang.Object o)
Description copied from class:DatabaseConnectionForce implementations to over-ride equals with a semantic implementation.
- Specified by:
equalsin classDatabaseConnection- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
Description copied from class:DatabaseConnectionForce implementations to over-ride hashcode.
- Specified by:
hashCodein classDatabaseConnection- See Also:
Object.hashCode()
-
getConnectionName
protected java.lang.String getConnectionName()
Description copied from class:DatabaseConnectionReturns a name for this connection for logging purposes.
- Specified by:
getConnectionNamein classDatabaseConnection- Returns:
- a name for this connection for logging purposes
- See Also:
DatabaseConnection.getConnectionName()
-
-