Package com.nt.udc.ei.node.jdbc
Class JDBCEITransport
java.lang.Object
com.nt.udc.ndk.node.EITransport
com.nt.udc.ei.node.jdbc.JDBCEITransport
- All Implemented Interfaces:
JDBCEIConfigFieldsIfc,DataProviderIfc,DCTransport,FileDataProviderIfc,JDBCNodeConfigFieldsIfc,Callback,StateBufferSaveable,StateFreezable,Runnable
public class JDBCEITransport
extends EITransport
implements JDBCEIConfigFieldsIfc, Callback, StateBufferSaveable, StateFreezable
This transport is responsible for periodically querying the specified
database and creating JDBCEIRecord objects to be processed.
-
Field Summary
Fields inherited from class com.nt.udc.ndk.node.EITransport
dataReceiver, fdChecked, filedataReceiver, fileduplicateCheck, fileToProcess, inputCount, lockFile, movedFile, node, pollingInterval, processing, processingDataFields inherited from interface com.nt.udc.ei.node.jdbc.JDBCEIConfigFieldsIfc
DBTABLE, DELETEROWS, FILTERBYID, FILTERBYTIME, FILTERCOLUMN, FILTERTYPE, ORDERBY, QUERYINTERVAL, RULESFILE, WHEREEXPR, WHEREEXPRCOUNTFields inherited from interface com.nt.udc.node.jdbc.JDBCNodeConfigFieldsIfc
DBCONNECT, DBPWORD, DBTYPE, DBUSER, ORACLE, ORACONNECT -
Constructor Summary
ConstructorsConstructorDescriptionJDBCEITransport(EINode node, JDBCEIRecordFactory rFactory, JDBCConnectionFactoryIfc cFactory, String query, int fType, String delete) Construct a new JDBCEITransport.JDBCEITransport(EINode node, JDBCEIRecordFactory rFactory, JDBCConnectionFactoryIfc cFactory, String query, int fType, String delete, DataReceiverIfc receiver) Construct a new JDBCEITransport. -
Method Summary
Modifier and TypeMethodDescriptionvoidcallback()This method is called when the receiving Object has performed a certain event, and wants to notify the implementor that the event has occurred.protected voidclose(boolean commit) Close the connection to the database.protected Connectionconnect()Attempt to establish the connection with the database.voidfreezeState(Callback freezeCallback) Used by the StateManager thread to halt the processing while the state of the node is saved.Not used, since data is pushed to the DataReceiver.getData()Not used, since data is pushed to the DataReceiver.booleanNot used, since the data is pushed to the DataReceiver.booleanThis method is used to check if the transport if fully functional.protected booleanIndicates whether this JDBCEITransport is runningvoidrestoreState(StateBuffer buffer) Restore the Object's state from the given buffer.voidrun()This is the transport's processing loop.voidsaveState(StateBuffer buffer) Save the Object's state to the given buffer.protected voidsetRunning(boolean run) Sets the boolean indicating whether the transport is runningvoidshutdown()Shuts the transport down cleanly.voidUsed by the StateManager thread to resume the processing previously halted.Methods inherited from class com.nt.udc.ndk.node.EITransport
getCurrArchFile, getData, getDataReceiver, getDubCheckObj, getDupCheckFlag, getFileBulkData, getFileData, getFileDataReceiver, getFileList, getMovedFileStatus, getNode, getPollingInterval, getProcessedArchFile, handleRejectOfFile, incrementIn, incrementIn, isEndOfFile, isFileDataAvailable, isProcessing, isProcessingData, isStartOfFile, moveCurrentFileToBackUp, openInputFile, rejectFile, removeProcessedFile, setCountsSuspect, setDataReceiver, setFileDataReceiver, setFileToProcess, setMovedFileStatus, setNode, setPollingInterval, setProcessedArchFile, setProcessing, signalBatchCompletion, validOIMinorType
-
Constructor Details
-
JDBCEITransport
public JDBCEITransport(EINode node, JDBCEIRecordFactory rFactory, JDBCConnectionFactoryIfc cFactory, String query, int fType, String delete) Construct a new JDBCEITransport.- Parameters:
node- Reference to the node using this transportrFactory- Factory used to create the EI recordscFactory- Factory used to create the database connectionquery- The query statement to be used to select specific rows from the databasefType- Indicates whether query is time-based or based upon a unique identifier columndelete- The delete statement to be used to delete rows from the database once they have been processed
-
JDBCEITransport
public JDBCEITransport(EINode node, JDBCEIRecordFactory rFactory, JDBCConnectionFactoryIfc cFactory, String query, int fType, String delete, DataReceiverIfc receiver) Construct a new JDBCEITransport.- Parameters:
node- Reference to the node using this transportrFactory- Factory used to create the EI recordscFactory- Factory used to create the database connectionquery- The query statement to be used to select specific rows from the databasefType- Indicates whether query is time-based or based upon a unique identifier columndelete- The delete statement to be used to delete rows from the database once they have been processedrecevier- The transport's DataReceiver
-
-
Method Details
-
run
public void run()This is the transport's processing loop. Until the node is shutdown, the transport will periodically query the database, producing JDBCEIRecord objects from the selected rows to be processed by the DataReceiver.- Specified by:
runin interfaceRunnable- Specified by:
runin classEITransport
-
shutdown
public void shutdown()Shuts the transport down cleanly.- Specified by:
shutdownin interfaceDCTransport- Specified by:
shutdownin classEITransport
-
isHealthy
public boolean isHealthy()This method is used to check if the transport if fully functional.- Specified by:
isHealthyin interfaceDCTransport- Overrides:
isHealthyin classEITransport- Returns:
- true if the transport is healthy, false otherwise
-
isDataAvailable
public boolean isDataAvailable()Not used, since the data is pushed to the DataReceiver.- Specified by:
isDataAvailablein interfaceDataProviderIfc- Specified by:
isDataAvailablein classEITransport- Returns:
- false (not used)
-
getData
Not used, since data is pushed to the DataReceiver.- Specified by:
getDatain interfaceDataProviderIfc- Specified by:
getDatain classEITransport- Returns:
- null (not used)
-
getBulkData
Not used, since data is pushed to the DataReceiver.- Specified by:
getBulkDatain interfaceDataProviderIfc- Specified by:
getBulkDatain classEITransport- Returns:
- null (not used)
-
callback
public void callback()Description copied from interface:CallbackThis method is called when the receiving Object has performed a certain event, and wants to notify the implementor that the event has occurred. -
saveState
Save the Object's state to the given buffer.- Specified by:
saveStatein interfaceStateBufferSaveable- Parameters:
buffer- Buffer for writing- Throws:
StateException
-
restoreState
Restore the Object's state from the given buffer.- Specified by:
restoreStatein interfaceStateBufferSaveable- Parameters:
buffer- Buffer for reading- Throws:
StateException
-
freezeState
Used by the StateManager thread to halt the processing while the state of the node is saved.- Specified by:
freezeStatein interfaceStateFreezable- Parameters:
freezeCallback- Object to notify when the processing has been frozen.
-
unfreezeState
public void unfreezeState()Used by the StateManager thread to resume the processing previously halted.- Specified by:
unfreezeStatein interfaceStateFreezable
-
setRunning
protected void setRunning(boolean run) Sets the boolean indicating whether the transport is running -
isRunning
protected boolean isRunning()Indicates whether this JDBCEITransport is running -
connect
Attempt to establish the connection with the database.- Throws:
SQLException
-
close
protected void close(boolean commit) Close the connection to the database.- Parameters:
commit-true, if any pending transactions should be commited prior to closing the database connection.
-