1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
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 | |
|
20 | |
|
21 | |
|
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 | |
} |