Class NARStreamHandler

java.lang.Object
com.nt.udc.nar.NARStreamHandler
All Implemented Interfaces:
DataProviderIfc, DataReceiverIfc, DCStreamHandler, FileDataProviderIfc, FileDataReceiverIfc
Direct Known Subclasses:
MXNARFileManager, NARFileManager

public abstract class NARStreamHandler extends Object implements DCStreamHandler
Provides file (or more generically stream) management for the node, such as reading and writing NARs to and from the .cache files
  • Field Details

    • inputShutdown

      protected boolean inputShutdown
      Indicates whether the input stream of the StreamHandler is available
    • outputShutdown

      protected boolean outputShutdown
      Indicates whether the output stream of the StreamHandler is available
    • narsIn

      protected Long narsIn
      Total number of NARs read
    • narsOut

      protected Long narsOut
      Total number of NARs written
    • np

      protected DCNodePerformance np
      Node Performance object
  • Constructor Details

    • NARStreamHandler

      public NARStreamHandler()
  • Method Details

    • readData

      public DCFieldContainer readData()
      Calls readNAR()
      Specified by:
      readData in interface DCStreamHandler
    • readNAR

      public abstract NAR readNAR()
      Retrieves a single NAR file
    • readNARs

      public abstract NAR[] readNARs()
      Retrieves multiple NARs
    • writeData

      public boolean writeData(DCFieldContainer field)
      Calls storeNAR()
      Specified by:
      writeData in interface DCStreamHandler
      Parameters:
      field - Object to put the information into
      Returns:
      true, if the data was successfully written to the object
    • writeData

      public boolean writeData(DCFieldContainer[] fields)
      Calls storeNAR()
      Specified by:
      writeData in interface DCStreamHandler
      Returns:
      true, if the data was successfully written to the object
    • getPerformanceMetrics

      public DCNodePerformance getPerformanceMetrics()
      Returns a node performance object
      Specified by:
      getPerformanceMetrics in interface DCStreamHandler
      Returns:
      DCNodePerformance object,
    • storeNAR

      public abstract boolean storeNAR(NAR record)
      Writes a single NAR to the cache file
    • storeNARs

      public abstract boolean storeNARs(NAR[] records)
      Writes a multiple NARs to the cache file
    • cleanup

      public abstract boolean cleanup()
      Deletes NARs files that have been processed
      Specified by:
      cleanup in interface DCStreamHandler
    • shutdown

      public void shutdown()
      Performs tasks necessary to cleanly shutdown the stream handler
      Specified by:
      shutdown in interface DCStreamHandler
    • shutdownInput

      public void shutdownInput()
      Performs tasks necessary to cleanly shutdown the input stream of the stream handler
      Specified by:
      shutdownInput in interface DCStreamHandler
    • shutdownOutput

      public void shutdownOutput()
      Performs tasks necessary to cleanly shutdown the output stream of the stream handler
      Specified by:
      shutdownOutput in interface DCStreamHandler
    • getRealNarsIn

      public abstract long getRealNarsIn()
      This must return a count of how many records this node has read in, since it started. The counts should be accurate, even if this node is an EI/CC. (as opposed to the narsIN counter, which won't count any input records if the node is an EI.)
      Returns: