[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] how to capture method joinpoints in EJB3 session bean interface?

Well if you can't hardcode the interface name then the you can intercept all method executions and then the JoinPoint.StaticPart state to determine at runtime if you are interested in it.

before(): execution(* *(..)) {

that may match a lot of places though.  If you can exploit the existence of annotations, that may help, something like this to indicate the declaring type must have the @Remote annotation.

before(): execution(* (@Remote *).*(..)) {


2009/7/28 ppkluk <imperfectluk-ppk@xxxxxxxxxxxx>

Hi all,

 i am new to aspectj and i am trying to write aspect to capture the method
of all a session bean (EJB 3.0 syntax).

 the methods i want to captures are the 'business method' in the session
As EJB 3.0 session bean can be created in the following form:

//interface defining the session bean method
public interface SessionBeanInterface {
  public void advicedMethod();

@Remote(SessionBeanInterface.class) //indicate SesionBeanInterface is the
remote bussinesss interface
public class SessionBean implements SessionBeanInterface {

  public void advicedMethod(){
       //this method to be captured by before execution(...) pointcut


  public void nonAdvicedMethod() {
   //this method is NOT to be captured

in this situation, is this possible to write pointcut to capture only the
methods declared
in the SessionBeanInterface interface??

*** i CANNOT HARDCODE the interface type in the aspect as i am now writing a
*** generic tool aims to capture all the method execution.

thank you.

View this message in context: http://www.nabble.com/how-to-capture-method-joinpoints-in-EJB3-session-bean-interface--tp24703854p24703854.html
Sent from the AspectJ - users mailing list archive at Nabble.com.

aspectj-users mailing list