Index Changes
This is version 22. It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]
Some of the key motivations for providing scripting support are
  • Leveraging programmer skills and advantages of different scripting languages.
  • Many of the scripting languages are Time Tested technologies. So providing execution support for these technologies within the JBI space helps in integrating\co-working with many components\applications developed in these technologies.
  • There are a lot of successful open source projects developed in various scripting languages. So adding scripting support provides a huge value add.
  • Also there are large numbers of scenarios where java and scripting technologies interact. So providing scripting support provides huge value adds.

Some of the key scenarios are:

A. Scripting of java objects
The scripting languages are able to create Java objects and call public methods of the objects using the syntax of the scripting languages. In this way, functionality available in Java that does not exist in the scripting languages can be used in scripts.

B. Java implementation of scripting interpreters
The java programming language has been used to implement interpreters in many scripting languages. Ex: Mozilla rhino script etc.

C. Embedded java interpreters
Most of the scripting language interpreters have interfaces exposed to the outside world. These interfaces provided a flexibility to use these scripting interpreters as components within an application. So the application can leverage these script engines to execute the scripts provided by their end users and hence control the application behavior as such.

Scripting Service Engine Design (High level)

Overview The basic intent is to provide a script executing service engine that can support all the Scripting engines that are complaint to JSR 223, i.e. all implementers of javax.script package. This makes Scripting service engine as a single point script executor for scripts in any language, within the JBI environment further strengthening “One VM, many Language” punch line.

Detailed Description
The block diagram representation of the Scripting SE can be explained as below

    1. The Scripting SE provides a service of taking an input xml source containing the input parameters for the script and providing the result of the script execution as an output xml source document.
    2. The Scripting SE basically contains 2 high level modules i.e. Input parser and script executor.
    3. The main task of the input parser module would be to parse the input document and extract all the relevant details from the input source document and provide the script execution details to the script executor.
    4. The script executor would receive the execution context information from the input parser and will load & instantiate the relevant script engine from the library.
    5. The communication between the script executor and the script engine would be as per the contract of javax.script package.
    6. The inter-working of the Script SE and the various script engines and the intricacies involved in java object to script object bindings etc would have to be taken care of the script executor and would be explained in more detail in the detailed design document.
    7. The result object from the delegated script engine would be processed by the script executor and the result from the Script SE would be an output xml source document.
    8. The output document will contain the result of the operation, which can be a java object or void or some fault in execution.
    9. The structure of the input and output xml sources and the schema’s is given below
    10. The services of the Scripting SE would be exposed to the outside world through http-soap binding component.

Demo of Scripting Service Engine
The attached demos illustrate the creation of a new Scripting kind of a project and executing some sample scripts in various scripting languages.

A video demonstrating the Design time of the Scripting SE and the corresponding runtime is present at Scripting Sample demo-E2E .

  • The demo shows how to create the Scripting Project, for providing a simple trading service.
  • The Trading Service depicted as the echo.wsdl, takes in a TradePriceRequest xml, which will contain some information like the Trading Symbol, the quantity of stocks required etc.
  • The output is an TradePrice xml which contains the pricing information for the requested quantity of stocks.
  • The Scripting Service Engine would execute the greet.rb file which will actuall calculate the price of the requested stocks.

A Video demonstrating a simple usecase wherein

  • The RubyScript\javascript etc, that is part of the project and packaged in the su will actually perform the transformation(Script Exection) is present at SimpleUC-Scripting.rar .
  • The User provides a simple SOAP message as an input containing only the input parameter required by the script. In this case its a simple name. The Script will take the input message and adds a "hello " to the beginning of it and returns that to the client.

In order to make the Scripting Service Engine to work with other scripting engines like for ex:jython, ognl etc, we need to
1. add the corresponding script libraries in to the src\lib directory
2. Modify the jbi.xml under the src\META-INF directory to include the added libraries (modifications have to be done to the bootstrap and component classpath elements)
3. Re-build the application and redeploy.

This should work for other service engines.


  1. Java scripting specs - jsr 223.
  2. JBI Specifications


  • Contributors:
1. Venkat Srinivasan
2. Narayana Murthy Rallabandi
3. Prashanth Rajsekhar

JSPWiki v2.4.100
« Home Index Changes Prefs
This particular version was published on 26-Apr-07 08:14 AM, -0700 by Prashanth