Package com.adaptris.core.services.jdbc
Class JdbcDataCaptureServiceImpl
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.jdbc.JdbcService
-
- com.adaptris.core.services.jdbc.JdbcServiceWithParameters
-
- com.adaptris.core.services.jdbc.JdbcDataCaptureServiceImpl
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,ConnectedService
,MessageEventGenerator
,Service
,StateManagedComponent
- Direct Known Subclasses:
JdbcIteratingDataCaptureServiceImpl
,JdbcRawDataCaptureService
public abstract class JdbcDataCaptureServiceImpl extends JdbcServiceWithParameters
Base implementation for capturing data from an AdaptrisMessage and storing it in a jdbc database.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
JdbcDataCaptureServiceImpl.DatabaseActor
-
Field Summary
Fields Modifier and Type Field Description protected JdbcDataCaptureServiceImpl.DatabaseActor
actor
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description JdbcDataCaptureServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeJdbcService()
Close the service.protected JdbcDataCaptureServiceImpl.DatabaseActor
configureActor(AdaptrisMessage msg)
java.lang.String
getRowsUpdatedMetadataKey()
java.lang.Boolean
getSaveReturnedKeys()
Get the configured flag.java.lang.String
getStatement()
The configured Statement.protected void
initJdbcService()
protected void
prepareService()
protected void
saveKeys(AdaptrisMessage msg, java.sql.Statement stmt)
boolean
saveReturnedKeys()
void
setRowsUpdatedMetadataKey(java.lang.String key)
Set the metadata key which will contain the number of rows updated by this service.void
setSaveReturnedKeys(java.lang.Boolean save)
Store any return value from the SQL statement as metadata.void
setStatement(java.lang.String s)
SQL statement to perform.protected void
startService()
Start the service.protected void
stopService()
Stop the service.protected void
updateMetadata(AdaptrisMessage msg, long value)
-
Methods inherited from class com.adaptris.core.services.jdbc.JdbcServiceWithParameters
addStatementParameter, getParameterApplicator, getStatementParameters, setParameterApplicator, setStatementParameters
-
Methods inherited from class com.adaptris.core.jdbc.JdbcService
applyTimeout, closeService, createStatement, getConnection, getConnection, getStatementTimeout, initService, prepare, prepareStatement, prepareStatement, setConnection, setStatementTimeout, start, stop
-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueId
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
close, init
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createName, createQualifier, isTrackingEndpoint
-
Methods inherited from interface com.adaptris.core.Service
continueOnFailure, doService, isBranching, setUniqueId
-
Methods inherited from interface com.adaptris.core.StateManagedComponent
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
-
-
-
-
Field Detail
-
actor
protected transient JdbcDataCaptureServiceImpl.DatabaseActor actor
-
-
Method Detail
-
initJdbcService
protected void initJdbcService() throws CoreException
- Specified by:
initJdbcService
in classJdbcService
- Throws:
CoreException
-
startService
protected void startService() throws CoreException
Description copied from class:JdbcService
Start the service.This is called after the connection is started
- Specified by:
startService
in classJdbcService
- Throws:
CoreException
-
stopService
protected void stopService()
Description copied from class:JdbcService
Stop the service.This is called after before the connection is stopped
- Specified by:
stopService
in classJdbcService
-
closeJdbcService
protected void closeJdbcService()
Description copied from class:JdbcService
Close the service.This is called before the connection is closed
- Specified by:
closeJdbcService
in classJdbcService
-
setStatement
public void setStatement(java.lang.String s)
SQL statement to perform.- Parameters:
s
- the statement.
-
getStatement
public java.lang.String getStatement()
The configured Statement.- Returns:
- the SQL statement.
-
saveReturnedKeys
public boolean saveReturnedKeys()
-
setSaveReturnedKeys
public void setSaveReturnedKeys(java.lang.Boolean save)
Store any return value from the SQL statement as metadata.- Parameters:
save
- the falg.
-
getSaveReturnedKeys
public java.lang.Boolean getSaveReturnedKeys()
Get the configured flag.- Returns:
- the flag.
-
getRowsUpdatedMetadataKey
public java.lang.String getRowsUpdatedMetadataKey()
-
setRowsUpdatedMetadataKey
public void setRowsUpdatedMetadataKey(java.lang.String key)
Set the metadata key which will contain the number of rows updated by this service.The precise value will depend on the statement(s) being executed; this is simply an aggregation of the values returned by
Statement.executeUpdate(String)
.- Parameters:
key
- the metadata key, if set this metadata will contain the number of rows affected.
-
updateMetadata
protected void updateMetadata(AdaptrisMessage msg, long value)
-
saveKeys
protected void saveKeys(AdaptrisMessage msg, java.sql.Statement stmt) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
configureActor
protected JdbcDataCaptureServiceImpl.DatabaseActor configureActor(AdaptrisMessage msg) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
prepareService
protected void prepareService() throws CoreException
- Specified by:
prepareService
in classJdbcService
- Throws:
CoreException
-
-