public abstract class AbstractScriptExecutingMessageProcessor<T> extends Object implements MessageProcessor<T>, BeanClassLoaderAware, BeanFactoryAware
MessageProcessor
for scripting implementations to extend.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 ClassLoader |
getBeanClassLoader() |
protected BeanFactory |
getBeanFactory() |
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.
|
protected ScriptVariableGenerator |
getScriptVariableGenerator() |
T |
processMessage(Message<?> message)
Executes the script and returns the result.
|
void |
setBeanClassLoader(ClassLoader classLoader) |
void |
setBeanFactory(BeanFactory beanFactory) |
protected AbstractScriptExecutingMessageProcessor()
protected AbstractScriptExecutingMessageProcessor(ScriptVariableGenerator scriptVariableGenerator)
public void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader
in interface BeanClassLoaderAware
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
BeansException
protected ScriptVariableGenerator getScriptVariableGenerator()
protected ClassLoader getBeanClassLoader()
protected BeanFactory getBeanFactory()
@Nullable public final T processMessage(Message<?> message)
processMessage
in interface MessageProcessor<T>
message
- The message to process.protected abstract ScriptSource getScriptSource(Message<?> message)
message
- the message being processed@Nullable protected abstract T executeScript(ScriptSource scriptSource, Map<String,Object> variables)
scriptSource
- The script source.variables
- The variables.