Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ExpressionEnricherProcessor |
|
| 1.3333333333333333;1.333 |
1 | /* | |
2 | * $Id: ExpressionEnricherProcessor.java 20273 2010-11-19 12:52:55Z dirk.olmes $ | |
3 | * -------------------------------------------------------------------------------------- | |
4 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
5 | * | |
6 | * The software in this package is published under the terms of the CPAL v1.0 | |
7 | * license, a copy of which has been included with this distribution in the | |
8 | * LICENSE.txt file. | |
9 | */ | |
10 | package org.mule.registry; | |
11 | ||
12 | import org.mule.api.MuleContext; | |
13 | import org.mule.api.expression.ExpressionEnricher; | |
14 | import org.mule.api.lifecycle.Disposable; | |
15 | import org.mule.api.registry.PreInitProcessor; | |
16 | ||
17 | /** | |
18 | * Registers ExpressionEvaluators with the {@link org.mule.expression.DefaultExpressionManager} so that they will | |
19 | * be resolved at run-time. | |
20 | * {@link org.mule.api.expression.ExpressionEvaluator} objects are used to execute property expressions (usually on the | |
21 | * current message) at run-time to extract a dynamic value. | |
22 | */ | |
23 | public class ExpressionEnricherProcessor implements PreInitProcessor, Disposable | |
24 | { | |
25 | private MuleContext context; | |
26 | ||
27 | public ExpressionEnricherProcessor(MuleContext context) | |
28 | 0 | { |
29 | 0 | this.context = context; |
30 | 0 | } |
31 | ||
32 | public Object process(Object object) | |
33 | { | |
34 | 0 | if(object instanceof ExpressionEnricher) |
35 | { | |
36 | 0 | context.getExpressionManager().registerEnricher((ExpressionEnricher) object); |
37 | } | |
38 | 0 | return object; |
39 | } | |
40 | ||
41 | /** | |
42 | * A lifecycle method where implementor should free up any resources. If an | |
43 | * exception is thrown it should just be logged and processing should continue. | |
44 | * This method should not throw Runtime exceptions. | |
45 | */ | |
46 | public void dispose() | |
47 | { | |
48 | 0 | context.getExpressionManager().clearEvaluators(); |
49 | 0 | } |
50 | } |