Class GenericFlatFileProcessor

All Implemented Interfaces:
DataProviderIfc, DCTransport, FileDataProviderIfc, Runnable
Direct Known Subclasses:
FlatFileEIProcessor, KnownFieldLengthFileProcessor

public abstract class GenericFlatFileProcessor extends FileEITransport
This is an abstract class that should be extended when a new type of flat file processing node is requrired
Since:
JDK1.3.1
  • Field Details

    • debug

      protected boolean debug
    • PROCESSED_FILE_PREFIX

      public static final String PROCESSED_FILE_PREFIX
      See Also:
    • PROCESSED_FILE_SUFFIX

      public static final String PROCESSED_FILE_SUFFIX
      See Also:
    • INPUT_BACKUP_DIR

      protected static final String INPUT_BACKUP_DIR
      See Also:
    • record

      protected DCEIRecord record
      Use one DCEIRecord for all data processing. This field should be set using the setRecordType call by the concrete class that is extending this class.
    • m_bCRTerminatorEnabled

      protected boolean m_bCRTerminatorEnabled
      This flag specifies if CR is active as a line delimiter.
    • m_bLFTerminatorEnabled

      protected boolean m_bLFTerminatorEnabled
      This flag specifies if LF is active as a line delimiter.
    • m_bCRLFTerminatorEnabled

      protected boolean m_bCRLFTerminatorEnabled
      This flag specifies if CRLF is active as a line delimiter.
    • actfile

      protected File actfile
    • inputStream

      protected FileInputStream inputStream
    • br

      protected com.nt.common.util.PosLineReader br
    • lineOfText

      protected String lineOfText
    • fileName

      protected String fileName
    • rawHeader

      protected String rawHeader
    • numBytes

      protected long numBytes
    • scratchFile

      protected File scratchFile
    • recoveryFile

      protected RandomAccessFile recoveryFile
    • FILENAME_NAR_ID

      protected static final String FILENAME_NAR_ID
      See Also:
    • UNICODE_TRANSFORMATION_FORMAT

      protected static final String UNICODE_TRANSFORMATION_FORMAT
      See Also:
  • Constructor Details

    • GenericFlatFileProcessor

      public GenericFlatFileProcessor(DCNode node, File localdir, String suffix, com.nt.common.util.SMGLock lock) throws NodeStartException
      Use this constructor when the accounting files are pushed to a local directory by an outside source.
      Parameters:
      node - The EI node which is using this class.
      localdir - The local directory where the target files can be found
      suffix - The file suffix used to identify the files that need to be processed (can be null if you want to process all files in the directory)
      Throws:
      NodeStartException - Used to signal the EI Node that there was a problem getting things going
    • GenericFlatFileProcessor

      public GenericFlatFileProcessor(DCNode node, SynchronizedDirectory sd, String suffix, com.nt.common.util.SMGLock lock) throws NodeStartException
      Use this constructor when using FTP to retrieve the accounting files that need to be processed.
      Parameters:
      node - The EI node which is using this class.
      sd - The representation of the local directory where the target files can be found
      suffix - The file suffix used to identify the files that need to be processed (can be null if you want to process all files in the directory)
      lock -
      Throws:
      NodeStartException - Used to signal the EI Node that there was a problem getting things going
  • Method Details

    • processFiles

      protected void processFiles(Vector filesToProcess)
      Here's where we actually parse the files and extract the data of interest.
      Specified by:
      processFiles in class FileEITransport
      Parameters:
      filesToProcess - list of filenames that need to be processed
    • processFilesOrdered

      protected void processFilesOrdered(File currFile)
    • processTheRecord

      protected abstract void processTheRecord(String rawRecord)
      This call process the record. Classes derived from this type should override this method to use there own record processing class.
      Parameters:
      String - rawRecord The raw unprocessed data record.
    • setRecordType

      protected void setRecordType(DCEIRecord rec)
      This call is used to set the specific object type used to process the individual records that have been read in from a flat file.
    • processScratchFile

      protected boolean processScratchFile()
      Processes scratch files in case of a abnormal shutdown.
    • skipAhead

      protected void skipAhead()
      This skips ahead in the last file being processed before termination. This should be overridden for record types the don't have a header record.
    • skipHeader

      protected void skipHeader()
      This code should be overridden by nodes which are processing data which does not have a header record. Just declare a member that does nothing.
    • getHeader

      protected void getHeader(String text)
      Parses a line of text (the file header) for the field names.
    • initLineTerminators

      protected void initLineTerminators()
      This method is used to initialize the line delimiters, which consist of combinations of CR, LF and CRLF. By default, all are active.