Coverage Report - org.mule.config.spring.ExpressionEvaluatorPostProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
ExpressionEvaluatorPostProcessor
0%
0/12
0%
0/6
2.333
 
 1  
 /*
 2  
  * $Id: ExpressionEvaluatorPostProcessor.java 19191 2010-08-25 21:05:23Z tcarlson $
 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  
 
 11  
 package org.mule.config.spring;
 12  
 
 13  
 import org.mule.api.MuleContext;
 14  
 import org.mule.api.expression.ExpressionEvaluator;
 15  
 import org.mule.api.expression.ExpressionManager;
 16  
 
 17  
 import org.springframework.beans.BeansException;
 18  
 import org.springframework.beans.factory.config.BeanPostProcessor;
 19  
 
 20  
 /**
 21  
  * Registers custom declarative expression evaluators configured via Spring config.
 22  
  *
 23  
  * @see ExpressionEvaluator
 24  
  */
 25  
 public class ExpressionEvaluatorPostProcessor implements BeanPostProcessor
 26  
 {
 27  
     private MuleContext muleContext;
 28  
 
 29  
     public ExpressionEvaluatorPostProcessor(MuleContext muleContext)
 30  0
     {
 31  0
         this.muleContext = muleContext;
 32  0
     }
 33  
 
 34  
     public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException
 35  
     {
 36  0
         if (muleContext == null)
 37  
         {
 38  0
             return bean;
 39  
         }
 40  
 
 41  0
         if (bean instanceof ExpressionEvaluator)
 42  
         {
 43  0
             ExpressionEvaluator ee = (ExpressionEvaluator) bean;
 44  
 
 45  0
             final ExpressionManager expressionManager = muleContext.getExpressionManager();
 46  0
             if (!expressionManager.isEvaluatorRegistered(ee.getName()))
 47  
             {
 48  0
                 expressionManager.registerEvaluator(ee);
 49  
             }
 50  
         }
 51  0
         return bean;
 52  
     }
 53  
 
 54  
     public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException
 55  
     {
 56  0
         return bean;
 57  
     }
 58  
 
 59  
 }