Search in sources :

Example 1 with ScriptingEnvironment

use of org.camunda.bpm.engine.impl.scripting.env.ScriptingEnvironment in project camunda-bpm-platform by camunda.

the class ProcessEngineConfigurationImpl method initScripting.

protected void initScripting() {
    if (resolverFactories == null) {
        resolverFactories = new ArrayList<ResolverFactory>();
        resolverFactories.add(new MocksResolverFactory());
        resolverFactories.add(new VariableScopeResolverFactory());
        resolverFactories.add(new BeansResolverFactory());
    }
    if (scriptingEngines == null) {
        scriptingEngines = new ScriptingEngines(new ScriptBindingsFactory(resolverFactories));
        scriptingEngines.setEnableScriptEngineCaching(enableScriptEngineCaching);
    }
    if (scriptFactory == null) {
        scriptFactory = new ScriptFactory();
    }
    if (scriptEnvResolvers == null) {
        scriptEnvResolvers = new ArrayList<ScriptEnvResolver>();
    }
    if (scriptingEnvironment == null) {
        scriptingEnvironment = new ScriptingEnvironment(scriptFactory, scriptEnvResolvers, scriptingEngines);
    }
}
Also used : MocksResolverFactory(org.camunda.bpm.engine.test.mock.MocksResolverFactory) ScriptEnvResolver(org.camunda.bpm.engine.impl.scripting.env.ScriptEnvResolver) ScriptingEngines(org.camunda.bpm.engine.impl.scripting.engine.ScriptingEngines) BeansResolverFactory(org.camunda.bpm.engine.impl.scripting.engine.BeansResolverFactory) ScriptBindingsFactory(org.camunda.bpm.engine.impl.scripting.engine.ScriptBindingsFactory) ScriptingEnvironment(org.camunda.bpm.engine.impl.scripting.env.ScriptingEnvironment) VariableScopeResolverFactory(org.camunda.bpm.engine.impl.scripting.engine.VariableScopeResolverFactory) BeansResolverFactory(org.camunda.bpm.engine.impl.scripting.engine.BeansResolverFactory) MocksResolverFactory(org.camunda.bpm.engine.test.mock.MocksResolverFactory) ResolverFactory(org.camunda.bpm.engine.impl.scripting.engine.ResolverFactory) ScriptFactory(org.camunda.bpm.engine.impl.scripting.ScriptFactory) VariableScopeResolverFactory(org.camunda.bpm.engine.impl.scripting.engine.VariableScopeResolverFactory)

Example 2 with ScriptingEnvironment

use of org.camunda.bpm.engine.impl.scripting.env.ScriptingEnvironment in project camunda-bpm-platform by camunda.

the class EnvScriptCachingTest method executeScript.

protected void executeScript(final ProcessApplicationInterface processApplication) {
    processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command<Void>() {

        public Void execute(CommandContext commandContext) {
            return Context.executeWithinProcessApplication(new Callable<Void>() {

                public Void call() throws Exception {
                    ScriptingEngines scriptingEngines = processEngineConfiguration.getScriptingEngines();
                    ScriptEngine scriptEngine = scriptingEngines.getScriptEngineForLanguage(SCRIPT_LANGUAGE);
                    SourceExecutableScript script = createScript(SCRIPT_LANGUAGE, SCRIPT);
                    ScriptingEnvironment scriptingEnvironment = processEngineConfiguration.getScriptingEnvironment();
                    scriptingEnvironment.execute(script, null, null, scriptEngine);
                    return null;
                }
            }, processApplication.getReference());
        }
    });
}
Also used : SourceExecutableScript(org.camunda.bpm.engine.impl.scripting.SourceExecutableScript) CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) ScriptingEngines(org.camunda.bpm.engine.impl.scripting.engine.ScriptingEngines) ScriptingEnvironment(org.camunda.bpm.engine.impl.scripting.env.ScriptingEnvironment) Callable(java.util.concurrent.Callable) ScriptEngine(javax.script.ScriptEngine)

Aggregations

ScriptingEngines (org.camunda.bpm.engine.impl.scripting.engine.ScriptingEngines)2 ScriptingEnvironment (org.camunda.bpm.engine.impl.scripting.env.ScriptingEnvironment)2 Callable (java.util.concurrent.Callable)1 ScriptEngine (javax.script.ScriptEngine)1 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)1 ScriptFactory (org.camunda.bpm.engine.impl.scripting.ScriptFactory)1 SourceExecutableScript (org.camunda.bpm.engine.impl.scripting.SourceExecutableScript)1 BeansResolverFactory (org.camunda.bpm.engine.impl.scripting.engine.BeansResolverFactory)1 ResolverFactory (org.camunda.bpm.engine.impl.scripting.engine.ResolverFactory)1 ScriptBindingsFactory (org.camunda.bpm.engine.impl.scripting.engine.ScriptBindingsFactory)1 VariableScopeResolverFactory (org.camunda.bpm.engine.impl.scripting.engine.VariableScopeResolverFactory)1 ScriptEnvResolver (org.camunda.bpm.engine.impl.scripting.env.ScriptEnvResolver)1 MocksResolverFactory (org.camunda.bpm.engine.test.mock.MocksResolverFactory)1