public abstract class AbstractScriptExecutingMessageProcessor<T>
extends java.lang.Object
implements org.springframework.integration.handler.MessageProcessor<T>, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.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(org.springframework.scripting.ScriptSource scriptSource,
java.util.Map<java.lang.String,java.lang.Object> variables)
Subclasses must implement this method.
|
protected java.lang.ClassLoader |
getBeanClassLoader() |
protected org.springframework.beans.factory.BeanFactory |
getBeanFactory() |
protected abstract org.springframework.scripting.ScriptSource |
getScriptSource(org.springframework.messaging.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(org.springframework.messaging.Message<?> message)
Executes the script and returns the result.
|
void |
setBeanClassLoader(java.lang.ClassLoader classLoader) |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
protected AbstractScriptExecutingMessageProcessor()
protected AbstractScriptExecutingMessageProcessor(ScriptVariableGenerator scriptVariableGenerator)
public void setBeanClassLoader(java.lang.ClassLoader classLoader)
setBeanClassLoader in interface org.springframework.beans.factory.BeanClassLoaderAwarepublic void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
throws org.springframework.beans.BeansException
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAwareorg.springframework.beans.BeansExceptionprotected ScriptVariableGenerator getScriptVariableGenerator()
protected java.lang.ClassLoader getBeanClassLoader()
protected org.springframework.beans.factory.BeanFactory getBeanFactory()
@Nullable public final T processMessage(org.springframework.messaging.Message<?> message)
processMessage in interface org.springframework.integration.handler.MessageProcessor<T>protected abstract org.springframework.scripting.ScriptSource getScriptSource(org.springframework.messaging.Message<?> message)
message - the message being processed@Nullable protected abstract T executeScript(org.springframework.scripting.ScriptSource scriptSource, java.util.Map<java.lang.String,java.lang.Object> variables)
scriptSource - The script source.variables - The variables.