org.apache.synapse.mediators.bsf
Class ScriptMediatorFactory

java.lang.Object
  extended by org.apache.synapse.config.xml.AbstractMediatorFactory
      extended by org.apache.synapse.mediators.bsf.ScriptMediatorFactory
All Implemented Interfaces:
MediatorFactory

public class ScriptMediatorFactory
extends AbstractMediatorFactory

Creates an instance of a Script mediator for inline or external script mediation for BSF scripting languages.

*

    <script [key="entry-key"]
      [function="script-function-name"] language="javascript|groovy|ruby">
      (text | xml)?
      <include key="entry-key" />
    </script>
 

The boolean response from the in-lined mediator is either the response from the evaluation of the script statements or if that result is not a boolean then a response of true is assumed.

The MessageContext passed in to the script mediator has additional methods over the Synapse MessageContext to enable working with the XML in a way natural to the scripting language. For example when using JavaScript get/setPayloadXML use E4X XML objects, when using Ruby they use REXML documents.

For external script mediation, that is when using key, function, language attributes, <include key"entry-key" /> is used to include one or more additional script files.


Field Summary
 
Fields inherited from class org.apache.synapse.config.xml.AbstractMediatorFactory
ATT_EXPRN, ATT_KEY, ATT_NAME, ATT_ONERROR, ATT_REGEX, ATT_SEQUENCE, ATT_SOURCE, ATT_STATS, ATT_TARGET, ATT_VALUE, ATT_XPATH, DESCRIPTION_Q, FEATURE_Q, PROP_Q, TARGET_Q
 
Constructor Summary
ScriptMediatorFactory()
           
 
Method Summary
 Mediator createSpecificMediator(OMElement elem, Properties properties)
          Specific mediator factory implementations should implement this method to build the Mediator by the given XML configuration
 QName getTagQName()
          The QName of this mediator element in the XML config
 
Methods inherited from class org.apache.synapse.config.xml.AbstractMediatorFactory
collectNameValuePairs, createMediator, handleException, handleException, processAuditStatus, processTraceState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptMediatorFactory

public ScriptMediatorFactory()
Method Detail

createSpecificMediator

public Mediator createSpecificMediator(OMElement elem,
                                       Properties properties)
Description copied from class: AbstractMediatorFactory
Specific mediator factory implementations should implement this method to build the Mediator by the given XML configuration

Specified by:
createSpecificMediator in class AbstractMediatorFactory
Parameters:
elem - configuration element describing the properties of the mediator
properties - bag of properties to pass in any information to the factory
Returns:
built mediator of that specific type

getTagQName

public QName getTagQName()
Description copied from interface: MediatorFactory
The QName of this mediator element in the XML config

Returns:
QName of the mediator element


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.