Search in sources :

Example 6 with JaxbDataFormat

use of org.apache.camel.converter.jaxb.JaxbDataFormat in project camel by apache.

the class JaxbDataFormatIssueTest method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            JaxbDataFormat jaxb = new JaxbDataFormat(JAXBContext.newInstance(Foo.class));
            jaxb.setPrettyPrint(false);
            from("direct:start").marshal(jaxb).to("log:xml", "mock:result");
        }
    };
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) JaxbDataFormat(org.apache.camel.converter.jaxb.JaxbDataFormat)

Example 7 with JaxbDataFormat

use of org.apache.camel.converter.jaxb.JaxbDataFormat in project camel by apache.

the class CamelJaxbNoNamespaceSchemaTest method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        public void configure() throws Exception {
            JaxbDataFormat dataFormat = new JaxbDataFormat("org.apache.camel.foo.bar");
            dataFormat.setNoNamespaceSchemaLocation("person-no-namespace.xsd");
            dataFormat.setIgnoreJAXBElement(false);
            from("direct:marshal").marshal(dataFormat).to("mock:result");
        }
    };
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) JaxbDataFormat(org.apache.camel.converter.jaxb.JaxbDataFormat)

Example 8 with JaxbDataFormat

use of org.apache.camel.converter.jaxb.JaxbDataFormat in project camel by apache.

the class UnmarshalTest method createRouteBuilder.

protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {

        public void configure() {
            DataFormat jaxb = new JaxbDataFormat("org.apache.camel.example");
            from("direct:start").unmarshal(jaxb).to("mock:result");
        }
    };
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) DataFormat(org.apache.camel.spi.DataFormat) JaxbDataFormat(org.apache.camel.converter.jaxb.JaxbDataFormat) JaxbDataFormat(org.apache.camel.converter.jaxb.JaxbDataFormat)

Example 9 with JaxbDataFormat

use of org.apache.camel.converter.jaxb.JaxbDataFormat in project quickstarts by jboss-switchyard.

the class GreetingServiceRoute method configure.

@Override
public void configure() throws Exception {
    JaxbDataFormat jxb = new JaxbDataFormat(JAXBContext.newInstance("org.switchyard.quickstarts.camel.jaxb"));
    from("switchyard://GreetingService").convertBodyTo(String.class).unmarshal(jxb).process(new Processor() {

        @Override
        public void process(Exchange exchange) throws Exception {
            GreetingRequest rq = exchange.getIn().getBody(GreetingRequest.class);
            GreetingResponse rp = new GreetingResponse("Ola " + rq.getName() + "!");
            SwitchYardMessage out = new SwitchYardMessage();
            out.setBody(rp);
            exchange.setOut(out);
        }
    }).marshal(jxb).convertBodyTo(String.class);
}
Also used : Exchange(org.apache.camel.Exchange) Processor(org.apache.camel.Processor) SwitchYardMessage(org.switchyard.common.camel.SwitchYardMessage) JaxbDataFormat(org.apache.camel.converter.jaxb.JaxbDataFormat)

Example 10 with JaxbDataFormat

use of org.apache.camel.converter.jaxb.JaxbDataFormat in project camel by apache.

the class IncrementRoute method configure.

@Override
public void configure() throws Exception {
    JaxbDataFormat jaxb = new JaxbDataFormat(IncrementRequest.class.getPackage().getName());
    from("spring-ws:rootqname:{http://camel.apache.org/example/increment}incrementRequest?endpointMapping=#endpointMapping").unmarshal(jaxb).process(new IncrementProcessor()).marshal(jaxb);
}
Also used : JaxbDataFormat(org.apache.camel.converter.jaxb.JaxbDataFormat)

Aggregations

JaxbDataFormat (org.apache.camel.converter.jaxb.JaxbDataFormat)17 RouteBuilder (org.apache.camel.builder.RouteBuilder)14 DataFormat (org.apache.camel.spi.DataFormat)6 Exchange (org.apache.camel.Exchange)3 Processor (org.apache.camel.Processor)3 CountDownLatch (java.util.concurrent.CountDownLatch)2 Test (org.junit.Test)2 HashMap (java.util.HashMap)1 JAXBContext (javax.xml.bind.JAXBContext)1 CamelContextAware (org.apache.camel.CamelContextAware)1 RuntimeCamelException (org.apache.camel.RuntimeCamelException)1 PersonType (org.apache.camel.foo.bar.PersonType)1 DataFormatFactory (org.apache.camel.spi.DataFormatFactory)1 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)1 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1 SwitchYardMessage (org.switchyard.common.camel.SwitchYardMessage)1