Coverage Report - org.mule.lifecycle.RegistryBrokerLifecycleManager
 
Classes in this File Line Coverage Branch Coverage Complexity
RegistryBrokerLifecycleManager
0%
0/24
0%
0/4
0
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.lifecycle;
 8  
 
 9  
 import org.mule.api.MuleContext;
 10  
 import org.mule.api.lifecycle.Disposable;
 11  
 import org.mule.api.lifecycle.Initialisable;
 12  
 import org.mule.api.lifecycle.InitialisationException;
 13  
 import org.mule.api.lifecycle.LifecycleCallback;
 14  
 import org.mule.api.lifecycle.LifecycleException;
 15  
 import org.mule.api.lifecycle.Startable;
 16  
 import org.mule.api.lifecycle.Stoppable;
 17  
 import org.mule.api.registry.Registry;
 18  
 import org.mule.lifecycle.phases.MuleContextDisposePhase;
 19  
 import org.mule.lifecycle.phases.MuleContextInitialisePhase;
 20  
 import org.mule.lifecycle.phases.MuleContextStartPhase;
 21  
 import org.mule.lifecycle.phases.MuleContextStopPhase;
 22  
 import org.mule.registry.AbstractRegistryBroker;
 23  
 
 24  
 public class RegistryBrokerLifecycleManager extends RegistryLifecycleManager
 25  
 {
 26  
 
 27  
     public RegistryBrokerLifecycleManager(String id, Registry object, MuleContext muleContext)
 28  
     {
 29  0
         super(id, object, muleContext);
 30  0
     }
 31  
 
 32  
     @Override
 33  
     protected void registerPhases()
 34  
     {
 35  0
         RegistryLifecycleCallback callback = new RegistryLifecycleCallback();
 36  0
         registerPhase(Initialisable.PHASE_NAME, new MuleContextInitialisePhase(),
 37  
             new EmptyLifecycleCallback<AbstractRegistryBroker>());
 38  0
         registerPhase(Startable.PHASE_NAME, new MuleContextStartPhase(), callback);
 39  0
         registerPhase(Stoppable.PHASE_NAME, new MuleContextStopPhase(), callback);
 40  0
         registerPhase(Disposable.PHASE_NAME, new MuleContextDisposePhase(),
 41  
             new EmptyLifecycleCallback<AbstractRegistryBroker>());
 42  0
     }
 43  
 
 44  
     public void fireInitialisePhase(LifecycleCallback<AbstractRegistryBroker> callback)
 45  
         throws InitialisationException
 46  
     {
 47  0
         checkPhase(Initialisable.PHASE_NAME);
 48  
 
 49  0
         if (logger.isInfoEnabled())
 50  
         {
 51  0
             logger.info("Initialising RegistryBroker");
 52  
         }
 53  
 
 54  
         // No pre notification
 55  
         try
 56  
         {
 57  0
             invokePhase(Initialisable.PHASE_NAME, getLifecycleObject(), callback);
 58  
         }
 59  0
         catch (LifecycleException e)
 60  
         {
 61  0
             throw new InitialisationException(e, object);
 62  0
         }
 63  
         // No post notification
 64  0
     }
 65  
 
 66  
     public void fireDisposePhase(LifecycleCallback<AbstractRegistryBroker> callback)
 67  
     {
 68  0
         checkPhase(Disposable.PHASE_NAME);
 69  
 
 70  0
         if (logger.isInfoEnabled())
 71  
         {
 72  0
             logger.info("Disposing RegistryBroker");
 73  
         }
 74  
 
 75  
         // No pre notification
 76  
         try
 77  
         {
 78  0
             invokePhase(Disposable.PHASE_NAME, getLifecycleObject(), callback);
 79  
         }
 80  0
         catch (LifecycleException e)
 81  
         {
 82  0
             logger.error("Failed to shut down registry broker cleanly: ", e);
 83  0
         }
 84  
         // No post notification
 85  0
     }
 86  
 
 87  
 }