Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] advanced(?) percflow uses

:: Could you say a bit more about your example? Maybe some code 
:: that suggests enough about it that it would be clear it 
:: would really be useful? 

the general scenario: there are some methods doing complex computation
in a subsystem, call it S. during this computation some Condition's
happen that should be handled by the caller. if there was a
Throwable.continue(Object returnValue) as there is in lisp, or slate, i
would be fine. but there isn't, so i simplified the scenario:

in the complex methods gather warnings (into a percflow() aspect) and on
the the call site (ui) grab the warnings and display them.

aspect WarningCollector percflow(pc())
{
	pointcut pc(): call(* S.*(..));
}

someUIMethod()
{
	S.complexMethod();	// the aspect is alive only under this
call
	
	WarningCollector.aspectOf().getWarnings();	// the aspect is
not alive here anymore
}


S.complexMethod()
{
...
	if (WarningCollector.hasAspect())
	{
		WarningCollector.aspectOf().addWarning("foo");
	}
...
}


with your proposed enclosingexecution() i can define the percflow()
expression in terms of the few well defined methods of S. without it i
need to use call() and list all the call sites from where the methods of
S are called.

aspect WarningCollector percflow(pc())
{
	pointcut pc(): enclosingexecution(call(* S.*(..)));
}

hope it's clear, and maybe we'll have another joinpoint... :) would be
helpful in this scenario.

thanks,

- 101


:: > -----Original Message-----
:: > From: aspectj-users-admin@xxxxxxxxxxx
:: > [mailto:aspectj-users-admin@xxxxxxxxxxx] On Behalf Of 
:: Lendvai Attila
:: > Sent: Thursday, February 26, 2004 8:52 AM
:: > To: aspectj-users@xxxxxxxxxxx
:: > Subject: [aspectj-users] advanced(?) percflow uses
:: > 
:: > 
:: > 
:: > hi,
:: > 
:: > is there a way to define a percflow aspect so that it 
:: lives one level 
:: > above the percflow expression? what i would like to do is 
:: to define a 
:: > percflow aspect that is alive in the entire method from 
:: where a given 
:: > set of other methods are called.
:: > 
:: > and on an even higher level: i would like to write a 
:: WarningCollector 
:: > aspect that my session bean methods can fill up, and the 
:: ui methods 
:: > can query for warnings.
:: > 
:: > aspect WarningCollector percflow(sessionBeanMethods())
:: > {
:: > }
:: > 
:: > void someUIMethod()
:: > {
:: > 
:: >   someService.someEJBMethod();
:: > 
:: >   WarningCollector.aspectOf().getWarnings();
:: > 
:: >   // unfortunately on this level the aspect is not alive anymore }
:: > 
:: > the only solution i know of is to list not the ejb methods in the
:: > percflow() definition, but rather the methods that call any
:: > ejb method.
:: > but this is not a nice way to do, error-prone, etc.
:: > 
:: > any ideas?
:: > 
:: > thanks in advance,
:: > 
:: > - 101
:: > 
:: > _______________________________________________
:: > aspectj-users mailing list
:: > aspectj-users@xxxxxxxxxxx 
:: > http://dev.eclipse.org/mailman/listinfo/aspectj-users
:: > 
:: 
:: 
:: _______________________________________________
:: aspectj-users mailing list
:: aspectj-users@xxxxxxxxxxx 
:: http://dev.eclipse.org/mailman/listinfo/aspectj-users
:: 
:: 


Back to the top