Package org.apache.camel.model

Examples of org.apache.camel.model.ProcessorDefinition


        // 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 || out instanceof InterceptSendToEndpointDefinition) {
                    continue;
                } else {
                    // we found the spot
                    break;
View Full Code Here


        }
        if (isEmpty(this.url) && isNotEmpty(this.nodeType)) {
            this.url = "http://camel.apache.org/" + this.nodeType.toLowerCase().replace(' ', '-') + ".html";
        }
        if (node instanceof ProcessorDefinition && this.outputs == null) {
            ProcessorDefinition processorType = (ProcessorDefinition)node;
            this.outputs = processorType.getOutputs();
        }
    }
View Full Code Here

        for (Processor child : nav.next()) {

            if (child instanceof Channel) {
                Channel channel = (Channel) child;
                ProcessorDefinition def = channel.getProcessorDefinition();
                navigateDefinition(def, sb);
            }
        }
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    private void navigateDefinition(ProcessorDefinition<?> def, StringBuilder sb) {

        // must do this ugly cast to avoid compiler error on HP-UX
        ProcessorDefinition defn = (ProcessorDefinition) def;

        if (defn instanceof LoadBalanceDefinition) {
            sb.append(".loadBalance()");

            LoadBalanceDefinition lbd = (LoadBalanceDefinition) defn;
            LoadBalancer balancer = lbd.getLoadBalancerType().getLoadBalancer(null);
            if (balancer instanceof RandomLoadBalancer) {
                sb.append(".random()");
            }
        }

        if (defn instanceof SendDefinition) {
            SendDefinition send = (SendDefinition) defn;
            sb.append(".to(\"" + send.getEndpoint().getEndpointUri() + "\")");
        }

        List<ProcessorDefinition> children = defn.getOutputs();
        if (children == null || children.isEmpty()) {
            return;
        }

        for (ProcessorDefinition child : children) {
View Full Code Here

    public void configure() throws Exception {
        if (fromUris.isEmpty()) {
            throw new IllegalArgumentException("the fromUris property must contain at least one valid URI");
        }
        for (String fromUri : fromUris) {
            ProcessorDefinition route = from(fromUri);

            route = addBeanCall(route);
            for (String toUri : toUris) {
                route = route.to(toUri);
            }
        }
    }
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

        @Override
        public Processor wrapProcessorInInterceptors(final CamelContext context, final ProcessorDefinition<?> definition,
                                                     final Processor target, final Processor nextTarget) throws Exception {
            String targetId = definition.hasCustomIdAssigned() ? definition.getId() : definition.getLabel();
            ProcessorDefinition parent = definition.getParent();
            String parentId = "";
            if (parent != null) {
                parentId = parent.hasCustomIdAssigned() ? parent.getId() : parent.getLabel();
            }

            LIST.add("Parent " + parentId + " -> target " + targetId);

            return target;
View Full Code Here

        for (Processor child : nav.next()) {

            if (child instanceof Channel) {
                Channel channel = (Channel) child;
                ProcessorDefinition def = channel.getProcessorDefinition();
                navigateDefinition(def, sb);
            }
        }
    }
View Full Code Here

        }
        if (isEmpty(this.url) && isNotEmpty(this.nodeType)) {
            this.url = "http://camel.apache.org/" + this.nodeType.toLowerCase().replace(' ', '-') + ".html";
        }
        if (node instanceof ProcessorDefinition && this.outputs == null) {
            ProcessorDefinition processorType = (ProcessorDefinition)node;
            this.outputs = processorType.getOutputs();
        }
    }
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.