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.
  • 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 transport
      rFactory - Factory used to create the EI records
      cFactory - Factory used to create the database connection
      query - The query statement to be used to select specific rows from the database
      fType - Indicates whether query is time-based or based upon a unique identifier column
      delete - 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 transport
      rFactory - Factory used to create the EI records
      cFactory - Factory used to create the database connection
      query - The query statement to be used to select specific rows from the database
      fType - Indicates whether query is time-based or based upon a unique identifier column
      delete - The delete statement to be used to delete rows from the database once they have been processed
      recevier - 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 interface Runnable
      Specified by:
      run in class EITransport
    • shutdown

      public void shutdown()
      Shuts the transport down cleanly.
      Specified by:
      shutdown in interface DCTransport
      Specified by:
      shutdown in class EITransport
    • isHealthy

      public boolean isHealthy()
      This method is used to check if the transport if fully functional.
      Specified by:
      isHealthy in interface DCTransport
      Overrides:
      isHealthy in class EITransport
      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 interface DataProviderIfc
      Specified by:
      isDataAvailable in class EITransport
      Returns:
      false (not used)
    • getData

      public DCFieldContainer getData()
      Not used, since data is pushed to the DataReceiver.
      Specified by:
      getData in interface DataProviderIfc
      Specified by:
      getData in class EITransport
      Returns:
      null (not used)
    • getBulkData

      public DCFieldContainer[] getBulkData()
      Not used, since data is pushed to the DataReceiver.
      Specified by:
      getBulkData in interface DataProviderIfc
      Specified by:
      getBulkData in class EITransport
      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.
      Specified by:
      callback in interface Callback
    • saveState

      public void saveState(StateBuffer buffer) throws StateException
      Save the Object's state to the given buffer.
      Specified by:
      saveState in interface StateBufferSaveable
      Parameters:
      buffer - Buffer for writing
      Throws:
      StateException
    • restoreState

      public void restoreState(StateBuffer buffer) throws StateException
      Restore the Object's state from the given buffer.
      Specified by:
      restoreState in interface StateBufferSaveable
      Parameters:
      buffer - Buffer for reading
      Throws:
      StateException
    • freezeState

      public void freezeState(Callback freezeCallback)
      Used by the StateManager thread to halt the processing while the state of the node is saved.
      Specified by:
      freezeState in interface StateFreezable
      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 interface StateFreezable
    • 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

      protected Connection connect() throws SQLException
      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.