Class DefaultFileSource

java.lang.Object
ch.grengine.source.BaseSource
ch.grengine.source.DefaultFileSource
All Implemented Interfaces:
FileSource, Source

public class DefaultFileSource extends BaseSource implements FileSource
File-based script source, default implementation of the FileSource interface.

The source ID is "ScriptFile_<canonical-or-absolute-file-path>".

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

    • DefaultFileSource

      public DefaultFileSource(File file)
      constructor from script file.

      The file is always converted to the canonical file, with fallback to the absolute file.

      The ID is the canonical file path, with fallback to the absolute file path.

      Parameters:
      file - script file
      Throws:
      NullPointerException - if file is null
      Since:
      1.0
  • Method Details

    • getLastModified

      public long getLastModified()
      Description copied from class: BaseSource
      always returns 0.
      Specified by:
      getLastModified in interface Source
      Overrides:
      getLastModified in class BaseSource
      Returns:
      always 0
    • getFile

      public File getFile()
      Description copied from interface: FileSource
      gets the canonical file of this source, with fallback to the absolute file.

      Hence fileSource.getFile().isAbsolute() always returns true.

      Specified by:
      getFile in interface FileSource
      Returns:
      canonical file of this source