| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
package org.apache.camel.component.event; |
| 18 |
|
|
| 19 |
|
import java.util.Map; |
| 20 |
|
|
| 21 |
|
import org.apache.camel.Exchange; |
| 22 |
|
import org.apache.camel.impl.DefaultComponent; |
| 23 |
|
|
| 24 |
|
import org.springframework.beans.BeansException; |
| 25 |
|
import org.springframework.context.ApplicationContext; |
| 26 |
|
import org.springframework.context.ApplicationContextAware; |
| 27 |
|
import org.springframework.context.ConfigurableApplicationContext; |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
56 |
public class EventComponent extends DefaultComponent<Exchange> implements ApplicationContextAware { |
| 36 |
|
private ApplicationContext applicationContext; |
| 37 |
|
|
| 38 |
0 |
public EventComponent() { |
| 39 |
0 |
} |
| 40 |
|
|
| 41 |
56 |
public EventComponent(ApplicationContext applicationContext) { |
| 42 |
56 |
setApplicationContext(applicationContext); |
| 43 |
56 |
} |
| 44 |
|
|
| 45 |
|
public ApplicationContext getApplicationContext() { |
| 46 |
1 |
return applicationContext; |
| 47 |
|
} |
| 48 |
|
|
| 49 |
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
| 50 |
56 |
this.applicationContext = applicationContext; |
| 51 |
56 |
} |
| 52 |
|
|
| 53 |
|
public ConfigurableApplicationContext getConfigurableApplicationContext() { |
| 54 |
0 |
ApplicationContext applicationContext = getApplicationContext(); |
| 55 |
0 |
if (applicationContext instanceof ConfigurableApplicationContext) { |
| 56 |
0 |
return (ConfigurableApplicationContext)applicationContext; |
| 57 |
|
} else { |
| 58 |
0 |
throw new IllegalArgumentException("Not created with a ConfigurableApplicationContext! Was: " + applicationContext); |
| 59 |
|
} |
| 60 |
|
} |
| 61 |
|
|
| 62 |
|
protected EventEndpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception { |
| 63 |
56 |
EventEndpoint answer = new EventEndpoint(uri, this); |
| 64 |
|
|
| 65 |
56 |
return answer; |
| 66 |
|
} |
| 67 |
|
} |