public abstract class FileEITransport 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 java.lang.String |
DELETE_LOCAL_FILES
Config string in the node's general config file:
|
protected boolean |
deleteLocalFiles
Determines whether to delete the local files after
processing them.
|
protected boolean |
fileLevelTransaction |
protected FileEISequenceCheck |
fileSeqCheck |
protected boolean |
fsChecked |
static java.lang.String |
INPUT_BACKUP_DIR |
protected SMGLock |
ioLock
Used to synchronize the thread in which this object runs and the
EI Node's main thread when shutting odwn.
|
protected boolean |
isOrdered |
protected java.lang.String |
itsFileSuffix
Specifies the suffix of the files this node will process
|
protected java.io.File |
localDir
Represents the local directory from which this object
gets files to process.
|
protected LoggerIfc |
logger
Represents the logging facility for the EI node using
this object.
|
protected boolean |
mtChecked |
static java.lang.String |
MULTI_THREADED |
static java.lang.String |
ORDER_REQUIRED |
protected static java.lang.String |
POLLING_INTERVAL
Config string in the node's general config file:
|
protected SynchronizedDirectory |
scratchDir
Represents the local directory from which this object
gets files to process.
|
protected boolean |
useSynchronizedDirectory
Determines whether to use a SynchronizedDirectory or
just a File object for monitoring for files to process.
|
dataReceiver, fdChecked, filedataReceiver, fileduplicateCheck, fileToProcess, inputCount, lockFile, movedFile, node, pollingInterval, processing, processingData, running
Constructor and Description |
---|
FileEITransport(DCNode node,
java.io.File sd,
java.lang.String suffix,
SMGLock lock)
Use this form when monitoring a local directory directly,
as opposed to waiting to be notified when files are ready to
process.
|
FileEITransport(DCNode node,
SynchronizedDirectory sd,
java.lang.String suffix,
SMGLock lock)
Use this form when you want to be notified when files are ready to
be processed.
|
Modifier and Type | Method and Description |
---|---|
boolean |
deleteLocalFiles()
Returns "delete local files" flag:
|
protected java.io.FilenameFilter |
getActFilter() |
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.
|
java.lang.String |
getInputBackupDir() |
protected long |
getLength(java.io.File file)
Returns the length stored in the scratch
file.
|
boolean |
isDataAvailable()
Allows a DataReceiver to determine whether some data is
available for processing
|
boolean |
isHealthy()
This method is used to check if the transport is fully functional.
|
boolean |
isLessThan(java.lang.String value1,
java.lang.String value2) |
void |
moveCurrentFileToBackUp(java.io.File currentFile,
java.lang.String newFilename) |
protected abstract void |
processFiles(java.util.Vector filesToProcess)
Here's where we actually parse the files and extract the data of interest.
|
protected long |
readLength(java.io.RandomAccessFile recoveryFile)
This method is used to read the number of bytes already read and
processed.
|
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.
|
protected void |
setActFilter(java.io.FilenameFilter newFilter) |
void |
setDubCheckObj(FileEIDuplicateCheck fileduplicateCheck) |
void |
setDupCheckFlag(boolean fdChecked) |
void |
setSeqCheckFlag(boolean fsChecked) |
void |
setSeqCheckObj(FileEISequenceCheck fileSeqCheck) |
void |
shutdown()
Specifies actions needed to shut down the thread in which this
object runs.
|
java.lang.String[] |
sortFiles(java.lang.String[] filesToProcess) |
protected void |
writeLength(java.io.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.
|
protected void |
writeLength(java.io.RandomAccessFile recoveryFile,
long len)
This method is used to store the current input file's length in
the recovery file.
|
getCurrArchFile, getData, getDataReceiver, getDubCheckObj, getDupCheckFlag, getFileBulkData, getFileData, getFileDataReceiver, getFileList, getMovedFileStatus, getNode, getPollingInterval, getProcessedArchFile, handleRejectOfFile, incrementIn, incrementIn, isEndOfFile, isFileDataAvailable, isProcessing, isProcessingData, isStartOfFile, openInputFile, rejectFile, removeProcessedFile, setCountsSuspect, setDataReceiver, setFileDataReceiver, setFileToProcess, setMovedFileStatus, setNode, setPollingInterval, setProcessedArchFile, setProcessing, signalBatchCompletion, validOIMinorType
protected static java.lang.String POLLING_INTERVAL
protected static java.lang.String DELETE_LOCAL_FILES
public static final java.lang.String MULTI_THREADED
public static final java.lang.String ORDER_REQUIRED
public static final java.lang.String INPUT_BACKUP_DIR
protected static int DEFAULT_POLLING_INTERVAL
protected boolean deleteLocalFiles
protected LoggerIfc logger
protected SynchronizedDirectory scratchDir
protected java.io.File localDir
protected boolean useSynchronizedDirectory
protected java.lang.String itsFileSuffix
protected SMGLock ioLock
protected boolean mtChecked
protected boolean isOrdered
protected boolean fileLevelTransaction
protected FileEISequenceCheck fileSeqCheck
protected boolean fsChecked
public FileEITransport(DCNode node, java.io.File sd, java.lang.String suffix, SMGLock lock) throws NodeStartException
node
- specifies the DCNode using this processing enginesd
- specifies the directory from which this node gets files to processsuffix
- specifies the suffix of the files this node will processlock
- used to properly shutdown the EI and all its threadsNodeStartException
public FileEITransport(DCNode node, SynchronizedDirectory sd, java.lang.String suffix, SMGLock lock) throws NodeStartException
node
- specifies the DCNode using this processing enginesd
- specifies the directory from which this node gets files to processsuffix
- specifies the suffix of the files this node will processlock
- used to properly shutdown the EI and all its threadsNodeStartException
public void shutdown()
shutdown
in interface DCTransport
shutdown
in class EITransport
public DCFieldContainer getData()
getData
in interface DataProviderIfc
getData
in class EITransport
public DCFieldContainer[] getBulkData()
getBulkData
in interface DataProviderIfc
getBulkData
in class EITransport
public boolean isDataAvailable()
isDataAvailable
in interface DataProviderIfc
isDataAvailable
in class EITransport
true
, if data is availablepublic void run()
run
in interface java.lang.Runnable
run
in class EITransport
protected abstract void processFiles(java.util.Vector filesToProcess)
filesToProcess
- list of filenames that need to be processedpublic boolean deleteLocalFiles()
protected void writeLength(java.io.File scratchfile, long len)
protected long getLength(java.io.File file)
file
- Specifies the scratch file.public boolean isHealthy()
isHealthy
in interface DCTransport
isHealthy
in class EITransport
protected void writeLength(java.io.RandomAccessFile recoveryFile, long len)
recoveryFile
- Specifies the recovery file.protected long readLength(java.io.RandomAccessFile recoveryFile)
recoveryFile
- Specifies the recovery file.protected java.io.FilenameFilter getActFilter()
protected void setActFilter(java.io.FilenameFilter newFilter)
public java.lang.String[] sortFiles(java.lang.String[] filesToProcess)
public boolean isLessThan(java.lang.String value1, java.lang.String value2)
public void setDupCheckFlag(boolean fdChecked)
public void setSeqCheckFlag(boolean fsChecked)
public void setDubCheckObj(FileEIDuplicateCheck fileduplicateCheck)
public void setSeqCheckObj(FileEISequenceCheck fileSeqCheck)
public java.lang.String getInputBackupDir()
public void moveCurrentFileToBackUp(java.io.File currentFile, java.lang.String newFilename) throws java.io.IOException
moveCurrentFileToBackUp
in class EITransport
java.io.IOException