1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.processor; |
12 | |
|
13 | |
import org.mule.DefaultMuleEvent; |
14 | |
import org.mule.api.MuleEvent; |
15 | |
import org.mule.api.MuleException; |
16 | |
import org.mule.api.endpoint.OutboundEndpoint; |
17 | |
import org.mule.api.processor.InterceptingMessageProcessor; |
18 | |
import org.mule.api.processor.MessageProcessor; |
19 | |
import org.mule.util.ObjectUtils; |
20 | |
|
21 | |
import org.apache.commons.logging.Log; |
22 | |
import org.apache.commons.logging.LogFactory; |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | 0 | public abstract class AbstractInterceptingMessageProcessor implements InterceptingMessageProcessor |
30 | |
{ |
31 | 0 | protected Log logger = LogFactory.getLog(getClass()); |
32 | |
|
33 | |
public void setListener(MessageProcessor next) |
34 | |
{ |
35 | 0 | this.next = next; |
36 | 0 | } |
37 | |
|
38 | |
protected MessageProcessor next; |
39 | |
|
40 | |
protected MuleEvent processNext(MuleEvent event) throws MuleException |
41 | |
{ |
42 | 0 | if (next == null) |
43 | |
{ |
44 | 0 | return event; |
45 | |
} |
46 | |
else |
47 | |
{ |
48 | 0 | if (logger.isTraceEnabled()) |
49 | |
{ |
50 | 0 | logger.trace("Invoking next MessageProcessor: '" + next.getClass().getName() + "' "); |
51 | |
} |
52 | |
|
53 | 0 | if (next instanceof OutboundEndpoint) |
54 | |
{ |
55 | 0 | event = new DefaultMuleEvent(event.getMessage(), (OutboundEndpoint) next, event.getSession()); |
56 | |
} |
57 | 0 | return next.process(event); |
58 | |
} |
59 | |
} |
60 | |
|
61 | |
@Override |
62 | |
public String toString() |
63 | |
{ |
64 | 0 | return ObjectUtils.toString(this); |
65 | |
} |
66 | |
} |