Coverage Report - org.mule.config.spring.NotificationListenersPostProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
NotificationListenersPostProcessor
0%
0/8
0%
0/4
1.667
 
 1  
 /*
 2  
  * $Id: NotificationListenersPostProcessor.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.context.notification.ServerNotificationListener;
 15  
 import org.springframework.beans.BeansException;
 16  
 import org.springframework.beans.factory.config.BeanPostProcessor;
 17  
 
 18  
 /**
 19  
  * Responsible for passing in the MuleContext instance for all objects in the
 20  
  * registry that want it. For an object to get an instance of the MuleContext it must
 21  
  * implement MuleContextAware.
 22  
  * 
 23  
  * @see org.mule.api.context.MuleContextAware
 24  
  * @see org.mule.api.MuleContext
 25  
  */
 26  
 public class NotificationListenersPostProcessor implements BeanPostProcessor
 27  
 {
 28  
 
 29  
     private final MuleContext muleContext;
 30  
 
 31  
     public NotificationListenersPostProcessor(MuleContext muleContext)
 32  0
     {
 33  0
         this.muleContext = muleContext;
 34  0
     }
 35  
 
 36  
     public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException
 37  
     {
 38  0
         if (bean instanceof ServerNotificationListener)
 39  
         {
 40  0
             if (!muleContext.getNotificationManager().isListenerRegistered((ServerNotificationListener) bean))
 41  
             {
 42  0
                 muleContext.getNotificationManager().addListener((ServerNotificationListener) bean);
 43  
             }
 44  
         }
 45  0
         return bean;
 46  
     }
 47  
 
 48  
     public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException
 49  
     {
 50  0
         return bean;
 51  
     }
 52  
 
 53  
 }