1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.routing.outbound; |
8 | |
|
9 | |
import org.mule.api.endpoint.OutboundEndpoint; |
10 | |
import org.mule.config.i18n.CoreMessages; |
11 | |
|
12 | |
import java.util.ArrayList; |
13 | |
import java.util.List; |
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | 0 | public class SplitMessage |
21 | |
{ |
22 | 0 | private List parts = new ArrayList(); |
23 | |
|
24 | |
public void addPart(Object part, OutboundEndpoint endpoint) |
25 | |
{ |
26 | 0 | parts.add(new MessagePart(endpoint, part)); |
27 | 0 | } |
28 | |
|
29 | |
public MessagePart getPart(int i) |
30 | |
{ |
31 | 0 | return (MessagePart) parts.get(i); |
32 | |
} |
33 | |
|
34 | |
public int size() |
35 | |
{ |
36 | 0 | return parts.size(); |
37 | |
} |
38 | |
|
39 | 0 | public class MessagePart |
40 | |
{ |
41 | |
private Object part; |
42 | |
private OutboundEndpoint endpoint; |
43 | |
|
44 | |
public MessagePart(OutboundEndpoint endpoint, Object part) |
45 | 0 | { |
46 | 0 | if (endpoint == null) |
47 | |
{ |
48 | 0 | throw new IllegalArgumentException(CoreMessages.objectIsNull("splitter endpoint").getMessage()); |
49 | |
} |
50 | |
|
51 | 0 | if (part == null) |
52 | |
{ |
53 | 0 | throw new IllegalArgumentException(CoreMessages.objectIsNull("splitter messagePart").getMessage()); |
54 | |
} |
55 | 0 | this.endpoint = endpoint; |
56 | 0 | this.part = part; |
57 | 0 | } |
58 | |
|
59 | |
public OutboundEndpoint getEndpoint() |
60 | |
{ |
61 | 0 | return endpoint; |
62 | |
} |
63 | |
|
64 | |
public Object getPart() |
65 | |
{ |
66 | 0 | return part; |
67 | |
} |
68 | |
|
69 | |
|
70 | |
public String toString() |
71 | |
{ |
72 | 0 | final StringBuffer sb = new StringBuffer(); |
73 | 0 | sb.append("MessagePart"); |
74 | 0 | sb.append("{endpoint=").append(endpoint.getName()); |
75 | 0 | sb.append(", part=").append(part); |
76 | 0 | sb.append('}'); |
77 | 0 | return sb.toString(); |
78 | |
} |
79 | |
} |
80 | |
} |