org.mule.module.scripting.expression
Class AbstractScriptExpressionEvaluator

java.lang.Object
  extended by org.mule.module.scripting.expression.AbstractScriptExpressionEvaluator
All Implemented Interfaces:
MuleContextAware, ExpressionEvaluator, Disposable, NamedObject
Direct Known Subclasses:
GroovyExpressionEvaluator

public abstract class AbstractScriptExpressionEvaluator
extends Object
implements ExpressionEvaluator, Disposable, MuleContextAware

An abstract ExpressionEvaluator that can be used for any JSR-233 script engine. If a POJO is passed in it is accessible from the 'payload' namespace. If a MuleMessage instance is used then it is accessible from the message' namespace and the 'payload' namespace is also available.


Field Summary
protected  Map cache
           
protected  MuleContext muleContext
           
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
AbstractScriptExpressionEvaluator()
           
 
Method Summary
 void dispose()
          A lifecycle method where implementor should free up any resources.
 Object evaluate(String expression, MuleMessage message)
          Extracts a single property from the message
protected  Scriptable getScript(String expression)
           
 void setMuleContext(MuleContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mule.api.NamedObject
getName
 

Field Detail

cache

protected Map cache

muleContext

protected MuleContext muleContext
Constructor Detail

AbstractScriptExpressionEvaluator

public AbstractScriptExpressionEvaluator()
Method Detail

setMuleContext

public void setMuleContext(MuleContext context)
Specified by:
setMuleContext in interface MuleContextAware

evaluate

public Object evaluate(String expression,
                       MuleMessage message)
Extracts a single property from the message

Specified by:
evaluate in interface ExpressionEvaluator
Parameters:
expression - the property expression or expression
message - the message to extract from
Returns:
the result of the extraction or null if the property was not found

getScript

protected Scriptable getScript(String expression)

dispose

public void dispose()
A lifecycle method where implementor should free up any resources. If an exception is thrown it should just be logged and processing should continue. This method should not throw Runtime exceptions.

Specified by:
dispose in interface Disposable


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.