Class ArchiveFileSet

java.lang.Object
org.savantbuild.io.FileSet
org.savantbuild.io.ArchiveFileSet

public class ArchiveFileSet extends FileSet
A FileSet for archives. This allows the files in the FileSet to optionally contain a prefix.
  • Field Details

    • REQUIRED_ATTRIBUTES

      public static final Set<String> REQUIRED_ATTRIBUTES
    • VALID_ATTRIBUTES

      public static final Set<String> VALID_ATTRIBUTES
    • dirGroupName

      public String dirGroupName
    • dirMode

      public Integer dirMode
    • dirUserName

      public String dirUserName
    • groupName

      public String groupName
    • mode

      public Integer mode
    • prefix

      public String prefix
    • userName

      public String userName
  • Constructor Details

    • ArchiveFileSet

      public ArchiveFileSet(Path directory)
      Constructs a new ArchiveFileSet.
      Parameters:
      directory - The directory of the FileSet.
    • ArchiveFileSet

      public ArchiveFileSet(Path directory, String prefix)
      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

      public static String attributesValid(Map<String,Object> attributes)
      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

      public static ArchiveFileSet fromAttributes(Path dir, Map<String,Object> attributes)
      Constructs an ArchiveFileSet from a Map of attributes.
      Parameters:
      dir - The directory for the ArchiveFileSet.
      attributes - The attributes.
      Returns:
      The ArchiveFileSet.
    • toDirectories

      public Set<Directory> toDirectories() throws IOException
      Overrides the parent method, but uses the dirGroupName, dirUserName and dirMode variables to set the mode, userName and groupName inside the returned Directory objects.
      Overrides:
      toDirectories in class FileSet
      Returns:
      The set of directories.
      Throws:
      IOException - If the build fails.
    • toFileInfos

      public List<FileInfo> toFileInfos() throws IOException
      Description copied from class: FileSet
      Converts 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:
      toFileInfos in class FileSet
      Returns:
      A List of FileInfo objects for this FileSet.
      Throws:
      IOException - If the directory traversal fails.
    • withDirGroupName

      public ArchiveFileSet withDirGroupName(String dirGroupName)
      Sets the dirGroupName.
      Parameters:
      dirGroupName - The dirGroupName.
      Returns:
      This.
    • withDirMode

      public ArchiveFileSet withDirMode(Integer dirMode)
      Sets the dirMode.
      Parameters:
      dirMode - The dirMode.
      Returns:
      This.
    • withDirUserName

      public ArchiveFileSet withDirUserName(String dirUserName)
      Sets the dirUserName.
      Parameters:
      dirUserName - The dirUserName.
      Returns:
      This.
    • withGroupName

      public ArchiveFileSet withGroupName(String groupName)
      Sets the groupName.
      Parameters:
      groupName - The groupName.
      Returns:
      This.
    • withMode

      public ArchiveFileSet withMode(Integer mode)
      Sets the mode.
      Parameters:
      mode - The mode.
      Returns:
      This.
    • withPrefix

      public ArchiveFileSet withPrefix(String prefix)
      Sets the prefix.
      Parameters:
      prefix - The prefix.
      Returns:
      This.
    • withUserName

      public ArchiveFileSet withUserName(String userName)
      Sets the userName.
      Parameters:
      userName - The userName.
      Returns:
      This.