public abstract class AbstractScriptExecutingMessageProcessor<T> extends Object implements MessageProcessor<T>, BeanClassLoaderAware, BeanFactoryAware
MessageProcessor
for scripting implementations to extend.Modifier and Type | Field and Description |
---|---|
protected ClassLoader |
beanClassLoader |
protected BeanFactory |
beanFactory |
Modifier | Constructor and Description |
---|---|
protected |
AbstractScriptExecutingMessageProcessor() |
protected |
AbstractScriptExecutingMessageProcessor(ScriptVariableGenerator scriptVariableGenerator) |
Modifier and Type | Method and Description |
---|---|
protected abstract T |
executeScript(ScriptSource scriptSource,
Map<String,Object> variables)
Subclasses must implement this method.
|
protected abstract ScriptSource |
getScriptSource(Message<?> message)
Subclasses must implement this method to create a script source,
optionally using the message to locate or create the script.
|
T |
processMessage(Message<?> message)
Executes the script and returns the result.
|
void |
setBeanClassLoader(ClassLoader classLoader) |
void |
setBeanFactory(BeanFactory beanFactory) |
protected volatile ClassLoader beanClassLoader
protected volatile BeanFactory beanFactory
protected AbstractScriptExecutingMessageProcessor()
protected AbstractScriptExecutingMessageProcessor(ScriptVariableGenerator scriptVariableGenerator)
public final T processMessage(Message<?> message)
processMessage
in interface MessageProcessor<T>
message
- The message to process.public void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader
in interface BeanClassLoaderAware
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
BeansException
protected abstract ScriptSource getScriptSource(Message<?> message)
message
- the message being processedprotected abstract T executeScript(ScriptSource scriptSource, Map<String,Object> variables) throws Exception
scriptSource
- The script source.variables
- The variables.Exception
- Any Exception.