Package scriptella.driver.janino
package scriptella.driver.janino
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
The primes sample in the 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.-
ClassDescriptionScriptella Driver for Janino Java Compiler.Scriptella connection adapter for Janino Script Evaluator.Thrown to indicate Janino failure.A base class for Janino <query> elements.A base class for Janino <script> elements.