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);
}
}
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());
}
});
}
Aggregations