JPPF Issue Tracker
Please log in to bookmark issues
CLOSED  Feature request JPPF-216  -  Configuration enhancement: scripted property values
Posted Jan 29, 2014 - updated Mar 11, 2014
icon_info.png This issue has been closed with status "Closed" and resolution "RESOLVED".
Issue details
  • Type of issue
    Feature request
  • Status
  • Assigned to
  • Progress
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
  • Posted by
  • Owned by
    Not owned by anyone
  • Category
  • Resolution
  • Priority
  • Targetted for
    icon_milestones.png JPPF 4.1
Issue description
We propose to add the following syntax to the JPPF configuration files, to express property values as the result of evaluating a JSR 223-compliant script language expression: = $script:language:source_type{script_source}$
  • language is the script language to use, such as provided by the javax.script APIs
  • source_type determines how to find the script, with possible values "inline", "file" or "url"
  • script_source is either the script expression of its location, depending on the value of source_type:
    • if source_type = inline, then script_source is the script itself, for example: my.prop = $script:javascript:inline{"hello" + "world"}$
    • if source_type = file, then script_source is a script file, looked up first in the file system, then in the classpath. For example: my.prop = $script:javascript:file{/home/me/myscript.js}$
    • if source_type = url, then script_source is a script loaded from a URL for example: my.prop = $script:javascript:url{file:///home/me/myscript.js}$
The scripts should be evaluated after all includes and variable substitutions have been resolved. This will allow the scripts to use a variable binding for the Properties (or TypedProperties object) being loaded.

Note the '$' at the end, to avoid confusion with any property substitution such as '${my.prop}' that would be part of the scripted value descriptor.

For instance, if the value of "other.prop" is 3:
my.prop = /my/path/folder_$script:javascript:inline{2 + thisProperties.getInt("other.prop")}$
then the value of my.prop should evaluate to the string "/my/path/folder_5". "thisProperties" is the variable binding which references the TypedProperties being loaded. Note that it could also be written equivalently as:
my.prop = /my/path/folder_$script:javascript:inline{2 + ${other.prop}}$
this will work because substitutions are resolved before the scripts are evaluated.

Comment posted by
Mar 11, 09:40
implemented in trunk revision 3077