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 String
protected static final String
protected static final String
protected static final int
protected static final String
protected boolean
protected static final String
protected String
protected String
protected static final String
protected HashMap
protected FileHandlerIfc
protected boolean
protected String
protected FileEISequenceCheck
protected boolean
protected FtpFileTracker
protected FtpEIManager
protected com.nt.common.util.SMGLock
protected boolean
protected File
protected String
protected String
protected String
protected LoggerIfc
protected static final int
protected static final String
protected SynchronizedDirectory
protected boolean
protected boolean
Fields 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 Vector
getFiles()
protected void
boolean
This method is used by the DataReceiver to ask this provider if data is available.boolean
This method is used to check the transport's state of health.boolean
isLessThan
(String value1, String value2) protected void
processError
(File file) protected void
processFiles
(Vector filesToProcess) protected void
processFilesOrdered
(File currentFile) boolean
recoveryFileExists
(File file) void
run()
This method is used to control processing for fetching data from the EI's source.void
shutdown()
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:EITransport
This method is used to provide a means of shutting down the transport in an orderly fashion.- Specified by:
shutdown
in interfaceDCTransport
- Specified by:
shutdown
in classEITransport
-
getData
Description copied from class:EITransport
This method is used by the DataReceiver to fetch a single- Specified by:
getData
in interfaceDataProviderIfc
- Specified by:
getData
in classEITransport
- Returns:
- DCFieldContainer.
-
getBulkData
Description copied from class:EITransport
This method is used by the DataReceiver to fetch a set of DCFieldContainer objects.- Specified by:
getBulkData
in interfaceDataProviderIfc
- Specified by:
getBulkData
in classEITransport
- Returns:
- DCFieldContainer object array, containing the data that is for processing
-
isDataAvailable
public boolean isDataAvailable()Description copied from class:EITransport
This method is used by the DataReceiver to ask this provider if data is available.- Specified by:
isDataAvailable
in interfaceDataProviderIfc
- Specified by:
isDataAvailable
in classEITransport
- Returns:
true
, if data is available
-
run
public void run()Description copied from class:EITransport
This method is used to control processing for fetching data from the EI's source.- Specified by:
run
in interfaceRunnable
- Specified by:
run
in classEITransport
-
getFiles
-
processFiles
-
processFilesOrdered
-
processError
-
isHealthy
public boolean isHealthy()Description copied from class:EITransport
This 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:
isHealthy
in interfaceDCTransport
- Overrides:
isHealthy
in classEITransport
- Returns:
- true if the transport is healthy, false otherwise
-
getLocalDir
-
sortFiles
-
isLessThan
-
recoveryFileExists
-