Skip navigation links

Package scriptella.driver.janino

Janino Driver for Scriptella.

See: Description

Package scriptella.driver.janino Description

Janino Driver for Scriptella.

This driver allows to embed Java code into <query> and <script> elements. This code is compiled by Janino and executed by Scriptella engine. For simple scripting solutions refer to JEXL expression language which is interpreted and less powerful.

Janino scripting elements are implicit subclasses of Query and Script base classes.

General information

Driver class:scriptella.driver.janino.Driver
Runtime dependencies:janino-2.6.1+.jar

Driver Specific Properties

Name Description Required

Script Syntax

In Scriptella Janino script is a Java "block", i.e. the body of a method. For convenience protected and public methods of JaninoScript are accessible from Janino <script> elements.

In other words the script element is an implementation of execute method of JaninoScript class.

Query Syntax

Queries are written using the same syntax as script elements with the only difference that protected/public methods from Query class are accessible from <query> element.

In other words the query element is an implementation of execute method of JaninoQuery class.

Properties substitution

The standard ant-style properties substitution is not supported. Instead, use get("variableName") to get the variable value and set("variableName", value) to set the variable value.

Example

    <connection driver="janino"/>

    <query>
        set("name", "John");
        next();
        <script>
            System.out.println("Processing: "+get("name"));
        </script>
    </query>
In this example the query produces a row having a column name=John. The child script prints a message using a column from a row produced by setting name to "John" and calling next() to allow nested content to be executed:
Processing: John

ODBC sample from Scriptella examples distribution also shows several use-cases for Janino.

Debugging

In Janino 2.6.1, line number information is not generated by default. Run scriptella with -d option or set a system propertyorg.codehaus.janino.source_debugging.enable=true.
Skip navigation links

Copyright © Copyright 2006-2019 The Scriptella Project Team.