Package fmpp.localdatabuilders
Class BshLocalDataBuilder
- java.lang.Object
-
- fmpp.localdatabuilders.BshLocalDataBuilder
-
- All Implemented Interfaces:
LocalDataBuilder
public class BshLocalDataBuilder extends java.lang.Object implements LocalDataBuilder
Deduces the file name of a BeanShell scrip file from the source file name, and executes that script to create local data.The script must return a
java.util.Map, which stores the variables that will be added to the local data.The following variables are accessible for the scripts:
engine: theEngineinstance.templateEnvironment: theTemplateEnvironmentinstance.
-
-
Constructor Summary
Constructors Constructor Description BshLocalDataBuilder()Creates new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Mapbuild(Engine eng, TemplateEnvironment env)Returns the variables that could be added to the local data.static BshLocalDataBuildercreateInstanceForSetting(java.lang.String fName, java.util.List params)java.lang.StringgetEncoding()java.lang.StringgetEnding()booleangetIgnoreMissing()Set if it will be ignored no script file found for the source file, rather than throwing an exception.booleangetRemoveExtension()voidsetEncoding(java.lang.String encoding)Sets the encoding of the script files.voidsetEnding(java.lang.String ending)Sets the string appended at the end of the source file name.voidsetIgnoreMissing(boolean ignoreMissing)voidsetRemoveExtension(boolean removeExtension)Sets if the extension from the source file name should be removed before appending theending.
-
-
-
Method Detail
-
createInstanceForSetting
public static BshLocalDataBuilder createInstanceForSetting(java.lang.String fName, java.util.List params) throws SettingException
- Throws:
SettingException
-
build
public java.util.Map build(Engine eng, TemplateEnvironment env) throws java.io.FileNotFoundException, DataModelBuildingException
Description copied from interface:LocalDataBuilderReturns the variables that could be added to the local data.- Specified by:
buildin interfaceLocalDataBuilder- Returns:
- the variables to add to the local data. Can be
null. The returned map will not be modified (although technically, badly behaved 3rd party code can modify the values soted in the map...). - Throws:
java.io.FileNotFoundExceptionDataModelBuildingException
-
getEncoding
public java.lang.String getEncoding()
-
setEncoding
public void setEncoding(java.lang.String encoding)
Sets the encoding of the script files. If it isnullthen the value of the sourceEncoding setting will be used.
-
getEnding
public java.lang.String getEnding()
-
setEnding
public void setEnding(java.lang.String ending)
Sets the string appended at the end of the source file name. Can't be 0 length string. It defaults to".bsh".
-
getIgnoreMissing
public boolean getIgnoreMissing()
Set if it will be ignored no script file found for the source file, rather than throwing an exception. Defaults tofalse.
-
setIgnoreMissing
public void setIgnoreMissing(boolean ignoreMissing)
-
getRemoveExtension
public boolean getRemoveExtension()
-
setRemoveExtension
public void setRemoveExtension(boolean removeExtension)
Sets if the extension from the source file name should be removed before appending theending. The extension is the part after the last dot of the file name. The dot itself is also removed. Defaults tofalse.
-
-