Coverage Report - org.mule.routing.outbound.OutboundPassThroughRouter
 
Classes in this File Line Coverage Branch Coverage Complexity
OutboundPassThroughRouter
0%
0/20
0%
0/5
2.667
 
 1  
 /*
 2  
  * $Id: OutboundPassThroughRouter.java 7976 2007-08-21 14:26:13Z 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.routing.outbound;
 12  
 
 13  
 import org.mule.umo.UMOFilter;
 14  
 import org.mule.umo.UMOImmutableDescriptor;
 15  
 import org.mule.umo.UMOMessage;
 16  
 import org.mule.umo.UMOSession;
 17  
 import org.mule.umo.endpoint.UMOEndpoint;
 18  
 import org.mule.umo.routing.RoutingException;
 19  
 
 20  
 import java.util.List;
 21  
 
 22  
 /**
 23  
  * <code>OutboundPassThroughRouter</code> allows outbound routing over a single
 24  
  * endpoint without any filtering. This class is used by Mule when a single outbound
 25  
  * router is set on a UMODescriptor.
 26  
  * 
 27  
  */
 28  
 public class OutboundPassThroughRouter extends FilteringOutboundRouter
 29  
 {
 30  
     public OutboundPassThroughRouter()
 31  
     {
 32  0
         super();
 33  0
     }
 34  
 
 35  
     public OutboundPassThroughRouter(UMOImmutableDescriptor descriptor)
 36  
     {
 37  0
         super();
 38  0
         if (descriptor != null && descriptor.getOutboundEndpoint() != null)
 39  
         {
 40  0
             addEndpoint(descriptor.getOutboundEndpoint());
 41  
         }
 42  0
     }
 43  
 
 44  
     public void addEndpoint(UMOEndpoint endpoint)
 45  
     {
 46  0
         if (endpoint == null)
 47  
         {
 48  0
             return;
 49  
         }
 50  0
         if (endpoints.size() == 1)
 51  
         {
 52  0
             throw new IllegalArgumentException("Only one endpoint can be set on the PassThrough router");
 53  
         }
 54  0
         super.addEndpoint(endpoint);
 55  0
     }
 56  
 
 57  
     public void setEndpoints(List endpoints)
 58  
     {
 59  0
         if (endpoints.size() > 1)
 60  
         {
 61  0
             throw new IllegalArgumentException("Only one endpoint can be set on the PassThrough router");
 62  
         }
 63  0
         super.setEndpoints(endpoints);
 64  0
     }
 65  
 
 66  
     public void setFilter(UMOFilter filter)
 67  
     {
 68  0
         throw new UnsupportedOperationException(
 69  
             "The Pass Through cannot use filters, use the FilteringOutboundRouter instead");
 70  
     }
 71  
 
 72  
     public UMOMessage route(UMOMessage message, UMOSession session, boolean synchronous)
 73  
         throws RoutingException
 74  
     {
 75  0
         if (endpoints == null || endpoints.size() == 0)
 76  
         {
 77  0
             return message;
 78  
         }
 79  0
         return super.route(message, session, synchronous);
 80  
     }
 81  
 }