| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
package org.apache.camel.component.direct; |
| 18 |
|
|
| 19 |
|
import java.net.URI; |
| 20 |
|
import java.util.Map; |
| 21 |
|
import java.util.concurrent.ScheduledExecutorService; |
| 22 |
|
|
| 23 |
|
import org.apache.camel.CamelContext; |
| 24 |
|
import org.apache.camel.Component; |
| 25 |
|
import org.apache.camel.Endpoint; |
| 26 |
|
import org.apache.camel.Exchange; |
| 27 |
|
import org.apache.camel.util.IntrospectionSupport; |
| 28 |
|
import org.apache.camel.util.ObjectHelper; |
| 29 |
|
import org.apache.camel.util.URISupport; |
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
153 |
public class DirectComponent<E extends Exchange> implements Component<E> { |
| 39 |
|
|
| 40 |
|
private CamelContext context; |
| 41 |
|
|
| 42 |
|
public CamelContext getCamelContext() { |
| 43 |
372 |
return context; |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
public ScheduledExecutorService getExecutorService() { |
| 47 |
0 |
return null; |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
public Endpoint<E> createEndpoint(String uri) throws Exception { |
| 51 |
|
|
| 52 |
186 |
ObjectHelper.notNull(getCamelContext(), "camelContext"); |
| 53 |
186 |
URI u = new URI(uri); |
| 54 |
186 |
Map parameters = URISupport.parseParamters(u); |
| 55 |
|
|
| 56 |
186 |
Endpoint<E> endpoint = new DirectEndpoint<E>(uri, this); |
| 57 |
186 |
if (parameters != null) { |
| 58 |
186 |
IntrospectionSupport.setProperties(endpoint, parameters); |
| 59 |
|
} |
| 60 |
186 |
return endpoint; |
| 61 |
|
} |
| 62 |
|
|
| 63 |
|
public void setCamelContext(CamelContext context) { |
| 64 |
153 |
this.context = context; |
| 65 |
153 |
} |
| 66 |
|
|
| 67 |
|
} |