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

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 


Back to the top