Examples of BeanInvocation


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

                // special for files so we can work with them out of the box
                InputStream is = exchange.getContext().getTypeConverter().convertTo(InputStream.class, body);
                answer = new InputSource(is);
            } else if (body instanceof BeanInvocation) {
                // if its a null bean invocation then handle that specially
                BeanInvocation bi = exchange.getContext().getTypeConverter().convertTo(BeanInvocation.class, body);
                if (bi.getArgs() != null && bi.getArgs().length == 1 && bi.getArgs()[0] == null) {
                    // its a null argument from the bean invocation so use null as answer
                    answer = null;
                }
            } else if (body instanceof String) {
                answer = new InputSource(new StringReader((String) body));
View Full Code Here

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

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (!isStarted()) {
            throw new IllegalStateException("The endpoint is not active: " + getEndpoint().getEndpointUri());
        }
        BeanInvocation invocation = new BeanInvocation(method, args);
        Exchange exchange = getEndpoint().createExchange();
        exchange.getIn().setBody(invocation);
        try {
            log.debug("Invoking {} with args {}", method, args);
            getProcessor().process(exchange);
View Full Code Here

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

                // special for bean invocation
                if (source == null) {
                    if (body instanceof BeanInvocation) {
                        // if its a null bean invocation then handle that
                        BeanInvocation bi = exchange.getContext().getTypeConverter().convertTo(BeanInvocation.class, body);
                        if (bi.getArgs() != null && bi.getArgs().length == 1 && bi.getArgs()[0] == null) {
                            // its a null argument from the bean invocation so use null as answer
                            source = null;
                        }
                    }
                }
View Full Code Here

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

    public void marshal(Exchange exchange, final Object inputObject, OutputStream stream) throws IOException {
        checkElementNameStrategy(exchange);

        String soapAction = getSoapActionFromExchange(exchange);
        if (soapAction == null && inputObject instanceof BeanInvocation) {
            BeanInvocation beanInvocation = (BeanInvocation) inputObject;
            WebMethod webMethod = beanInvocation.getMethod().getAnnotation(WebMethod.class);
            if (webMethod != null && webMethod.action() != null) {
                soapAction = webMethod.action();
            }
        }
               
View Full Code Here

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

    private List<JAXBElement<?>> createContentFromObject(final Object inputObject, String soapAction,
                                                         List<JAXBElement<?>> headerElements) {
        List<Object> bodyParts = new ArrayList<Object>();
        List<Object> headerParts = new ArrayList<Object>();
        if (inputObject instanceof BeanInvocation) {
            BeanInvocation bi = (BeanInvocation)inputObject;
            Annotation[][] annotations = bi.getMethod().getParameterAnnotations();

            List<WebParam> webParams = new ArrayList<WebParam>();
            for (Annotation[] singleParameterAnnotations : annotations) {
                for (Annotation annotation : singleParameterAnnotations) {
                    if (annotation instanceof WebParam) {
                        webParams.add((WebParam)annotation);
                    }
                }
            }

            if (webParams.size() > 0) {
                if (webParams.size() == bi.getArgs().length) {
                    int index = -1;
                    for (Object o : bi.getArgs()) {
                        if (webParams.get(++index).header()) {
                            headerParts.add(o);
                        } else {
                            bodyParts.add(o);
                        }
                    }
                } else {
                    throw new RuntimeCamelException(
                                                    "The number of bean invocation parameters does not "
                                                        + "match the number of parameters annotated with @WebParam for the method [ "
                                                        + bi.getMethod().getName() + "].");
                }
            } else {
                // try to map all objects for the body
                for (Object o : bi.getArgs()) {
                    bodyParts.add(o);
                }
            }

        } else {
View Full Code Here

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

                    if (exchange.getIn().getBody() == null) {
                        return null;
                    }

                    // if its a bean invocation then if it has no arguments then it should be threaded as null body allowed
                    BeanInvocation bi = exchange.getIn().getBody(BeanInvocation.class);
                    if (bi != null && (bi.getArgs() == null || bi.getArgs().length == 0 || bi.getArgs()[0] == null)) {
                        return null;
                    }
                }

                try {
View Full Code Here

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

                // special for bean invocation
                if (source == null) {
                    if (body instanceof BeanInvocation) {
                        // if its a null bean invocation then handle that
                        BeanInvocation bi = exchange.getContext().getTypeConverter().convertTo(BeanInvocation.class, body);
                        if (bi.getArgs() != null && bi.getArgs().length == 1 && bi.getArgs()[0] == null) {
                            // its a null argument from the bean invocation so use null as answer
                            source = null;
                        }
                    }
                }
View Full Code Here

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

                // special for files so we can work with them out of the box
                InputStream is = exchange.getContext().getTypeConverter().convertTo(InputStream.class, body);
                answer = new InputSource(is);
            } else if (body instanceof BeanInvocation) {
                // if its a null bean invocation then handle that specially
                BeanInvocation bi = exchange.getContext().getTypeConverter().convertTo(BeanInvocation.class, body);
                if (bi.getArgs() != null && bi.getArgs().length == 1 && bi.getArgs()[0] == null) {
                    // its a null argument from the bean invocation so use null as answer
                    answer = null;
                }
            } else if (body instanceof String) {
                answer = new InputSource(new StringReader((String) body));
View Full Code Here

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

                    if (exchange.getIn().getBody() == null) {
                        return null;
                    }

                    // if its a bean invocation then if it has no arguments then it should be threaded as null body allowed
                    BeanInvocation bi = exchange.getIn().getBody(BeanInvocation.class);
                    if (bi != null && (bi.getArgs() == null || bi.getArgs().length == 0 || bi.getArgs()[0] == null)) {
                        return null;
                    }
                }

                try {
View Full Code Here

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

                    if (exchange.getIn().getBody() == null) {
                        return null;
                    }

                    // if its a bean invocation then if it has no arguments then it should be threaded as null body allowed
                    BeanInvocation bi = exchange.getIn().getBody(BeanInvocation.class);
                    if (bi != null && (bi.getArgs() == null || bi.getArgs().length == 0 || bi.getArgs()[0] == null)) {
                        return null;
                    }
                }

                try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.