Package org.savantbuild.io
Class ArchiveFileSet
java.lang.Object
org.savantbuild.io.FileSet
org.savantbuild.io.ArchiveFileSet
A FileSet for archives. This allows the files in the FileSet to optionally contain a prefix.
-
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class org.savantbuild.io.FileSet
directory, excludePatterns, includePatterns -
Constructor Summary
ConstructorsConstructorDescriptionArchiveFileSet(Path directory) Constructs a new ArchiveFileSet.ArchiveFileSet(Path directory, String prefix) Constructs a new ArchiveFileSet.ArchiveFileSet(Path directory, String prefix, Integer mode, String userName, String groupName, String dirUserName, String dirGroupName, Integer dirMode, Collection<Pattern> includePatterns, Collection<Pattern> excludePatterns) Constructs a new ArchiveFileSet. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringattributesValid(Map<String, Object> attributes) Determines if the attributes given can be used to construct an ArchiveFileSet.static ArchiveFileSetfromAttributes(Path dir, Map<String, Object> attributes) Constructs an ArchiveFileSet from a Map of attributes.Overrides the parent method, but uses thedirGroupName,dirUserNameanddirModevariables to set the mode, userName and groupName inside the returned Directory objects.Converts this FileSet to a list of FileInfo objects.withDirGroupName(String dirGroupName) Sets the dirGroupName.withDirMode(Integer dirMode) Sets the dirMode.withDirUserName(String dirUserName) Sets the dirUserName.withGroupName(String groupName) Sets the groupName.Sets the mode.withPrefix(String prefix) Sets the prefix.withUserName(String userName) Sets the userName.Methods inherited from class org.savantbuild.io.FileSet
withExcludePatterns, withIncludePatterns
-
Field Details
-
REQUIRED_ATTRIBUTES
-
VALID_ATTRIBUTES
-
dirGroupName
-
dirMode
-
dirUserName
-
groupName
-
mode
-
prefix
-
userName
-
-
Constructor Details
-
ArchiveFileSet
Constructs a new ArchiveFileSet.- Parameters:
directory- The directory of the FileSet.
-
ArchiveFileSet
Constructs a new ArchiveFileSet. The directory is required but the prefix is optional. Leaving the prefix blank will cause all of the files in the FileSet to contain relative paths based on the FileSet's directory. Using the prefix will cause the files in the FileSet to be relative to the prefix plus the directory.- Parameters:
directory- The directory of the FileSet.prefix- The prefix used to calculate the relative paths in the FileInfo objects.
-
ArchiveFileSet
public ArchiveFileSet(Path directory, String prefix, Integer mode, String userName, String groupName, String dirUserName, String dirGroupName, Integer dirMode, Collection<Pattern> includePatterns, Collection<Pattern> excludePatterns) Constructs a new ArchiveFileSet. The directory is required but the prefix is optional. Leaving the prefix blank will cause all of the files in the FileSet to contain relative paths based on the FileSet's directory. Using the prefix will cause the files in the FileSet to be relative to the prefix plus the directory.- Parameters:
directory- The directory of the FileSet.prefix- (Optional) The prefix used to calculate the relative paths in the FileInfo objects.mode- (Optional) The POSIX file mode.userName- (Optional) The user name for the fileset.groupName- (Optional) The group name for the fileset.dirUserName- (Optional) The user name that the directories created by this ArchiveFileSet will use.dirGroupName- (Optional) The group name that the directories created by this ArchiveFileSet will use.dirMode- (Optional) The mode that the directories created by this ArchiveFileSet will use.includePatterns- (Optional) A list of regular expression Pattern objects that list the files to include.excludePatterns- (Optional) A list of regular expression Pattern objects that list the files to exclude.
-
-
Method Details
-
attributesValid
Determines if the attributes given can be used to construct an ArchiveFileSet.- Parameters:
attributes- The attributes.- Returns:
- Null if the attributes are valid, an error message describing why they aren't valid.
-
fromAttributes
Constructs an ArchiveFileSet from a Map of attributes.- Parameters:
dir- The directory for the ArchiveFileSet.attributes- The attributes.- Returns:
- The ArchiveFileSet.
-
toDirectories
Overrides the parent method, but uses thedirGroupName,dirUserNameanddirModevariables to set the mode, userName and groupName inside the returned Directory objects.- Overrides:
toDirectoriesin classFileSet- Returns:
- The set of directories.
- Throws:
IOException- If the build fails.
-
toFileInfos
Description copied from class:FileSetConverts this FileSet to a list of FileInfo objects. The info objects contain the origin Path and a relative Path. They also include additional information about the file.- Overrides:
toFileInfosin classFileSet- Returns:
- A List of FileInfo objects for this FileSet.
- Throws:
IOException- If the directory traversal fails.
-
withDirGroupName
Sets the dirGroupName.- Parameters:
dirGroupName- The dirGroupName.- Returns:
- This.
-
withDirMode
Sets the dirMode.- Parameters:
dirMode- The dirMode.- Returns:
- This.
-
withDirUserName
Sets the dirUserName.- Parameters:
dirUserName- The dirUserName.- Returns:
- This.
-
withGroupName
Sets the groupName.- Parameters:
groupName- The groupName.- Returns:
- This.
-
withMode
Sets the mode.- Parameters:
mode- The mode.- Returns:
- This.
-
withPrefix
Sets the prefix.- Parameters:
prefix- The prefix.- Returns:
- This.
-
withUserName
Sets the userName.- Parameters:
userName- The userName.- Returns:
- This.
-