public class ScriptMediator extends AbstractMediator
<script [key="entry-key"]
[function="script-function-name"] language="javascript|groovy|ruby">
(text | xml)?
</script>
The function is an optional attribute defining the name of the script function to call,
if not specified it defaults to a function named 'mediate'. The function takes a single
parameter which is the Synapse MessageContext. The function may return a boolean, if it
does not then true is assumed.| Modifier and Type | Field and Description |
|---|---|
protected ScriptEngine |
scriptEngine
The BSF engine created to process each message through the script
|
log, trace, traceState| Constructor and Description |
|---|
ScriptMediator(String language,
Map<Value,Object> includeKeysMap,
Value key,
String function,
ClassLoader classLoader)
Create a script mediator for the given language and given script entry key and function
|
ScriptMediator(String language,
String scriptSourceCode,
ClassLoader classLoader)
Create a script mediator for the given language and given script source
|
| Modifier and Type | Method and Description |
|---|---|
String |
getFunction() |
Map<Value,Object> |
getIncludeMap() |
Value |
getKey() |
String |
getLanguage() |
ClassLoader |
getLoader() |
String |
getScriptSrc() |
protected void |
initInlineScript()
Initialise the Mediator for the inline script
|
protected void |
initScriptEngine() |
boolean |
mediate(MessageContext synCtx)
Perform Script mediation
|
protected void |
prepareExternalScript(MessageContext synCtx)
Prepares the mediator for the invocation of an external script
|
void |
setLoader(ClassLoader loader) |
auditLog, auditWarn, configure, disableStatistics, enableStatistics, getAspectConfiguration, getDescription, getLog, getTraceState, getType, handleException, handleException, isContentAware, isStatisticsEnable, isTraceOn, isTraceOrDebugOn, setDescription, setEffectiveTraceState, setTraceState, shouldTrace, traceOrDebug, traceOrDebugWarnprotected ScriptEngine scriptEngine
public ScriptMediator(String language, String scriptSourceCode, ClassLoader classLoader)
language - the BSF languagescriptSourceCode - the source code of the scriptpublic ScriptMediator(String language, Map<Value,Object> includeKeysMap, Value key, String function, ClassLoader classLoader)
language - the BSF languageincludeKeysMap - Include script keyskey - the registry entry key to load the scriptfunction - the function to be invokedpublic boolean mediate(MessageContext synCtx)
synCtx - the Synapse message contextprotected void initInlineScript()
protected void prepareExternalScript(MessageContext synCtx) throws ScriptException
synCtx - MessageContext scriptScriptException - For any errors , when compile the scriptprotected void initScriptEngine()
public String getLanguage()
public Value getKey()
public String getFunction()
public String getScriptSrc()
public ClassLoader getLoader()
public void setLoader(ClassLoader loader)
Copyright © 2005-2017 Apache Software Foundation. All Rights Reserved.