Re: hot deployment and multiple pointcuts
"Joseph Milora" <[email protected]> Thu, 8 May 2003 15:03:37 -0700
| Newsgroups | gmane.comp.java.aspectwerkz |
|---|---|
| Message-ID | <005301c315ad$ad426140$0f02a8c0@win2000mjknnai> |
Hi Jonas, Thanks for the quick reply, it cleared things up. The cvs repository seems to be working fine now. I think your new additions will fill in the few missing pieces for me. Thanks again, Joe Milora ----- Original Message ----- From: "Jonas Bonér" <[email protected]> To: "Joseph Milora" <[email protected]> Cc: <[email protected]> Sent: Thursday, May 08, 2003 2:12 PM Subject: Re: [aspectwerkz-developer] hot deployment and multiple pointcuts > Hi Joseph. > > This holds for the coming release (and the latest snapshot in the CVS). > > * I you add an advice dynamically using: > > AspectWerkz.createAdvice("myadvice", "test.Advice", "perInstance", null); > > * Then you can add it to a Pointcut using: > > // get all the aspects for a certain class pattern > List aspects = AspectWerkz.getAspects("test.*"); > > // get the aspect we want (call it aspect) > ... > > // add the advice to the pointcut we want (need to use the same pattern > as specified before) > aspect.getMethodPointcut("* to*(..)").addAdvice("myadvice"); > > * You can also retrieve a list of all the Pointcuts for a specific > method or field using the MethodMetaData (or FieldMetaData) as a > parameter. And then add the advice to the Pointcut you want. > Like this: > > // get the pointcuts for a specific method > MethodPointcut[] pointcuts = AspectWerkz.getAspect("test.*"). > getMethodPointcut(MethodMetaData metaData); > > // get the poincut we want (call it pointcut) > ... > > // add the advice to the pointcut > pointcut.addAdvice("myadvice"); > > > Hope it clears out a few things. > > Sincerely, Jonas. > > Ps. What is the problem with accessing the CVS? Ds. > > > Joseph Milora wrote: > > Hi, > > > > I have a question about the hot deployment. > > If I want to dynamically add an advice to an aspect, do I have to > > specify every pointcut? > > For example, with the logging example, if I specify a pointcut pattern > > of to.*, every toLog(n) > > call will be intercepted. If I try to add an advice dynamically, I'd > > like to be able to specify the same > > pattern, without having to manually add each method explicitly. > > Also, the ability to add new advices dynamically looks great, but I'm > > having a problem accessing the > > cvs repository to get the latest build. > > > > BTW great tool! > > Thanks in advance, > > Joe Milora > > > -- > Jonas > http://freeroller.net/page/jboner > > > ------------------------------------------------------- Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara The only event dedicated to issues related to Linux enterprise solutions www.enterpriselinuxforum.com