org.mule.el.mvel
Class MVELExpressionLanguage

java.lang.Object
  extended by org.mule.el.mvel.MVELExpressionLanguage
All Implemented Interfaces:
ExpressionLanguage, Initialisable
Direct Known Subclasses:
MVELExpressionLanguageWrapper

public class MVELExpressionLanguage
extends Object
implements ExpressionLanguage, Initialisable

Expression language that uses MVEL (http://mvel.codehaus.org/).


Field Summary
protected  Map<String,String> aliases
           
protected  boolean autoResolveVariables
           
protected  MVELExpressionExecutor expressionExecutor
           
protected  Collection<ExpressionLanguageExtension> expressionLanguageExtensions
           
protected  Map<String,org.mule.mvel2.ast.Function> globalFunctions
           
protected  String globalFunctionsFile
           
protected  String globalFunctionsString
           
protected  Map<String,Class<?>> imports
           
protected  MuleContext muleContext
           
protected  org.mule.mvel2.ParserConfiguration parserConfiguration
           
protected  org.mule.mvel2.integration.VariableResolverFactory staticContext
           
protected  boolean useGlobalConfiguration
           
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Constructor Summary
MVELExpressionLanguage(MuleContext muleContext)
           
 
Method Summary
 void addAlias(String name, String expression)
           
 void addGlobalFunction(String name, org.mule.mvel2.ast.Function function)
           
 void addImport(String name, Class<?> clazz)
           
protected  void configureParserConfiguration(org.mule.mvel2.ParserConfiguration parserConfiguration)
           
protected  MVELExpressionLanguageContext createExpressionLanguageContext(Map<String,Object> vars)
           
protected  org.mule.mvel2.integration.VariableResolverFactory createGlobalVariableResolverFactory(org.mule.mvel2.integration.VariableResolverFactory... parents)
           
protected  org.mule.mvel2.ParserConfiguration createParserConfiguration()
           
protected  void createStaticContext()
           
protected  org.mule.mvel2.integration.VariableResolverFactory createVariableVariableResolverFactory(MuleEvent event)
           
protected  org.mule.mvel2.integration.VariableResolverFactory createVariableVariableResolverFactory(MuleMessage message)
          Deprecated. 
<T> T
evaluate(String expression)
          Execute the expression returning the result.
<T> T
evaluate(String expression, Map<String,Object> vars)
          Execute the expression returning the result.
<T> T
evaluate(String expression, MuleEvent event)
          Execute the expression returning the result.
<T> T
evaluate(String expression, MuleEvent event, Map<String,Object> vars)
          Execute the expression returning the result.
<T> T
evaluate(String expression, MuleMessage message)
          Deprecated. 
<T> T
evaluate(String expression, MuleMessage message, Map<String,Object> vars)
          Deprecated. 
protected
<T> T
evaluateInternal(String expression, MVELExpressionLanguageContext variableResolverFactory)
           
protected  Map<String,String> getAliases()
           
protected  Collection<ExpressionLanguageExtension> getExpressionLanguageExtensions()
           
protected  Map<String,org.mule.mvel2.ast.Function> getGlobalFunctions()
           
 void initialise()
          Method used to perform any initialisation work.
 boolean isValid(String expression)
          Validates the expression returning true is the expression is valid, false otherwise..
protected  void loadGlobalFunctions()
           
 void setAliases(Map<String,String> aliases)
           
 void setAutoResolveVariables(boolean autoResolveVariables)
           
 void setGlobalFunctionsFile(String globalFunctionsFile)
           
 void setGlobalFunctionsString(String globalFunctionsString)
           
 void setImports(Map<String,Class<?>> imports)
           
 void validate(String expression)
          Validates the expression returning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parserConfiguration

protected org.mule.mvel2.ParserConfiguration parserConfiguration

muleContext

protected MuleContext muleContext

expressionExecutor

protected MVELExpressionExecutor expressionExecutor

expressionLanguageExtensions

protected Collection<ExpressionLanguageExtension> expressionLanguageExtensions

staticContext

protected org.mule.mvel2.integration.VariableResolverFactory staticContext

globalFunctionsString

protected String globalFunctionsString

globalFunctionsFile

protected String globalFunctionsFile

globalFunctions

protected Map<String,org.mule.mvel2.ast.Function> globalFunctions

aliases

protected Map<String,String> aliases

imports

protected Map<String,Class<?>> imports

autoResolveVariables

protected boolean autoResolveVariables

useGlobalConfiguration

protected boolean useGlobalConfiguration
Constructor Detail

MVELExpressionLanguage

public MVELExpressionLanguage(MuleContext muleContext)
Method Detail

initialise

public void initialise()
                throws InitialisationException
Description copied from interface: Initialisable
Method used to perform any initialisation work. If a fatal error occurs during initialisation an InitialisationException should be thrown, causing the Mule instance to shutdown. If the error is recoverable, say by retrying to connect, a RecoverableException should be thrown. There is no guarantee that by throwing a Recoverable exception that the Mule instance will not shut down.

Specified by:
initialise in interface Initialisable
Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from

createStaticContext

protected void createStaticContext()

loadGlobalFunctions

protected void loadGlobalFunctions()
                            throws InitialisationException
Throws:
InitialisationException

evaluate

public <T> T evaluate(String expression)
Description copied from interface: ExpressionLanguage
Execute the expression returning the result. The expression will be executed by the expression language implementation without making any event or message context available.

Specified by:
evaluate in interface ExpressionLanguage
Type Parameters:
T - the return type expected
Parameters:
expression - the expression to be executed
Returns:
the result of execution of the expression.

evaluate

public <T> T evaluate(String expression,
                      Map<String,Object> vars)
Description copied from interface: ExpressionLanguage
Execute the expression returning the result. The expression will be executed by the expression language implementation without making any event or message context available. A Map of variables can be provided that will be able to the expression when executed. Variable provided in the map will only be available if there are no conflicts with context variables provided by the expression language implementation.

Specified by:
evaluate in interface ExpressionLanguage
Type Parameters:
T - the return type expected
Parameters:
expression - the expression to be executed
vars - a map of expression variables
Returns:
the result of execution of the expression.

evaluate

public <T> T evaluate(String expression,
                      MuleEvent event)
Description copied from interface: ExpressionLanguage
Execute the expression returning the result. The expression will be executed with MuleEvent context, meaning the expression language implementation should provided access to the message.

Specified by:
evaluate in interface ExpressionLanguage
Type Parameters:
T - the return type expected
Parameters:
expression - the expression to be executed
event - the current event being processed
Returns:
the result of execution of the expression.

evaluate

public <T> T evaluate(String expression,
                      MuleEvent event,
                      Map<String,Object> vars)
Description copied from interface: ExpressionLanguage
Execute the expression returning the result. The expression will be executed with MuleEvent context, meaning the expression language implementation should provided access to the message. A Map of variables can be provided that will be able to the expression when executed. Variable provided in the map will only be available if there are no conflict with context variables provided by the expression language implementation.

Specified by:
evaluate in interface ExpressionLanguage
Type Parameters:
T - the return type expected
Parameters:
expression - the expression to be executed
event - the current event being processed
vars - a map of expression variables
Returns:
the result of execution of the expression.

evaluate

@Deprecated
public <T> T evaluate(String expression,
                                 MuleMessage message)
Deprecated. 

Description copied from interface: ExpressionLanguage
Required to provide gradual migration to use of MuleEvent signatures

Specified by:
evaluate in interface ExpressionLanguage
See Also:
ExpressionLanguage.evaluate(String, MuleEvent)

evaluate

@Deprecated
public <T> T evaluate(String expression,
                                 MuleMessage message,
                                 Map<String,Object> vars)
Deprecated. 

Description copied from interface: ExpressionLanguage
Required to provide gradual migration to use of MuleEvent signatures

Specified by:
evaluate in interface ExpressionLanguage
See Also:
ExpressionLanguage.evaluate(String, MuleEvent)

evaluateInternal

protected <T> T evaluateInternal(String expression,
                                 MVELExpressionLanguageContext variableResolverFactory)

isValid

public boolean isValid(String expression)
Description copied from interface: ExpressionLanguage
Validates the expression returning true is the expression is valid, false otherwise.. All implementors should should validate expression syntactically. Semantic validation is optional.

Specified by:
isValid in interface ExpressionLanguage
Returns:

validate

public void validate(String expression)
              throws InvalidExpressionException
Description copied from interface: ExpressionLanguage
Validates the expression returning. An ExpressionInvalidException will be thrown is the All implementors should should validate expression syntactically. Semantic validation is optional.

Specified by:
validate in interface ExpressionLanguage
Throws:
InvalidExpressionException

createExpressionLanguageContext

protected MVELExpressionLanguageContext createExpressionLanguageContext(Map<String,Object> vars)

createParserConfiguration

protected org.mule.mvel2.ParserConfiguration createParserConfiguration()

configureParserConfiguration

protected void configureParserConfiguration(org.mule.mvel2.ParserConfiguration parserConfiguration)

setGlobalFunctionsString

public void setGlobalFunctionsString(String globalFunctionsString)

setAliases

public void setAliases(Map<String,String> aliases)

setImports

public void setImports(Map<String,Class<?>> imports)

setAutoResolveVariables

public void setAutoResolveVariables(boolean autoResolveVariables)

addGlobalFunction

public void addGlobalFunction(String name,
                              org.mule.mvel2.ast.Function function)

addImport

public void addImport(String name,
                      Class<?> clazz)

addAlias

public void addAlias(String name,
                     String expression)

setGlobalFunctionsFile

public void setGlobalFunctionsFile(String globalFunctionsFile)

createGlobalVariableResolverFactory

protected org.mule.mvel2.integration.VariableResolverFactory createGlobalVariableResolverFactory(org.mule.mvel2.integration.VariableResolverFactory... parents)

createVariableVariableResolverFactory

protected org.mule.mvel2.integration.VariableResolverFactory createVariableVariableResolverFactory(MuleEvent event)

createVariableVariableResolverFactory

@Deprecated
protected org.mule.mvel2.integration.VariableResolverFactory createVariableVariableResolverFactory(MuleMessage message)
Deprecated. 


getExpressionLanguageExtensions

protected Collection<ExpressionLanguageExtension> getExpressionLanguageExtensions()

getAliases

protected Map<String,String> getAliases()

getGlobalFunctions

protected Map<String,org.mule.mvel2.ast.Function> getGlobalFunctions()


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