Package org.apache.camel.model

Examples of org.apache.camel.model.CatchDefinition


    private CatchDefinitionRenderer() {
        // Utility class, no public or protected default constructor
    }
   
    public static void render(StringBuilder buffer, ProcessorDefinition processor) {
        CatchDefinition catchDef = (CatchDefinition)processor;
        buffer.append(".").append(catchDef.getShortName()).append("(");
        List<Class> exceptions = catchDef.getExceptionClasses();
        for (Class clazz : exceptions) {
            buffer.append(clazz.getSimpleName()).append(".class");
            if (clazz != exceptions.get(exceptions.size() - 1)) {
                buffer.append(", ");
            }
        }
        buffer.append(")");

        // render handled() dsl
        if (catchDef.getHandledPolicy() != null) {
            String handled = catchDef.getHandledPolicy().toString();
            buffer.append(".handled(").append(handled).append(")");
        }

        List<ProcessorDefinition> branches = catchDef.getOutputs();
        for (ProcessorDefinition branch : branches) {
            SendDefinitionRenderer.render(buffer, branch);
        }
    }
View Full Code Here


    private CatchDefinitionRenderer() {
        // Utility class, no public or protected default constructor
    }
   
    public static void render(StringBuilder buffer, ProcessorDefinition<?> processor) {
        CatchDefinition catchDef = (CatchDefinition)processor;
        buffer.append(".").append(catchDef.getShortName()).append("(");
        List<Class> exceptions = catchDef.getExceptionClasses();
        for (Class clazz : exceptions) {
            buffer.append(clazz.getSimpleName()).append(".class");
            if (clazz != exceptions.get(exceptions.size() - 1)) {
                buffer.append(", ");
            }
        }
        buffer.append(")");

        // render handled() dsl
        if (catchDef.getHandledPolicy() != null) {
            String handled = catchDef.getHandledPolicy().toString();
            buffer.append(".handled(").append(handled).append(")");
        }

        List<ProcessorDefinition> branches = catchDef.getOutputs();
        for (ProcessorDefinition branch : branches) {
            SendDefinitionRenderer.render(buffer, branch);
        }
    }
View Full Code Here

    private CatchDefinitionRenderer() {
        // Utility class, no public or protected default constructor
    }
   
    public static void render(StringBuilder buffer, ProcessorDefinition<?> processor) {
        CatchDefinition catchDef = (CatchDefinition)processor;
        buffer.append(".").append(catchDef.getShortName()).append("(");
        List<Class> exceptions = catchDef.getExceptionClasses();
        for (Class clazz : exceptions) {
            buffer.append(clazz.getSimpleName()).append(".class");
            if (clazz != exceptions.get(exceptions.size() - 1)) {
                buffer.append(", ");
            }
        }
        buffer.append(")");

        // render handled() dsl
        if (catchDef.getHandledPolicy() != null) {
            String handled = catchDef.getHandledPolicy().toString();
            buffer.append(".handled(").append(handled).append(")");
        }

        List<ProcessorDefinition> branches = catchDef.getOutputs();
        for (ProcessorDefinition branch : branches) {
            SendDefinitionRenderer.render(buffer, branch);
        }
    }
View Full Code Here

    }

    @SuppressWarnings("rawtypes")
    @Override
    public ProcessorDefinition createCamelDefinition() {
        CatchDefinition answer = new CatchDefinition();

        answer.setInheritErrorHandler(toXmlPropertyValue(PROPERTY_INHERITERRORHANDLER, Objects.<Boolean>getField(this, "inheritErrorHandler")));
        answer.setExceptions(toXmlPropertyValue(PROPERTY_EXCEPTIONS, this.getExceptions()));
        Objects.setField(answer, "handled", toXmlPropertyValue(PROPERTY_HANDLED, this.getHandled()));

        super.savePropertiesToCamelDefinition(answer);
        return answer;
    }
View Full Code Here

    @Override
    protected void loadPropertiesFromCamelDefinition(ProcessorDefinition processor) {
        super.loadPropertiesFromCamelDefinition(processor);

        if (processor instanceof CatchDefinition) {
            CatchDefinition node = (CatchDefinition) processor;

            this.setInheritErrorHandler(Objects.<Boolean>getField(node, "inheritErrorHandler"));
            this.setExceptions(node.getExceptions());
            Objects.setField(this, "handled", node.getHandled());
        } else {
            throw new IllegalArgumentException("ProcessorDefinition not an instanceof CatchDefinition. Was " + processor.getClass().getName());
        }
    }
View Full Code Here

TOP

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

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.