You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by Dan Diephouse <da...@mulesource.com> on 2008/03/07 08:42:07 UTC

Re: Entity/DTO serialization in entry.content

I've been thinking about this some more today. I'd really like to write 
some code like this:

Entry entry = ....;
entry.addElement(new JAXBElement(myJaxbPojo));

Then when the entry is serialized, it would call out to JAXB and marshal 
the "myJaxbPojo" object using an XMLStreamWriter. Anyone have any 
pointers as to how to actually achieve this?

Dan

Dan Diephouse wrote:
> I've been meaning to write a JAXB plugin for this purpose, but time 
> hasn't quite allowed me. What I *really* want though is an XHTML 
> databinding framework... Frameworks fix everything! :-)
>
> http://netzooid.com/blog/2007/12/11/lazyweb-microformat-databinding/
>
> Dan
>
> Remy Gendron wrote:
>> After looking at this a bit more, XMLEncoder would be a better fit.
>>
>> R.
>>
>> -----Original Message-----
>> From: Remy Gendron [mailto:remy@arrova.ca] Sent: February 28, 2008 12:13
>> To: abdera-user@incubator.apache.org
>> Subject: Entity/DTO serialization in entry.content
>>
>> Hello all,
>>
>>  
>>
>> My entries are backed by simple entity pojos.
>>
>>  
>>
>> To prevent business rules from being implemented outside my service 
>> layer,
>> the service APIs use interfaces on these pojos. The interface make only
>> certain fields available to the caller, and some of those fields are 
>> only
>> readable (only a getter is available in the interface). So, no DTOs. 
>> Only my
>> entities wrapped by interfaces.
>>
>>  
>>
>> I was looking for a way to automate (when appropriate) the serialization
>> (both ways) of a backing entity in the entry.content atom field.
>>
>>  
>>
>> Any recommendations?
>>
>>  
>>
>> I was thinking of using something like XStream… Does Abdera provides
>> internal support for this, something working hand in hand with FOMEntry?
>>
>>  
>>
>> Thanks!
>>
>>  
>>
>> Remy
>>
>>
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 
>> 269.21.1/1302 - Release Date: 2008.02.27
>> 16:34
>>  
>>
>> No virus found in this incoming message.
>> Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 
>> 269.21.1/1302 - Release Date: 2008.02.27
>> 16:34
>>  
>>
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 
>> 269.21.1/1302 - Release Date: 2008.02.27
>> 16:34
>>  
>>
>>   
>
>


-- 
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com 


RE: Entity/DTO serialization in entry.content

Posted by Remy Gendron <re...@arrova.ca>.

BTW, for those of you interested in how I introspect my domain object
interfaces... I only patched two classes (JavaBeanInterfaceConverter and
BeanInterfaceProvider) that came with XTream to support JavaBean
introspection thru their interfaces instead of looking directly at the
pojos. The code is horrible and could be rewritten cleanly but I didn't have
the time to do it.

R.

-----Original Message-----
From: Remy Gendron [mailto:remy@arrova.ca] 
Sent: March 07, 2008 09:40
To: abdera-dev@incubator.apache.org
Subject: RE: Entity/DTO serialization in entry.content

I totally dislike JAXB because of all this XML schema stuff. It is probably
the way to go however to cover all the use cases but, I will architect my
project to use convention in naming my domain object fields so that
reflection can be used to serialize the pojo into entry.content.

If you look at my XStream extensions, I actually serialize what is
accessible thru the interfaces implemented by the domain objects. And I only
deserialize writable 'javabean' properties.

But I do agree that Abdera should reward those who follow some sort of
Abdera conventions by automating as much of the work of mapping data between
the persistence store, Abdera and the HTTP client.

R.

-----Original Message-----
From: Dan Diephouse [mailto:dan.diephouse@mulesource.com] 
Sent: March 07, 2008 02:42
To: abdera-dev@incubator.apache.org
Subject: Re: Entity/DTO serialization in entry.content

I've been thinking about this some more today. I'd really like to write 
some code like this:

Entry entry = ....;
entry.addElement(new JAXBElement(myJaxbPojo));

Then when the entry is serialized, it would call out to JAXB and marshal 
the "myJaxbPojo" object using an XMLStreamWriter. Anyone have any 
pointers as to how to actually achieve this?

Dan

 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.6/1317 - Release Date: 2008.03.07
08:15
 


RE: Entity/DTO serialization in entry.content

Posted by Remy Gendron <re...@arrova.ca>.
I totally dislike JAXB because of all this XML schema stuff. It is probably
the way to go however to cover all the use cases but, I will architect my
project to use convention in naming my domain object fields so that
reflection can be used to serialize the pojo into entry.content.

If you look at my XStream extensions, I actually serialize what is
accessible thru the interfaces implemented by the domain objects. And I only
deserialize writable 'javabean' properties.

But I do agree that Abdera should reward those who follow some sort of
Abdera conventions by automating as much of the work of mapping data between
the persistence store, Abdera and the HTTP client.

R.

-----Original Message-----
From: Dan Diephouse [mailto:dan.diephouse@mulesource.com] 
Sent: March 07, 2008 02:42
To: abdera-dev@incubator.apache.org
Subject: Re: Entity/DTO serialization in entry.content

I've been thinking about this some more today. I'd really like to write 
some code like this:

Entry entry = ....;
entry.addElement(new JAXBElement(myJaxbPojo));

Then when the entry is serialized, it would call out to JAXB and marshal 
the "myJaxbPojo" object using an XMLStreamWriter. Anyone have any 
pointers as to how to actually achieve this?

Dan

Dan Diephouse wrote:
> I've been meaning to write a JAXB plugin for this purpose, but time 
> hasn't quite allowed me. What I *really* want though is an XHTML 
> databinding framework... Frameworks fix everything! :-)
>
> http://netzooid.com/blog/2007/12/11/lazyweb-microformat-databinding/
>
> Dan
>
> Remy Gendron wrote:
>> After looking at this a bit more, XMLEncoder would be a better fit.
>>
>> R.
>>
>> -----Original Message-----
>> From: Remy Gendron [mailto:remy@arrova.ca] Sent: February 28, 2008 12:13
>> To: abdera-user@incubator.apache.org
>> Subject: Entity/DTO serialization in entry.content
>>
>> Hello all,
>>
>>  
>>
>> My entries are backed by simple entity pojos.
>>
>>  
>>
>> To prevent business rules from being implemented outside my service 
>> layer,
>> the service APIs use interfaces on these pojos. The interface make only
>> certain fields available to the caller, and some of those fields are 
>> only
>> readable (only a getter is available in the interface). So, no DTOs. 
>> Only my
>> entities wrapped by interfaces.
>>
>>  
>>
>> I was looking for a way to automate (when appropriate) the serialization
>> (both ways) of a backing entity in the entry.content atom field.
>>
>>  
>>
>> Any recommendations?
>>
>>  
>>
>> I was thinking of using something like XStream… Does Abdera provides
>> internal support for this, something working hand in hand with FOMEntry?
>>
>>  
>>
>> Thanks!
>>
>>  
>>
>> Remy
>>
>>
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 
>> 269.21.1/1302 - Release Date: 2008.02.27
>> 16:34
>>  
>>
>> No virus found in this incoming message.
>> Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 
>> 269.21.1/1302 - Release Date: 2008.02.27
>> 16:34
>>  
>>
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 
>> 269.21.1/1302 - Release Date: 2008.02.27
>> 16:34
>>  
>>
>>   
>
>


-- 
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com 

No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.6/1315 - Release Date: 2008.03.06
09:07
 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.6/1317 - Release Date: 2008.03.07
08:15