Package org.apache.unomi.groovy.actions
Class GroovyActionDispatcher
java.lang.Object
org.apache.unomi.groovy.actions.GroovyActionDispatcher
- All Implemented Interfaces:
ActionDispatcher
High-performance ActionDispatcher for pre-compiled Groovy scripts.
Executes scripts without GroovyShell overhead using isolated instances.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis method is responsible of executing the action logic, so it will probably dispatch to an underlying engine such as a scripting engine or any other type.Retrieves the prefix that this dispatcher recognizes and that is used in the actionTypeId.voidsetActionExecutorDispatcher(ActionExecutorDispatcher actionExecutorDispatcher) voidsetDefinitionsService(DefinitionsService definitionsService) voidsetGroovyActionsService(GroovyActionsService groovyActionsService) voidsetMetricsService(MetricsService metricsService)
-
Constructor Details
-
GroovyActionDispatcher
public GroovyActionDispatcher()
-
-
Method Details
-
setMetricsService
-
setGroovyActionsService
-
setDefinitionsService
-
setActionExecutorDispatcher
-
getPrefix
Description copied from interface:ActionDispatcherRetrieves the prefix that this dispatcher recognizes and that is used in the actionTypeId. For example to dispatch to a GroovyActionDispatcher, the prefix could be : "groovy". Then when you want to refer to a Groovy action type you could do something like this: "groovy:myGroovyAction". Prefixes MUST be globally unique. Not sanity check is done on this so please be careful!- Specified by:
getPrefixin interfaceActionDispatcher- Returns:
- a string containing the unique
-
execute
Description copied from interface:ActionDispatcherThis method is responsible of executing the action logic, so it will probably dispatch to an underlying engine such as a scripting engine or any other type. This makes it possible for example to implement actions in Groovy or even Javascript.- Specified by:
executein interfaceActionDispatcher- Parameters:
action- theActionto executeevent- theEventthat triggered the actionactionName- the name of the action to execute that is after the prefix in the action type- Returns:
- an integer status corresponding to what happened as defined by public constants of
EventService
-