camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bgoetzmann <bgoetzm...@sophia.symag.com>
Subject Re: From File to POJO using JAXB
Date Tue, 02 Oct 2007 09:26:40 GMT

Thank you James,

Looking at the source code of the FallbackTypeConverter's unmarshall method
class, I don't see where the content file is unmarshalled to the POJO.
Perhaps the file object is first converted to InputStream?

Bertrand.


James.Strachan wrote:
> 
> On 28/09/2007, bgoetzmann <bgoetzmann@sophia.symag.com> 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...)
> 
> http://www.nabble.com/musings-on-Source-Sink-integration-%28e.g.-serialization-v-JAXB2-v-SOAP-encoding-etc%29-tf4548713s22882.html
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source SOA
> http://open.iona.com
> 
> 

-- 
View this message in context: http://www.nabble.com/From-File-to-POJO-using-JAXB-tf4535029s22882.html#a12995397
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message