Coverage Report - org.mule.transport.jms.redelivery.AbstractRedeliveryHandler
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractRedeliveryHandler
0%
0/7
N/A
1.667
 
 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.jms.redelivery;
 8  
 
 9  
 import org.mule.DefaultMuleMessage;
 10  
 import org.mule.api.MuleException;
 11  
 import org.mule.api.MuleMessage;
 12  
 import org.mule.api.construct.FlowConstruct;
 13  
 import org.mule.api.endpoint.ImmutableEndpoint;
 14  
 import org.mule.transport.jms.JmsConnector;
 15  
 
 16  
 import javax.jms.JMSException;
 17  
 import javax.jms.Message;
 18  
 
 19  0
 public abstract class AbstractRedeliveryHandler implements RedeliveryHandler
 20  
 {
 21  
     protected JmsConnector connector;
 22  
 
 23  
     public abstract void handleRedelivery(Message message, ImmutableEndpoint endpoint, FlowConstruct flow) throws JMSException, MuleException;
 24  
 
 25  
     /**
 26  
      * The connector associated with this handler is set before
 27  
      * <code>handleRedelivery()</code> is called
 28  
      * 
 29  
      * @param connector the connector associated with this handler
 30  
      */
 31  
     public void setConnector(JmsConnector connector)
 32  
     {
 33  0
         this.connector = connector;
 34  0
     }
 35  
     
 36  
     protected MuleMessage createMuleMessage(Message message)
 37  
     {
 38  
         try
 39  
         {
 40  0
             String encoding = connector.getMuleContext().getConfiguration().getDefaultEncoding();
 41  0
             return connector.createMuleMessageFactory().create(message, encoding);
 42  
         }
 43  0
         catch (Exception e)
 44  
         {
 45  0
             return new DefaultMuleMessage(message, connector.getMuleContext());
 46  
         }
 47  
     }
 48  
 }