Package org.apache.camel.model

Examples of org.apache.camel.model.ProcessorDefinition


                                           final Iterator<ProcessorDefinition> it) {
        return new AdviceWithTask() {
            public void task() throws Exception {
                boolean match = false;
                while (it.hasNext()) {
                    ProcessorDefinition output = it.next();
                    if (matchBy.match(output)) {
                        ProcessorDefinition parent = output.getParent();
                        if (parent != null) {
                            int index = parent.getOutputs().indexOf(output);
                            if (index != -1) {
                                match = true;
                                Object old = parent.getOutputs().remove(index);
                                LOG.info("AdviceWith (" + matchBy.getId() + ") : [" + old + "] --> remove");
                            }
                        }
                    }
                }
View Full Code Here


                                           final Iterator<ProcessorDefinition> it) {
        return new AdviceWithTask() {
            public void task() throws Exception {
                boolean match = false;
                while (it.hasNext()) {
                    ProcessorDefinition output = it.next();
                    if (matchBy.match(output)) {
                        ProcessorDefinition parent = output.getParent();
                        if (parent != null) {
                            int index = parent.getOutputs().indexOf(output);
                            if (index != -1) {
                                match = true;
                                Object existing = parent.getOutputs().get(index);
                                parent.getOutputs().add(index, before);
                                LOG.info("AdviceWith (" + matchBy.getId() + ") : [" + existing + "] --> before [" + before + "]");
                            }
                        }
                    }
                }
View Full Code Here

                                          final Iterator<ProcessorDefinition> it) {
        return new AdviceWithTask() {
            public void task() throws Exception {
                boolean match = false;
                while (it.hasNext()) {
                    ProcessorDefinition output = it.next();
                    if (matchBy.match(output)) {

                        ProcessorDefinition parent = output.getParent();
                        if (parent != null) {
                            int index = parent.getOutputs().indexOf(output);
                            if (index != -1) {
                                match = true;
                                Object existing = parent.getOutputs().get(index);
                                parent.getOutputs().add(index + 1, after);
                                LOG.info("AdviceWith (" + matchBy.getId() + ") : [" + existing + "] --> after [" + after + "]");
                            }
                        }
                    }
                }
View Full Code Here

        // first iterator and apply match by
        List<ProcessorDefinition> matched = new ArrayList<ProcessorDefinition>();
        Iterator<ProcessorDefinition> itAll = ProcessorDefinitionHelper.filterTypeInOutputs(route.getOutputs(), ProcessorDefinition.class);
        while (itAll.hasNext()) {
            ProcessorDefinition next = itAll.next();
            if (matchBy.match(next)) {
                matched.add(next);
            }
        }
View Full Code Here

                return current < list.size();
            }

            @Override
            public ProcessorDefinition next() {
                ProcessorDefinition answer = list.get(current);
                current++;
                return answer;
            }

            @Override
View Full Code Here

                                    Set visited) {
        if ( !nav.getOutputs().isEmpty() ) {

            List<ProcessorDefinition<?>> outputs = nav.getOutputs();
            for ( int i = 0; i < outputs.size(); i++ ) {
                ProcessorDefinition child = outputs.get( i );//it.next();
                if ( child instanceof ToDefinition ) {
                    ToDefinition to = (ToDefinition) child;
                    if ( to.getUri().startsWith( "cxfrs" ) && !visited.contains( to ) ) {
                        BeanDefinition beanDef = new BeanDefinition();
                        beanDef.setBeanType( PreCxfrs.class.getName() );
                        outputs.add( i,
                                     beanDef ); // insert before cxfrs
                        beanDef = new BeanDefinition();
                        beanDef.setBeanType( PostCxfrs.class.getName() );
                        outputs.add( i + 2,
                                     beanDef ); // insert after cxfrs
                        i = i + 2;// adjust for the two inserts
                    } else if ( to.getUri().startsWith( "cxf" ) && !visited.contains( to ) ) {
                        BeanDefinition beanDef = new BeanDefinition();
                        beanDef.setBeanType( PreCxfSoapProcessor.class.getName() );
                        outputs.add( i,
                                     beanDef ); // insert before cxf
                        beanDef = new BeanDefinition();
                        beanDef.setBeanType( PostCxfSoapProcessor.class.getName() );
                        outputs.add( i + 2,
                                     beanDef ); // insert after cxf
                        i = i + 2;// adjust for the two inserts
                        augmented = true;
                    }
                } else if ( child instanceof MarshalDefinition ) {
                    MarshalDefinition m = (MarshalDefinition) child;
                    DataFormatDefinition dformatDefinition = m.getDataFormatType();
                    dformatDefinition = processDataFormatType( routeContext,
                                                               m.getRef(),
                                                               dformatDefinition );
                    m.setDataFormatType( dformatDefinition ); // repoint the marshaller, if it was cloned
                } else if ( child instanceof UnmarshalDefinition ) {
                    UnmarshalDefinition m = (UnmarshalDefinition) child;
                    DataFormatDefinition dformatDefinition = m.getDataFormatType();
                    dformatDefinition = processDataFormatType( routeContext,
                                                               m.getRef(),
                                                               dformatDefinition );
                    m.setDataFormatType( dformatDefinition ); // repoint the marshaller, if it was cloned                   
                }
            }

            for ( Iterator<ProcessorDefinition<?>> it = nav.getOutputs().iterator(); it.hasNext(); ) {
                ProcessorDefinition child = it.next();
                augmentNodes( routeContext,
                              child,
                              visited );
            }
        }
View Full Code Here

        // add onCompletion *after* intercept, as its important intercept is first
        if (!hasRouteScope) {
            int index = 0;
            for (int i = 0; i < route.getOutputs().size(); i++) {
                index = i;
                ProcessorDefinition out = route.getOutputs().get(i);
                if (!(out instanceof InterceptDefinition)) {
                    break;
                }
            }
            route.getOutputs().addAll(index, getOnCompletions());
View Full Code Here

        // instrument the route endpoint
        final Endpoint endpoint = routeContext.getEndpoint();

        // only needed to register on the first output as all rotues will pass through this one
        ProcessorDefinition out = routeContext.getRoute().getOutputs().get(0);

        // add an intercept strategy that counts when the route sends to any of its outputs
        out.addInterceptStrategy(new InterceptStrategy() {
            public Processor wrapProcessorInInterceptors(ProcessorDefinition processorDefinition, Processor target, Processor nextTarget) throws Exception {
                if (registeredRoutes.containsKey(endpoint)) {
                    // do not double wrap
                    return target;
                }
View Full Code Here

    }

    private String extractPreviousNode(Exchange exchange) {
        if (exchange.getUnitOfWork() instanceof TraceableUnitOfWork) {
            TraceableUnitOfWork tuow = (TraceableUnitOfWork) exchange.getUnitOfWork();
            ProcessorDefinition last = tuow.getLastInterceptedNode();
            return last != null ? extractNode(last) : null;
        }
        return null;
    }
View Full Code Here

        // compute from and to
        String from = "";
        if (showNode && exchange.getUnitOfWork() instanceof TraceableUnitOfWork) {
            TraceableUnitOfWork tuow = (TraceableUnitOfWork) exchange.getUnitOfWork();
            ProcessorDefinition prev = tuow.getLastInterceptedNode();
            if (prev != null) {
                from = getNodeMessage(prev);
            } else if (exchange.getFromEndpoint() != null) {
                from = exchange.getFromEndpoint().getEndpointUri();
            }
View Full Code Here

TOP

Related Classes of org.apache.camel.model.ProcessorDefinition

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.