Scripting Languages Scripting Languages
A guide to the NetKernel Scripting Language Development
Home > Books > Solutions Developer Guide > Scripting Languages

Rate this page:
Really useful
Satisfactory
Not helpful
Confusing
Incorrect
Unsure
Extra comments:


Developing with Scripting Languages

NetKernel is written in Java and runs in the Java Runtime Environment (JRE). Development at the physical level may be done using Java or one of the scripting languages supported by NetKernel which includes JavaScript, Ruby, Python, Groovy and Beanshell. Resource models such as the XML resource model may contribute additional scripting languages. These languages are integrated into NetKernel using the NetKernel Scripting Framework. This framework adapts the language runtime support (usually a compiler) to the NetKernel resource-oriented programming model.

Language runtimes are activated by calling the runtime as an active: service. NetKernel 3.3 supports:

When the language runtime service is called it is given a reference to a resource that holds the program to be executed as the operator argument. For example, to run a Beanshell program issue a request as follows:

active:beanshell+operator@ffcpl:/myprogram.bsh

When activated, each language runtime, through the NetKernel Script Language Framework, issues a resource request for the program. The underlying language system requires the program to be compiled into Java byte codes. The language runtimes are designed to convert the representation of the program from source form to byte code form through transreption. The internal cache will store the transrepted (compiled) form until invalidated (such as when a developer modifies the program) at which time the new source code will be transrepted again into byte code automatically.

Within each language access to NetKernel and the microkernel is provided through the NetKernel Foundation API (NKF) via an instance of INKFConvenienceHelper which is given the local name "context".

Passing Parameters

Script language programs have access to argument values as is discussed in the section on Parameters and Context.

Java Classpath and Imports

A script inherits the Java classpath of the host module within which it is invoked. This includes the classpaths exported by any modules which are imported into the host module. In addition the kernel and layer1 classpaths are always accessible. The manner in which a scripting language accesses native Java classes is language specific. Refer to the language's reference guide for details.

Language Specific Libraries

Each language is able to import its own language's libraries from the NetKernel address space - refer to each languages' reference guide for details.

Thread Safety

The ScriptEngine is threadsafe. Script language programs can and will be executed concurrently. While you may be able to create local threads in your script programs, you would be responsible for their management and local thread safety - we strongly recommend delegating all threading and concurrency to NetKernel's microkernel.

Reference

The following versions of script language runtimes are used in NetKernel 3.3.

© 2003-2007, 1060 Research Limited. 1060 registered trademark, NetKernel trademark of 1060 Research Limited.