[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Is it possible to dynamically exclude joinpoints at runtime?
|
Chad,
You can use if() pointcut that checks for information obtained from
thisJoinPointStaticPart to implement such functionality. Please
refer to online documentaion for JoinPoint.StaticPart's API
(thisJoinPointStaticPart's type).
-Ramnivas
--- Chad Woolley <lists@xxxxxxxxxxxxxxxxx> wrote:
> Hello,
>
> I would like to be able to dynamically define an "exclude" joinpoit
> on my advice
> at runtime. For example, say I have:
>
> pointcut myPointcut(): execution(* *.*(..));
>
> Object around() : myPointcut() ...
>
>
>
> At runtime, I would like to be able to dynamically define another
> joinpoint
> which will be added as an "excluded" joinpoint on the advice, in
> order to
> exclude some package from the advice. The definition would be
> equivalent to this:
>
> pointcut myPointcut(): execution(* *.*(..)) &&
> !execution(* some.package..*(..));
>
> Object around() : myPointcut() ...
>
>
> Is this at all possible with AspectJ? My only idea would be to have
> some sort
> of independent pre-processing step which would read the exclusions
> (perhaps from
> a property file), and then build and write the aspect source out to
> disk,
> recompile and reweave the app. Then the app could be re-started with
> the new
> dynamically defined aspect and the correct exclusions on the
> pointcut. This
> definitely wouldn't be at runtime, but it's the only solution I can
> think of.
> Can anyone think of a more elegant solution?
>
> By the way, you may be wondering why I don't just write the aspect
> with the
> correct joinpoint definition in the first place. The reason is that
> this is
> part of a framework, and I want a simple API (a method call or
> property file)
> for users to define classes to exclude from weaving. I don't want
> the users to
> have to know AspectJ.
>
> Thanks,
> Chad
>
>
>
>
>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com