public class GroovyScriptExecutingMessageProcessor extends AbstractScriptExecutingMessageProcessor<Object>
MessageProcessor
implementation
to evaluate Groovy scripts.beanClassLoader, beanFactory
Constructor and Description |
---|
GroovyScriptExecutingMessageProcessor(ScriptSource scriptSource)
Create a processor for the given
ScriptSource that will use a
DefaultScriptVariableGenerator. |
GroovyScriptExecutingMessageProcessor(ScriptSource scriptSource,
ScriptVariableGenerator scriptVariableGenerator)
Create a processor for the given
ScriptSource that will use the provided
ScriptVariableGenerator. |
Modifier and Type | Method and Description |
---|---|
protected Object |
executeScript(ScriptSource scriptSource,
Map<String,Object> variables)
Subclasses must implement this method.
|
protected ScriptSource |
getScriptSource(Message<?> message)
Subclasses must implement this method to create a script source,
optionally using the message to locate or create the script.
|
void |
setBeanClassLoader(ClassLoader classLoader) |
void |
setBeanFactory(BeanFactory beanFactory) |
void |
setCustomizer(GroovyObjectCustomizer customizer)
Sets a
GroovyObjectCustomizer for this processor. |
processMessage
public GroovyScriptExecutingMessageProcessor(ScriptSource scriptSource)
ScriptSource
that will use a
DefaultScriptVariableGenerator.scriptSource
- The script source.public GroovyScriptExecutingMessageProcessor(ScriptSource scriptSource, ScriptVariableGenerator scriptVariableGenerator)
ScriptSource
that will use the provided
ScriptVariableGenerator.scriptSource
- The script source.scriptVariableGenerator
- The variable generator.public void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader
in interface BeanClassLoaderAware
setBeanClassLoader
in class AbstractScriptExecutingMessageProcessor<Object>
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
setBeanFactory
in class AbstractScriptExecutingMessageProcessor<Object>
BeansException
public void setCustomizer(GroovyObjectCustomizer customizer)
GroovyObjectCustomizer
for this processor.customizer
- The customizer.protected ScriptSource getScriptSource(Message<?> message)
AbstractScriptExecutingMessageProcessor
getScriptSource
in class AbstractScriptExecutingMessageProcessor<Object>
message
- the message being processedprotected Object executeScript(ScriptSource scriptSource, Map<String,Object> variables) throws Exception
AbstractScriptExecutingMessageProcessor
executeScript
in class AbstractScriptExecutingMessageProcessor<Object>
scriptSource
- The script source.variables
- The variables.Exception
- Any Exception.