public class AcsFileFinderForDirectories
extends java.lang.Object
acs.system.path.
Optionally also looks under $ACSDATA.
The first occurrence of a file is taken, so that "less permanent" root directories such as $INTROOT are preferred over more permanent dirs such as $ACSROOT.
Implementation note: We do not use AcsFileFinder
because it would cache all files under the root directories,
which is too much for our purpose.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ACSDATA_PATH_PROPERTYNAME |
static java.lang.String |
SEARCHPATH_PROPERTYNAME |
| Constructor and Description |
|---|
AcsFileFinderForDirectories(java.util.logging.Logger logger,
boolean includeAcsdataDir)
Creates an AcsFileFinderForDirectories that can be used for multiple file searches.
|
| Modifier and Type | Method and Description |
|---|---|
java.io.File |
findFile(java.lang.String relativePath,
java.lang.String fileName)
Searches for a single file with a known name.
|
java.util.List<java.io.File> |
findFiles(java.lang.String relativePath,
java.io.FilenameFilter filter)
More flexible file search, that allows the user to check the filename
in the supplied
filter callback, for example to return
all "*.txt" files under a given relative directory "config/myBelovedTxtFiles". |
public static final java.lang.String SEARCHPATH_PROPERTYNAME
public static final java.lang.String ACSDATA_PATH_PROPERTYNAME
public AcsFileFinderForDirectories(java.util.logging.Logger logger,
boolean includeAcsdataDir)
logger - includeAcsdataDir - If true then $ACSDATA is included in the list of root dirs,
as the last chance for finding a file.public java.io.File findFile(java.lang.String relativePath,
java.lang.String fileName)
relativePath - The path underneath $INTROOT, $ACSROOT, for example "config" or "lib/oracle/hiddenJars" or "".fileName - The file name (without path), e.g. "myConfigFile.txt".null if it wasn't found.java.lang.NullPointerException - If fileName is nullpublic java.util.List<java.io.File> findFiles(java.lang.String relativePath,
java.io.FilenameFilter filter)
filter callback, for example to return
all "*.txt" files under a given relative directory "config/myBelovedTxtFiles".
For performance reasons (and to get simpler code) the method findFile(String, String)
should be used instead whenever the single file name is known.
relativePath - The path underneath $INTROOT, $ACSROOT, for example "config" or "lib/oracle/hiddenJars".filter - Must decide which files match.
The dir callback argument will be consistent with the relativePath
and should not be considered in the FilenameFilter implementation that should focus
only on the name parameter.