1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.module.cxf.endpoint; |
8 | |
|
9 | |
import org.mule.api.MuleContext; |
10 | |
import org.mule.api.endpoint.EndpointException; |
11 | |
import org.mule.api.endpoint.EndpointURI; |
12 | |
import org.mule.api.endpoint.ImmutableEndpoint; |
13 | |
import org.mule.api.endpoint.InboundEndpoint; |
14 | |
import org.mule.api.endpoint.OutboundEndpoint; |
15 | |
import org.mule.api.lifecycle.InitialisationException; |
16 | |
import org.mule.api.processor.MessageProcessor; |
17 | |
import org.mule.endpoint.AbstractMetaEndpointBuilder; |
18 | |
import org.mule.endpoint.EndpointURIEndpointBuilder; |
19 | |
import org.mule.endpoint.URIBuilder; |
20 | |
import org.mule.module.cxf.builder.LocalClientMessageProcessorBuilder; |
21 | |
|
22 | |
import java.util.ArrayList; |
23 | |
|
24 | |
public class CxfEndpointBuilder extends AbstractMetaEndpointBuilder |
25 | |
{ |
26 | |
|
27 | |
public CxfEndpointBuilder() |
28 | |
{ |
29 | 0 | super(); |
30 | 0 | } |
31 | |
|
32 | |
public CxfEndpointBuilder(EndpointURI endpointURI) |
33 | |
{ |
34 | 0 | super(endpointURI); |
35 | 0 | } |
36 | |
|
37 | |
public CxfEndpointBuilder(EndpointURIEndpointBuilder global) throws EndpointException |
38 | |
{ |
39 | 0 | super(global); |
40 | 0 | } |
41 | |
|
42 | |
public CxfEndpointBuilder(ImmutableEndpoint source) |
43 | |
{ |
44 | 0 | super(source); |
45 | 0 | } |
46 | |
|
47 | |
public CxfEndpointBuilder(String address, MuleContext muleContext) |
48 | |
{ |
49 | 0 | super(getEndpointAddressWithoutMetaScheme(address), muleContext); |
50 | 0 | } |
51 | |
|
52 | |
public CxfEndpointBuilder(URIBuilder builder) |
53 | |
{ |
54 | 0 | super(builder); |
55 | 0 | } |
56 | |
|
57 | |
@Override |
58 | |
public InboundEndpoint buildInboundEndpoint() throws EndpointException, InitialisationException |
59 | |
{ |
60 | 0 | throw new UnsupportedOperationException("Inbound meta CXF endpoints not supported"); |
61 | |
} |
62 | |
|
63 | |
@Override |
64 | |
public OutboundEndpoint buildOutboundEndpoint() throws EndpointException, InitialisationException |
65 | |
{ |
66 | 0 | LocalClientMessageProcessorBuilder builder = new LocalClientMessageProcessorBuilder(); |
67 | 0 | builder.setMuleContext(muleContext); |
68 | 0 | builder.setAddress(getEndpointBuilder().getEndpoint().toString()); |
69 | |
|
70 | |
try |
71 | |
{ |
72 | 0 | ArrayList<MessageProcessor> processors = new ArrayList<MessageProcessor>(); |
73 | 0 | processors.add(builder.build()); |
74 | 0 | if (messageProcessors != null) |
75 | |
{ |
76 | 0 | processors.addAll(messageProcessors); |
77 | |
} |
78 | 0 | messageProcessors = processors; |
79 | |
} |
80 | 0 | catch (Exception e) |
81 | |
{ |
82 | 0 | throw new EndpointException(e); |
83 | 0 | } |
84 | |
|
85 | 0 | return super.buildOutboundEndpoint(); |
86 | |
} |
87 | |
|
88 | |
} |