Search in sources :

Example 1 with ComponentResolver

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;
    }
}
Also used : CamelContext(org.apache.camel.CamelContext) LanguageResolver(org.apache.camel.spi.LanguageResolver) SimpleLanguage(org.apache.camel.language.simple.SimpleLanguage) Language(org.apache.camel.spi.Language) MyService(org.apache.camel.core.osgi.test.MyService) FileComponent(org.apache.camel.component.file.FileComponent) ComponentResolver(org.apache.camel.spi.ComponentResolver) SimpleLanguage(org.apache.camel.language.simple.SimpleLanguage)

Example 2 with ComponentResolver

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"));
}
Also used : DefaultComponentResolver(org.apache.camel.impl.DefaultComponentResolver) DefaultComponentResolver(org.apache.camel.impl.DefaultComponentResolver) ComponentResolver(org.apache.camel.spi.ComponentResolver)

Example 3 with ComponentResolver

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"));
}
Also used : DefaultComponentResolver(org.apache.camel.impl.DefaultComponentResolver) DefaultComponentResolver(org.apache.camel.impl.DefaultComponentResolver) ComponentResolver(org.apache.camel.spi.ComponentResolver)

Example 4 with ComponentResolver

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));
    }
}
Also used : ComponentResolver(org.apache.camel.spi.ComponentResolver) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext)

Aggregations

ComponentResolver (org.apache.camel.spi.ComponentResolver)4 DefaultComponentResolver (org.apache.camel.impl.DefaultComponentResolver)2 CamelContext (org.apache.camel.CamelContext)1 FileComponent (org.apache.camel.component.file.FileComponent)1 MyService (org.apache.camel.core.osgi.test.MyService)1 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)1 SimpleLanguage (org.apache.camel.language.simple.SimpleLanguage)1 Language (org.apache.camel.spi.Language)1 LanguageResolver (org.apache.camel.spi.LanguageResolver)1