cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: How to use TransactionDelegate to do audit logging?
Date Tue, 03 Oct 2006 02:48:20 GMT

Yeah, need to write the docs. Here is a short example:

DataDomain domain;
int callbackType; // types are defined in  
'org.apache.cayenne.map.LifecycleEventCallback' interface

domain.getEntityResolver().getCallbacks(callbackType).addListener(
				MyClass.class, listener, "handleCallback");

or

domain.getEntityResolver().getCallbacks(callbackType).addListener(
				MyClass.class, "handleCallback");

Andrus




On Oct 2, 2006, at 10:31 PM, Jeff de Vries wrote:

> Yes, that looks very much like what I need.  One problem:  The  
> section labeled "Enabling Callbacks" says "TODO"!
>
> How do you set them up?
>
> Thanks,
> Jeff
>
> Aristedes Maniatis wrote:
>> On 9/30/06, Jeff de Vries <jdevries@pfrog.com> wrote:
>>
>>>> What I'm *really* trying to do is that we have about 15-20  
>>>> different
>>>> types of alerts, and a bunch of rules that specify some additional
>>>> processing that needs to take place when certain types of alerts  
>>>> are
>>>> generated.  Rather than scatter the rules around the umpteen  
>>>> different
>>>> places alerts are created, I thought I'd be "clever" and put all  
>>>> the
>>>> rule processing stuff in one place, looking at the alerts as  
>>>> they get
>>>> written out.  So, as a complete workaround, I could just go add the
>>>> rules to the umpteen different places the alerts are getting  
>>>> generated.
>>>> Or, if there was a convenient place to hook some "aspect-oriented"
>>>> programming stuff (which is what I guess I'm doing), like a
>>>> Alert.onSave(), that would work too.
>>
>> Actually support to do exactly this is now built into Cayenne 3.0  
>> and we are using it in production. It was added only in the last  
>> fortnight, but is working really well.
>>
>> http://cwiki.apache.org/CAYDOC/lifecycle-callbacks.html
>>
>> I think it will do exactly what you need.
>>
>>
>> As for auditing, I wonder whether this callback work now makes the  
>> auditing approach redundant? It appears that the callbacks are a  
>> more general implementation of what Mike has done and might be  
>> able to be used for his auditing requirements.
>>
>> Ari Maniatis
>>
>>
>>
>> -------------------------->
>> ish
>> http://www.ish.com.au
>> Level 1, 30 Wilson Street Newtown 2042 Australia
>> phone +61 2 9550 5001   fax +61 2 9550 4001
>> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
>>
>>
>


Mime
View raw message