|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.rhi.architecture.parc.adapter.AbstractOutputAdapter
com.rhi.architecture.parc.adapter.jdbc.JDBCOutputAdapter
JDBC Output Adapter. Helper class for interfaces implementing an Output Adapter using JDBC.
Field Summary |
Fields inherited from interface com.rhi.architecture.parc.OutputAdapter |
DEFAULT_THREAD_MODE, RUN_AS_THREAD, RUN_AS_THREAD_KEY |
Constructor Summary | |
JDBCOutputAdapter()
Default constructor |
Method Summary | |
protected void |
addErrorToRecord(Record r)
Add error to valid record for a problem during output adapter processing. |
void |
cleanup()
Cleanup any resources. |
protected java.lang.String |
getPersistErrorSQL()
Return the SQL for inserting or updating an error record. |
protected java.lang.String |
getPersistValidSQL()
Return the SQL for persisting (insert or update) a new valid record. |
protected java.lang.String |
getUpdateSQLForErrorSourceRecord()
Return the SQL for updating the source record corresponding to the given output record. |
protected java.lang.String |
getUpdateSQLForValidSourceRecord()
Return the SQL for updating the source record corresponding to the given output record. |
protected void |
handleErrorRecords(java.util.Collection c,
Transaction t)
General Case implementation for persisting error records. |
protected java.util.Collection |
handleValidRecords(java.util.Collection c,
Transaction t)
Handle persistence of valid records from the framework. |
void |
init(java.util.Properties props)
Initialize the Logger, and load the SQL statements. |
protected boolean |
persistErrorRecord(Error error,
Transaction t)
Add or update the error record. |
protected boolean |
persistValidRecord(Record record,
Transaction t)
Add or update valid records to the output table. |
protected java.sql.PreparedStatement |
prepareErrorStatement(Error error,
java.sql.Connection conn)
Get SQL, prepare SQL statement, and set all the error fields. |
protected java.sql.PreparedStatement |
prepareStatementForErrorSourceRecord(Record record,
java.sql.Connection conn)
Get SQL, prepare SQL statement, and set all the error fields. |
protected java.sql.PreparedStatement |
prepareStatementForValidSourceRecord(Record record,
java.sql.Connection conn)
Get SQL, prepare SQL statement, and set all the error fields. |
protected java.sql.PreparedStatement |
prepareValidStatement(Record record,
java.sql.Connection conn)
Get SQL, prepare SQL statement, and set all the appropriate fields. |
protected void |
setErrorStatementFields(Error error,
java.sql.PreparedStatement stmt)
Set the appropriate fields on the prepared statement Not abstract so that sub-classes that don't use prepareErrorStatement need not implement this w/ a no-op, but if anyone who _should_ implement it doesn't, it will "fail fast" & let them know immediately. |
protected void |
setStatementForErrorSourceRecord(Record record,
java.sql.PreparedStatement stmt)
Set the appropriate fields on the prepared statement Not abstract so that sub-classes that don't use prepareErrorStatement need not implement this w/ a no-op, but if anyone who _should_ implement it doesn't, it will "fail fast" & let them know immediately. |
protected void |
setStatementForValidSourceRecord(Record record,
java.sql.PreparedStatement stmt)
Set the appropriate fields on the prepared statement Not abstract so that sub-classes that don't use prepareErrorStatement need not implement this w/ a no-op, but if anyone who _should_ implement it doesn't, it will "fail fast" & let them know immediately. |
protected void |
setValidStatementFields(Record record,
java.sql.PreparedStatement stmt)
Set all the fields on the prepared statement using the output record. |
protected boolean |
updateSourceForErrorRecord(Record record,
Transaction t)
Mark the source record complete. |
protected boolean |
updateSourceForValidRecord(Record record,
Transaction t)
Mark the source record complete. |
Methods inherited from class com.rhi.architecture.parc.adapter.AbstractOutputAdapter |
close, completeBatch, createTransaction, flush, getAuditAgent, log, markComplete, run, setAuditAgent, setErrorChannel, setExceptionHandler, setValidChannel, write, writeErrorRecords, writeValidRecords |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JDBCOutputAdapter()
Method Detail |
public void init(java.util.Properties props) throws InitializationException
init
in interface OutputAdapter
init
in class AbstractOutputAdapter
props
- - the configuration data
InitializationException
- - Logger not properly configuredpublic void cleanup()
cleanup
in interface OutputAdapter
cleanup
in class AbstractOutputAdapter
protected java.util.Collection handleValidRecords(java.util.Collection c, Transaction t) throws ProcessingException
handleValidRecords
in class AbstractOutputAdapter
c
- - valid records.t
- - the transaction to use in committing the records.
ProcessingException
protected boolean persistValidRecord(Record record, Transaction t) throws ProcessingException
record
- t
-
ProcessingException
- - irrecoverable failure.protected java.sql.PreparedStatement prepareValidStatement(Record record, java.sql.Connection conn) throws java.sql.SQLException, ProcessingException
record
- conn
-
java.sql.SQLException
ProcessingException
protected void setValidStatementFields(Record record, java.sql.PreparedStatement stmt) throws java.sql.SQLException, ProcessingException
record
- stmt
- - the statement to execute.
ProcessingException
java.sql.SQLException
protected java.lang.String getPersistValidSQL()
protected void handleErrorRecords(java.util.Collection c, Transaction t) throws ProcessingException
handleErrorRecords
in class AbstractOutputAdapter
c
- - errored recordst
- - the database transaction under which
any SQL inserts/updates should be made.
ProcessingException
protected boolean persistErrorRecord(Error error, Transaction t) throws ProcessingException
error
- t
-
ProcessingException
protected java.sql.PreparedStatement prepareErrorStatement(Error error, java.sql.Connection conn) throws java.sql.SQLException, ProcessingException
error
- conn
-
java.sql.SQLException
ProcessingException
protected void setErrorStatementFields(Error error, java.sql.PreparedStatement stmt) throws java.sql.SQLException, ProcessingException
error
- stmt
-
java.sql.SQLException
ProcessingException
protected java.lang.String getPersistErrorSQL()
protected boolean updateSourceForValidRecord(Record record, Transaction t) throws ProcessingException
record
- the destination record.t
-
ProcessingException
protected java.sql.PreparedStatement prepareStatementForValidSourceRecord(Record record, java.sql.Connection conn) throws java.sql.SQLException, ProcessingException
record
- conn
-
java.sql.SQLException
ProcessingException
protected void setStatementForValidSourceRecord(Record record, java.sql.PreparedStatement stmt) throws java.sql.SQLException, ProcessingException
record
- stmt
-
java.sql.SQLException
ProcessingException
protected java.lang.String getUpdateSQLForValidSourceRecord()
protected boolean updateSourceForErrorRecord(Record record, Transaction t) throws ProcessingException
record
- the destination record.t
-
ProcessingException
protected java.sql.PreparedStatement prepareStatementForErrorSourceRecord(Record record, java.sql.Connection conn) throws java.sql.SQLException, ProcessingException
record
- conn
-
java.sql.SQLException
ProcessingException
protected void setStatementForErrorSourceRecord(Record record, java.sql.PreparedStatement stmt) throws java.sql.SQLException, ProcessingException
record
- stmt
-
java.sql.SQLException
ProcessingException
protected java.lang.String getUpdateSQLForErrorSourceRecord()
protected void addErrorToRecord(Record r)
r
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |