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