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.5.11+.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 is executed on a query result set and prints the message
Processing: John to the console.
ODBC sample from Scriptella examples distribution also shows
several use-cases for Janino.
|