Class AbstractPathAction

    • Constructor Detail

      • AbstractPathAction

        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.
        Parameters:
        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).
    • Method Detail

      • createFileVisitor

        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.

        The visitor is responsible for processing the files it encounters that are accepted by all filters.

        Parameters:
        visitorBaseDir - base dir from where to start scanning for files to process
        conditions - filters that determine if a file should be processed
        Returns:
        a new FileVisitor<Path>
      • getBasePath

        public Path getBasePath()
        Returns the base path from where to start scanning for files to delete. Lookups are resolved, so if the configuration was <Delete basePath="${sys:user.home}/abc" /> then this method returns a path to the "abc" file or directory in the user's home directory.
        Returns:
        the base path (all lookups resolved)
      • getBasePathString

        public String getBasePathString()
        Returns the base path as it was specified in the configuration. Lookups are not resolved.
        Returns:
        the base path as it was specified in the configuration
      • getOptions

        public Set<FileVisitOption> getOptions()
        Returns whether to follow symbolic links or not.
        Returns:
        the options
      • isFollowSymbolicLinks

        public boolean isFollowSymbolicLinks()
        Returns whether to follow symbolic links or not.
        Returns:
        whether to follow symbolic links or not
      • getMaxDepth

        public int getMaxDepth()
        Returns the the maximum number of directory levels to visit.
        Returns:
        the maxDepth
      • getPathConditions

        public List<PathCondition> getPathConditions()
        Returns the list of PathCondition objects.
        Returns:
        the pathFilters