public abstract class AbstractPathAction extends AbstractAction
LOGGER
Modifier | Constructor and Description |
---|---|
protected |
AbstractPathAction(String basePath,
boolean followSymbolicLinks,
int maxDepth,
PathCondition[] pathFilters,
StrSubstitutor subst)
Creates a new AbstractPathAction that starts scanning for files to process from the specified base path.
|
Modifier and Type | Method and Description |
---|---|
protected abstract FileVisitor<Path> |
createFileVisitor(Path visitorBaseDir,
List<PathCondition> conditions)
Creates a new
FileVisitor<Path> to pass to the Files.walkFileTree(Path, Set, int, FileVisitor)
method when the execute() method is invoked. |
boolean |
execute()
Performs action.
|
boolean |
execute(FileVisitor<Path> visitor) |
Path |
getBasePath()
Returns the base path from where to start scanning for files to delete.
|
String |
getBasePathString()
Returns the base path as it was specified in the configuration.
|
int |
getMaxDepth()
Returns the the maximum number of directory levels to visit.
|
Set<FileVisitOption> |
getOptions()
Returns whether to follow symbolic links or not.
|
List<PathCondition> |
getPathConditions()
Returns the list of PathCondition objects.
|
StrSubstitutor |
getStrSubstitutor() |
boolean |
isFollowSymbolicLinks()
Returns whether to follow symbolic links or not.
|
String |
toString() |
close, isComplete, isInterrupted, reportException, run
protected AbstractPathAction(String basePath, boolean followSymbolicLinks, int maxDepth, PathCondition[] pathFilters, StrSubstitutor subst)
basePath
- base path from where to start scanning for files to process.followSymbolicLinks
- whether to follow symbolic links. Default is false.maxDepth
- The maxDepth parameter is the maximum number of levels of directories to visit. A value of 0
means that only the starting file is visited, unless denied by the security manager. A value of
MAX_VALUE may be used to indicate that all levels should be visited.pathFilters
- an array of path filters (if more than one, they all need to accept a path before it is
processed).public boolean execute() throws IOException
AbstractAction
execute
in interface Action
execute
in class AbstractAction
IOException
- if IO error.public boolean execute(FileVisitor<Path> visitor) throws IOException
IOException
protected abstract FileVisitor<Path> createFileVisitor(Path visitorBaseDir, List<PathCondition> conditions)
FileVisitor<Path>
to pass to the Files.walkFileTree(Path, Set, int, FileVisitor)
method when the execute()
method is invoked.
The visitor is responsible for processing the files it encounters that are accepted by all filters.
visitorBaseDir
- base dir from where to start scanning for files to processconditions
- filters that determine if a file should be processedFileVisitor<Path>
public Path getBasePath()
<Delete basePath="${sys:user.home}/abc" />
then this method returns a path
to the "abc" file or directory in the user's home directory.public String getBasePathString()
public StrSubstitutor getStrSubstitutor()
public Set<FileVisitOption> getOptions()
public boolean isFollowSymbolicLinks()
public int getMaxDepth()
public List<PathCondition> getPathConditions()
Copyright © 1999-2019 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.