public abstract class AbstractScriptExecutingMessageProcessor<T> extends java.lang.Object implements MessageProcessor<T>, BeanClassLoaderAware, BeanFactoryAware
MessageProcessor
for scripting implementations to extend.Modifier and Type | Field and Description |
---|---|
protected java.lang.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,
java.util.Map<java.lang.String,java.lang.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(java.lang.ClassLoader classLoader) |
void |
setBeanFactory(BeanFactory beanFactory) |
protected volatile java.lang.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(java.lang.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, java.util.Map<java.lang.String,java.lang.Object> variables) throws java.lang.Exception
scriptSource
- The script source.variables
- The variables.java.lang.Exception
- Any Exception.