Class GroovyActionsServiceImpl
- All Implemented Interfaces:
GroovyActionsService
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interface
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClass<? extends groovy.lang.Script>
Retrieves a pre-compiled script class from cache.getScriptMetadata
(String actionName) Retrieves script metadata for monitoring and change detection.void
void
Removes a Groovy action and all associated metadata.void
Saves a Groovy action script with compilation and validation.void
setDefinitionsService
(DefinitionsService definitionsService) void
setPersistenceService
(PersistenceService persistenceService) void
setSchedulerService
(SchedulerService schedulerService) void
start
(GroovyActionsServiceImpl.GroovyActionsServiceConfig config, org.osgi.framework.BundleContext bundleContext)
-
Constructor Details
-
GroovyActionsServiceImpl
public GroovyActionsServiceImpl()
-
-
Method Details
-
setDefinitionsService
-
setPersistenceService
-
setSchedulerService
-
start
public void start(GroovyActionsServiceImpl.GroovyActionsServiceConfig config, org.osgi.framework.BundleContext bundleContext) -
onDestroy
public void onDestroy() -
save
Saves a Groovy action script with compilation and validation.This method compiles the script, validates it has the required annotations, persists it, and updates the internal cache. If the script content hasn't changed, recompilation is skipped. Implementation performs hash-based change detection to skip unnecessary recompilation.
- Specified by:
save
in interfaceGroovyActionsService
- Parameters:
actionName
- the unique identifier for the actiongroovyScript
- the Groovy script source code
-
remove
Removes a Groovy action and all associated metadata.This method removes the action from both the cache and persistent storage, and cleans up any registered action types in the definitions service.
- Specified by:
remove
in interfaceGroovyActionsService
- Parameters:
actionName
- the unique identifier of the action to remove
-
getCompiledScript
Retrieves a pre-compiled script class from cache.This is the preferred method for script execution as it returns pre-compiled classes without any compilation overhead. Returns
null
if the script is not found in the cache.- Specified by:
getCompiledScript
in interfaceGroovyActionsService
- Parameters:
id
- the unique identifier of the action- Returns:
- the compiled script class, or
null
if not found in cache
-
getScriptMetadata
Retrieves script metadata for monitoring and change detection.The returned metadata includes content hash, compilation timestamp, and the compiled class reference. This is useful for monitoring tools and debugging.
- Specified by:
getScriptMetadata
in interfaceGroovyActionsService
- Parameters:
actionName
- the unique identifier of the action- Returns:
- the script metadata, or
null
if not found
-