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 Details

  • Method Details

    • getScriptTypes

      List<String> 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

      void scopeValues(ScriptEngine scriptEngine, Map<String,Object> scopeValues)
      This method "scopes" new values into the given ScriptEngine.
      Parameters:
      scriptEngine -
      scopeValues -
    • createScriptEngine

      @Nullable ScriptEngine createScriptEngine(String scriptType)
      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

      default @Nullable ScriptDependencyTracker getDependencyTracker()
      This method returns a ScriptDependencyTracker if it is available
      Returns:
      a ScriptDependencyTracker or null if dependency tracking is not supported for ScriptEngines created by this factory