Class DirBasedSources

java.lang.Object
ch.grengine.sources.BaseSources
ch.grengine.sources.DirBasedSources
All Implemented Interfaces:
Sources

public class DirBasedSources extends BaseSources
Sources based on a directory with script files.

Script file extensions and whether to also scan subdirectories is configurable.

The implementation is basic, but may still be good enough for many use cases in practice: Invisible files, as well as invisible or unlistable directories, are ignored; no attempts are made to detect symlinks.

Since:
1.0
Author:
Alain Stalder, Made in Switzerland.
  • Constructor Details

    • DirBasedSources

      protected DirBasedSources(DirBasedSources.Builder builder)
      constructor from builder.
      Parameters:
      builder - builder
      Since:
      1.0
  • Method Details

    • getSourceSetNew

      protected Set<Source> getSourceSetNew()
      gets the updated source set.
      Specified by:
      getSourceSetNew in class BaseSources
      Returns:
      updated source set
      Since:
      1.0
    • getDir

      public File getDir()
      gets the script file directory.
      Returns:
      script file directory
      Since:
      1.0
    • getDirMode

      public DirMode getDirMode()
      gets the dir mode.
      Returns:
      dir mode
      Since:
      1.0
    • getScriptExtensions

      public Set<String> getScriptExtensions()
      gets the set of script extensions.
      Returns:
      set of script extensions
      Since:
      1.0
    • getBuilder

      public DirBasedSources.Builder getBuilder()
      gets the builder.
      Returns:
      builder
      Since:
      1.0