Package com.adaptris.interlok.jdbc
Class JDBCCaptureStatementBuilder
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.jdbc.JdbcService
-
- com.adaptris.interlok.jdbc.JDBCStatementBuilder
-
- com.adaptris.interlok.jdbc.JDBCCaptureStatementBuilder
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,ConnectedService,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="JDBC data capture statement builder service", tag="jdbc,capture,build,statement", since="4.1.0") public class JDBCCaptureStatementBuilder extends JDBCStatementBuilderJDBC data captuer statement builder service.Build a JDBC data captuere service using the given statement to create the necessary parameter list. It turns:
<jdbc-upsert-service> <unique-id>7b18517b-017d-4741-8b5e-9e490bff6c51</unique-id> <statement>INSERT INTO person (id, name, dob, age) VALUES (%sql_id{string:id}, %sql_payload{string:name}, %sql_metadata{date:dob}, %sql_metadata{integer:age})</statement> </jdbc-upsert-service>into:
<jdbc-raw-data-capture-service> <uniqueId>3759673b-e2e2-4f01-a122-b59b67931a02</uniqueId> <named-parameter-applicator> <parameterNamePrefix>#</parameterNamePrefix> <parameterNameRegex>#\w*</parameterNameRegex> </named-parameter-applicator> <statementParameters> <parameters> <jdbc-integer-statement-parameter> <name>age</name> <queryString>age</queryString> <queryType>metadata</queryType> <convertNull>false</convertNull> </jdbc-integer-statement-parameter> <jdbc-date-statement-parameter> <name>dob</name> <queryString>dob</queryString> <queryType>metadata</queryType> <convertNull>false</convertNull> <dateFormat>yyyy-MM-dd</dateFormat> </jdbc-date-statement-parameter> <jdbc-string-statement-parameter> <name>name</name> <queryString>name</queryString> <queryType>payload</queryType> <convertNull>false</convertNull> </jdbc-string-statement-parameter> <jdbc-string-statement-parameter> <name>id</name> <queryString>id</queryString> <queryType>id</queryType> <convertNull>false</convertNull> </jdbc-string-statement-parameter> </parameters> </statementParameters> <statement>INSERT INTO person (id, name, dob, age) VALUES (#id, #name, #dob, #age)</statement> </jdbc-raw-data-capture-service>
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description JDBCCaptureStatementBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseJdbcService()Close the service.protected JdbcServiceWithParameterscreateService(java.lang.String statement)voiddoService(AdaptrisMessage message)Apply the service to the message.protected voidinitJdbcService()protected voidstartService()Start the service.protected voidstopService()Stop the service.-
Methods inherited from class com.adaptris.interlok.jdbc.JDBCStatementBuilder
buildService, getStatement, prepareService, setStatement
-
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, isBranching, setUniqueId
-
Methods inherited from interface com.adaptris.core.StateManagedComponent
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
-
-
-
-
Method Detail
-
createService
protected JdbcServiceWithParameters createService(java.lang.String statement)
- Specified by:
createServicein classJDBCStatementBuilder
-
initJdbcService
protected void initJdbcService() throws CoreException- Specified by:
initJdbcServicein classJdbcService- Throws:
CoreException
-
closeJdbcService
protected void closeJdbcService()
Close the service.This is called before the connection is closed
- Specified by:
closeJdbcServicein classJdbcService
-
startService
protected void startService() throws CoreExceptionStart the service.This is called after the connection is started
- Specified by:
startServicein classJdbcService- Throws:
CoreException
-
stopService
protected void stopService()
Stop the service.This is called after before the connection is stopped
- Specified by:
stopServicein classJdbcService
-
doService
public void doService(AdaptrisMessage message) throws ServiceException
Apply the service to the message.- Parameters:
message- theAdaptrisMessageto process.- Throws:
ServiceException- wrapping any underlyingException.
-
-