Spring Integration

org.springframework.integration.groovy
Class GroovyCommandMessageProcessor

java.lang.Object
  extended by org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor<java.lang.Object>
      extended by org.springframework.integration.groovy.GroovyCommandMessageProcessor
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, MessageProcessor<java.lang.Object>

public class GroovyCommandMessageProcessor
extends AbstractScriptExecutingMessageProcessor<java.lang.Object>

Since:
2.0
Author:
Dave Syer, Mark Fisher, Oleg Zhurakousky, Artem Bilan, Stefan Reuter

Constructor Summary
GroovyCommandMessageProcessor()
          Creates a GroovyCommandMessageProcessor that will use the DefaultScriptVariableGenerator.
GroovyCommandMessageProcessor(groovy.lang.Binding binding)
          Creates a GroovyCommandMessageProcessor that will use the DefaultScriptVariableGenerator and provided Binding.
GroovyCommandMessageProcessor(groovy.lang.Binding binding, ScriptVariableGenerator scriptVariableGenerator)
          Creates a GroovyCommandMessageProcessor that will use the provided ScriptVariableGenerator and Binding.
GroovyCommandMessageProcessor(ScriptVariableGenerator scriptVariableGenerator)
          Creates a GroovyCommandMessageProcessor that will use the provided ScriptVariableGenerator.
 
Method Summary
protected  java.lang.Object executeScript(org.springframework.scripting.ScriptSource scriptSource, java.util.Map<java.lang.String,java.lang.Object> variables)
          Subclasses must implement this method.
protected  java.lang.String generateScriptName(Message<?> message)
           
protected  org.springframework.scripting.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 setCustomizer(org.springframework.scripting.groovy.GroovyObjectCustomizer customizer)
          Sets a GroovyObjectCustomizer for this processor.
 
Methods inherited from class org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor
getBeanClassLoader, getBeanFactory, processMessage, setBeanClassLoader, setBeanFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroovyCommandMessageProcessor

public GroovyCommandMessageProcessor()
Creates a GroovyCommandMessageProcessor that will use the DefaultScriptVariableGenerator.


GroovyCommandMessageProcessor

public GroovyCommandMessageProcessor(ScriptVariableGenerator scriptVariableGenerator)
Creates a GroovyCommandMessageProcessor that will use the provided ScriptVariableGenerator.


GroovyCommandMessageProcessor

public GroovyCommandMessageProcessor(groovy.lang.Binding binding)
Creates a GroovyCommandMessageProcessor that will use the DefaultScriptVariableGenerator and provided Binding. Provided 'binding' will be used in the BindingOverwriteGroovyObjectCustomizerDecorator to overwrite original Groovy Script 'binding'.


GroovyCommandMessageProcessor

public GroovyCommandMessageProcessor(groovy.lang.Binding binding,
                                     ScriptVariableGenerator scriptVariableGenerator)
Creates a GroovyCommandMessageProcessor that will use the provided ScriptVariableGenerator and Binding. Provided 'binding' will be used in the BindingOverwriteGroovyObjectCustomizerDecorator to overwrite original Groovy Script 'binding'.

Method Detail

setCustomizer

public void setCustomizer(org.springframework.scripting.groovy.GroovyObjectCustomizer customizer)
Sets a GroovyObjectCustomizer for this processor.


getScriptSource

protected org.springframework.scripting.ScriptSource getScriptSource(Message<?> message)
Description copied from class: AbstractScriptExecutingMessageProcessor
Subclasses must implement this method to create a script source, optionally using the message to locate or create the script.

Specified by:
getScriptSource in class AbstractScriptExecutingMessageProcessor<java.lang.Object>
Parameters:
message - the message being processed
Returns:
a ScriptSource to use to create a script

executeScript

protected java.lang.Object executeScript(org.springframework.scripting.ScriptSource scriptSource,
                                         java.util.Map<java.lang.String,java.lang.Object> variables)
                                  throws java.lang.Exception
Description copied from class: AbstractScriptExecutingMessageProcessor
Subclasses must implement this method. In doing so, the execution context for the script should be populated with the provided script variables.

Specified by:
executeScript in class AbstractScriptExecutingMessageProcessor<java.lang.Object>
Throws:
java.lang.Exception

generateScriptName

protected java.lang.String generateScriptName(Message<?> message)

Spring Integration