Coverage Report - org.mule.transport.ConnectorLifecycleManager
 
Classes in this File Line Coverage Branch Coverage Complexity
ConnectorLifecycleManager
0%
0/20
0%
0/8
0
 
 1  
 /*
 2  
  * $Id: ConnectorLifecycleManager.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  
 package org.mule.transport;
 11  
 
 12  
 import org.mule.api.MuleException;
 13  
 import org.mule.api.lifecycle.Disposable;
 14  
 import org.mule.api.lifecycle.Initialisable;
 15  
 import org.mule.api.lifecycle.LifecycleCallback;
 16  
 import org.mule.api.lifecycle.Startable;
 17  
 import org.mule.api.lifecycle.Stoppable;
 18  
 import org.mule.api.transport.Connector;
 19  
 import org.mule.context.notification.ConnectionNotification;
 20  
 import org.mule.lifecycle.SimpleLifecycleManager;
 21  
 
 22  
 /**
 23  
  * Manages the lifecycle of connectors in Mule. Currently only manages the 'initialsie', 'start', 'stop' and dispose
 24  
  * phases, not the connect phase which is managed by the Retry handler
 25  
  *
 26  
  * @since 3.0
 27  
  */
 28  
 public class ConnectorLifecycleManager extends SimpleLifecycleManager<Connector>
 29  
 {
 30  
     public ConnectorLifecycleManager(AbstractConnector connector)
 31  
     {
 32  0
         super(connector.getName(), connector);
 33  0
     }
 34  
 
 35  
     public void fireInitialisePhase(LifecycleCallback<Connector> callback) throws MuleException
 36  
     {
 37  0
         checkPhase(Initialisable.PHASE_NAME);
 38  0
         if(logger.isInfoEnabled()) logger.info("Initialising connector: " + getLifecycleObject().getName());
 39  
         //No pre notification
 40  0
         invokePhase(Initialisable.PHASE_NAME, getLifecycleObject(), callback);
 41  
         //No post notification
 42  0
     }
 43  
 
 44  
     public void fireStartPhase(LifecycleCallback<Connector> callback) throws MuleException
 45  
     {
 46  0
         checkPhase(Startable.PHASE_NAME);
 47  0
         if(logger.isInfoEnabled()) logger.info("Starting connector: " + getLifecycleObject().getName());
 48  
         //No pre notification
 49  0
         invokePhase(Startable.PHASE_NAME, getLifecycleObject(), callback);
 50  
         //No post notification
 51  0
     }
 52  
 
 53  
     public void fireStopPhase(LifecycleCallback<Connector> callback) throws MuleException
 54  
     {
 55  0
         checkPhase(Stoppable.PHASE_NAME);
 56  0
         if(logger.isInfoEnabled()) logger.info("Stopping connector: " + getLifecycleObject().getName());
 57  
         //No pre notification
 58  0
         invokePhase(Stoppable.PHASE_NAME, getLifecycleObject(), callback);
 59  
         //No post notification
 60  0
     }
 61  
 
 62  
     public void fireDisposePhase(LifecycleCallback<Connector> callback) throws MuleException
 63  
     {
 64  0
         checkPhase(Disposable.PHASE_NAME);
 65  0
         if(logger.isInfoEnabled()) logger.info("Disposing connector: " + getLifecycleObject().getName());                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                //No pre notification
 66  0
         invokePhase(Disposable.PHASE_NAME, getLifecycleObject(), callback);
 67  
         //No post notification
 68  0
     }
 69  
 
 70  
     protected void fireNotification(int action)
 71  
     {
 72  0
         getLifecycleObject().getMuleContext().fireNotification(new ConnectionNotification(getLifecycleObject(), getLifecycleObject().getName(), action));
 73  0
     }
 74  
 }