Class MXNarInputTracker

java.lang.Object
com.metasolv.nm.processor.MXAggregator.MXNarInputTracker

public class MXNarInputTracker extends Object
  • Field Details

    • MXFieldKey_Filename

      public static final FieldKey MXFieldKey_Filename
    • MXFieldKey_RecordID

      public static final FieldKey MXFieldKey_RecordID
  • Constructor Details

    • MXNarInputTracker

      public MXNarInputTracker(File inputDirectory, File scratchDirectory)
      + To be called by MXNarFileManager.init().
      Parameters:
      inputDirectory - is where the directory that holds the input record/NAR files.
      scratchDirectory - is the node's temporary directory.
  • Method Details

    • setRecordReader

      public void setRecordReader(MXNarReader reader)
      The MXNarFileManager creates this object first, then gives this object to the MXNarReader's constructor. This method lets the MXNarFileManager set the created MXNarReader object afterwards. The MXNarRead object is needed to do the actual file removal work, since there's more than just deleting a file. + MXNarFileManager.init()
      Parameters:
      reader -
    • trackFile

      public void trackFile(String newNarFile)
      When MXNarReader opened a new Nar file for input, it should tell me about it using this method. This method will create a new journal file. If a matching journal file already exists, it will read the file to populate the list of processed record numbers. + MXNarReader.setupNextInputFile(), almost last line
      Parameters:
      newNarFile -
    • isTrackedFile

      public boolean isTrackedFile(String narFile)
      For use by MXNarReader to find out if an input file is known by this object. Files that this object knows about will be deleted by this object.
      Parameters:
      narFile -
      Returns:
    • isRecordProcessed

      public boolean isRecordProcessed(DCFieldContainer dcfc)
      Check the internal list of processed records for the procssed status of this record. The originating filename and record# should be embedded in the NAR already. + This method is to be used by MXNarInputProcessor.run().
      Parameters:
      nar -
      Returns:
    • startRecordProcessing

      public void startRecordProcessing(DCFieldContainer dcfc)
      Add this record to the outstanding record list of the matching input file entry. + This method is to be used by MXNarInputProcessor.getData().
      Parameters:
      dcfc -
    • endRecordProcessing

      public void endRecordProcessing(DCFieldContainer dcfc)
      Keep this recordID in the "processed list" of the filename. Also write a journal entry for this file about this record. Finally, if there are no more outstanding records for this file, delete the actual input file, the matching journal file, and any hashtable/array/whatever related to tracking stuff in this file. + This method is to be called by MXNPLFieldProcessor.processData() MXNarProvider.endRecordProcessing() MXNarInputProcessor.endRecordProcessing().
      Parameters:
      nar -
    • saveRecordDetails

      public void saveRecordDetails(DCFieldContainer dcfc, String filename, int recordID)
      Store the filename and recordID as Fields inside the NAR, so that the information can be recovered later by other methods in this class. + Used by MXNarReader.readNAR().
      Parameters:
      dcfc -
      filename -
      recordID -
    • setEndOfFileReached

      public void setEndOfFileReached(String filename, long size)
      Tell the tracker that all records of this file has been read in. (But not all are processed yet.) + To be used by MXNarReader.handleEndOfFile().
      Parameters:
      filename -
    • handleBadFile

      public void handleBadFile(String filename, long size)
      The specified input record file is bad and will be deleted shortly (after this method). + Used by MXNarReader.handleInputFileError().
      Parameters:
      filename -
    • shutdown

      public void shutdown()
      Close all open journal files. Empty the internal file entry mappings. + This is used by MXNarFileManager.shutdownOutput(), because MXNarFileManager created this thing. It's in shutdownOutput() because both MXNarInputProcessor thread and the field processor threads are still using the entries inside the fileMap, so they have to be shutdown first.