1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.endpoint.inbound; |
8 | |
|
9 | |
import org.mule.api.MuleEvent; |
10 | |
import org.mule.api.MuleException; |
11 | |
import org.mule.api.config.MuleProperties; |
12 | |
import org.mule.api.endpoint.InboundEndpoint; |
13 | |
import org.mule.api.processor.MessageProcessor; |
14 | |
import org.mule.api.transport.PropertyScope; |
15 | |
import org.mule.util.ObjectUtils; |
16 | |
import org.mule.util.StringUtils; |
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
public class InboundEndpointPropertyMessageProcessor implements MessageProcessor |
24 | |
{ |
25 | |
private InboundEndpoint endpoint; |
26 | |
|
27 | |
public InboundEndpointPropertyMessageProcessor(InboundEndpoint endpoint) |
28 | 0 | { |
29 | 0 | this.endpoint = endpoint; |
30 | 0 | } |
31 | |
|
32 | |
public MuleEvent process(MuleEvent event) throws MuleException |
33 | |
{ |
34 | |
|
35 | 0 | String inboundEndpoint = endpoint.getName(); |
36 | |
|
37 | 0 | if (StringUtils.isBlank(inboundEndpoint)) |
38 | |
{ |
39 | |
|
40 | 0 | inboundEndpoint = endpoint.getEndpointURI().getUri().toString(); |
41 | |
} |
42 | 0 | event.getMessage().setProperty(MuleProperties.MULE_ORIGINATING_ENDPOINT_PROPERTY, inboundEndpoint, PropertyScope.INBOUND); |
43 | 0 | return event; |
44 | |
} |
45 | |
|
46 | |
@Override |
47 | |
public String toString() |
48 | |
{ |
49 | 0 | return ObjectUtils.toString(this); |
50 | |
} |
51 | |
} |