Package org.apache.camel.spi

Examples of org.apache.camel.spi.ComponentResolver


        return new SpringInjector((AbstractRefreshableApplicationContext)getApplicationContext());
    }

    @Override
    protected ComponentResolver createComponentResolver() {
        ComponentResolver defaultResolver = super.createComponentResolver();
        return new SpringComponentResolver(getApplicationContext(), defaultResolver);
    }
View Full Code Here


    public Object getService(ServiceReference reference) {
        String[] classNames = (String[]) reference.getProperty(Constants.OBJECTCLASS);       
        if (classNames[0].equals("org.apache.camel.osgi.test.MyService")) {
            return new MyService();
        } else if (classNames[0].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;
View Full Code Here

    protected Component getComponent(String name, CamelContext context) throws Exception {
        LOG.trace("Finding Component: " + name);
        try {
            ServiceReference[] refs = bundleContext.getServiceReferences(ComponentResolver.class.getName(), "(component=" + name + ")");
            if (refs != null && refs.length > 0) {
                ComponentResolver resolver = (ComponentResolver) bundleContext.getService(refs[0]);
                return resolver.resolveComponent(name, context);
            }
            return null;
        } catch (InvalidSyntaxException e) {
            throw new RuntimeException(e); // Should never happen
        }
View Full Code Here

            LOG.trace("Finding Component: " + name);
        }
        try {
            ServiceReference[] refs = bundleContext.getServiceReferences(ComponentResolver.class.getName(), "(component=" + name + ")");
            if (refs != null && refs.length > 0) {
                ComponentResolver resolver = (ComponentResolver) bundleContext.getService(refs[0]);
                return resolver.resolveComponent(name, context);
            }
            return null;
        } catch (InvalidSyntaxException e) {
            throw ObjectHelper.wrapRuntimeCamelException(e);
        }
View Full Code Here

    public Object getService(ServiceReference reference) {
        String[] classNames = (String[]) reference.getProperty(Constants.OBJECTCLASS);       
        if (classNames[0].equals("org.apache.camel.core.osgi.test.MyService")) {
            return new MyService();
        } else if (classNames[0].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;
View Full Code Here

            ServiceReference[] refs = bundleContext.getServiceReferences(ComponentResolver.class.getName(), "(component=" + name + ")");
            if (refs != null) {
                for (ServiceReference ref : refs) {
                    Object service = bundleContext.getService(ref);
                    if (ComponentResolver.class.isAssignableFrom(service.getClass())) {
                        ComponentResolver resolver = (ComponentResolver) service;
                        return resolver.resolveComponent(name, context);
                    }
                }
            }
            return null;
        } catch (InvalidSyntaxException e) {
View Full Code Here

        return new SpringInjector((AbstractRefreshableApplicationContext) getApplicationContext());
    }

    @Override
    protected ComponentResolver createComponentResolver() {
        ComponentResolver defaultResolver = super.createComponentResolver();
        return new SpringComponentResolver(getApplicationContext(), defaultResolver);
    }
View Full Code Here

    protected Component getComponent(String name, CamelContext context) throws Exception {
        LOG.trace("Finding Component: {}", name);
        try {
            ServiceReference[] refs = bundleContext.getServiceReferences(ComponentResolver.class.getName(), "(component=" + name + ")");
            if (refs != null && refs.length > 0) {
                ComponentResolver resolver = (ComponentResolver) bundleContext.getService(refs[0]);
                return resolver.resolveComponent(name, context);
            }
            return null;
        } catch (InvalidSyntaxException e) {
            throw ObjectHelper.wrapRuntimeCamelException(e);
        }
View Full Code Here

            ServiceReference<?>[] refs = bundleContext.getServiceReferences(ComponentResolver.class.getName(), "(component=" + name + ")");
            if (refs != null) {
                for (ServiceReference<?> ref : refs) {
                    Object service = bundleContext.getService(ref);
                    if (ComponentResolver.class.isAssignableFrom(service.getClass())) {
                        ComponentResolver resolver = (ComponentResolver) service;
                        return resolver.resolveComponent(name, context);
                    }
                }
            }
            return null;
        } catch (InvalidSyntaxException e) {
View Full Code Here

    public Object getService(@SuppressWarnings("rawtypes") ServiceReference reference) {
        String[] classNames = (String[]) reference.getProperty(Constants.OBJECTCLASS);       
        if (classNames[0].equals("org.apache.camel.core.osgi.test.MyService")) {
            return new MyService();
        } else if (classNames[0].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;
View Full Code Here

TOP

Related Classes of org.apache.camel.spi.ComponentResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.