camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: From File to POJO using JAXB
Date Mon, 01 Oct 2007 15:47:14 GMT
On 28/09/2007, bgoetzmann <> wrote:
> Hello,
> Looking at the ETL example that is impressive, I see that a detected file is
> converted to a POJO ; this is defined a route declared in the EtlRoutes
> class:
> from("file:src/data?noop=true").convertBodyTo(PersonDocument.class)...
> I know that when a file is detected in the src folder the body of the
> message that comes in is of type File ; how the XML content of this file is
> converted (marshalled) to the POJO PersonDocument that has JAXB annotations?
> Can I have more details, for example how Camel knows that it has to marshall
> using JAXB?
> Thank you!

If camel-jaxb.jar is on the classpath it installs a
FallbackTypeConverter which looks at the requested type and if its a
JAXB2 POJO (i.e. has an @XmlRootElement) then it tries to convert the
body to the JAXB2 POJO using JAXB.

We should probably add the concept of explicit message Source (input
format) and Sink (output format) to make this a little more explicit
and a little less magic. (I've spun up a separate thread on this...)


Open Source SOA

View raw message