Package com.nt.udc.node.util
Class CFileMgr
java.lang.Object
com.nt.udc.node.util.CFileMgr
This class manages files stored in an input directory.
It is used to return files to process.
- Since:
- JDK1.2.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static int
protected boolean
protected String
This is the "done" marker-file prefix.protected String
This is the "done" marker-file suffix.protected FilenameFilter
This is the filter used to select files to process.protected LoggerIfc
This member is used to report errors and warningsprotected File
This is the input directoryprotected File[]
This is the cache of input files.protected int
This is the position of the next file to process in m_inputFileCache.protected File
This is the scratch directory. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
boolean
This function is called after a file has been processed.static int
boolean
This function is used to select a file to process.boolean
This function is used to check if more files are available for processing.protected boolean
selectFileForProcessing
(File inputFile) This function is used to check whether an inputFile may be selected for processing.static void
setDebugLevel
(int debugLevel) void
setDeleteProcessedFiles
(boolean m_deleteProcessedFiles) void
setDoneFilePrefix
(String doneFilePrefix) void
setDoneFileSuffix
(String doneFileSuffix) void
setFilenameFilter
(FilenameFilter filenameFilter) void
setInputDir
(String inputDirName) void
setScratchDir
(String scratchDirName)
-
Field Details
-
m_debugLevel
protected static int m_debugLevel -
m_iLogger
This member is used to report errors and warnings -
m_inputDir
This is the input directory -
m_inputFileCache
This is the cache of input files. It is used to retrieve the files to process. -
m_inputFileIndex
protected int m_inputFileIndexThis is the position of the next file to process in m_inputFileCache. -
m_scratchDir
This is the scratch directory. Work-files are stored here. -
m_filenameFilter
This is the filter used to select files to process. -
m_doneFilePrefix
This is the "done" marker-file prefix. -
m_doneFileSuffix
This is the "done" marker-file suffix. -
m_deleteProcessedFiles
protected boolean m_deleteProcessedFiles
-
-
Constructor Details
-
CFileMgr
-
-
Method Details
-
getDebugLevel
public static int getDebugLevel() -
getInputDir
-
getScratchDir
-
getFilenameFilter
-
getDoneFilePrefix
-
getDoneFileSuffix
-
getDeleteProcessedFiles
public boolean getDeleteProcessedFiles() -
setDeleteProcessedFiles
public void setDeleteProcessedFiles(boolean m_deleteProcessedFiles) -
setDebugLevel
public static void setDebugLevel(int debugLevel) -
setInputDir
-
setScratchDir
-
setFilenameFilter
-
setDoneFilePrefix
-
setDoneFileSuffix
-
hasMoreFilesToProcess
public boolean hasMoreFilesToProcess()This function is used to check if more files are available for processing.We search the input file cache first. If no file is found, we try to update the cache and do the search again. If a file is found, it is guaranteed that the input file index remains positioned on a valid candidate.
- Returns:
- true if more files are available for processing, false otherwise.
-
getFileToProcess
This function is used to select a file to process.We search the input directory for files to be processed. The oldest successful candidate is returned. A cache of input files, sorted by last-modification time is used to avoid frequent disk-accesses.
- Returns:
- A valid managed file to process if successful, null if no file to process or not successful
-
finishedProcessing
This function is called after a file has been processed.A marker file is created in the input directory.
- Returns:
- true if successul, false otherwise
-
selectFileForProcessing
This function is used to check whether an inputFile may be selected for processing.- Returns:
- true if inputFile is to be selected, false otherwise
-
error
-
debug
-