Package com.nt.udc.io
Class CFileMgr
java.lang.Object
com.nt.udc.io.CFileMgr
This class manages files stored in an input directory.
It is used to return files to process.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static intprotected StringThis is the "done" marker-file prefix.protected StringThis is the "done" marker-file suffix.protected FilenameFilterThis is the filter used to select files to process.protected ILoggerThis member is used to report errors and warningsprotected FileThis is the input directoryprotected File[]This is the cache of input files.protected intThis is the position of the next file to process in m_inputFileCache.protected FileThis is the scratch directory. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidbooleanThis function is called after a file has been processed.static intThis function is used to select a file to process.booleanThis function is used to check if more files are available for processing.protected booleanselectFileForProcessing(File inputFile) This function is used to check whether an inputFile may be selected for processing.static voidsetDebugLevel(int debugLevel) voidsetDoneFilePrefix(String doneFilePrefix) voidsetDoneFileSuffix(String doneFileSuffix) voidsetFilenameFilter(FilenameFilter filenameFilter) voidsetInputDir(String inputDirName) voidsetScratchDir(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.
-
-
Constructor Details
-
CFileMgr
-
-
Method Details
-
getDebugLevel
public static int getDebugLevel() -
getInputDir
-
getScratchDir
-
getFilenameFilter
-
getDoneFilePrefix
-
getDoneFileSuffix
-
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.
-
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.
-
finishedProcessing
This function is called after a file has been processed.A marker file is created in the input directory.
-
selectFileForProcessing
This function is used to check whether an inputFile may be selected for processing. -
error
-
debug
-