Package com.metasolv.nm.collector.file
Class FtpFileTracker
java.lang.Object
com.metasolv.nm.collector.file.FtpFileTracker
Used to keep track of files that have been retrieved from a specific FTP server.
This will ensure that a file is not retrieved more than once.
This class is based on the SmdrFtpFileTracker class that was designed for the
SMDR cartridge.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PrintWriterprotected ThreadLocal<SimpleDateFormat> protected intstatic final intprotected booleanprotected Threadprotected Fileprotected TreeSetprotected ArrayListprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanSearch this tracker for the given IP address + file name combination.voidvoidinit()protected voidprotected voidinitTrackerFileList(Calendar cal, int daysToTrack) protected Stringprotected StringmakeTrackerFilename(Date date) protected voidreadTrackerFile(File inputTrackerFile, TreeSet filenameSet) protected voidvoidshutdown()booleanAdds the specified IP address and file name to this tracker if it is not already present.
-
Field Details
-
DEFAULT_DAYS_TO_TRACK
public static final int DEFAULT_DAYS_TO_TRACK- See Also:
-
sortedFilenameSet
-
trackerFilePrefix
-
dateFmt
-
trackerFileList
-
currentWriter
-
scratchDirectory
-
oldTrackerFileRemoverThread
-
keepRunning
protected boolean keepRunning -
daysToTrack
protected int daysToTrack
-
-
Constructor Details
-
FtpFileTracker
-
-
Method Details
-
shutdown
public void shutdown() -
track
Adds the specified IP address and file name to this tracker if it is not already present. The information will be saved to file.- Parameters:
ipAddress- IP address to be added to this tracker.filename- file name to be added to this tracker.- Returns:
- true if the tracker did not already contain the specified file name.
-
contains
Search this tracker for the given IP address + file name combination.- Parameters:
ipAddress- IP address to be checked within this tracker.filename- file name to be checked within this tracker.- Returns:
- true if the tracker contains this file name.
-
flushOldRecords
- Throws:
IOException
-
makeTodayTrackerFilename
-
makeTrackerFilename
-
readTrackerFile
-
init
- Throws:
IOException
-
initTrackerFileList
-
removeOutdatedTrackerFiles
protected void removeOutdatedTrackerFiles() -
initSortedFilenameSet
protected void initSortedFilenameSet()
-