Package fmpp.localdatabuilders
Class BshLocalDataBuilder
java.lang.Object
fmpp.localdatabuilders.BshLocalDataBuilder
- All Implemented Interfaces:
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
: theEngine
instance.templateEnvironment
: theTemplateEnvironment
instance.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild
(Engine eng, TemplateEnvironment env) Returns the variables that could be added to the local data.static BshLocalDataBuilder
createInstanceForSetting
(String fName, List params) boolean
Set if it will be ignored no script file found for the source file, rather than throwing an exception.boolean
void
setEncoding
(String encoding) Sets the encoding of the script files.void
Sets the string appended at the end of the source file name.void
setIgnoreMissing
(boolean ignoreMissing) void
setRemoveExtension
(boolean removeExtension) Sets if the extension from the source file name should be removed before appending theending
.
-
Constructor Details
-
BshLocalDataBuilder
public BshLocalDataBuilder()Creates new instance.
-
-
Method Details
-
createInstanceForSetting
public static BshLocalDataBuilder createInstanceForSetting(String fName, List params) throws SettingException - Throws:
SettingException
-
build
public Map build(Engine eng, TemplateEnvironment env) throws FileNotFoundException, DataModelBuildingException Description copied from interface:LocalDataBuilder
Returns the variables that could be added to the local data.- Specified by:
build
in 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:
FileNotFoundException
DataModelBuildingException
-
getEncoding
-
setEncoding
Sets the encoding of the script files. If it isnull
then the value of the sourceEncoding setting will be used. -
getEnding
-
setEnding
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
.
-