Class JdbcConnection
- java.lang.Object
-
- com.adaptris.core.AdaptrisConnectionImp
-
- com.adaptris.core.AllowsRetriesConnection
-
- com.adaptris.core.jdbc.DatabaseConnection
-
- com.adaptris.core.jdbc.JdbcConnection
-
- All Implemented Interfaces:
AdaptrisComponent,AdaptrisConnection,ComponentLifecycle,ComponentLifecycleExtension,StateManagedComponent
@ComponentProfile(summary="Connect to a database using a JDBC driver", tag="connections,jdbc") public class JdbcConnection extends DatabaseConnectionImplementation of
AdaptrisConnectionImpfor JDBC.In the adapter configuration file this class is aliased as 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 JdbcConnection()JdbcConnection(java.lang.String url, java.lang.String driver)Convenience constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.lang.StringgetConnectUrl()Returns the connection string to use for this JDBC source.inthashCode()Force implementations to over-ride hashcode.protected voidinitialiseDatabaseConnection()Initialise the underlying database connection.protected java.sql.ConnectionmakeConnection()Make the connection.voidsetConnectUrl(java.lang.String s)Sets the connection string to use for this JDBC source.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
-
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.initialiseDatabaseConnection()
-
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.startDatabaseConnection()
-
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- See Also:
DatabaseConnection.stopDatabaseConnection()
-
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
-
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()
-
getConnectUrl
public java.lang.String getConnectUrl()
Returns the connection string to use for this JDBC source.
- Returns:
- the connection string to use for this JDBC source
-
setConnectUrl
public void setConnectUrl(java.lang.String s)
Sets the connection string to use for this JDBC source.
- Parameters:
s- the connection string to use for this JDBC source
-
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()
-
-