public class CFileMgr
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static int |
m_debugLevel |
protected java.lang.String |
m_doneFilePrefix
This is the "done" marker-file prefix.
|
protected java.lang.String |
m_doneFileSuffix
This is the "done" marker-file suffix.
|
protected java.io.FilenameFilter |
m_filenameFilter
This is the filter used to select files to process.
|
protected ILogger |
m_iLogger
This member is used to report errors and warnings
|
protected java.io.File |
m_inputDir
This is the input directory
|
protected java.io.File[] |
m_inputFileCache
This is the cache of input files.
|
protected int |
m_inputFileIndex
This is the position of the next file to process
in m_inputFileCache.
|
protected java.io.File |
m_scratchDir
This is the scratch directory.
|
Modifier and Type | Method and Description |
---|---|
protected void |
debug(java.lang.String fName,
java.lang.String msg) |
protected void |
error(java.lang.String fName,
java.lang.String msg) |
boolean |
finishedProcessing(CManagedFile file)
This function is called after a file has been processed.
|
static int |
getDebugLevel() |
java.lang.String |
getDoneFilePrefix() |
java.lang.String |
getDoneFileSuffix() |
java.io.FilenameFilter |
getFilenameFilter() |
CManagedFile |
getFileToProcess()
This function is used to select a file to process.
|
java.lang.String |
getInputDir() |
java.lang.String |
getScratchDir() |
boolean |
hasMoreFilesToProcess()
This function is used to check if more files are available
for processing.
|
protected boolean |
selectFileForProcessing(java.io.File inputFile)
This function is used to check whether an inputFile may be
selected for processing.
|
static void |
setDebugLevel(int debugLevel) |
void |
setDoneFilePrefix(java.lang.String doneFilePrefix) |
void |
setDoneFileSuffix(java.lang.String doneFileSuffix) |
void |
setFilenameFilter(java.io.FilenameFilter filenameFilter) |
void |
setInputDir(java.lang.String inputDirName) |
void |
setScratchDir(java.lang.String scratchDirName) |
protected static int m_debugLevel
protected ILogger m_iLogger
protected java.io.File m_inputDir
protected java.io.File[] m_inputFileCache
protected int m_inputFileIndex
protected java.io.File m_scratchDir
protected java.io.FilenameFilter m_filenameFilter
protected java.lang.String m_doneFilePrefix
protected java.lang.String m_doneFileSuffix
public CFileMgr(ILogger iLogger)
public static int getDebugLevel()
public java.lang.String getInputDir()
public java.lang.String getScratchDir()
public java.io.FilenameFilter getFilenameFilter()
public java.lang.String getDoneFilePrefix()
public java.lang.String getDoneFileSuffix()
public static void setDebugLevel(int debugLevel)
public void setInputDir(java.lang.String inputDirName)
public void setScratchDir(java.lang.String scratchDirName)
public void setFilenameFilter(java.io.FilenameFilter filenameFilter)
public void setDoneFilePrefix(java.lang.String doneFilePrefix)
public void setDoneFileSuffix(java.lang.String doneFileSuffix)
public boolean hasMoreFilesToProcess()
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.
public CManagedFile getFileToProcess()
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.
public boolean finishedProcessing(CManagedFile file)
A marker file is created in the input directory.
protected boolean selectFileForProcessing(java.io.File inputFile)
protected void error(java.lang.String fName, java.lang.String msg)
protected void debug(java.lang.String fName, java.lang.String msg)