Skip navigation links

Package scriptella.driver.jexl

JEXL Driver for Scriptella.

See: Description

Package scriptella.driver.jexl Description

JEXL Driver for Scriptella.

Allows usage of JEXL scripts in ETL <query> and <script> elements.

The driver uses commons-jexl library which is a part of Scriptella Core. JEXL scripts are interpreted at runtime and generally work slower than compiled scripts (e.g. Janino), nevertheless JEXL scripts are easier to write and maintain especially for non-Java developers.

General information

Driver class:scriptella.driver.jexl.Driver
Runtime dependencies:None

Query and Script Syntax

Standard JEXL scripts syntax is used inside ETL elements.

Bind variables from parent elements are accessible as simple variables. Assignment operator v="value" makes variable v available for nested ETL elements.

Implicit variable query is available in <query> elements. This variable should be used to produce a result set:

    <query>
        i=0; while(i lt 10) {
            i=i+1;
            query.next(); // Causes child script to be executed
        }
        <script>......</script>
    </query>
See ParametersCallbackMap class Javadoc for more details. Note: It is important to call query.next() so that the row produced by set(...) methods is created and inner elements are executed.

Examples

<connection id="jexl" driver="jexl"/>
<connection id="out" driver="oracle" url="jdbc:oracle:thin:@localhost:1521:DB"/>

<query connection-id="jexl">
    i=0;while (i lt 10) {
        i=i+1;
        login='login'+i;
        query.next();
    }
    <script connection-id="out">
        INSERT INTO Table(ID, Login) VALUES (?i, ?login);
    </script>
</query>

The query executes a child script 10 times. As the result of execution 10 records are inserted in a database table.
Skip navigation links

Copyright © Copyright 2006-2019 The Scriptella Project Team.