You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by James Carman <ja...@carmanconsulting.com> on 2006/02/20 16:06:34 UTC

Squeezer-based Property Persistence...

All,

I have been going crazy trying to figure out why my client-persisted page
properties aren't being "unsqueezed" by my custom squeezer.  Well, it's
because Tapestry doesn't use the "squeezer" to store client-persisted page
properties
(http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-dev/200507.mbox/%
3Cecd0e331050707114717b7263d@mail.gmail.com%3E).  Has anyone ever
implemented a SqueezerPropertyPersistenceStrategy?  What I'm trying to do is
merely write the id of an entity object out to the client and use that to
reconstruct the object when it comes back up (using Hibernate of course).

James



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: Squeezer-based Property Persistence...

Posted by James Carman <ja...@carmanconsulting.com>.
What I have written is a HibernateEntitySqueezer implementation that
basically just writes out the "entityName" and the "id" of the entity.  When
it comes back up, I use the Hibernate Session to restore the object.  This
way, I don't have a problem with detached objects.  It works pretty well.  I
actually implemented it in another way, but I was wondering if someone had
come up with an implementation that leans on the squeezer stuff.  I'm not
really concerned with writeFloat, writeUTF, etc.  The entityName/id doesn't
take up that much space and it's somewhat constant in size.  Thanks!

James

-----Original Message-----
From: Andreas Andreou [mailto:andyhot@di.uoa.gr] 
Sent: Monday, February 20, 2006 10:54 AM
To: Tapestry users
Subject: Re: Squeezer-based Property Persistence...

I was actually messing with this 2 days ago.
I created a custom impementation of
PersistentPropertyDataEncoder
that instead of using ObjectOutputStream.writeObject (in
writeChangesToStream )
checks the type of the object and outputs a prefix + accordingly uses
ObjectOutputStream.writeFloat, ObjectOutputStream.writeUTF,
ObjectOutputStream.writeLong e.t.c.
It also handles nulls by using a special prefix.
Anyway, by using this approach, i got the Base64 encoded string down to 1/3
of its size.
I was also thinking of injecting the DataSqueezer in my custom
PersistentPropertyDataEncoder
but the squeezer turns object to strings and this cannot take advantage
of the writeLong,
writeFloat e.t.c. methods of the ObjectOutputString.

Perhaps these 2 modules need a bit of refactoring in order for one to
make use of the other.


>All,
>
>I have been going crazy trying to figure out why my client-persisted page
>properties aren't being "unsqueezed" by my custom squeezer.  Well, it's
>because Tapestry doesn't use the "squeezer" to store client-persisted page
>properties
>(http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-dev/200507.mbox/
%
>3Cecd0e331050707114717b7263d@mail.gmail.com%3E).  Has anyone ever
>implemented a SqueezerPropertyPersistenceStrategy?  What I'm trying to do
is
>merely write the id of an entity object out to the client and use that to
>reconstruct the object when it comes back up (using Hibernate of course).
>
>James
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Squeezer-based Property Persistence...

Posted by Andreas Andreou <an...@di.uoa.gr>.
I was actually messing with this 2 days ago.
I created a custom impementation of
PersistentPropertyDataEncoder
that instead of using ObjectOutputStream.writeObject (in
writeChangesToStream )
checks the type of the object and outputs a prefix + accordingly uses
ObjectOutputStream.writeFloat, ObjectOutputStream.writeUTF,
ObjectOutputStream.writeLong e.t.c.
It also handles nulls by using a special prefix.
Anyway, by using this approach, i got the Base64 encoded string down to 1/3
of its size.
I was also thinking of injecting the DataSqueezer in my custom
PersistentPropertyDataEncoder
but the squeezer turns object to strings and this cannot take advantage
of the writeLong,
writeFloat e.t.c. methods of the ObjectOutputString.

Perhaps these 2 modules need a bit of refactoring in order for one to
make use of the other.


>All,
>
>I have been going crazy trying to figure out why my client-persisted page
>properties aren't being "unsqueezed" by my custom squeezer.  Well, it's
>because Tapestry doesn't use the "squeezer" to store client-persisted page
>properties
>(http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-dev/200507.mbox/%
>3Cecd0e331050707114717b7263d@mail.gmail.com%3E).  Has anyone ever
>implemented a SqueezerPropertyPersistenceStrategy?  What I'm trying to do is
>merely write the id of an entity object out to the client and use that to
>reconstruct the object when it comes back up (using Hibernate of course).
>
>James
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org