Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Need help with point cuts for subclasses

I've two different eclipse projects. ISTSFXmlTxn is
from one project and the second project uses the
istsf.jar file.

This is how ISTSFXmlTxn looks:

public class ISTSFXmlTxn extends TxnProcessor
implements ISTSFConstants, XmlConstants{
	protected int error = 0;	
	protected int queryExecutionTime = 0;
	protected String txnName = "";
	
	public void process(TransactionRequest request,
TransactionResponse response, Session session) throws
IOException {		
	}

}


In the second project, there is a class EspressoXmlTxn
and it extends ISTSFXmlTxn.


>From the eclipse, i can see the point cut enabled (the
arrow symbol) for ISTSFXmlTxn's process method. But i
don't see anything for the ESpressoXmlTxn class which
is in another eclipse project. This is how
EspressoXmlTxn looks:

public class EspressoXmlTxn extends ISTSFXmlTxn {
	....
	public void process(TransactionRequest request,
TransactionResponse response, Session session) throws
IOException {
		
}

}


I do have '+' symbol now. I'm not sure why the point
cut is enabled for the EspressoXmlTxn.process method.


Originally, ISTSFXmlTxn class was an abstract class
and process method was also abstract. In that case i
didn't see any point cut enabled graphically (with the
arrow symbol in the IDE). 


Could some one please tell me what is that i am
missing?

Thanks,
Manjula



--- Manjula Jayaraman <manjuv123@xxxxxxxxx> wrote:

> Thanks Matthew. I added the '+' in the point cut.
> But
> it still doesn't work. Should i also include '+'
> symbol in the before/after methods as below:
> 
> before() : staticinitialization(ISTSFXmlTxn+) &&
> !excluded() {
> 		System.out.println("In## static init...");
> 	
>
ISTSFBamLog.initLogger(ISTLogger.getLogger(thisJoinPointStaticPart.getSignature().getDeclaringTypeName()));
> 	}
> 
> 	before(ISTSFXmlTxn+ txn) : sendBamLog(txn) {
> 		Timer.start();	
> 	}
> 
> 	after(ISTSFXmlTxn+ txn) : sendBamLog(txn) {
> 		System.out.println("publishing ##to BAM...: : " +
> txn.getTxnName());
> 		Timer.stop();	
> 		ISTSFBamLog.log(txn.getTxnName(),
> txn.getQueryExecutionTime(), Timer.getTime(), 1,
> txn.getError() == 0 ? ISTLogger.BAM_STATUS_SUCCESS :
> ISTLogger.BAM_STATUS_FAILURE);
> 	}
> 
> Thanks,
> Manjula
> 
> --- Matthew Webster <matthew_webster@xxxxxxxxxx>
> wrote:
> 
> > Manjula,
> > 
> > I think you need this (note the "+" symbol) which
> > means "ISTSFXmlTxn and 
> > all subclasses":
> > 
> > pointcut excluded() :
> > within(com.apple.ist.istsf.aspects..*);
> > 
> > pointcut sendBamLog(ISTSFXmlTxn txn) : target(txn)
> 
> > &&
> > execution(*
> > com.apple.ist.istsf.util.ISTSFXmlTxn+.process(..))
> > &&
> > !excluded();
> > 
> > Matthew Webster
> > AOSD Project
> > Java Technology Centre, MP146
> > IBM Hursley Park, Winchester,  SO21 2JN, England
> > Telephone: +44 196 2816139 (external) 246139
> > (internal) 
> > Email: Matthew Webster/UK/IBM @ IBMGB,
> > matthew_webster@xxxxxxxxxx
> > http://w3.hursley.ibm.com/~websterm/
> > Please respond to aspectj-users@xxxxxxxxxxx 
> > Sent by:        aspectj-users-bounces@xxxxxxxxxxx
> > To:     aspectj-users@xxxxxxxxxxx
> > cc:      
> > Subject:        [aspectj-users] Need help with
> point
> > cuts for subclasses
> > 
> > 
> > Hi All,
> > 
> > We've a simple aspect for publishing data to BAM
> and
> > it was all working fine. Originally, the point cut
> > was
> > as below:
> > 
> > pointcut excluded() :
> > within(com.ist.espresso.aspects..*);
> > 
> > pointcut sendBamLog(EspressoXmlTxn txn) :
> > target(txn) 
> > && execution(*
> >
>
com.ist.ruby.services.espresso.EspressoXmlTxn.process(..))
> > && !excluded();
> > 
> > 
> > As part of making this code generic, we introduce
> a
> > class called ISTSFXml. This ISTSFXml class is an
> > abstract class which has an abstract method
> > process.We've re-written the aspect as below. 
> > 
> > pointcut excluded() :
> > within(com.apple.ist.istsf.aspects..*);
> > 
> > pointcut sendBamLog(ISTSFXmlTxn txn) : target(txn)
> 
> > &&
> > execution(*
> > com.apple.ist.istsf.util.ISTSFXmlTxn.process(..))
> &&
> > !excluded();
> > 
> > 
> > The idea is that any class that extends
> ISTSFXmlTxn
> > will implement the process method and the point
> cut
> > should be invoked for those subclasses. But i
> don't
> > see the pointcut getting called.
> > 
> > 
> > Could someone please let me know what's the
> mistake
> > i'm doing here?
> > 
> > Thanks for anyinput in advance,
> > Manjula
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> > protection around 
> > http://mail.yahoo.com 
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> >
>
https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > 
> > > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> >
>
https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
>
https://dev.eclipse.org/mailman/listinfo/aspectj-users
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Back to the top