Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Current »

 New scripting languages can be added to IGB via plugins that implement JSR-223.

To create a plugin for a scripting language, find a ScriptEngine implementation for the language, and include it in the plugin with an implementation of the ScriptProcessor interface. Then in the plugin Activator start() method, include the line:

ScriptProcessorHolder.getInstance().addScriptProcessor(new MyScriptProcessor());

Note that OSGi is not compatible with the java Service Provider framework, so the usual way of getting the ScriptEngineFactory, ScriptEngineManager.getEngineByName(name) or ScriptEngineManager.getEngineByExtension(extension) does not work. Instead, the ScriptProcessor has a method:

 public ScriptEngineFactory getScriptEngineFactory();


that returns the ScriptEngineFactory. You can find the ScriptEngineFactory implementation by looking in the META-INF/services/javax.script.ScriptEngineFactory file. You may be able to just call the no parameter constructor.

There are several JSR-223 scripting language implementations at http://java.net/projects/scripting, but you can find them elsewhere.

  • No labels