org.mule.module.scripting.expression
Class AbstractScriptExpressionEvaluator

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

public abstract class AbstractScriptExpressionEvaluator
extends Object
implements ExpressionEvaluator, Disposable

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
           
 
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 setName(String name)
          Sets the name of the object
 
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
Constructor Detail

AbstractScriptExpressionEvaluator

public AbstractScriptExpressionEvaluator()
Method Detail

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

setName

public void setName(String name)
Sets the name of the object

Specified by:
setName in interface NamedObject
Parameters:
name - the name of the object

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-2009 MuleSource, Inc.. All Rights Reserved.