Skip to main content



      Home
Home » Language IDEs » AspectJ » how to capture method joinpoints in EJB 3 session bean?
how to capture method joinpoints in EJB 3 session bean? [message #351436] Tue, 28 July 2009 05:46 Go to next message
Eclipse UserFriend
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
bean.
As EJB 3.0 session bean can be created in the following form:

------------------------------------------------------------ --
public interface SessionBeanInterface {
public void advicedMethod();
}
------------------------------------------------------------ --

@Stateless(name="SessionBean")
@Remote(SessionBeanInterface.class)
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
}
}
------------------------------------------------------------ -------

could anybody tell me the pointcut to capture ONLY the
method in the SessionBeanInterface interface??

*** i CANNOT HARDCODE the interface in the aspect as i am now writing a
*** generic tool to capture all the session bean interface method

thank you.

ppk
Re: how to capture method joinpoints in EJB 3 session bean? [message #371211 is a reply to message #351436] Wed, 29 July 2009 00:55 Go to previous message
Eclipse UserFriend
Originally posted by: andrew.eisenberg.springsource.com

One thing that you can do is create an abstract aspect that defines the
advice and an abstract pointcut. People who want to use your aspect need to
create a concrete aspect and instantiate the pointcut.

Eg-

abstract aspect AbstractSessionBeanAspect {
protected abstract pointcut sessionBeanMethods();

before() : sessionBeanMethods() {
// do something

}
}


aspect MySessionBeanAspect extends AbstractSessionBeanAspect {
protected pointcut sessionBeanMethods() : execution(
SessionBeanInterface.*(..));
}

On 28/07/09 2:46 AM, in article
ecf71309e5f50e59fcb367e208c87a5e$1@www.eclipse.org, "ppk"
<imperfectluk-ppk@yahoo.com.hk> wrote:

> 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
> bean.
> As EJB 3.0 session bean can be created in the following form:
>
> ------------------------------------------------------------ --
> public interface SessionBeanInterface {
> public void advicedMethod();
> }
> ------------------------------------------------------------ --
>
> @Stateless(name="SessionBean")
> @Remote(SessionBeanInterface.class)
> 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
> }
> }
> ------------------------------------------------------------ -------
>
> could anybody tell me the pointcut to capture ONLY the
> method in the SessionBeanInterface interface??
>
> *** i CANNOT HARDCODE the interface in the aspect as i am now writing a
> *** generic tool to capture all the session bean interface method
>
> thank you.
>
> ppk
>
>
Re: how to capture method joinpoints in EJB 3 session bean? [message #600409 is a reply to message #351436] Wed, 29 July 2009 00:55 Go to previous message
Eclipse UserFriend
One thing that you can do is create an abstract aspect that defines the
advice and an abstract pointcut. People who want to use your aspect need to
create a concrete aspect and instantiate the pointcut.

Eg-

abstract aspect AbstractSessionBeanAspect {
protected abstract pointcut sessionBeanMethods();

before() : sessionBeanMethods() {
// do something

}
}


aspect MySessionBeanAspect extends AbstractSessionBeanAspect {
protected pointcut sessionBeanMethods() : execution(
SessionBeanInterface.*(..));
}

On 28/07/09 2:46 AM, in article
ecf71309e5f50e59fcb367e208c87a5e$1@www.eclipse.org, "ppk"
<imperfectluk-ppk@yahoo.com.hk> wrote:

> 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
> bean.
> As EJB 3.0 session bean can be created in the following form:
>
> ------------------------------------------------------------ --
> public interface SessionBeanInterface {
> public void advicedMethod();
> }
> ------------------------------------------------------------ --
>
> @Stateless(name="SessionBean")
> @Remote(SessionBeanInterface.class)
> 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
> }
> }
> ------------------------------------------------------------ -------
>
> could anybody tell me the pointcut to capture ONLY the
> method in the SessionBeanInterface interface??
>
> *** i CANNOT HARDCODE the interface in the aspect as i am now writing a
> *** generic tool to capture all the session bean interface method
>
> thank you.
>
> ppk
>
>
Previous Topic:how to capture method joinpoints in EJB 3 session bean?
Next Topic:development branch of AJDT
Goto Forum:
  


Current Time: Wed Jul 23 14:42:12 EDT 2025

Powered by FUDForum. Page generated in 0.03118 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top