1 /* 2 * $Id: ExpressionEvaluatorProcessor.java 11282 2008-03-08 21:08:08Z rossmason $ 3 * -------------------------------------------------------------------------------------- 4 * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.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.lifecycle.Disposable; 13 import org.mule.api.registry.ObjectProcessor; 14 import org.mule.util.expression.ExpressionEvaluator; 15 import org.mule.util.expression.ExpressionEvaluatorManager; 16 17 /** 18 * Registers ExpressionEvaluators with the {@link org.mule.util.expression.ExpressionEvaluatorManager} so that they will 19 * be resolved at run-time. 20 * {@link org.mule.util.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 ExpressionEvaluatorProcessor implements ObjectProcessor, Disposable 24 { 25 public ExpressionEvaluatorProcessor() 26 { 27 ExpressionEvaluatorManager.clearEvaluators(); 28 } 29 30 public Object process(Object object) 31 { 32 if(object instanceof ExpressionEvaluator) 33 { 34 ExpressionEvaluatorManager.registerEvaluator((ExpressionEvaluator)object); 35 } 36 return object; 37 } 38 39 /** 40 * A lifecycle method where implementor should free up any resources. If an 41 * exception is thrown it should just be logged and processing should continue. 42 * This method should not throw Runtime exceptions. 43 */ 44 public void dispose() 45 { 46 ExpressionEvaluatorManager.clearEvaluators(); 47 } 48 }