Class GraalVMJavascriptEngineExecutor
java.lang.Object
org.eclipse.dirigible.engine.api.resource.AbstractResourceExecutor
org.eclipse.dirigible.engine.api.script.AbstractScriptExecutor
org.eclipse.dirigible.engine.js.api.AbstractJavascriptExecutor
org.eclipse.dirigible.engine.js.graalvm.processor.GraalVMJavascriptEngineExecutor
- All Implemented Interfaces:
AutoCloseable,org.eclipse.dirigible.engine.api.IEngineExecutor,org.eclipse.dirigible.engine.api.resource.IResourceExecutor,org.eclipse.dirigible.engine.api.script.IScriptEngineExecutor,IJavascriptEngineExecutor,CodeRunner<String,Object>,JavascriptCodeRunner<String,Object>
public class GraalVMJavascriptEngineExecutor extends AbstractJavascriptExecutor implements JavascriptCodeRunner<String,Object>
The GraalVM Javascript Engine Executor.
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_DEBUG_PORTThe Constant DEFAULT_DEBUG_PORT.static StringDIRIGIBLE_JAVASCRIPT_GRAALVM_COMPATIBILITY_MODE_MOZILLAThe Constant DIRIGIBLE_JAVASCRIPT_GRAALVM_COMPATIBILITY_MODE_MOZILLA.static StringDIRIGIBLE_JAVASCRIPT_GRAALVM_DEBUGGER_ENABLEDThe Constant DIRIGIBLE_JAVASCRIPT_GRAALVM_DEBUGGER_ENABLED.static StringDIRIGIBLE_JAVASCRIPT_GRAALVM_DEBUGGER_PORTThe Constant DIRIGIBLE_JAVASCRIPT_GRAALVM_DEBUGGER_PORT.static StringENGINE_NAMEThe Constant ENGINE_NAME.Fields inherited from class org.eclipse.dirigible.engine.js.api.AbstractJavascriptExecutor
MODULE_EXT_GRAALVM, MODULE_EXT_JS, MODULE_EXT_MJS, MODULE_EXT_NASHORN, MODULE_EXT_RHINO, MODULE_EXT_V8Fields inherited from interface org.eclipse.dirigible.engine.js.api.IJavascriptEngineExecutor
CONSOLE, CONTEXT, DIRIGIBLE_JAVASCRIPT_DEBUG_ENABLED, DIRIGIBLE_JAVASCRIPT_ENGINE_TYPE_DEFAULT, DIRIGIBLE_JAVASCRIPT_ENGINE_TYPE_HEADER, JAVASCRIPT_ENGINE_TYPE, JAVASCRIPT_TYPE_DEFAULT, JAVASCRIPT_TYPE_GRAALIUM, JAVASCRIPT_TYPE_GRAALVM -
Constructor Summary
Constructors Constructor Description GraalVMJavascriptEngineExecutor() -
Method Summary
Modifier and Type Method Description protected voidbeforeEval(org.graalvm.polyglot.Context context)Before eval.voidclose()Close.ObjectevalCode(String code, Map<Object,Object> executionContext)Eval code.ObjectevalModule(String module, Map<Object,Object> executionContext)Eval module.ObjectexecuteMethodFromModule(String module, String memberClass, String memberMethod, Map<Object,Object> executionContext)Execute method from module.ObjectexecuteService(String moduleOrCode, Map<Object,Object> executionContext, boolean isModule, boolean commonJSModule)Execute service.ObjectexecuteService(String moduleOrCode, Map<Object,Object> executionContext, boolean isModule, boolean commonJSModule, BiConsumer<org.graalvm.polyglot.Context,org.graalvm.polyglot.Value> onAfterExecute)Execute service.ObjectexecuteServiceCode(String code, Map<Object,Object> executionContext)Execute service code.ObjectexecuteServiceModule(String module, Map<Object,Object> executionContext)Execute service module.StringgetName()Gets the name.IJavascriptModuleSourceProvidergetSourceProvider()Gets the source provider.StringgetType()Gets the type.protected StringloadSource(String module)Load source.Objectrun(String codeSource)Run.Objectrun(Path codeFilePath)Run.Methods inherited from class org.eclipse.dirigible.engine.js.api.AbstractJavascriptExecutor
forceFlushMethods inherited from class org.eclipse.dirigible.engine.api.script.AbstractScriptExecutor
existsModule, existsModule, generateResourcePath, getResourcePath, retrieveModule, retrieveModuleMethods inherited from class org.eclipse.dirigible.engine.api.resource.AbstractResourceExecutor
createResourcePath, createResourcePath, existResource, existResource, getCollection, getLoadedPredeliveredContent, getRepository, getResource, getResource, getResourceContent, getResourceContent
-
Field Details
-
ENGINE_NAME
The Constant ENGINE_NAME.- See Also:
- Constant Field Values
-
DIRIGIBLE_JAVASCRIPT_GRAALVM_DEBUGGER_ENABLED
The Constant DIRIGIBLE_JAVASCRIPT_GRAALVM_DEBUGGER_ENABLED.- See Also:
- Constant Field Values
-
DIRIGIBLE_JAVASCRIPT_GRAALVM_DEBUGGER_PORT
The Constant DIRIGIBLE_JAVASCRIPT_GRAALVM_DEBUGGER_PORT.- See Also:
- Constant Field Values
-
DIRIGIBLE_JAVASCRIPT_GRAALVM_COMPATIBILITY_MODE_MOZILLA
The Constant DIRIGIBLE_JAVASCRIPT_GRAALVM_COMPATIBILITY_MODE_MOZILLA.- See Also:
- Constant Field Values
-
DEFAULT_DEBUG_PORT
The Constant DEFAULT_DEBUG_PORT.- See Also:
- Constant Field Values
-
-
Constructor Details
-
GraalVMJavascriptEngineExecutor
public GraalVMJavascriptEngineExecutor()
-
-
Method Details
-
executeServiceModule
public Object executeServiceModule(String module, Map<Object,Object> executionContext) throws ScriptingExceptionExecute service module.- Specified by:
executeServiceModulein interfaceIJavascriptEngineExecutor- Specified by:
executeServiceModulein interfaceorg.eclipse.dirigible.engine.api.script.IScriptEngineExecutor- Parameters:
module- the moduleexecutionContext- the execution context- Returns:
- the object
- Throws:
ScriptingException- the scripting exception
-
executeServiceCode
public Object executeServiceCode(String code, Map<Object,Object> executionContext) throws ScriptingExceptionExecute service code.- Specified by:
executeServiceCodein interfaceorg.eclipse.dirigible.engine.api.script.IScriptEngineExecutor- Parameters:
code- the codeexecutionContext- the execution context- Returns:
- the object
- Throws:
ScriptingException- the scripting exception
-
evalCode
public Object evalCode(String code, Map<Object,Object> executionContext) throws ScriptingExceptionEval code.- Specified by:
evalCodein interfaceorg.eclipse.dirigible.engine.api.script.IScriptEngineExecutor- Parameters:
code- the codeexecutionContext- the execution context- Returns:
- the object
- Throws:
ScriptingException- the scripting exception
-
evalModule
public Object evalModule(String module, Map<Object,Object> executionContext) throws ScriptingExceptionEval module.- Specified by:
evalModulein interfaceorg.eclipse.dirigible.engine.api.script.IScriptEngineExecutor- Parameters:
module- the moduleexecutionContext- the execution context- Returns:
- the object
- Throws:
ScriptingException- the scripting exception
-
executeMethodFromModule
public Object executeMethodFromModule(String module, String memberClass, String memberMethod, Map<Object,Object> executionContext)Execute method from module.- Specified by:
executeMethodFromModulein interfaceorg.eclipse.dirigible.engine.api.script.IScriptEngineExecutor- Parameters:
module- the modulememberClass- the member classmemberMethod- the member methodexecutionContext- the execution context- Returns:
- the object
-
run
Run.- Specified by:
runin interfaceCodeRunner<String,Object>- Parameters:
codeFilePath- the code file path- Returns:
- the object
-
run
Run.- Specified by:
runin interfaceCodeRunner<String,Object>- Parameters:
codeSource- the code source- Returns:
- the object
-
executeService
public Object executeService(String moduleOrCode, Map<Object,Object> executionContext, boolean isModule, boolean commonJSModule) throws ScriptingExceptionExecute service.- Parameters:
moduleOrCode- the module or codeexecutionContext- the execution contextisModule- the is modulecommonJSModule- the common JS module- Returns:
- the object
- Throws:
ScriptingException- the scripting exception
-
executeService
public Object executeService(String moduleOrCode, Map<Object,Object> executionContext, boolean isModule, boolean commonJSModule, BiConsumer<org.graalvm.polyglot.Context,org.graalvm.polyglot.Value> onAfterExecute) throws ScriptingExceptionExecute service.- Parameters:
moduleOrCode- the module or codeexecutionContext- the execution contextisModule- the is modulecommonJSModule- the common JS moduleonAfterExecute- the on after execute- Returns:
- the object
- Throws:
ScriptingException- the scripting exception
-
loadSource
Load source.- Parameters:
module- the module- Returns:
- the string
- Throws:
IOException- Signals that an I/O exception has occurred.URISyntaxException- the URI syntax exception
-
beforeEval
Before eval.- Parameters:
context- the context- Throws:
IOException- Signals that an I/O exception has occurred.
-
getType
Gets the type.- Specified by:
getTypein interfaceorg.eclipse.dirigible.engine.api.IEngineExecutor- Returns:
- the type
-
getName
Gets the name.- Specified by:
getNamein interfaceorg.eclipse.dirigible.engine.api.IEngineExecutor- Returns:
- the name
-
getSourceProvider
Gets the source provider.- Returns:
- the source provider
-
close
public void close()Close.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCodeRunner<String,Object>
-