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, processingData
Fields inherited from interface com.nt.udc.ei.node.jdbc.JDBCEIConfigFieldsIfc
DBTABLE, DELETEROWS, FILTERBYID, FILTERBYTIME, FILTERCOLUMN, FILTERTYPE, ORDERBY, QUERYINTERVAL, RULESFILE, WHEREEXPR, WHEREEXPRCOUNT
Fields 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 TypeMethodDescriptionvoid
callback()
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 void
close
(boolean commit) Close the connection to the database.protected Connection
connect()
Attempt to establish the connection with the database.void
freezeState
(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.boolean
Not used, since the data is pushed to the DataReceiver.boolean
This method is used to check if the transport if fully functional.protected boolean
Indicates whether this JDBCEITransport is runningvoid
restoreState
(StateBuffer buffer) Restore the Object's state from the given buffer.void
run()
This is the transport's processing loop.void
saveState
(StateBuffer buffer) Save the Object's state to the given buffer.protected void
setRunning
(boolean run) Sets the boolean indicating whether the transport is runningvoid
shutdown()
Shuts the transport down cleanly.void
Used 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:
run
in interfaceRunnable
- Specified by:
run
in classEITransport
-
shutdown
public void shutdown()Shuts the transport down cleanly.- Specified by:
shutdown
in interfaceDCTransport
- Specified by:
shutdown
in classEITransport
-
isHealthy
public boolean isHealthy()This method is used to check if the transport if fully functional.- Specified by:
isHealthy
in interfaceDCTransport
- Overrides:
isHealthy
in 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:
isDataAvailable
in interfaceDataProviderIfc
- Specified by:
isDataAvailable
in classEITransport
- Returns:
- false (not used)
-
getData
Not used, since data is pushed to the DataReceiver.- Specified by:
getData
in interfaceDataProviderIfc
- Specified by:
getData
in classEITransport
- Returns:
- null (not used)
-
getBulkData
Not used, since data is pushed to the DataReceiver.- Specified by:
getBulkData
in interfaceDataProviderIfc
- Specified by:
getBulkData
in classEITransport
- Returns:
- null (not used)
-
callback
public void callback()Description copied from interface:Callback
This 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:
saveState
in interfaceStateBufferSaveable
- Parameters:
buffer
- Buffer for writing- Throws:
StateException
-
restoreState
Restore the Object's state from the given buffer.- Specified by:
restoreState
in 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:
freezeState
in 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:
unfreezeState
in 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.
-