| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
package org.apache.camel.model; |
| 18 |
|
|
| 19 |
|
import java.util.ArrayList; |
| 20 |
|
import java.util.Collections; |
| 21 |
|
import java.util.List; |
| 22 |
|
|
| 23 |
|
import javax.xml.bind.annotation.XmlAccessType; |
| 24 |
|
import javax.xml.bind.annotation.XmlAccessorType; |
| 25 |
|
import javax.xml.bind.annotation.XmlAttribute; |
| 26 |
|
import javax.xml.bind.annotation.XmlElement; |
| 27 |
|
import javax.xml.bind.annotation.XmlRootElement; |
| 28 |
|
import javax.xml.bind.annotation.XmlTransient; |
| 29 |
|
import javax.xml.bind.annotation.XmlElementRef; |
| 30 |
|
|
| 31 |
|
import org.apache.camel.Endpoint; |
| 32 |
|
import org.apache.camel.Processor; |
| 33 |
|
import org.apache.camel.impl.RouteContext; |
| 34 |
|
import org.apache.camel.processor.SendProcessor; |
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
@XmlRootElement(name = "to") |
| 42 |
|
@XmlAccessorType(XmlAccessType.FIELD) |
| 43 |
|
public class ToType extends ProcessorType { |
| 44 |
|
@XmlAttribute |
| 45 |
|
private String uri; |
| 46 |
|
@XmlAttribute |
| 47 |
|
private String ref; |
| 48 |
|
@XmlElementRef |
| 49 |
345 |
private List<InterceptorType> interceptors = new ArrayList<InterceptorType>(); |
| 50 |
|
@XmlTransient |
| 51 |
|
private Endpoint endpoint; |
| 52 |
|
|
| 53 |
27 |
public ToType() { |
| 54 |
27 |
} |
| 55 |
|
|
| 56 |
318 |
public ToType(String uri) { |
| 57 |
318 |
setUri(uri); |
| 58 |
318 |
} |
| 59 |
|
|
| 60 |
0 |
public ToType(Endpoint endpoint) { |
| 61 |
0 |
setEndpoint(endpoint); |
| 62 |
0 |
} |
| 63 |
|
|
| 64 |
|
@Override |
| 65 |
|
public String toString() { |
| 66 |
195 |
return "To[" + FromType.description(getUri(), getRef(), getEndpoint()) + "]"; |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
@Override |
| 70 |
|
public Processor createProcessor(RouteContext routeContext) throws Exception { |
| 71 |
312 |
Endpoint endpoint = resolveEndpoint(routeContext); |
| 72 |
309 |
return new SendProcessor(endpoint); |
| 73 |
|
} |
| 74 |
|
|
| 75 |
|
public Endpoint resolveEndpoint(RouteContext context) { |
| 76 |
312 |
if (endpoint == null) { |
| 77 |
312 |
endpoint = context.resolveEndpoint(getUri(), getRef()); |
| 78 |
|
} |
| 79 |
309 |
return endpoint; |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
|
| 83 |
|
|
| 84 |
|
public String getUri() { |
| 85 |
534 |
return uri; |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
|
| 89 |
|
|
| 90 |
|
|
| 91 |
|
|
| 92 |
|
|
| 93 |
|
public void setUri(String uri) { |
| 94 |
318 |
this.uri = uri; |
| 95 |
318 |
} |
| 96 |
|
|
| 97 |
|
public String getRef() { |
| 98 |
507 |
return ref; |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| 103 |
|
|
| 104 |
|
|
| 105 |
|
|
| 106 |
|
|
| 107 |
|
public void setRef(String ref) { |
| 108 |
0 |
this.ref = ref; |
| 109 |
0 |
} |
| 110 |
|
|
| 111 |
|
public Endpoint getEndpoint() { |
| 112 |
195 |
return endpoint; |
| 113 |
|
} |
| 114 |
|
|
| 115 |
|
public void setEndpoint(Endpoint endpoint) { |
| 116 |
0 |
this.endpoint = endpoint; |
| 117 |
0 |
} |
| 118 |
|
|
| 119 |
|
public List<ProcessorType> getOutputs() { |
| 120 |
0 |
return Collections.EMPTY_LIST; |
| 121 |
|
} |
| 122 |
|
|
| 123 |
|
public List<InterceptorType> getInterceptors() { |
| 124 |
285 |
return interceptors; |
| 125 |
|
} |
| 126 |
|
|
| 127 |
|
public void setInterceptors(List<InterceptorType> interceptors) { |
| 128 |
0 |
this.interceptors = interceptors; |
| 129 |
0 |
} |
| 130 |
|
} |