Package org.apache.camel.spi

Examples of org.apache.camel.spi.DataFormat


    @Override
    protected DataFormat createDataFormat(RouteContext routeContext) {
        if ("json".equals(this.driver)) {
            setProperty(this, "dataFormatName", "json-xstream");
        }
        DataFormat answer = super.createDataFormat(routeContext);
        // need to lookup the reference for the xstreamDriver
        if (ObjectHelper.isNotEmpty(driverRef)) {
            setProperty(answer, "xstreamDriver", CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), driverRef));
        }
        return answer;
View Full Code Here


    public static final String DATAFORMAT_RESOURCE_PATH = "META-INF/services/org/apache/camel/dataformat/";

    protected FactoryFinder dataformatFactory;

    public DataFormat resolveDataFormat(String name, CamelContext context) {
        DataFormat dataFormat = lookup(context, name, DataFormat.class);
        if (dataFormat == null) {
            Class<?> type = null;
            try {
                if (dataformatFactory == null) {
                    dataformatFactory = context.getFactoryFinder(DATAFORMAT_RESOURCE_PATH);
View Full Code Here

    public static final String DATAFORMAT_RESOURCE_PATH = "META-INF/services/org/apache/camel/dataformat/";

    protected FactoryFinder dataformatFactory;

    public DataFormat resolveDataFormat(String name, CamelContext context) {
        DataFormat dataFormat = lookup(context, name, DataFormat.class);
        if (dataFormat == null) {
            Class<?> type = null;
            try {
                if (dataformatFactory == null) {
                    dataformatFactory = context.getFactoryFinder(DATAFORMAT_RESOURCE_PATH);
View Full Code Here

        this.dataFormatType = dataFormatType;
    }

    @Override
    public Processor createProcessor(RouteContext routeContext) {
        DataFormat dataFormat = DataFormatDefinition.getDataFormat(routeContext, getDataFormatType(), ref);
        return new MarshalProcessor(dataFormat);
    }
View Full Code Here

            if (type != null) {
                return type.getDataFormat(routeContext);
            }

            DataFormat dataFormat = routeContext.getCamelContext().resolveDataFormat(ref);
            if (dataFormat == null) {
                throw new IllegalArgumentException("Cannot find data format in registry with ref: " + ref);
            }

            return dataFormat;
View Full Code Here

        this.dataFormatType = dataFormatType;
    }

    @Override
    public Processor createProcessor(RouteContext routeContext) {
        DataFormat dataFormat = DataFormatDefinition.getDataFormat(routeContext, getDataFormatType(), ref);
        return new MarshalProcessor(dataFormat);
    }
View Full Code Here

    }

    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            public void configure() {
                DataFormat jaxb = new JaxbDataFormat("org.apache.camel.example");

                from("direct:start").
                        marshal(jaxb).
                        to("direct:marshalled");
View Full Code Here

    }

    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            public void configure() {
                DataFormat jaxb = new JaxbDataFormat("org.apache.camel.example");

                // use 5 concurrent threads to do marshalling
                from("dataset:beer").marshal(jaxb).to("dataset:beer");
            }
        };
View Full Code Here

                errorHandler(deadLetterChannel("mock:error").redeliverDelay(0));

                onException(InvalidOrderException.class).maximumRedeliveries(0).handled(true)
                    .to("mock:invalid");

                DataFormat jaxb = new JaxbDataFormat("org.apache.camel.example");

                from("direct:start")
                    .unmarshal(jaxb)
                    .choice()
                        .when().method(RouteWithErrorHandlerTest.class, "isWine").to("mock:wine")
View Full Code Here

    }

    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            public void configure() {
                DataFormat jaxb = new JaxbDataFormat("org.apache.camel.example");

                // use seda that supports concurrent consumers for concurrency
                from("seda:start?size=" + size + "&concurrentConsumers=5").marshal(jaxb).convertBodyTo(String.class).to("mock:result");
            }
        };
View Full Code Here

TOP

Related Classes of org.apache.camel.spi.DataFormat

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.