org.jboss.soa.esb.actions.scripting
Class ScriptingAction
java.lang.Object
org.jboss.soa.esb.actions.AbstractActionLifecycle
org.jboss.soa.esb.actions.AbstractActionPipelineProcessor
org.jboss.soa.esb.actions.scripting.ScriptingAction
- All Implemented Interfaces:
- ActionLifecycle, ActionPipelineProcessor
public class ScriptingAction
- extends AbstractActionPipelineProcessor
BSF Scripting action pipeline processor.
Based on GroovyActionProcessor
by Gregory Pierce and Tom Fennelly.
<action name="helloWorld" class="org.jboss.soa.esb.actions.scripting.ScriptingAction">
<property name="script" value="/scripts/helloWorld.ext"/>
<-- The language property is not required; it is deduced via the script extension but can be overridden -->
<property name="language" value="languageDescriptor"/>
</action>
The Message
is bound into the script with the name "message".
The ConfigTree
is bound into the script with the name "config".
The MessagePayloadProxy
is bound into the script with the name "payloadProxy".
The Logger
is bound into the script with the name "logger".
The script can also be supplied to this action as the message payload, allowing you to
dynamically supply the action script. For message based scripts to be executable,
the "script" action property must be omitted and the "supportMessageBasedScripting" property must
be set to "true". There are obvious security issues around executing message based scripts,
so use this feature controlled manner.
The following are the supported scripting languages, although the developer
is responsible for including the appropriate 3rd party libraries (from bsf.jar's
org/apache/bsf/Languages.properties):
# List of script types and their associated scripting engines
#
# languageDescriptor = engineClass, ext1|ext2|... {, codebaseURL, ...}
#
# where exti are extensions for the language. Note that we leave
# all the engines enabled now and allow them to fail at load time.
# This way engines can be added by just adding to the classpath
# without having to edit this file. Cheating, really, but it works.
#
javascript = org.apache.bsf.engines.javascript.JavaScriptEngine, js
jacl = org.apache.bsf.engines.jacl.JaclEngine, jacl
netrexx = org.apache.bsf.engines.netrexx.NetRexxEngine, nrx
java = org.apache.bsf.engines.java.JavaEngine, java
javaclass = org.apache.bsf.engines.javaclass.JavaClassEngine, class
bml = org.apache.bml.ext.BMLEngine, bml
vbscript = org.apache.bsf.engines.activescript.ActiveScriptEngine, vbs
jscript = org.apache.bsf.engines.activescript.ActiveScriptEngine, jss
perlscript = org.apache.bsf.engines.activescript.ActiveScriptEngine, pls
perl = org.apache.bsf.engines.perl.PerlEngine, pl
jpython = org.apache.bsf.engines.jpython.JPythonEngine, py
jython = org.apache.bsf.engines.jython.JythonEngine, py
lotusscript = org.apache.bsf.engines.lotusscript.LsEngine, lss
xslt = org.apache.bsf.engines.xslt.XSLTEngine, xslt
pnuts = pnuts.ext.PnutsBSFEngine, pnut
beanbasic = org.apache.bsf.engines.beanbasic.BeanBasicEngine, bb
beanshell = bsh.util.BeanShellBSFEngine, bsh
ruby = org.jruby.javasupport.bsf.JRubyEngine, rb
judoscript = com.judoscript.BSFJudoEngine, judo|jud
- Author:
- dward at jboss.org
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ScriptingAction
public ScriptingAction(ConfigTree config)
initialise
public void initialise()
throws ActionLifecycleException
- Description copied from class:
AbstractActionLifecycle
- Initialise the action instance.
This method is called after the action instance has been instantiated so that
configuration options can be validated.
- Specified by:
initialise
in interface ActionLifecycle
- Overrides:
initialise
in class AbstractActionLifecycle
- Throws:
ActionLifecycleException
- for errors during initialisation.
process
public Message process(Message message)
throws ActionProcessingException
- Description copied from interface:
ActionPipelineProcessor
- Perform the action processing on the specified message.
This method is invoked for each message passing throught the pipeline.
- Parameters:
message
- The current message being processed.
- Returns:
- The message to be passed to the next stage of the pipeline.
- Throws:
ActionProcessingException
- for errors during processing.