Package com.metasolv.nm.collector.file
Class FileEITransport
java.lang.Object
com.nt.udc.ndk.node.EITransport
com.metasolv.nm.collector.file.FileEITransport
- All Implemented Interfaces:
DataProviderIfc,DCTransport,FileDataProviderIfc,Runnable
This class is based on the other FileEITransport class of the same name. The main
differences are that the FileEITransport is now responsible for instantiating the
FTP objects, and that the data processing layer has been separated into a distinct
file handler object instead of being handled in a sub-classed object.
The FileEITransport class is responsible for managing the data files on the local
server. It will initialize the FTP objects if an FTP-pull approach is being used.
It will then poll the configured local directory for new data files and will pass
them to the file handler object for processing. Once the file handler has finished
processing the file, the transport will either rename or delete it based on the
node's configuration.
This class will also provide a safety mechanism whereby it will rename files that
are not successfully processed after 3 attempts with a ".error" extension. This
will ensure that a corrupt file does not hold up the processing of subsequent
valid files.
This class provides a mechanism to monitor a directory for files to process by either
a "SynchronizedDirectory" object or a standard File Object. A SynchronizedDirectory
object is used when objects of this class need to be informed when files are available,
and the standard File object is used when this class directly monitors the directory.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DirectoryStream.Filter<Path> protected static final Stringprotected static final Stringprotected static final Stringprotected static final intprotected static final Stringprotected booleanprotected static final Stringprotected Stringprotected Stringprotected static final Stringprotected HashMapprotected FileHandlerIfcprotected booleanprotected Stringprotected FileEISequenceCheckprotected booleanprotected FtpFileTrackerprotected FtpEIManagerprotected com.nt.common.util.SMGLockprotected booleanprotected Fileprotected Stringprotected Stringprotected Stringprotected LoggerIfcprotected static final intprotected static final Stringprotected SynchronizedDirectoryprotected booleanprotected booleanFields inherited from class com.nt.udc.ndk.node.EITransport
dataReceiver, fdChecked, filedataReceiver, fileduplicateCheck, fileToProcess, inputCount, lockFile, movedFile, node, pollingInterval, processing, processingData, running -
Constructor Summary
ConstructorsConstructorDescriptionFileEITransport(DCNode node, FileHandlerIfc handler, com.nt.common.util.SMGLock lock, boolean ordered, boolean fdChecked, FileEIDuplicateCheck fileduplicateCheck, boolean fsChecked, FileEISequenceCheck fileSeqCheck) FileEITransport(DCNode node, FileHandlerIfc handler, com.nt.common.util.SMGLock lock, boolean ordered, FtpFileTracker tracker, boolean fdChecked, FileEIDuplicateCheck fileduplicateCheck, boolean fsChecked, FileEISequenceCheck fileSeqCheck) FileEITransport(DCNode node, FileHandlerIfc handler, com.nt.common.util.SMGLock lock, boolean fdChecked, FileEIDuplicateCheck fileduplicateCheck, boolean fsChecked, FileEISequenceCheck fileSeqCheck) -
Method Summary
Modifier and TypeMethodDescriptionThis method is used by the DataReceiver to fetch a set of DCFieldContainer objects.getData()This method is used by the DataReceiver to fetch a singleprotected VectorgetFiles()protected voidbooleanThis method is used by the DataReceiver to ask this provider if data is available.booleanThis method is used to check the transport's state of health.booleanisLessThan(String value1, String value2) protected voidprocessError(File file) protected voidprocessFiles(Vector filesToProcess) protected voidprocessFilesOrdered(File currentFile) booleanrecoveryFileExists(File file) voidrun()This method is used to control processing for fetching data from the EI's source.voidshutdown()This method is used to provide a means of shutting down the transport in an orderly fashion.String[]Methods inherited from class com.nt.udc.ndk.node.EITransport
getCurrArchFile, getData, getDataReceiver, getDubCheckObj, getDupCheckFlag, getFileBulkData, getFileData, getFileDataReceiver, getFileList, getMovedFileStatus, getNode, getPollingInterval, getProcessedArchFile, handleRejectOfFile, incrementIn, incrementIn, isEndOfFile, isFileDataAvailable, isProcessing, isProcessingData, isStartOfFile, moveCurrentFileToBackUp, openInputFile, rejectFile, removeProcessedFile, setCountsSuspect, setDataReceiver, setFileDataReceiver, setFileToProcess, setMovedFileStatus, setNode, setPollingInterval, setProcessedArchFile, setProcessing, signalBatchCompletion, validOIMinorType
-
Field Details
-
logger
-
fileHandler
-
fileSeqCheck
-
BINARY_FTP_TRANSER
- See Also:
-
DONE_MARKER_SUFFIX
- See Also:
-
DEFAULT_POLLING_INTERVAL
protected static final int DEFAULT_POLLING_INTERVAL- See Also:
-
DEFAULT_SUFFIX
- See Also:
-
DEFAULT_DONE_PREFIX
- See Also:
-
DEFAULT_DONE_SUFFIX
- See Also:
-
MAX_NUM_RETRIES
protected static final int MAX_NUM_RETRIES- See Also:
-
ERROR_SUFFIX
- See Also:
-
deleteLocalFiles
protected boolean deleteLocalFiles -
localFilePrefix
-
localFileSuffix
-
localFileRegExp
-
filePatternMode
-
doneFilePrefix
-
doneFileSuffix
-
useFtp
protected boolean useFtp -
useSynchronizedDirectory
protected boolean useSynchronizedDirectory -
RECOVERY_FILE_SUFFIX
- See Also:
-
fileLevelTransaction
protected boolean fileLevelTransaction -
sd_localDir
-
localDir
-
actFilter
-
ftpManager
-
errorTracker
-
ftpFileTracker
-
scratchDir
-
ioLock
protected com.nt.common.util.SMGLock ioLock -
isOrdered
protected boolean isOrdered -
fsChecked
protected boolean fsChecked
-
-
Constructor Details
-
FileEITransport
public FileEITransport(DCNode node, FileHandlerIfc handler, com.nt.common.util.SMGLock lock, boolean fdChecked, FileEIDuplicateCheck fileduplicateCheck, boolean fsChecked, FileEISequenceCheck fileSeqCheck) throws NodeStartException - Throws:
NodeStartException
-
FileEITransport
public FileEITransport(DCNode node, FileHandlerIfc handler, com.nt.common.util.SMGLock lock, boolean ordered, boolean fdChecked, FileEIDuplicateCheck fileduplicateCheck, boolean fsChecked, FileEISequenceCheck fileSeqCheck) throws NodeStartException - Throws:
NodeStartException
-
FileEITransport
public FileEITransport(DCNode node, FileHandlerIfc handler, com.nt.common.util.SMGLock lock, boolean ordered, FtpFileTracker tracker, boolean fdChecked, FileEIDuplicateCheck fileduplicateCheck, boolean fsChecked, FileEISequenceCheck fileSeqCheck) throws NodeStartException - Throws:
NodeStartException
-
-
Method Details
-
initConfig
- Throws:
NodeStartException
-
shutdown
public void shutdown()Description copied from class:EITransportThis method is used to provide a means of shutting down the transport in an orderly fashion.- Specified by:
shutdownin interfaceDCTransport- Specified by:
shutdownin classEITransport
-
getData
Description copied from class:EITransportThis method is used by the DataReceiver to fetch a single- Specified by:
getDatain interfaceDataProviderIfc- Specified by:
getDatain classEITransport- Returns:
- DCFieldContainer.
-
getBulkData
Description copied from class:EITransportThis method is used by the DataReceiver to fetch a set of DCFieldContainer objects.- Specified by:
getBulkDatain interfaceDataProviderIfc- Specified by:
getBulkDatain classEITransport- Returns:
- DCFieldContainer object array, containing the data that is for processing
-
isDataAvailable
public boolean isDataAvailable()Description copied from class:EITransportThis method is used by the DataReceiver to ask this provider if data is available.- Specified by:
isDataAvailablein interfaceDataProviderIfc- Specified by:
isDataAvailablein classEITransport- Returns:
true, if data is available
-
run
public void run()Description copied from class:EITransportThis method is used to control processing for fetching data from the EI's source.- Specified by:
runin interfaceRunnable- Specified by:
runin classEITransport
-
getFiles
-
processFiles
-
processFilesOrdered
-
processError
-
isHealthy
public boolean isHealthy()Description copied from class:EITransportThis method is used to check the transport's state of health. By default it returns true. It is to be overridden by subclasses.- Specified by:
isHealthyin interfaceDCTransport- Overrides:
isHealthyin classEITransport- Returns:
- true if the transport is healthy, false otherwise
-
getLocalDir
-
sortFiles
-
isLessThan
-
recoveryFileExists
-