Package com.nt.udc.ei.transport
Class InputFileProcessor
java.lang.Object
com.nt.udc.ei.transport.InputFileProcessor
- All Implemented Interfaces:
InputFileProcessorIfc
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected InputStatisticsMonitorIfc
protected LoggerIfc
Represents the logging facility for the EI node using this object.protected EINode
protected boolean
Number of bytes having been read so far. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected long
Returns the length stored in the scratch file.protected void
boolean
postProcessInputData
(OpenFileInputStream inputStream, File fileToProcess, File scratchFile) boolean
preProcessInputData
(OpenFileInputStream inputStream, File fileToProcess, File scratchFile) boolean
processInputData
(OpenFileInputStream inputStream, DataReceiverIfc dataReceiver) void
shutdown()
Specifies actions needed to shut down the thread in which this object runs.protected void
writeLength
(File scratchfile, long len) Record a long in a file - used to write a length in a scratch file to keep track of how much of a file has been processed.
-
Field Details
-
running
protected boolean runningNumber of bytes having been read so far. -
logger
Represents the logging facility for the EI node using this object. -
node
-
inputCount
-
-
Constructor Details
-
InputFileProcessor
-
-
Method Details
-
preProcessInputData
public boolean preProcessInputData(OpenFileInputStream inputStream, File fileToProcess, File scratchFile) throws Exception - Specified by:
preProcessInputData
in interfaceInputFileProcessorIfc
- Throws:
Exception
-
processInputData
public boolean processInputData(OpenFileInputStream inputStream, DataReceiverIfc dataReceiver) throws Exception - Specified by:
processInputData
in interfaceInputFileProcessorIfc
- Throws:
Exception
-
postProcessInputData
public boolean postProcessInputData(OpenFileInputStream inputStream, File fileToProcess, File scratchFile) throws Exception - Specified by:
postProcessInputData
in interfaceInputFileProcessorIfc
- Throws:
Exception
-
shutdown
public void shutdown()Specifies actions needed to shut down the thread in which this object runs.- Specified by:
shutdown
in interfaceInputFileProcessorIfc
-
writeLength
Record a long in a file - used to write a length in a scratch file to keep track of how much of a file has been processed. Used for recovering when the node is shut down prematurely (or crashes or dies unexpectedly). To use this, call it from the appropriate place in your version of the "processFiles" method. -
getLength
Returns the length stored in the scratch file. Used to keep track of how much of a file has been processed.- Parameters:
file
- Specifies the scratch file.- Returns:
- number of bytes that have already been read and processed.
-
getRecoveryInformation
- Specified by:
getRecoveryInformation
in interfaceInputFileProcessorIfc
-
incrementIn
protected void incrementIn()
-