You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Tore Halset <ha...@pvv.ntnu.no> on 2007/03/10 00:13:24 UTC

lifecycle callbacks and ROP

Hello.

I am a lifecycle callbacks newbie trying to understand http:// 
cwiki.apache.org/CAYDOC/lifecycle-callbacks.html in a ROP context.

Can the callback methods be defined in the client PersistentObject or  
only in the server CayenneDataObject?

Can a ROP client perform non-lifecycle callbacks on the server? If  
not, are there any other standard way for a ROP client to call a  
method on the server not related to the persistence lifecycle? Or  
perhaps it is possible to have custom event types not related to the  
lifecycle?

  - Tore. 

Re: lifecycle callbacks and ROP

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Mar 10, 2007, at 2:15 AM, Aristedes Maniatis wrote:

>
> On 10/03/2007, at 10:13 AM, Tore Halset wrote:
>
>> Hello.
>>
>> I am a lifecycle callbacks newbie trying to understand http:// 
>> cwiki.apache.org/CAYDOC/lifecycle-callbacks.html in a ROP context.
>>
>> Can the callback methods be defined in the client PersistentObject  
>> or only in the server CayenneDataObject?
>
> I believe that they will only operate on the server side. At least  
> that's how we've been able to use them.

True. Let's put it this way - no decision has been made on the client  
callbacks yet.


>> Can a ROP client perform non-lifecycle callbacks on the server? If  
>> not, are there any other standard way for a ROP client to call a  
>> method on the server not related to the persistence lifecycle?
>
> We use Jetty as the transport for Hessian between client/server  
> ROP. So we can define special servlet calls as we need in order to  
> perform code on the server or return values. For instance, when a  
> client logs into the server we wanted the server to maintain a list  
> of client sessions. So, because we aren't committing an object  
> through Cayenne to the server we couldn't use a lifecycle event and  
> we wrote a special servlet call which is used instead.

IIRC, Tore mentioned this before, that it would be nice to define  
some arbitrary RPC-like calls to the server-side peer objects, kind  
of like EOF does. So that you can do clientObject.doX() and it will  
proxy the call to the serverObject.doX(). I'd say this can be a new  
feature in 3.0, and it would be nice if somebody volunteers to do it.

Andrus

Re: lifecycle callbacks and ROP

Posted by Aristedes Maniatis <ar...@maniatis.org>.
On 10/03/2007, at 10:13 AM, Tore Halset wrote:

> Hello.
>
> I am a lifecycle callbacks newbie trying to understand http:// 
> cwiki.apache.org/CAYDOC/lifecycle-callbacks.html in a ROP context.
>
> Can the callback methods be defined in the client PersistentObject  
> or only in the server CayenneDataObject?

I believe that they will only operate on the server side. At least  
that's how we've been able to use them.

> Can a ROP client perform non-lifecycle callbacks on the server? If  
> not, are there any other standard way for a ROP client to call a  
> method on the server not related to the persistence lifecycle?

We use Jetty as the transport for Hessian between client/server ROP.  
So we can define special servlet calls as we need in order to perform  
code on the server or return values. For instance, when a client logs  
into the server we wanted the server to maintain a list of client  
sessions. So, because we aren't committing an object through Cayenne  
to the server we couldn't use a lifecycle event and we wrote a  
special servlet call which is used instead.

> Or perhaps it is possible to have custom event types not related to  
> the lifecycle?

I think the lifecycle calls are intrinsically tied into the concept  
of committing one or more objects.

We are looking into writing a more advanced messaging scheme between  
the client and server (and through the server to other clients) -  
this is something we hope to work on soon. We want this to create  
distributed cache invalidation systems and for other reasons (for  
example, the server admin might want to log out all users gracefully  
in order to shut down the system). I think the implementation will be  
connectionless (in the sense that it will not wait for a return  
value). Is this the sort of thing you are after?

Cheers
Ari Maniatis



-------------------------->
Aristedes Maniatis
phone +61 2 9660 9700
PGP fingerprint 08 57 20 4B 80 69 59 E2  A9 BF 2D 48 C2 20 0C C8