Class FileDataLoader

java.lang.Object
fmpp.dataloaders.FileDataLoader
All Implemented Interfaces:
DataLoader
Direct Known Subclasses:
AbstractTextDataLoader, CsvDataLoader, JSONDataLoader, PropertiesDataLoader, TddDataLoader, TddSequenceDataLoader, TextDataLoader, XmlInfosetDataLoader

public abstract class FileDataLoader extends Object implements DataLoader
Ancestor of data loaders that create the result based on a file. The first argument of the data loader will be the path of the file. If the path is a relative path, then it will be relative to the data root directory (an engine level setting), or if data root is null, then relative to the working directory (OS facility). The path can use slash (/) instead of the OS specific separator char.
  • Field Details

    • engine

      protected Engine engine
    • args

      protected List args
    • dataFile

      protected File dataFile
  • Constructor Details

    • FileDataLoader

      public FileDataLoader()
  • Method Details

    • load

      public Object load(Engine engine, List args) throws Exception
      Specified by:
      load in interface DataLoader
      args - Arguments that the caller specifies for this directive call. Not null. The implementation should check if it understands all arguments, and it should throw java.lang.IllegalArgumentException if it doesn't.
      Returns:
      The object that will be accessed in FreeMarker templates. The object can be of any type. FreeMarker will wrap the object so that it is visible as an FTL variable. However, if the object implements freemarker.template.TemplateModel, then it will not be wrapped, as it is already an FTL variable.
      Throws:
      Exception
    • load

      protected abstract Object load(InputStream data) throws Exception
      FileDataLoader subclasess override this method to parse the file.
      Throws:
      Exception