fmpp.dataloaders
Class FileDataLoader

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

public abstract class FileDataLoader
extends java.lang.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 realtive path, then it will be realative 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 Summary
protected  java.util.List args
           
protected  java.io.File dataFile
           
protected  Engine engine
           
 
Constructor Summary
FileDataLoader()
           
 
Method Summary
 java.lang.Object load(Engine engine, java.util.List args)
           
protected abstract  java.lang.Object load(java.io.InputStream data)
          FileDataLoader subclasess override this method to parse the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

engine

protected Engine engine

args

protected java.util.List args

dataFile

protected java.io.File dataFile
Constructor Detail

FileDataLoader

public FileDataLoader()
Method Detail

load

public java.lang.Object load(Engine engine,
                             java.util.List args)
                      throws java.lang.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:
java.lang.Exception

load

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

Throws:
java.lang.Exception