Coverage Report - org.mule.api.routing.ServiceRoutingException
 
Classes in this File Line Coverage Branch Coverage Complexity
ServiceRoutingException
39%
7/18
50%
1/2
1.333
 
 1  
 /*
 2  
  * $Id: ServiceRoutingException.java 11717 2008-05-09 13:26:38Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.api.routing;
 12  
 
 13  
 import org.mule.api.MuleMessage;
 14  
 import org.mule.api.endpoint.ImmutableEndpoint;
 15  
 import org.mule.api.service.Service;
 16  
 import org.mule.config.i18n.CoreMessages;
 17  
 import org.mule.config.i18n.Message;
 18  
 
 19  
 /**
 20  
  * <code>ServiceRoutingException</code> is thrown due to a routing exception
 21  
  * between the endpoint the event was received on and the service receiving the
 22  
  * event.
 23  
  */
 24  
 public class ServiceRoutingException extends RoutingException
 25  
 {
 26  
     /**
 27  
      * Serial version
 28  
      */
 29  
     private static final long serialVersionUID = -113944443831267318L;
 30  
 
 31  
     private transient Service service;
 32  
 
 33  
     public ServiceRoutingException(Message message,
 34  
                                      MuleMessage umoMessage,
 35  
                                      ImmutableEndpoint endpoint,
 36  
                                      Service service)
 37  
     {
 38  2
         super(generateMessage(message, endpoint, service), umoMessage, endpoint);
 39  2
         this.service = service;
 40  2
     }
 41  
 
 42  
     public ServiceRoutingException(Message message,
 43  
                                      MuleMessage umoMessage,
 44  
                                      ImmutableEndpoint endpoint,
 45  
                                      Service service,
 46  
                                      Throwable cause)
 47  
     {
 48  0
         super(generateMessage(message, endpoint, service), umoMessage, endpoint, cause);
 49  0
         this.service = service;
 50  0
     }
 51  
 
 52  
     public ServiceRoutingException(MuleMessage umoMessage,
 53  
                                      ImmutableEndpoint endpoint,
 54  
                                      Service service)
 55  
     {
 56  0
         super(generateMessage(null, endpoint, service), umoMessage, endpoint);
 57  0
         this.service = service;
 58  0
     }
 59  
 
 60  
     public ServiceRoutingException(MuleMessage umoMessage,
 61  
                                      ImmutableEndpoint endpoint,
 62  
                                      Service service,
 63  
                                      Throwable cause)
 64  
     {
 65  0
         super(generateMessage(null, endpoint, service), umoMessage, endpoint, cause);
 66  0
         this.service = service;
 67  
 
 68  0
     }
 69  
 
 70  
     private static Message generateMessage(Message message,
 71  
                                            ImmutableEndpoint endpoint,
 72  
                                            Service service)
 73  
     {
 74  2
         Message m = CoreMessages.routingFailedOnEndpoint(service, endpoint);
 75  2
         if (message != null)
 76  
         {
 77  2
             message.setNextMessage(m);
 78  2
             return message;
 79  
         }
 80  
         else
 81  
         {
 82  0
             return m;
 83  
         }
 84  
     }
 85  
 
 86  
     public Service getService()
 87  
     {
 88  0
         return service;
 89  
     }
 90  
 }