public class DefaultExpressionManager extends Object implements ExpressionManager, MuleContextAware, Initialisable
ExpressionEvaluator through this interface.| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.commons.logging.Log |
logger
logger used by this class
|
static String |
OBJECT_FOR_ENRICHMENT |
DEFAULT_EXPRESSION_POSTFIX, DEFAULT_EXPRESSION_PREFIXPHASE_NAME| Constructor and Description |
|---|
DefaultExpressionManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearEnrichers()
Clears all registered enrichers from the manager.
|
void |
clearEvaluators()
Clears all registered evaluators from the manager.
|
protected String |
createEnrichmentExpression(String expression) |
void |
enrich(String expression,
MuleEvent event,
Object object) |
void |
enrich(String expression,
MuleMessage message,
Object object)
Enriches the current message using
|
void |
enrich(String expression,
String enricherName,
MuleMessage message,
Object object)
Enriches the current message
|
void |
enrichTyped(String expression,
MuleMessage message,
TypedValue object)
Enriches the current message using a typed value
|
Object |
evaluate(String expression,
MuleEvent event) |
Object |
evaluate(String expression,
MuleEvent event,
boolean failIfNull)
Evaluates the given expression.
|
Object |
evaluate(String expression,
MuleMessage message)
Evaluates the given expression.
|
Object |
evaluate(String expression,
MuleMessage message,
boolean failIfNull)
Evaluates the given expression.
|
Object |
evaluate(String expression,
String evaluator,
MuleMessage message,
boolean failIfNull)
Evaluates the given expression.
|
boolean |
evaluateBoolean(String expression,
MuleEvent event) |
boolean |
evaluateBoolean(String expression,
MuleEvent event,
boolean nullReturnsTrue,
boolean nonBooleanReturnsTrue) |
boolean |
evaluateBoolean(String expression,
MuleMessage message)
Evaluates the given expression resolving the result of the evaluation to a boolean.
|
boolean |
evaluateBoolean(String expression,
MuleMessage message,
boolean nullReturnsTrue,
boolean nonBooleanReturnsTrue)
Evaluates the given expression resolving the result of the evaluation to a boolean.
|
boolean |
evaluateBoolean(String expression,
String evaluator,
MuleMessage message)
Evaluates the given expression resolving the result of the evaluation to a boolean.
|
boolean |
evaluateBoolean(String expression,
String evaluator,
MuleMessage message,
boolean nullReturnsTrue,
boolean nonBooleanReturnsTrue)
Evaluates the given expression resolving the result of the evaluation to a boolean.
|
TypedValue |
evaluateTyped(String expression,
MuleMessage message) |
TypedValue |
evaluateTyped(String expression,
String evaluator,
MuleMessage message,
boolean failIfNull)
Evaluates the given expression propagating dataType.
|
ExpressionLanguage |
getExpressionLanguage() |
void |
initialise()
Method used to perform any initialisation work.
|
protected boolean |
isEnricherExpression(String expression) |
boolean |
isEnricherRegistered(String name)
Checks whether an enricher is registered with the manager
|
protected boolean |
isEvaluatorExpression(String expression) |
boolean |
isEvaluatorRegistered(String name)
Checks whether an evaluator is registered with the manager
|
boolean |
isExpression(String string)
Determines if the string is an expression.
|
boolean |
isValidExpression(String expression)
Determines if the expression is valid or not.
|
String |
parse(String expression,
MuleEvent event) |
String |
parse(String expression,
MuleEvent event,
boolean failIfNull) |
String |
parse(String expression,
MuleMessage message)
Evaluates expressions in a given string.
|
String |
parse(String expression,
MuleMessage message,
boolean failIfNull)
Evaluates expressions in a given string.
|
void |
registerEnricher(ExpressionEnricher enricher) |
void |
registerEvaluator(ExpressionEvaluator evaluator) |
static String |
removeExpressionMarker(String expression) |
protected boolean |
resolveBoolean(Object result,
boolean nullReturnsTrue,
boolean nonBooleanReturnsTrue,
String expression) |
void |
setExpressionLanguage(ExpressionLanguage expressionLanguage) |
void |
setMuleContext(MuleContext context) |
ExpressionEnricher |
unregisterEnricher(String name)
Removes the evaluator with the given name
|
ExpressionEvaluator |
unregisterEvaluator(String name)
Removes the evaluator with the given name
|
void |
validateExpression(String expression)
Determines if the expression is valid or not.
|
protected static final transient org.apache.commons.logging.Log logger
public static final String OBJECT_FOR_ENRICHMENT
public void setMuleContext(MuleContext context)
setMuleContext in interface MuleContextAwarepublic void registerEvaluator(ExpressionEvaluator evaluator)
registerEvaluator in interface ExpressionManagerpublic void registerEnricher(ExpressionEnricher enricher)
registerEnricher in interface ExpressionManagerpublic boolean isEvaluatorRegistered(String name)
isEvaluatorRegistered in interface ExpressionManagername - the name of the expression evaluatorpublic boolean isEnricherRegistered(String name)
isEnricherRegistered in interface ExpressionManagername - the name of the expression enricherpublic ExpressionEvaluator unregisterEvaluator(String name)
unregisterEvaluator in interface ExpressionManagername - the name of the evaluator to removepublic ExpressionEnricher unregisterEnricher(String name)
unregisterEnricher in interface ExpressionManagername - the name of the evaluator to removepublic Object evaluate(String expression, MuleMessage message) throws ExpressionRuntimeException
ExpressionManager.parse(String,org.mule.api.MuleMessage,boolean) method
should be used since it will iterate through all expressions in a string.evaluate in interface ExpressionManagerexpression - a single expression i.e. xpath://foomessage - the current message to process. The expression will evaluata on the message.ExpressionRuntimeException - if the expression is invalid, or a null is found for the expression
and 'failIfNull is set to true.public Object evaluate(String expression, MuleEvent event) throws ExpressionRuntimeException
evaluate in interface ExpressionManagerExpressionRuntimeExceptionpublic Object evaluate(String expression, MuleEvent event, boolean failIfNull) throws ExpressionRuntimeException
ExpressionManager.parse(String,org.mule.api.MuleMessage,boolean) method
should be used since it will iterate through all expressions in a string.evaluate in interface ExpressionManagerexpression - a single expression i.e. xpath://foomessage - the current message to process. The expression will evaluata on the message.failIfNull - determines if an exception should be thrown if expression could not be evaluated or
returns null.ExpressionRuntimeException - if the expression is invalid, or a null is found for the expression
and 'failIfNull is set to true.public Object evaluate(String expression, MuleMessage message, boolean failIfNull)
ExpressionManagerExpressionManager.parse(String,org.mule.api.MuleMessage,boolean) method should be used since it will iterate
through all expressions in a string.evaluate in interface ExpressionManagerexpression - a single expression i.e. xpath://foomessage - The current message being processedfailIfNull - determines if an exception should be thrown if expression could not be evaluated or
returns null. @return the result of the evaluationpublic void enrich(String expression, MuleMessage message, Object object) throws ExpressionRuntimeException
ExpressionManagerenrich in interface ExpressionManagerexpression - a single expression i.e. header://foo that defines how the message should be enrichedmessage - The current message being processed that will be enrichedobject - The object that will be used to enrich the messageExpressionRuntimeExceptionpublic void enrichTyped(String expression, MuleMessage message, TypedValue object)
ExpressionManagerenrichTyped in interface ExpressionManagerexpression - a single expression i.e. header://foo that defines how the message should be enrichedmessage - The current message being processed that will be enrichedobject - The typed value that will be used to enrich the messagepublic void enrich(String expression, MuleEvent event, Object object)
enrich in interface ExpressionManagerpublic void enrich(String expression, String enricherName, MuleMessage message, Object object)
ExpressionManagerenrich in interface ExpressionManagerexpression - a single expression i.e. header://foo that defines how the message shoud be enrichedenricherName - the enricher to use when executing the expressionmessage - The current message being processed that will be enrichedobject - The object that will be used to enrich the messagepublic Object evaluate(String expression, String evaluator, MuleMessage message, boolean failIfNull) throws ExpressionRuntimeException
ExpressionManager.parse(String,org.mule.api.MuleMessage,boolean) method
should be used since it will iterate through all expressions in a string.evaluate in interface ExpressionManagerexpression - a single expression i.e. xpath://fooevaluator - the evaluator to use when executing the expressionmessage - the current message to process. The expression will evaluata on the message.failIfNull - determines if an exception should be thrown if expression could not be evaluated or
returns null or if an exception should be thrown if an empty collection is returned.ExpressionRuntimeException - if the expression is invalid, or a null is found for the expression
and 'failIfNull is set to true.public TypedValue evaluateTyped(String expression, String evaluator, MuleMessage message, boolean failIfNull) throws ExpressionRuntimeException
ExpressionManagerExpressionManager.parse(String, org.mule.api.MuleMessage, boolean) method should be used since it will iterate
through all expressions in a string.evaluateTyped in interface ExpressionManagerexpression - one or more expressions embedded in a literal string i.e.
"Value is #[xpath://foo] other value is #[header:foo]."evaluator - the evaluator to use when executing the expressionmessage - The current message being processedfailIfNull - determines if an exception should be thrown if expression could not be evaluated or
returns null. @return the result of the evaluationExpressionRuntimeException - if the expression is invalid, or a null is found for the expression
and 'failIfNull is set to true.public boolean evaluateBoolean(String expression, String evaluator, MuleMessage message) throws ExpressionRuntimeException
ExpressionManagerevaluateBoolean in interface ExpressionManagerexpression - a single expression i.e. header:foo=barevaluator - the evaluator to use when executing the expressionmessage - The current message being processedExpressionRuntimeExceptionpublic boolean evaluateBoolean(String expression, MuleMessage message) throws ExpressionRuntimeException
ExpressionManagerevaluateBoolean in interface ExpressionManagerexpression - a single expression i.e. header:foo=barmessage - The current message being processedExpressionRuntimeExceptionpublic boolean evaluateBoolean(String expression, String evaluator, MuleMessage message, boolean nullReturnsTrue, boolean nonBooleanReturnsTrue) throws ExpressionRuntimeException
ExpressionManagerevaluateBoolean in interface ExpressionManagerexpression - a single expression i.e. header:foo=barevaluator - the evaluator to use when executing the expressionmessage - The current message being processednullReturnsTrue - determines if true should be returned if the result of the evaluation is nullnonBooleanReturnsTrue - determines if true should returned if the result is not null but isn't
recognised as a booleanExpressionRuntimeExceptionpublic boolean evaluateBoolean(String expression, MuleMessage message, boolean nullReturnsTrue, boolean nonBooleanReturnsTrue) throws ExpressionRuntimeException
ExpressionManagerevaluateBoolean in interface ExpressionManagerexpression - a single expression i.e. header:foo=barmessage - The current message being processednullReturnsTrue - determines if true should be returned if the result of the evaluation is nullnonBooleanReturnsTrue - determines if true should returned if the result is not null but isn't
recognised as a booleanExpressionRuntimeExceptionpublic boolean evaluateBoolean(String expression, MuleEvent event, boolean nullReturnsTrue, boolean nonBooleanReturnsTrue) throws ExpressionRuntimeException
evaluateBoolean in interface ExpressionManagerExpressionRuntimeExceptionprotected boolean resolveBoolean(Object result, boolean nullReturnsTrue, boolean nonBooleanReturnsTrue, String expression)
public String parse(String expression, MuleMessage message) throws ExpressionRuntimeException
ExpressionManager.evaluate(String,org.mule.api.MuleMessage,boolean).parse in interface ExpressionManagerexpression - a single expression i.e. xpath://foomessage - the current message to process. The expression will evaluata on the message.ExpressionRuntimeException - if the expression is invalid, or a null is
found for the expression and 'failIfNull is set to true.public String parse(String expression, MuleEvent event) throws ExpressionRuntimeException
parse in interface ExpressionManagerExpressionRuntimeExceptionpublic String parse(String expression, MuleMessage message, boolean failIfNull) throws ExpressionRuntimeException
ExpressionManager.evaluate(String,org.mule.api.MuleMessage,boolean).parse in interface ExpressionManagerexpression - a single expression i.e. xpath://foomessage - the current message to process. The expression will evaluata on the message.failIfNull - determines if an exception should be thrown if expression could not be evaluated or
returns null.ExpressionRuntimeException - if the expression is invalid, or a null is found for the expression
and 'failIfNull is set to true.public String parse(String expression, MuleEvent event, boolean failIfNull) throws ExpressionRuntimeException
parse in interface ExpressionManagerExpressionRuntimeExceptionpublic void clearEvaluators()
clearEvaluators in interface ExpressionManagerpublic void clearEnrichers()
ExpressionManagerclearEnrichers in interface ExpressionManagerpublic boolean isExpression(String string)
ExpressionManagerisExpression in interface ExpressionManagerstring - is this string an expression stringpublic TypedValue evaluateTyped(String expression, MuleMessage message)
evaluateTyped in interface ExpressionManagerpublic boolean isValidExpression(String expression)
isValidExpression in interface ExpressionManagerexpression - the expression to validatepublic void validateExpression(String expression) throws InvalidExpressionException
ExpressionManagervalidateExpression in interface ExpressionManagerexpression - the expression to validateInvalidExpressionException - if the expression is invalid, including information about the
position and faultpublic void initialise()
throws InitialisationException
InitialisableInitialisationException 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.initialise in interface InitialisableInitialisationException - if a fatal error occurs causing the Mule instance to shutdownRecoverableException - if an error occurs that can be recovered frompublic boolean evaluateBoolean(String expression, MuleEvent event) throws ExpressionRuntimeException
evaluateBoolean in interface ExpressionManagerExpressionRuntimeExceptionprotected boolean isEvaluatorExpression(String expression)
protected boolean isEnricherExpression(String expression)
public void setExpressionLanguage(ExpressionLanguage expressionLanguage)
public ExpressionLanguage getExpressionLanguage()
Copyright © 2003–2015 MuleSoft, Inc.. All rights reserved.