Coverage Report - org.mule.transport.servlet.jetty.AbstractConnectorHolder
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractConnectorHolder
0%
0/20
N/A
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.transport.servlet.jetty;
 8  
 
 9  
 import org.mule.api.MuleException;
 10  
 import org.mule.api.lifecycle.LifecycleException;
 11  
 import org.mule.api.transport.MessageReceiver;
 12  
 
 13  
 import javax.servlet.Servlet;
 14  
 
 15  
 import org.apache.commons.logging.Log;
 16  
 import org.apache.commons.logging.LogFactory;
 17  
 import org.mortbay.jetty.Connector;
 18  
 
 19  
 /**
 20  
  * TODO
 21  
  */
 22  
 public abstract class AbstractConnectorHolder<S extends Servlet, R extends MessageReceiver> implements ConnectorHolder<S, R>
 23  
 {
 24  
     /**
 25  
      * logger used by this class
 26  
      */
 27  0
     protected transient final Log logger = LogFactory.getLog(AbstractConnectorHolder.class);
 28  
     protected Connector connector;
 29  
     protected S servlet;
 30  0
     protected boolean started = false;
 31  
 
 32  
     @SuppressWarnings("unused")
 33  
     public AbstractConnectorHolder(Connector connector, S servlet, R receiver)
 34  0
     {
 35  0
         this.connector = connector;
 36  0
         this.servlet = servlet;
 37  0
     }
 38  
 
 39  
     public S getServlet()
 40  
     {
 41  0
         return servlet;
 42  
     }
 43  
 
 44  
     public Connector getConnector()
 45  
     {
 46  0
         return connector;
 47  
     }
 48  
 
 49  
 
 50  
     public void start() throws MuleException
 51  
     {
 52  
         try
 53  
         {
 54  0
             connector.start();
 55  0
             started = true;
 56  
         }
 57  0
         catch (Exception e)
 58  
         {
 59  0
             throw new LifecycleException(e, this);
 60  0
         }
 61  0
     }
 62  
 
 63  
     public void stop() throws MuleException
 64  
     {
 65  
         try
 66  
         {
 67  0
             connector.stop();
 68  0
             started = false;
 69  
         }
 70  0
         catch (Exception e)
 71  
         {
 72  0
             logger.warn("Jetty connector did not close cleanly: " + e.getMessage());
 73  0
         }
 74  
 
 75  0
     }
 76  
 
 77  
 }