Package com.nt.udc.ndk.node
Class OIFileFormatter
java.lang.Object
com.nt.udc.ndk.node.OIFileFormatter
- Direct Known Subclasses:
FFOIFileFormatter
,GenevaOIFileFormatter
,IPDROIFormatter
,NAROIFormatter
,NARXMLOIFormatter
,XMLOIFormatter
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOIFileFormatter
(LoggerIfc logr, OIFileWriter oiFileWriter) Construct a newOIFileFormatter
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
fileClosing
(DCFieldContainer record) This method is called from putToFile() and shutdown() just before a file is closed.void
fileOpening
(DCFieldContainer record) This method is called from putToFile() after a new file is opened.Returns OIFileWriter ObjectReturns the AbstractOIFtpPusher objectboolean
This method is used to check if the formatter and its components are fully functional.void
putToFile
(DCFieldContainer record) Accept a DCFieldContainer.void
readyToCycle
(DCFieldContainer dcfc) void
setFtpPusher
(AbstractOIFtpPusher ftpPusher) Configure the FileFormatter to use an OIFtpPusher object to transfer the completed output files to a remote host.void
shutdown()
Stop the formatter.abstract void
This method should contain any logic required to properly format the output file (i.e.
-
Field Details
-
errMesg
-
logger
Object used to access the node's log file -
writer
Object which handles all file output operations -
emptyFile
protected boolean emptyFileIndicates when a new output file has been created. Useful for determining when to write file header, if necessary.
-
-
Constructor Details
-
OIFileFormatter
Construct a newOIFileFormatter
. TheOIFileWriter()
object will create the output files.- Parameters:
logr
- LoggerIfc() object providing access to the node's log fileoiFileWriter
- OIFileWriter() object responsible for file output and managing the output files.
-
-
Method Details
-
setFtpPusher
Configure the FileFormatter to use an OIFtpPusher object to transfer the completed output files to a remote host. -
getFtpPusher
Returns the AbstractOIFtpPusher object- Returns:
- pusher
-
getFileWriter
Returns OIFileWriter Object- Returns:
- writer
-
putToFile
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
- Throws:
IOException
-
fileOpening
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
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
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.
-