Class BshLocalDataBuilder

java.lang.Object
fmpp.localdatabuilders.BshLocalDataBuilder
All Implemented Interfaces:
LocalDataBuilder

public class BshLocalDataBuilder extends 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:

  • Constructor Details

    • BshLocalDataBuilder

      public BshLocalDataBuilder()
      Creates new instance.
  • Method Details

    • createInstanceForSetting

      public static BshLocalDataBuilder createInstanceForSetting(String fName, List params) throws SettingException
      Throws:
      SettingException
    • build

      Description copied from interface: LocalDataBuilder
      Returns the variables that could be added to the local data.
      Specified by:
      build in interface LocalDataBuilder
      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

      public String getEncoding()
    • setEncoding

      public void setEncoding(String encoding)
      Sets the encoding of the script files. If it is null then the value of the sourceEncoding setting will be used.
    • getEnding

      public String getEnding()
    • setEnding

      public void setEnding(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 to false.
    • 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 the ending. The extension is the part after the last dot of the file name. The dot itself is also removed. Defaults to false.