Coverage Report - org.mule.routing.outbound.SplitMessage
 
Classes in this File Line Coverage Branch Coverage Complexity
SplitMessage
0%
0/7
N/A
1.571
SplitMessage$MessagePart
0%
0/16
0%
0/4
1.571
 
 1  
 /*
 2  
  * $Id: SplitMessage.java 20321 2010-11-24 15:21:24Z dfeist $
 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  
 package org.mule.routing.outbound;
 11  
 
 12  
 import org.mule.api.endpoint.OutboundEndpoint;
 13  
 import org.mule.config.i18n.CoreMessages;
 14  
 
 15  
 import java.util.ArrayList;
 16  
 import java.util.List;
 17  
 
 18  
 /**
 19  
  * A Split message contains one or more message parts with an endpoint associated with each part.
 20  
  * This class is used by the Message Splitter routers ({@link org.mule.routing.outbound.AbstractRoundRobinMessageSplitter})
 21  
  * to define a mapping between message parts and the endpoint to dispatch on.
 22  
  */
 23  0
 public class SplitMessage
 24  
 {
 25  0
     private List parts = new ArrayList();
 26  
 
 27  
     public void addPart(Object part, OutboundEndpoint endpoint)
 28  
     {
 29  0
         parts.add(new MessagePart(endpoint, part));
 30  0
     }
 31  
 
 32  
     public MessagePart getPart(int i)
 33  
     {
 34  0
         return (MessagePart) parts.get(i);
 35  
     }
 36  
 
 37  
     public int size()
 38  
     {
 39  0
         return parts.size();
 40  
     }
 41  
 
 42  0
     public class MessagePart
 43  
     {
 44  
         private Object part;
 45  
         private OutboundEndpoint endpoint;
 46  
 
 47  
         public MessagePart(OutboundEndpoint endpoint, Object part)
 48  0
         {
 49  0
             if (endpoint == null)
 50  
             {
 51  0
                 throw new IllegalArgumentException(CoreMessages.objectIsNull("splitter endpoint").getMessage());
 52  
             }
 53  
 
 54  0
             if (part == null)
 55  
             {
 56  0
                 throw new IllegalArgumentException(CoreMessages.objectIsNull("splitter messagePart").getMessage());
 57  
             }
 58  0
             this.endpoint = endpoint;
 59  0
             this.part = part;
 60  0
         }
 61  
 
 62  
         public OutboundEndpoint getEndpoint()
 63  
         {
 64  0
             return endpoint;
 65  
         }
 66  
 
 67  
         public Object getPart()
 68  
         {
 69  0
             return part;
 70  
         }
 71  
 
 72  
 
 73  
         public String toString()
 74  
         {
 75  0
             final StringBuffer sb = new StringBuffer();
 76  0
             sb.append("MessagePart");
 77  0
             sb.append("{endpoint=").append(endpoint.getName());
 78  0
             sb.append(", part=").append(part);
 79  0
             sb.append('}');
 80  0
             return sb.toString();
 81  
         }
 82  
     }
 83  
 }