Class FileOITransport

java.lang.Object
com.nt.udc.ndk.node.OITransport
com.nt.udc.oi.transport.FileOITransport
All Implemented Interfaces:
DataReceiverIfc, DCTransport, FileDataReceiverIfc, Runnable

public class FileOITransport extends OITransport
This transport can be used as a generic transport for the creation and management of files created by an OI node. Constructed with an OIFileFormatter() object, this transport will obtain OI records from its DataProvider and pass them along to the formatter to be processed.
  • Field Details

  • Constructor Details

    • FileOITransport

      public FileOITransport(OINode oiNode, OIFileFormatter oiFileFormatter)
      Construct a new FileOITransport to be used within the specified OINode. The OIFileFormatter() object will create the output files.
      Parameters:
      oiNode - Reference to the OINode containing the transport.
      oiFileFormatter - OIFileFormatter() object responsible for file output and managing the output files.
    • FileOITransport

      public FileOITransport(OINode oiNode, OIFileFormatter oiFileFormatter, AbstractOIFtpPusher oiFtpPusher)
      Construct a new FileOITransport to be used within the specified OINode. The OIFileFormatter() object will create the output files. The AbstractOIFtpPusher() object will transfer the completed files to the remote host.
      Parameters:
      oiNode - Reference to the OINode containing the transport.
      oiFileFormatter - OIFileFormatter() object responsible for file output and managing the output files.
      abstractOiFtpPusher - AbastractOIFtpPusher() object responsible for transferring completed files to the remote host.
    • FileOITransport

      public FileOITransport(OINode oiNode, DataProviderIfc dp, OIFileFormatter oiFileFormatter)
      Construct a new FileOITransport to be used within the specified OINode, receiving its data from the given DataProvider. The OIFileFormatter() object will create the output files.
      Parameters:
      oiNode - Reference to the OINode containing the transport.
      dp - Reference to the transport's DataProvider.
      oiFileFormatter - OIFileWriter() object responsible for file output and managing the output files.
    • FileOITransport

      public FileOITransport(OINode oiNode, DataProviderIfc dp, OIFileFormatter oiFileFormatter, AbstractOIFtpPusher oiFtpPusher)
      Construct a new FileOITransport to be used within the specified OINode, receiving its data from the given DataProvider. The OIFileFormatter() object will create the output files. The AbstractOIFtpPusher() object will transfer the completed files to the remote host.
      Parameters:
      oiNode - Reference to the OINode containing the transport.
      dp - Reference to the transport's DataProvider.
      oiFileFormatter - OIFileFormatter() object responsible for file output and managing the output files.
      AbstractoiFtpPusher - AbstractOIFtpPusher() object responsible for transferring completed files to the remote host.
  • Method Details

    • isShutdownOnError

      public boolean isShutdownOnError()
      Indicates whether transport should shutdown upon processing error
    • setShutdownOnError

      public void setShutdownOnError(boolean flag)
      Indicates whether transport should shutdown upon processing error
      Parameters:
      flag - true, if error should cause a shutdown. Default is false.
    • dataIsAvailable

      public void dataIsAvailable()
      This method allows the transport's DataProvider to tell the transport that data is waiting to be 'picked up'. It is then the responsibility of the transport to retrieve the data and process it via the provider's getData() method and the receiver's processData() method.
      Specified by:
      dataIsAvailable in interface DataReceiverIfc
      Specified by:
      dataIsAvailable in class OITransport
    • run

      public void run()
      This method is used when the OITransport runs within its own thread. The method will retrieve the data from the transport's DataProvider and pass the DCFieldContainer() objects on to the processData() method.
      Specified by:
      run in interface Runnable
      Specified by:
      run in class OITransport
    • shutdown

      public void shutdown()
      Stop the transport. To ensure no loss of data, this method will wait for the transport to obtain and process all pending data from its DataProvider, unless it is shutting down due to a processing error.

      Upon shutdown, the currently open output file will be closed and a final check will be made for any output files which have exceeded the configured time threshold. Such files will be tagged with the appropriate file extension indicated by the 'processedfileextension' configuration parameter.

      Specified by:
      shutdown in interface DCTransport
      Specified by:
      shutdown in class OITransport
    • processData

      public void processData(DCFieldContainer record) throws NodeProcessingException
      Accept a DCFieldContainer to be written to the output file. Pass the record along to the file formatter to be output to the file.
      Specified by:
      processData in interface DataReceiverIfc
      Specified by:
      processData in class OITransport
      Parameters:
      record - DCFieldContainer containing the data.
      Throws:
      NodeProcessingException
    • processData

      public void processData(DCFieldContainer[] records) throws NodeProcessingException
      Accept some DCFieldContainer objects to be written to the output file. Pass the record along to the file formatter to be output to the file.
      Parameters:
      record - DCFieldContainer containing the data.
      Throws:
      NodeProcessingException
    • processFileData

      public boolean processFileData(DCFieldContainer dcfContainer) throws NodeProcessingException
      Description copied from class: OITransport
      This method should be overridden with the transport-specific logic to accept a DCFieldContainer object and send the information out through the desired protocol. This is just a dummy implementation, any transport needing to have file level transaction, should override this method and provide implementation.
      Specified by:
      processFileData in interface FileDataReceiverIfc
      Overrides:
      processFileData in class OITransport
      Parameters:
      dcfContainer - DCFieldContainer object containing the data.
      Returns:
      true, if data is processed successfully
      Throws:
      NodeProcessingException
    • processFileData

      public boolean processFileData(DCFieldContainer[] records) throws NodeProcessingException
      Description copied from class: OITransport
      Manipulates the set of data provided by its DataProvider This is just a dummy implementation, any transport needing to have file level transaction, should override this method and provide implementation.
      Specified by:
      processFileData in interface FileDataReceiverIfc
      Overrides:
      processFileData in class OITransport
      Returns:
      true, if data is processed successfully
      Throws:
      NodeProcessingException
    • processRejectFile

      public boolean processRejectFile()
      Description copied from class: OITransport
      Allows FileDataProvider to indicate rejection of the file This is just a dummy implementation, any transport needing to have file level transaction, should override this method and provide implementation.
      Specified by:
      processRejectFile in interface FileDataReceiverIfc
      Overrides:
      processRejectFile in class OITransport
      Returns:
      true , if processed successfully
    • processStartOfFileData

      public boolean processStartOfFileData(String originalFileName)
      Description copied from class: OITransport
      Allows FileDataProvider to indicate start of file This is just a dummy implementation, any transport needing to have file level transaction, should override this method and provide implementation.
      Specified by:
      processStartOfFileData in interface FileDataReceiverIfc
      Overrides:
      processStartOfFileData in class OITransport
      Returns:
      true, if data is available
    • processEndOfFileData

      public boolean processEndOfFileData(String transactionID)
      Description copied from class: OITransport
      Allows FileDataProvider to indicate end of file record This is just a dummy implementation, any transport needing to have file level transaction, should override this method and provide implementation.
      Specified by:
      processEndOfFileData in interface FileDataReceiverIfc
      Overrides:
      processEndOfFileData in class OITransport
      Returns:
      true , if processed successfully
    • isHealthy

      public boolean isHealthy()
      This method is used to check if the transport is fully functional.
      Specified by:
      isHealthy in interface DCTransport
      Overrides:
      isHealthy in class OITransport
      Returns:
      true if the transport is healthy, false otherwise
    • setTransactionID

      public void setTransactionID(String tID)
      Specified by:
      setTransactionID in interface FileDataReceiverIfc
      Overrides:
      setTransactionID in class OITransport