private static void registerCFlowPointcuts(final String uuid,
final AspectWerkzDefinitionImpl definition) {
// get all aspects definitions
for (Iterator it1 = definition.getAspectDefinitions().iterator(); it1.hasNext();) {
AspectDefinition aspectDefinition = (AspectDefinition)it1.next();
AspectMetaData aspect = SystemLoader.getSystem(uuid).
getAspectMetaData(aspectDefinition.getName());
// get all bind-advice rules defined in this aspect
List bindAdviceRules = aspectDefinition.getBindAdviceRules();
for (Iterator it2 = bindAdviceRules.iterator(); it2.hasNext();) {
BindAdviceRule bindAdviceRule = (BindAdviceRule)it2.next();
Expression expression = bindAdviceRule.getExpression();
for (Iterator it3 = expression.getCflowExpressions().entrySet().iterator(); it3.hasNext();) {
Map.Entry entry = (Map.Entry) it3.next();
Expression value = (Expression) entry.getValue();
if (value instanceof ExpressionExpression) {
// recursive
//TODO exprexpr using exprexpr
// like pc cflow = "a or b"
// .. pc exec = "c IN cflow"
(new Exception("todo")).printStackTrace();
} else {
// get the referenced cflow poincut definition
PointcutDefinition cflowPointcutDef =
aspectDefinition.getPointcutDef(value.getName());
// create call pointcut
CallPointcut pointcut = new CallPointcut(uuid, value);
// register the cflow advices in the system (if they does not already exist)
//TODO: [alex] clean this - works as well when commented.
if (!SystemLoader.getSystem(uuid).hasAspect(CFlowPreAdvice.NAME)) {
AdviceDefinition adviceDef = CFlowPreAdvice.getDefinition();
// add the advice to the aspectwerkz definition
definition.addAdvice(adviceDef);
// add the advice to the aspectwerkz system
registerAdvice(uuid, adviceDef);
}
if (!SystemLoader.getSystem(uuid).hasAspect(CFlowPostAdvice.NAME)) {
AdviceDefinition adviceDef = CFlowPostAdvice.getDefinition();
// add the advice to the aspectwerkz definition
definition.addAdvice(adviceDef);
// add the advice to the aspectwerkz system
registerAdvice(uuid, adviceDef);
}
// add the pointcut definition to the method pointcut
pointcut.addPointcutDef(cflowPointcutDef);
// add references to the cflow advices to the cflow pointcut
pointcut.addBeforeAdvice(CFlowPreAdvice.NAME);
pointcut.addAfterAdvice(CFlowPostAdvice.NAME);
// add the method pointcut
aspect.addCallPointcut(pointcut);
//TODO USELESS - does not support NOT IN
// impl a visitor
aspect.addMethodToCflowExpressionMap(expression, value);
}
}
// //expression.
// Expression cflowExpression = bindAdviceRule.getCflowExpression();
// if ( cflowExpression == null ) {