Class MXNarReader
java.lang.Object
com.metasolv.nm.processor.MXAggregator.MXNarReader
- All Implemented Interfaces:
Callback,StateBufferSaveable
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMXNarReader(File inputdir, LoggerIfc inLogger, File backupdir, DCNode node, CheckpointManager cpm, InputStatisticsMonitorIfc inCount, MXNarInputTracker inTracker) Creates a NarReader with backup capabilities, and state recovery capabilities. -
Method Summary
Modifier and TypeMethodDescriptionvoidcallback()This callback is made when the NarReader's call to saveState() has successfully saved the state of the system to disk.booleanThis method checks for an empty input directory.protected booleanThis implmentation is not thread-safe.booleanReturns whether there are more records available for processing.readNAR()Returns the next NAR.NAR[]readNARs()booleanremoveInputFile(File removeFile) voidrestoreState(StateBuffer buffer) Restores the runtime state of the Reader from a StateBuffer.voidsaveState(StateBuffer buffer) Saves the state of the NarReader to a buffer.voidshutdown()Tells the NarReader it is time to shut down.
-
Field Details
-
InputFileProp
-
NAROffsetProp
-
NARsInFileProp
-
-
Constructor Details
-
MXNarReader
public MXNarReader(File inputdir, LoggerIfc inLogger, File backupdir, DCNode node, CheckpointManager cpm, InputStatisticsMonitorIfc inCount, MXNarInputTracker inTracker) Creates a NarReader with backup capabilities, and state recovery capabilities.- Parameters:
inputdir- Node input directoryinLogger- Node loggerbackupdir- Node backup directorynode- Used to signal state backups.
-
-
Method Details
-
shutdown
public void shutdown()Tells the NarReader it is time to shut down. Don't forget to remember which file and which offset we were working on... -
readNAR
Returns the next NAR. Will automatically go to the next file if necessary.- Returns:
-
readNARs
-
removeInputFile
-
deleteOrRemoveFiles
protected boolean deleteOrRemoveFiles()This implmentation is not thread-safe.- Parameters:
removeFile-- Returns:
-
callback
public void callback()This callback is made when the NarReader's call to saveState() has successfully saved the state of the system to disk. This method can then clean up the input files. -
saveState
Saves the state of the NarReader to a buffer.- Specified by:
saveStatein interfaceStateBufferSaveable- Parameters:
buffer- Buffer containing state data
-
restoreState
Restores the runtime state of the Reader from a StateBuffer.- Specified by:
restoreStatein interfaceStateBufferSaveable- Parameters:
buffer- Buffer, holding the Reader data- Throws:
StateException
-
checkInput
public boolean checkInput()This method checks for an empty input directory.- Returns:
- true, if directory contains files
-
isDataAvailable
public boolean isDataAvailable()Returns whether there are more records available for processing.- Returns:
true, if data is available
-