Class FilesetUtils

java.lang.Object
de.iip_ecosphere.platform.tools.maven.python.FilesetUtils

public class FilesetUtils extends Object
Helper functions for maven filesets.
Author:
Holger Eichelberger, SSE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addExcludedPaths(String[] paths, boolean isFile, Set<String> excluded)
    Determines excluded paths from the given paths, i.e., split the directories add them to excluded.
    static void
    addExcludedPaths(String path, boolean isFile, Set<String> excluded)
    Determines excluded paths from the given path, i.e., split the directories add them to excluded.
    static void
    deletePaths(org.apache.maven.shared.model.fileset.FileSet fileset, String[] paths, Set<String> excluded, org.apache.maven.plugin.logging.Log log)
    Deletes the given paths.
    static void
    deletePaths(org.apache.maven.shared.model.fileset.FileSet fileset, org.apache.maven.plugin.logging.Log log)
    Deletes the specified included and not excluded paths.
    static void
    determineFiles(org.apache.maven.shared.model.fileset.FileSet fileset, boolean considerDirectories, Consumer<File> fileConsumer)
    Determines the files to be processed.
    static void
    iteratePaths(org.apache.maven.shared.model.fileset.FileSet fileset, String[] paths, Set<String> excluded, Consumer<File> fileConsumer)
    Iterates over paths.
    static List<File>
    listFiles(org.apache.maven.shared.model.fileset.FileSet fileset, boolean considerDirectories)
    Materializes the files specified by fileset as list.
    static Stream<File>
    streamFiles(org.apache.maven.shared.model.fileset.FileSet fileset, boolean considerDirectories)
    Streams the files specified by fileset.
    static void
    touch(File file, org.apache.maven.plugin.logging.Log log)
    Touches file if not null.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FilesetUtils

      public FilesetUtils()
  • Method Details

    • addExcludedPaths

      public static void addExcludedPaths(String[] paths, boolean isFile, Set<String> excluded)
      Determines excluded paths from the given paths, i.e., split the directories add them to excluded.
      Parameters:
      paths - the paths to be excluded
      isFile - whether path represents a file (than ignore the last path) or whether it is a folder
      excluded - the excluded paths to be modified as a side effect
    • addExcludedPaths

      public static void addExcludedPaths(String path, boolean isFile, Set<String> excluded)
      Determines excluded paths from the given path, i.e., split the directories add them to excluded.
      Parameters:
      path - the path to be excluded
      isFile - whether path represents a file (than ignore the last path) or whether it is a folder
      excluded - the excluded paths to be modified as a side effect
    • deletePaths

      public static void deletePaths(org.apache.maven.shared.model.fileset.FileSet fileset, String[] paths, Set<String> excluded, org.apache.maven.plugin.logging.Log log)
      Deletes the given paths.
      Parameters:
      fileset - the fileset to operate on
      paths - the paths to be deleted
      excluded - paths that shall not be deleted (excluded)
      log - the log instance
      See Also:
    • iteratePaths

      public static void iteratePaths(org.apache.maven.shared.model.fileset.FileSet fileset, String[] paths, Set<String> excluded, Consumer<File> fileConsumer)
      Iterates over paths.
      Parameters:
      fileset - the fileset to operate on
      paths - the paths to be iterated
      excluded - paths that shall not be deleted (excluded)
      fileConsumer - function that operates on the included files
    • deletePaths

      public static void deletePaths(org.apache.maven.shared.model.fileset.FileSet fileset, org.apache.maven.plugin.logging.Log log)
      Deletes the specified included and not excluded paths.
      Parameters:
      fileset - the specifying fileset
      log - the log instance (may be null for none
      See Also:
    • determineFiles

      public static void determineFiles(org.apache.maven.shared.model.fileset.FileSet fileset, boolean considerDirectories, Consumer<File> fileConsumer)
      Determines the files to be processed.
      Parameters:
      fileset - the specifying fileset
      considerDirectories - whether directories shall be considered in the result
      fileConsumer - a consumer receiving the results
      See Also:
    • streamFiles

      public static Stream<File> streamFiles(org.apache.maven.shared.model.fileset.FileSet fileset, boolean considerDirectories)
      Streams the files specified by fileset.
      Parameters:
      fileset - the specifying fileset
      considerDirectories - whether directories shall be considered in the result
      Returns:
      the stream of files
      See Also:
    • listFiles

      public static List<File> listFiles(org.apache.maven.shared.model.fileset.FileSet fileset, boolean considerDirectories)
      Materializes the files specified by fileset as list.
      Parameters:
      fileset - the specifying fileset
      considerDirectories - whether directories shall be considered in the result
      Returns:
      the files
      See Also:
    • touch

      public static void touch(File file, org.apache.maven.plugin.logging.Log log)
      Touches file if not null. Emits a warning into log if touching is not possible.
      Parameters:
      file - the file to touch
      log - the log to be used