use of org.apache.camel.spi.ComponentResolver in project camel by apache.
the class CamelMockBundleContext method getService.
public Object getService(@SuppressWarnings("rawtypes") ServiceReference reference) {
String[] classNames = (String[]) reference.getProperty(Constants.OBJECTCLASS);
String classNames0 = classNames != null ? classNames[0] : null;
String pid = (String) reference.getProperty(Constants.SERVICE_PID);
if (classNames0 != null && classNames0.equals("org.apache.camel.core.osgi.test.MyService")) {
return new MyService();
} else if (pid != null && pid.equals(SERVICE_PID_PREFIX + "org.apache.camel.core.osgi.test.MyService")) {
return new MyService();
} else if (classNames0 != null && classNames0.equals(ComponentResolver.class.getName())) {
return new ComponentResolver() {
public Component resolveComponent(String name, CamelContext context) throws Exception {
if (name.equals("file_test")) {
return new FileComponent();
}
return null;
}
};
} else if (classNames0 != null && classNames0.equals(LanguageResolver.class.getName())) {
return new LanguageResolver() {
public Language resolveLanguage(String name, CamelContext context) {
if (name.equals("simple")) {
return new SimpleLanguage();
}
return null;
}
};
} else {
return null;
}
}
use of org.apache.camel.spi.ComponentResolver in project camel by apache.
the class MllpTcpClientProducerBlueprintTest method addServicesOnStartup.
/*
This doesn't seem to work
@Override
protected String useOverridePropertiesWithConfigAdmin(Dictionary props) throws Exception {
props.put("mllp.port", mllpServer.getListenPort() );
return "MllpTcpClientProducer";
}
*/
@Override
protected void addServicesOnStartup(Map<String, KeyValueHolder<Object, Dictionary>> services) {
ComponentResolver testResolver = new DefaultComponentResolver();
services.put(ComponentResolver.class.getName(), asService(testResolver, "component", "mllp"));
}
use of org.apache.camel.spi.ComponentResolver in project camel by apache.
the class MllpTcpServerConsumerBlueprintTest method addServicesOnStartup.
@Override
protected void addServicesOnStartup(Map<String, KeyValueHolder<Object, Dictionary>> services) {
ComponentResolver testResolver = new DefaultComponentResolver();
services.put(ComponentResolver.class.getName(), asService(testResolver, "component", "mllp"));
}
use of org.apache.camel.spi.ComponentResolver in project wildfly-camel by wildfly-extras.
the class ComponentResolverAssociationHandler method setup.
@Override
public void setup(final CamelContext camelctx) {
if (camelctx instanceof DefaultCamelContext) {
DefaultCamelContext defaultctx = (DefaultCamelContext) camelctx;
ComponentResolver delegate = defaultctx.getComponentResolver();
defaultctx.setComponentResolver(new WildFlyComponentResolver(delegate));
}
}
Aggregations