Class FileListProvider

  • All Implemented Interfaces:
    ListProvider

    @DynamicListProvider
    public class FileListProvider
    extends java.lang.Object
    implements ListProvider
    A ListProvider which will enumerate files in a directory configured in a specified global parameter.

    Argument Usage: This provider requires one to three arguments.

    1. Required: Global parameter name containing the configured directory to scan. If multiple values are configured for the global parameter, files in all directories will be combined.
    2. Optional: Boolean value (true/false) indicating if a recursive scan into subdirectories should be used. Defaults to false.
    3. Optional: A regular expression containing a file mask (e.g. ".*" or ".*txt") to match against the file name. Note that this uses Pattern and not glob patterns. If not specified, all files match.
    4. Optional: Boolean value (true/false) indicating if validation against valid existing files should be performed before execution, and not just on parameter updates. Defaults to true.
    Since:
    3.3
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<java.lang.String> getValidValues​(java.util.List<java.lang.String> arguments, boolean beforeExecute)
      Return a list of valid values for this parameter.
      protected void processDirectory​(java.util.LinkedHashSet<java.lang.String> collector, java.io.File dir, boolean recurse, java.util.regex.Pattern pattern)  
      • Methods inherited from class java.lang.Object

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

      • FileListProvider

        public FileListProvider()
    • Method Detail

      • getValidValues

        public java.util.List<java.lang.String> getValidValues​(java.util.List<java.lang.String> arguments,
                                                               boolean beforeExecute)
                                                        throws java.lang.Exception
        Description copied from interface: ListProvider
        Return a list of valid values for this parameter.
        Specified by:
        getValidValues in interface ListProvider
        Parameters:
        arguments - values supplied in Parameter.listArgs() (never null)
        beforeExecute - indicates if this check is happening right before the job is being executed. This allows implementations to only validate valid values at configuration time by returning null when beforeExecute is true. If you wish to enforce values at all times, simply ignore this flag.
        Returns:
        a list of all valid values (includes empty lists), or null, which means any value may be configured
        Throws:
        java.lang.Exception - if enumeration of valid values fails
      • processDirectory

        protected void processDirectory​(java.util.LinkedHashSet<java.lang.String> collector,
                                        java.io.File dir,
                                        boolean recurse,
                                        java.util.regex.Pattern pattern)