Class OIFileFormatter

java.lang.Object
com.nt.udc.ndk.node.OIFileFormatter
Direct Known Subclasses:
FFOIFileFormatter, GenevaOIFileFormatter, IPDROIFormatter, NAROIFormatter, NARXMLOIFormatter, XMLOIFormatter

public abstract class OIFileFormatter extends Object
This class is responsible for managing the output files via OIFileWriter() and performing any specific file-formatting operations. DCFieldContainers are accepted from the transport and written to the file.
  • Field Details

    • errMesg

      protected String errMesg
    • logger

      protected LoggerIfc logger
      Object used to access the node's log file
    • writer

      protected OIFileWriter writer
      Object which handles all file output operations
    • emptyFile

      protected boolean emptyFile
      Indicates when a new output file has been created. Useful for determining when to write file header, if necessary.
  • Constructor Details

    • OIFileFormatter

      public OIFileFormatter(LoggerIfc logr, OIFileWriter oiFileWriter)
      Construct a new OIFileFormatter. The OIFileWriter() object will create the output files.
      Parameters:
      logr - LoggerIfc() object providing access to the node's log file
      oiFileWriter - OIFileWriter() object responsible for file output and managing the output files.
  • Method Details

    • setFtpPusher

      public void setFtpPusher(AbstractOIFtpPusher ftpPusher)
      Configure the FileFormatter to use an OIFtpPusher object to transfer the completed output files to a remote host.
    • getFtpPusher

      public AbstractOIFtpPusher getFtpPusher()
      Returns the AbstractOIFtpPusher object
      Returns:
      pusher
    • getFileWriter

      public OIFileWriter getFileWriter()
      Returns OIFileWriter Object
      Returns:
      writer
    • putToFile

      public void putToFile(DCFieldContainer record) throws NodeProcessingException
      Accept a DCFieldContainer. The contents of the field container object will be written to the output file. This method is also responsible for cycling the output files.
      Throws:
      NodeProcessingException
    • shutdown

      public void shutdown()
      Stop the formatter. This method will close the active output file and shutdown the file writer, stopping the thread which determines when the active file is ready to be cycled.
    • readyToCycle

      public void readyToCycle(DCFieldContainer dcfc) throws IOException
      Throws:
      IOException
    • fileOpening

      public void fileOpening(DCFieldContainer record) throws IOException
      This method is called from putToFile() after a new file is opened. The default implementation is to do nothing. It should be overridden as necessary to perform any operations related to the opening of the output file (i.e. write a file header record). It accepts the DCFieldContainer object passed in to putToFile(), should any information contained within the record be necessary (i.e. file header record).
      Throws:
      IOException
    • fileClosing

      public void fileClosing(DCFieldContainer record) throws IOException
      This method is called from putToFile() and shutdown() just before a file is closed. The default implementation is to do nothing. It should be overridden as necessary to perform any operations related to the closing of the output file (i.e. write a file trailer record). It accepts the DCFieldContainer object passed in to putToFile(), should any information contained within the record be necessary (i.e. file trailer record). When called from the shutdown() method, no DCFieldContainer object is available so a null is passed in.
      Throws:
      IOException
    • writeToFile

      public abstract void writeToFile(DCFieldContainer dcf) throws IOException
      This method should contain any logic required to properly format the output file (i.e. multiple records per detail line, data collection for trailer record, etc.)
      Throws:
      IOException
    • isHealthy

      public boolean isHealthy()
      This method is used to check if the formatter and its components are fully functional.