[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] pointcuts from a properties file
|
wrt this...
> I can't really find the javadoc that says whether
> "execution"
> (or "call" or any of the other methods) takes a String or not.
These are pointcuts, not methods, and can be considered to
exist only at compile/weave-time. The documentation is in the
AspectJ programmers guide.
Matt's right about abstract aspects. I suspect you want to say
"public method execution in any type below package
com.alloyinc.quiz.admin". You could create a library aspect
abstract aspect DoingThing {
abstract pointcut withinTypes();
pointcut publicMethodsWithinTypes() : withinTypes()
&& execution(public * *(..));
before() : publicMethodsWithinTypes() { ... }
// more advice
}
then use it like this
aspect DoingMyThing extends DoingThing {
pointcut withinTypes() : within(com.alloyinc.quiz.admin..*);
}
I believe Adrian, et al are working on a way to allow you to
configure a subaspect pointcut like this with config tools.
(Still more cool things coming out of those guys!)
Wes
> ------------Original Message------------
> From: "Charles N. Harvey III" <charlieh@xxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Tue, Jan-25-2005 2:51 PM
> Subject: [aspectj-users] pointcuts from a properties file
>
> Hello.
> I would like to write an aspect and put it in a jar file and have it
> be re-used a lot. But, the classes that it will weave will change
> in each project. So the pointcut statement has to change each time.
>
> Consider this example:
> ----------------------------------------------------------------------------
> /**
> * pointcut defining which Action classes to weave into.
> */
> public pointcut adminAuth( ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request,
> HttpServletResponse response )
> : ( execution( public * com.alloyinc.quiz.admin.*.*.execute(..)
> ) ||
> execution( public * com.alloyinc.poll.admin.*.*.execute(..)
> ) )
> && args( mapping, form, request, response );
>
> /**
> * Advice for <code>adminAuth</code> pointcut.
> */
> ActionForward around( ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request,
> HttpServletResponse response )
> : adminAuth( mapping, form, request, response )
> {
> // some stuff that checks for login
> }
> ----------------------------------------------------------------------------
>
> I want to be able to switch the following with text from a properties
> file:
> : ( execution( public * com.alloyinc.quiz.admin.*.*.execute(..)
> ) ||
> execution( public * com.alloyinc.poll.admin.*.*.execute(..)
> ) )
>
> Can I do that? I can't really find the javadoc that says whether
> "execution"
> (or "call" or any of the other methods) takes a String or not. If it
> does,
> I would think that I could replace it with a property. If not, well,
> then
> I guess not.
>
> Thanks in advance if anyone knows the answer to this.
>
>
> Charlie
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>