1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
package org.apache.camel.component.cxf.transport; |
18 |
|
|
19 |
|
import java.io.IOException; |
20 |
|
import java.util.HashSet; |
21 |
|
import java.util.Set; |
22 |
|
|
23 |
|
import javax.annotation.Resource; |
24 |
|
|
25 |
|
import org.apache.camel.CamelContext; |
26 |
|
import org.apache.cxf.Bus; |
27 |
|
import org.apache.cxf.configuration.Configurer; |
28 |
|
import org.apache.cxf.service.model.EndpointInfo; |
29 |
|
import org.apache.cxf.transport.AbstractTransportFactory; |
30 |
|
import org.apache.cxf.transport.Conduit; |
31 |
|
import org.apache.cxf.transport.ConduitInitiator; |
32 |
|
import org.apache.cxf.transport.Destination; |
33 |
|
import org.apache.cxf.transport.DestinationFactory; |
34 |
|
import org.apache.cxf.ws.addressing.EndpointReferenceType; |
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
0 |
public class CamelTransportFactory extends AbstractTransportFactory implements ConduitInitiator, DestinationFactory { |
40 |
0 |
private static final Set<String> URI_PREFIXES = new HashSet<String>(); |
41 |
|
|
42 |
|
static { |
43 |
0 |
URI_PREFIXES.add("camel://"); |
44 |
0 |
} |
45 |
|
|
46 |
|
private Bus bus; |
47 |
|
private CamelContext camelContext; |
48 |
|
|
49 |
|
@Resource |
50 |
|
public void setBus(Bus b) { |
51 |
0 |
bus = b; |
52 |
0 |
} |
53 |
|
|
54 |
|
public Bus getBus() { |
55 |
0 |
return bus; |
56 |
|
} |
57 |
|
|
58 |
|
public CamelContext getCamelContext() { |
59 |
0 |
return camelContext; |
60 |
|
} |
61 |
|
|
62 |
|
@Resource |
63 |
|
public void setCamelContext(CamelContext camelContext) { |
64 |
0 |
this.camelContext = camelContext; |
65 |
0 |
} |
66 |
|
|
67 |
|
public Conduit getConduit(EndpointInfo targetInfo) throws IOException { |
68 |
0 |
return getConduit(targetInfo, null); |
69 |
|
} |
70 |
|
|
71 |
|
public Conduit getConduit(EndpointInfo endpointInfo, EndpointReferenceType target) throws IOException { |
72 |
0 |
return new CamelConduit(camelContext, bus, endpointInfo, target); |
73 |
|
} |
74 |
|
|
75 |
|
public Destination getDestination(EndpointInfo endpointInfo) throws IOException { |
76 |
0 |
CamelDestination destination = new CamelDestination(camelContext, bus, this, endpointInfo); |
77 |
0 |
Configurer configurer = bus.getExtension(Configurer.class); |
78 |
0 |
if (null != configurer) { |
79 |
0 |
configurer.configureBean(destination); |
80 |
|
} |
81 |
0 |
return destination; |
82 |
|
} |
83 |
|
|
84 |
|
public Set<String> getUriPrefixes() { |
85 |
0 |
return URI_PREFIXES; |
86 |
|
} |
87 |
|
} |
88 |
|
|