Package org.apache.camel.component.bean

Examples of org.apache.camel.component.bean.RegistryBean


        } else if (instance != null) {
            answer = new BeanExpression(instance, getMethod());
        } else {
            String ref = beanName();
            // if its a ref then check that the ref exists
            BeanHolder holder = new RegistryBean(camelContext, ref);
            // get the bean which will check that it exists
            instance = holder.getBean();
            answer = new BeanExpression(ref, getMethod());
        }

        validateHasMethod(camelContext, instance, getMethod());
        return answer;
View Full Code Here


    @Override
    public Processor createProcessor(RouteContext routeContext) {
        BeanProcessor answer;
        if (ObjectHelper.isNotEmpty(ref)) {
            RegistryBean beanHolder = new RegistryBean(routeContext.getCamelContext(), ref);
            // bean holder will check if the bean exists
            bean = beanHolder.getBean();
            answer = new BeanProcessor(beanHolder);
        } else {
            if (bean == null) {
                ObjectHelper.notNull(beanType, "bean, ref or beanType", this);
                bean = CamelContextHelper.newInstance(routeContext.getCamelContext(), beanType);
View Full Code Here

    public Object evaluate(Exchange exchange) {
        // either use registry lookup or a constant bean
        BeanHolder holder;
        if (bean == null) {
            holder = new RegistryBean(exchange.getContext(), beanName);
        } else {
            holder = new ConstantBeanHolder(bean, exchange.getContext());
        }

        // invoking the bean can either be the easy way or using OGNL
View Full Code Here

        // either use registry lookup or a constant bean
        BeanHolder holder;
        if (bean != null) {
            holder = new ConstantBeanHolder(bean, context);
        } else if (beanName != null) {
            holder = new RegistryBean(context, beanName);
        } else if (type != null) {
            holder = new ConstantTypeBeanHolder(type, context);
        } else {
            throw new IllegalArgumentException("Either bean, beanName or type should be set on " + this);
        }
View Full Code Here

        // either use registry lookup or a constant bean
        BeanHolder holder;
        if (bean != null) {
            holder = new ConstantBeanHolder(bean, exchange.getContext());
        } else if (beanName != null) {
            holder = new RegistryBean(exchange.getContext(), beanName);
        } else if (type != null) {
            holder = new ConstantTypeBeanHolder(type, exchange.getContext());
        } else {
            throw new IllegalArgumentException("Either bean, beanName or type should be set on " + this);
        }
View Full Code Here

    @Override
    @SuppressWarnings("unchecked")
    public Processor createProcessor(RouteContext routeContext) {
        BeanProcessor answer;
        if (ref != null) {
            answer = new BeanProcessor(new RegistryBean(routeContext.getCamelContext(), ref));
        } else {
            if (bean == null) {
                ObjectHelper.notNull(beanType, "bean, ref or beanType", this);
                bean = CamelContextHelper.newInstance(routeContext.getCamelContext(), beanType);
            }
View Full Code Here

    public Object evaluate(Exchange exchange) {
        // either use registry lookup or a constant bean
        BeanHolder holder;
        if (bean == null) {
            holder = new RegistryBean(exchange.getContext(), beanName);
        } else {
            holder = new ConstantBeanHolder(bean, exchange.getContext());
        }

        BeanProcessor processor = new BeanProcessor(holder);
View Full Code Here

        } else if (instance != null) {
            holder = new ConstantBeanHolder(instance, camelContext);
        } else {
            String ref = beanName();
            // if its a ref then check that the ref exists
            BeanHolder regHolder = new RegistryBean(camelContext, ref);
            // get the bean which will check that it exists
            instance = regHolder.getBean();
            holder = new ConstantBeanHolder(instance, camelContext);
        }

        // create answer using the holder
        answer = new BeanExpression(holder, getMethod());
View Full Code Here

    protected String assertionFailureMessage(E exchange) {
        return "bean: " + beanName + " method: " + method;
    }

    public Object evaluate(E exchange) {
        BeanProcessor processor = new BeanProcessor(new RegistryBean(exchange.getContext(), beanName));
        if (method != null) {
            processor.setMethod(method);
        }
        try {
            Exchange newExchange = exchange.copy();
View Full Code Here

        } else if (instance != null) {
            answer = new BeanExpression(instance, getMethod());
        } else {
            String ref = beanName();
            // if its a ref then check that the ref exists
            BeanHolder holder = new RegistryBean(camelContext, ref);
            // get the bean which will check that it exists
            instance = holder.getBean();
            answer = new BeanExpression(instance, getMethod());
        }

        validateHasMethod(camelContext, instance, beanType, getMethod());
        return answer;
View Full Code Here

TOP

Related Classes of org.apache.camel.component.bean.RegistryBean

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.