GVScriptConfig

From GreenVulcano Wiki
Revision as of 13:45, 2 January 2015 by G.dimaio (talk | contribs) (ScriptEngine)
Jump to: navigation, search

Description

Defines the JSR-223 "Scripting for the Java Platform" Script engine/context initializers.

Its sub-elements are:

ScriptCache

Defines the script file cache configuration.

Its attributes are:

Attribute Type Description
base-path optional Base path for script files access. Default to $GV_HOME/scripts.

ScriptEngines

Defines the engine/context initializers.

ScriptEngine

Script Engine initializer. Usable script engine must at least have MULTITHREADED capability. If the script engine implements Compilable interface and the script DESN'T USE placeholders, the script itself is precompiled and reused for better performances. Script Engines dependency libraries must be prensent into GreenVulcano® ESB classpath.

Its attributes are:

Attribute Type Description
type fixed script-engine.
lang required Script Engine language.
default-context optional If defined, refers to an included BaseContext to be used as default context initialized for the given language scripts.

Its sub-elements are:

BaseContext

Basic Context initializer.

Its attributes are:

Attribute Type Description
name required Initializer name.
file optional This attribute is the name of a file containing the script to parse/execute for initializing the context. The file path must be relative to $GV_HOME/scripts.

Follow an examples configuration of multiple scripting engines:

<GVScriptConfig name="SCRIPT" type="module">
    <ScriptCache base-path="sp{{gv.app.home}}/scripts"/>
    <ScriptEngines>
        <ScriptEngine lang="ognl" type="script-engine"/>
        <ScriptEngine lang="groovy" type="script-engine"/>
        <ScriptEngine default-context="gvesb" lang="jruby" type="script-engine">
            <BaseContext name="basic"/>
            <BaseContext file="jruby/initscope.rb" name="gvesb"/>
        </ScriptEngine>
        <ScriptEngine default-context="gvesb" lang="js" type="script-engine">
            <BaseContext file="js/initscope.js" name="gvesb"/>
            <BaseContext name="basic"/>
            <BaseContext file="js/initscope.js" name="JavaScriptRetriever"/>
        </ScriptEngine>
    </ScriptEngines>
</GVScriptConfig>