Class FileSetManager
java.lang.Object
org.apache.maven.shared.model.fileset.util.FileSetManager
Provides operations for use with FileSet instances, such as retrieving the included/excluded files, deleting all
matching entries, etc.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String[]private final org.slf4j.Loggerprivate final boolean -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new manager instance with an own logger.FileSetManager(org.slf4j.Logger logger) Create a new manager instance with the supplied log instance.FileSetManager(org.slf4j.Logger logger, boolean verbose) Create a new manager instance with the supplied log instance and flag for whether to output verbose messages. -
Method Summary
Modifier and TypeMethodDescriptionvoidDelete the matching files and directories for the given file-set definition.voidDelete the matching files and directories for the given file-set definition.private voidexcludeParentDirectoriesOfExcludedPaths(List<String> excludedPaths, Set<String> deletablePaths) Removes all parent directories of the already excluded files/directories from the given set of deletable directories.findDeletableDirectories(FileSet fileSet) findDeletableFiles(FileSet fileSet, Set<String> deletableDirectories) findDeletablePaths(FileSet fileSet) String[]getExcludedDirectories(FileSet fileSet) Get all the directory names which have been excluded by the rules in this fileset.String[]getExcludedFiles(FileSet fileSet) Get all the filenames which have been excluded by the rules in this fileset.String[]getIncludedDirectories(FileSet fileSet) Get all the directory names which have been included by the rules in this fileset.String[]getIncludedFiles(FileSet fileSet) Get all the filenames which have been included by the rules in this fileset.private booleanmapIncludedFiles(FileSet fileSet) private voidDelete a directoryprivate org.codehaus.plexus.util.DirectoryScanner
-
Field Details
-
EMPTY_STRING_ARRAY
-
verbose
private final boolean verbose -
logger
private final org.slf4j.Logger logger
-
-
Constructor Details
-
FileSetManager
public FileSetManager(org.slf4j.Logger logger, boolean verbose) Create a new manager instance with the supplied log instance and flag for whether to output verbose messages.- Parameters:
logger- the logger instanceverbose- whether to output verbose messages
-
FileSetManager
public FileSetManager(org.slf4j.Logger logger) Create a new manager instance with the supplied log instance. Verbose flag is set to false.- Parameters:
logger- The log instance
-
FileSetManager
public FileSetManager()Create a new manager instance with an own logger. Verbose flag is set to false.
-
-
Method Details
-
isSymlink
- Throws:
IOException
-
excludeParentDirectoriesOfExcludedPaths
private void excludeParentDirectoriesOfExcludedPaths(List<String> excludedPaths, Set<String> deletablePaths) Removes all parent directories of the already excluded files/directories from the given set of deletable directories. I.e. if "subdir/excluded.txt" should not be deleted, "subdir" should be excluded from deletion, too.- Parameters:
excludedPaths- The relative paths of the files/directories which are excluded from deletion, must not benull.deletablePaths- The relative paths to files/directories which are scheduled for deletion, must not benull.
-
removeDir
private void removeDir(File dir, boolean followSymlinks, boolean throwsError, List<String> warnMessages) throws IOException Delete a directory- Parameters:
dir- the directory to deletefollowSymlinks- whether to follow symbolic links, or simply delete the linkthrowsError- Throw IOException when errors have occurred by deleting files or directories.warnMessages- A list of warning messages used whenthrowsError=false.- Throws:
IOException- If a matching file cannot be deleted andthrowsError=true.