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
Modifier and TypeFieldDescriptionstatic final String
Key to access Dependency ListenerScriptDependencyListener
static final String
Key to access engine identifier in script context.static final String
Key to access Extension AccessorScriptExtensionAccessor
static final ScriptEngineManager
-
Method Summary
Modifier and TypeMethodDescription@Nullable ScriptEngine
createScriptEngine
(String scriptType) This method creates a new ScriptEngine based on the supplied file extension or MimeType.default @Nullable ScriptDependencyTracker
This method returns aScriptDependencyTracker
if it is availableThis method returns a list of file extensions and MimeTypes that are supported by the ScriptEngine, e.g.void
scopeValues
(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 aScriptDependencyTracker
if it is available- Returns:
- a
ScriptDependencyTracker
ornull
if dependency tracking is not supported forScriptEngine
s created by this factory
-