Thanks! Couple more questions ...
1) Where do I get 3.0? Nightly snapshot? Is any one more stable than
any other? Any installation instructions? Or things to watch out for?
2) Is the "handleCallback" argument actually the name of the method to
call as the callback, aka "myPostPersist"?
3) Where is the proper place to set up the callbacks? In a custom data
context factory (assuming you always want the callbacks)? This is for a
web app using thread data contexts.
4) Where do I get the domain object?
Thanks again!
Jeff
Andrus Adamchik wrote:
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 <[EMAIL PROTECTED]> 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