Skip navigation links
org.netbeans.api.scripting 1.3

Scripting API Wrapper
Official

See: Description

Scripting API Wrapper 
Package Description
org.netbeans.api.scripting
Use powerful scripting in your applications.
org.netbeans.spi.scripting
Implement EngineProvider to dynamically add new engine factories.

This module provides a wrapper around JDK's ScriptEngineManager that is aware of NetBeans specific extensions. Please see the scripting tutorial to read about many interesting use-cases.

What is New (see all changes)?

Use Cases

Create ScriptEngineManager
To create new instance script engine manager ready for the NetBeans execution environment use Scripting class offers static createManager() method that should be used whenever one needs an instance of ScriptEngineManager inside of NetBeans based application. Many client oriented use-cases are covered in the scripting tutorial.
Dynamic registration of ScriptEngineFactory
Implement EngineProvider and register it into global lookup via ServiceProvider to dynamically discover and offer new ScriptEngines to users of ScriptEngineManager obtained via Scripting factory methods.
Static registration of ScriptEngineFactory

To register additional scripting engine, just include its JAR file in the application. Its factory registration in META-INF/services/javax.script.ScriptEngineFactory will be found and used by Scripting factory methods. Alternatively you can implement and register EngineProvider as in the dynamic registration use-case.

In any case don't forget to advertise your engine to the runtime container via OpenIDE-Module-Providers: javax.script.ScriptEngine."engineName" tag as specified by manifest registration API.

Exported Interfaces

This table lists all of the module exported APIs with defined stability classifications. It is generated based on answers to questions about the architecture of the module. Read them all...
Group of java interfaces
Interface NameIn/OutStabilitySpecified in What Document?
org.netbeans.api.scriptingExportedOfficial

Scripting class offers static createManager() method that should be used whenever one needs an instance of ScriptEngineManager inside of NetBeans based application.

org.netbeans.spi.scriptingExportedOfficial

Implement
EngineProvider and register it into global lookup via ServiceProvider to dynamically discover and offer new ScriptEngines to users of ScriptEngineManager obtained via Scripting factory methods.

Group of property interfaces
Interface NameIn/OutStabilitySpecified in What Document?
allowAllAccessExportedStable .../netbeans/api/scripting/Scripting.html

If Scripting.allowAllAccess is used, then a property allowAllAccess is placed into the ScriptManager.getBindings() with value true.

manifest.ScriptEngineExportedOfficial

If your module wants to use a script engine of given name, then include a token dependency
  • for example OpenIDE-Module-Needs: javax.script.ScriptEngine.js
  • or OpenIDE-Module-Needs: javax.script.ScriptEngine.python
  • or OpenIDE-Module-Recommends: javax.script.ScriptEngine.ruby
in your manifest file (also accessible through project customizer GUI) to indicate to the system that you need it.
Modules that provide implementations of enginesshould use OpenIDE-Module-Provides tag to advertise them. Only then the
runtime container can make sure all requested providers in the application are really enabled and the dependencies are satisfied.

Implementation Details

Where are the sources for the module?

The sources for the module are in the NetBeans Mercurial repositories.

What do other modules need to do to declare a dependency on this one, in addition to or instead of a plain module dependency?

XXX no answer for deploy-dependencies

Read more about the implementation in the answers to architecture questions.

Skip navigation links
org.netbeans.api.scripting 1.3