Class CamundaScriptEngineManager

java.lang.Object
javax.script.ScriptEngineManager
org.cibseven.bpm.engine.impl.scripting.engine.CamundaScriptEngineManager

public class CamundaScriptEngineManager extends ScriptEngineManager
Custom Script Engine Manager that can execute custom logic:

a) after the discovery of the engines on the classpath; the respective engine factories are created b) before the engines are created. If custom logic is needed for a specific engine after the classpath detection, before the engine creation, it can be added to the classes map.

  • Field Details

    • engineNameToInitLogicMappings

      protected final Map<String,Runnable> engineNameToInitLogicMappings
  • Constructor Details

    • CamundaScriptEngineManager

      public CamundaScriptEngineManager()
    • CamundaScriptEngineManager

      public CamundaScriptEngineManager(ClassLoader loader)
  • Method Details

    • applyConfigOnEnginesAfterClasspathDiscovery

      protected void applyConfigOnEnginesAfterClasspathDiscovery()
    • getEngineNamesFoundInClasspath

      protected List<String> getEngineNamesFoundInClasspath()
    • getEngineByName

      public ScriptEngine getEngineByName(String shortName)
      Overrides:
      getEngineByName in class ScriptEngineManager
    • createCibSevenClassLoader

      public static ClassLoader createCibSevenClassLoader()
      Creates a CibSevenClassLoader that can be used by external script engines. This classloader automatically translates Camunda namespace classes to CibSeven namespace. Example usage with Groovy:
       ClassLoader cibSevenClassLoader = CamundaScriptEngineManager.createCibSevenClassLoader();
       GroovyClassLoader groovyClassLoader = new GroovyClassLoader(cibSevenClassLoader);
       ScriptEngine groovyEngine = new GroovyScriptEngineImpl(groovyClassLoader);
       
      Returns:
      A ClassLoader that handles CibSeven namespace translation
    • createCibSevenClassLoader

      public static ClassLoader createCibSevenClassLoader(ClassLoader parent)
      Creates a CibSevenClassLoader with a specific parent ClassLoader.
      Parameters:
      parent - The parent ClassLoader
      Returns:
      A ClassLoader that handles CibSeven namespace translation
    • executeConfigurationBeforeEngineCreation

      protected void executeConfigurationBeforeEngineCreation(String engineName)
      Fetches the config logic of a given engine from the mappings and executes it in case it exists.
      Parameters:
      engineName - the given engine name
    • disableGraalVMInterpreterOnlyModeWarnings

      protected void disableGraalVMInterpreterOnlyModeWarnings()
    • createGraalJSScriptEngineWithCibSevenClassLoader

      protected ScriptEngine createGraalJSScriptEngineWithCibSevenClassLoader(ProcessEngineConfigurationImpl config)
      Creates a GraalJS script engine with CibSevenClassLoader using reflection to avoid compile-time dependency. Returns null if GraalJS classes are not available at runtime.
    • createGroovyScriptEngineWithCibSevenClassLoader

      protected ScriptEngine createGroovyScriptEngineWithCibSevenClassLoader()
      Creates a Groovy script engine with CibSevenClassLoader using reflection to avoid compile-time dependency. Returns null if Groovy classes are not available at runtime.