Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[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




Back to the top