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  
  * $Id: AbstractRedeliveryHandler.java 20501 2010-12-08 00:52:19Z 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.transport.jms.redelivery;
 12  
 
 13  
 import org.mule.DefaultMuleMessage;
 14  
 import org.mule.api.MuleException;
 15  
 import org.mule.api.MuleMessage;
 16  
 import org.mule.api.construct.FlowConstruct;
 17  
 import org.mule.api.endpoint.ImmutableEndpoint;
 18  
 import org.mule.transport.jms.JmsConnector;
 19  
 
 20  
 import javax.jms.JMSException;
 21  
 import javax.jms.Message;
 22  
 
 23  0
 public abstract class AbstractRedeliveryHandler implements RedeliveryHandler
 24  
 {
 25  
     protected JmsConnector connector;
 26  
 
 27  
     public abstract void handleRedelivery(Message message, ImmutableEndpoint endpoint, FlowConstruct flow) throws JMSException, MuleException;
 28  
 
 29  
     /**
 30  
      * The connector associated with this handler is set before
 31  
      * <code>handleRedelivery()</code> is called
 32  
      * 
 33  
      * @param connector the connector associated with this handler
 34  
      */
 35  
     public void setConnector(JmsConnector connector)
 36  
     {
 37  0
         this.connector = connector;
 38  0
     }
 39  
     
 40  
     protected MuleMessage createMuleMessage(Message message)
 41  
     {
 42  
         try
 43  
         {
 44  0
             String encoding = connector.getMuleContext().getConfiguration().getDefaultEncoding();
 45  0
             return connector.createMuleMessageFactory().create(message, encoding);
 46  
         }
 47  0
         catch (Exception e)
 48  
         {
 49  0
             return new DefaultMuleMessage(message, connector.getMuleContext());
 50  
         }
 51  
     }
 52  
 }