Interface ScriptEngineFactory
- All Known Implementing Classes:
AbstractScriptEngineFactory
@NonNullByDefault
public interface ScriptEngineFactory
This class is used by the ScriptEngineManager to load ScriptEngines. This is meant as a way to allow other OSGi
bundles to provide custom script-languages with special needs, e.g. Nashorn, Jython, Groovy, etc.
- Author:
- Simon Merschjohann - Initial contribution, Scott Rushworth - added/changed methods and parameters when implementing
ScriptModuleTypeProvider, Jonathan Gilbert - added context keys
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringKey to access Dependency ListenerScriptDependencyListenerstatic final StringKey to access engine identifier in script context.static final StringKey to access Extension AccessorScriptExtensionAccessorstatic final ScriptEngineManager -
Method Summary
Modifier and TypeMethodDescription@Nullable ScriptEnginecreateScriptEngine(String scriptType) This method creates a new ScriptEngine based on the supplied file extension or MimeType.default @Nullable ScriptDependencyTrackerThis method returns aScriptDependencyTrackerif it is availableThis method returns a list of file extensions and MimeTypes that are supported by the ScriptEngine, e.g. py, application/python, js, application/javascript, etc.voidscopeValues(ScriptEngine scriptEngine, Map<String, Object> scopeValues) This method "scopes" new values into the given ScriptEngine.
-
Field Details
-
ENGINE_MANAGER
-
CONTEXT_KEY_ENGINE_IDENTIFIER
Key to access engine identifier in script context.- See Also:
-
CONTEXT_KEY_EXTENSION_ACCESSOR
Key to access Extension AccessorScriptExtensionAccessor- See Also:
-
CONTEXT_KEY_DEPENDENCY_LISTENER
Key to access Dependency ListenerScriptDependencyListener- See Also:
-
-
Method Details
-
getScriptTypes
This method returns a list of file extensions and MimeTypes that are supported by the ScriptEngine, e.g. py, application/python, js, application/javascript, etc.- Returns:
- List of supported script types
-
scopeValues
This method "scopes" new values into the given ScriptEngine.- Parameters:
scriptEngine-scopeValues-
-
createScriptEngine
This method creates a new ScriptEngine based on the supplied file extension or MimeType.- Parameters:
scriptType- a file extension (script) or MimeType (ScriptAction or ScriptCondition)- Returns:
- ScriptEngine or null
-
getDependencyTracker
This method returns aScriptDependencyTrackerif it is available- Returns:
- a
ScriptDependencyTrackerornullif dependency tracking is not supported forScriptEngines created by this factory
-