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 PrintWriter
protected ThreadLocal
<SimpleDateFormat> protected int
static final int
protected boolean
protected Thread
protected File
protected TreeSet
protected ArrayList
protected String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Search this tracker for the given IP address + file name combination.void
void
init()
protected void
protected void
initTrackerFileList
(Calendar cal, int daysToTrack) protected String
protected String
makeTrackerFilename
(Date date) protected void
readTrackerFile
(File inputTrackerFile, TreeSet filenameSet) protected void
void
shutdown()
boolean
Adds 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()
-