public class OpenFileEITransport extends EITransport
| Modifier and Type | Field and Description |
|---|---|
protected static int |
DEFAULT_POLLING_INTERVAL
Default polling interval if none is specified in config file:
|
protected static int |
DEFAULT_TIME_AWAITING_DATA
Default time awaiting data if none is specified in config file:
|
protected static java.lang.String |
DELETE_SCRATCH_FILES |
protected boolean |
m_activeFileRenamed
True if an active file become a closed file.
|
protected java.lang.String |
m_activefilter
Used as the key string for active file filter.
|
protected java.io.File |
m_activeScratchFile
Active scratch file before becomming closed.
|
protected java.lang.String |
m_closedfilter
Used as the key string for closed file filter.
|
protected ConfigIfc |
m_config
to get information from the node GUI
|
protected boolean |
m_deleteScratchFiles
Determines whether to delete the local files after
processing them.
|
protected InputFileProcessorIfc |
m_fileProcessor |
protected SMGLock |
m_ioLock
Used to synchronize the thread in which this object runs and the
EI Node's main thread when shutting odwn.
|
protected java.io.File |
m_localDir
Represents the local directory from which this object
gets files to process.
|
protected LoggerIfc |
m_logger
Represents the logging facility for the EI node using
this object.
|
protected FileSelectorIfc |
m_openFileSelector
Used to select the desired files from the given directory.
|
protected long |
m_time_awaiting_data
Repensents the idle time in milliseconds that awaiting next set of
billing records to be added to the active AMA DIRP file.
|
protected static java.lang.String |
POLLING_INTERVAL
Config string in the node's general config file:
|
protected static java.lang.String |
TIME_AWAITING_DATA |
dataReceiver, fdChecked, filedataReceiver, fileduplicateCheck, fileToProcess, inputCount, lockFile, movedFile, node, pollingInterval, processing, processingData, running| Constructor and Description |
|---|
OpenFileEITransport()
Constructor
|
OpenFileEITransport(EINode einode,
java.io.File syncDirectory,
java.lang.String activeFilter,
java.lang.String closedFilter,
SMGLock lock,
FileSelectorIfc fileSelector,
InputFileProcessorIfc fileProcessor)
Use this form when monitoring a local directory directly,
as opposed to waiting to be notified when files are ready to
process.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
deleteScratchFiles()
Returns "delete scratch files" flag:
|
DCFieldContainer[] |
getBulkData()
Allows a DataReceiver to obtain the available data in a
known format.
|
DCFieldContainer |
getData()
Allows a DataReceiver to obtain the available data in a
known format.
|
boolean |
isActive(java.io.File file)
Determines the given File object of the file is open/active.
|
boolean |
isDataAvailable()
Allows a DataReceiver to determine whether some data is
available for processing
|
protected void |
processFile(java.io.File fileToProcess)
Logic of processing a file:
Pre process this file
if this file is a close file then
process data of this file
otherwise, while this active/open file exist do
process data of this file
sleep some time util timeout
Post process this file
Repeat the whole process if the active file has been closed
|
protected void |
processFiles(java.util.Vector filesToProcess)
Here's where we actually parse the files and extract the data of
interest.
|
void |
run()
This is what gets executed as this object runs in its thread: Basically,
wait for files that need to be processed and then process them.
|
void |
shutdown()
Specifies actions needed to shut down the thread in which this
object runs.
|
getDataReceiver, getDubCheckObj, getDupCheckFlag, getFileBulkData, getFileData, getFileDataReceiver, getMovedFileStatus, getNode, getPollingInterval, handleRejectOfFile, incrementIn, incrementIn, isEndOfFile, isFileDataAvailable, isHealthy, isProcessing, isProcessingData, isStartOfFile, openInputFile, rejectFile, setCountsSuspect, setDataReceiver, setFileDataReceiver, setFileToProcess, setMovedFileStatus, setNode, setPollingInterval, setProcessingprotected static java.lang.String POLLING_INTERVAL
protected static java.lang.String TIME_AWAITING_DATA
protected static java.lang.String DELETE_SCRATCH_FILES
protected static int DEFAULT_POLLING_INTERVAL
protected static int DEFAULT_TIME_AWAITING_DATA
protected LoggerIfc m_logger
protected ConfigIfc m_config
protected java.io.File m_localDir
protected long m_time_awaiting_data
protected boolean m_deleteScratchFiles
protected SMGLock m_ioLock
protected FileSelectorIfc m_openFileSelector
protected InputFileProcessorIfc m_fileProcessor
protected java.lang.String m_activefilter
protected java.lang.String m_closedfilter
protected java.io.File m_activeScratchFile
protected boolean m_activeFileRenamed
public OpenFileEITransport()
public OpenFileEITransport(EINode einode, java.io.File syncDirectory, java.lang.String activeFilter, java.lang.String closedFilter, SMGLock lock, FileSelectorIfc fileSelector, InputFileProcessorIfc fileProcessor) throws NodeStartException
einode - specifies the EINode using this processing
engine.inputDirectory - specifies the directory from which this node
gets files to process.activeFilter - specifies the prefix of the active files this
node will process.closedFilter - specifies the prefix of the closed files this
node will process.fileSelector - specifies the file selector.lock - used to properly shutdown the EI and all its
threads.fileProcessor - specifies the AMA DIRP files processor.NodeStartExceptionpublic void shutdown()
shutdown in interface DCTransportshutdown in class EITransportpublic DCFieldContainer getData()
getData in interface DataProviderIfcgetData in class EITransportpublic DCFieldContainer[] getBulkData()
getBulkData in interface DataProviderIfcgetBulkData in class EITransportpublic boolean isDataAvailable()
isDataAvailable in interface DataProviderIfcisDataAvailable in class EITransporttrue, if data is availablepublic void run()
run in interface java.lang.Runnablerun in class EITransportprotected void processFiles(java.util.Vector filesToProcess)
filesToProcess - list of filenames that need to be processedprotected void processFile(java.io.File fileToProcess)
fileToProcess - A single file that need to be processedpublic boolean deleteScratchFiles()
public boolean isActive(java.io.File file)
file - The File object of the file.