Difference between revisions of "GVScriptConfig"

From GreenVulcano Wiki
Jump to: navigation, search
(Created page with "==Description== Defines the JSR-223 "Scripting for the Java Platform" Script engine/context initializers. Its sub-elements are: *ScriptCache *[[#ScriptEngines|S...")
 
(Description)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Description==
 
==Description==
 
Defines the JSR-223 "Scripting for the Java Platform" Script engine/context initializers.
 
Defines the JSR-223 "Scripting for the Java Platform" Script engine/context initializers.
 +
 +
It's mostly referenced by the [[Script]] element.
  
 
Its sub-elements are:
 
Its sub-elements are:
Line 22: Line 24:
 
Script Engine initializer. Usable script engine must at least have MULTITHREADED capability.
 
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.
 
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 il {{GVESB}} classpath.
+
Script Engines dependency libraries must be prensent into {{GVESB}} classpath.
  
 
Its attributes are:
 
Its attributes are:
Line 40: Line 42:
  
 
====BaseContext====
 
====BaseContext====
Basic Context initializer.
+
Basic Context initializer. A given context can contains pre-configured set of objects/functions, to be used in specific script executions.
  
 
Its attributes are:
 
Its attributes are:
Line 51: Line 53:
 
|}
 
|}
  
Follow an examples configuration of multiple scripting engines:
+
Follow an examples configuration of multiple scripting engines/context:
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
 
<GVScriptConfig name="SCRIPT" type="module">
 
<GVScriptConfig name="SCRIPT" type="module">

Latest revision as of 13:54, 2 January 2015

Description

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

It's mostly referenced by the Script element.

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. A given context can contains pre-configured set of objects/functions, to be used in specific script executions.

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/context:

<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>