/** @Around("localEjbCommandExecution") */ public Object commandExecution(final JoinPoint jp) throws Throwable { final MethodRtti rtti = (MethodRtti) jp.getRtti(); Method m = (Method) threadLocal.get(); if (m != null && m.equals(rtti.getMethod())) { Object value = jp.proceed(); threadLocal.set(null); return value; } final CommandResolver obj = (CommandResolver) jp.getTarget(); final Class[] classes = rtti.getParameterTypes(); final String[] classNames = new String[classes.length]; final String methodName = rtti.getMethod().getName(); final Object[] parameterValues = rtti.getParameterValues(); for (int i = 0; i < classes.length; i++) { classNames[i] = classes[i].getName(); } CommandExecutorLocal commandExecutorLocal = null; try { commandExecutorLocal = getCommandExecutor(); threadLocal.set(rtti.getMethod()); if (obj.isTransactional(rtti.getMethod())) { return commandExecutorLocal.executeTransaction( obj, methodName, classNames, parameterValues); } else if (obj.isRemotable(rtti.getMethod())) { return commandExecutorLocal.executeQuery(obj, methodName, classNames, parameterValues); } else { return jp.proceed(); } } catch (final InvocationTargetException ite) { throw ite.getTargetException(); } finally { threadLocal.set(null); } }
/** @Around execution(* test.abstractclass.AbstractTarget+.*(..)) */ public Object adviceOnAbstractMethod(final JoinPoint joinPoint) throws Throwable { s_log += joinPoint.getSignature().getName() + "XX"; // method name + XX return joinPoint.proceed(); }
/** @Around pc8 || pc7 */ public Object around(final JoinPoint joinPoint) throws Throwable { CallerSideAdviceTest.log("before "); Object result = joinPoint.proceed(); CallerSideAdviceTest.log("after "); return result; }
/** @Around pc */ public Object advice(final JoinPoint joinPoint) throws Throwable { s_log += joinPoint.getSignature().getName(); // method name return joinPoint.proceed(); }
/** * FIXME: this expression leads to match all at cflow early filtering. * * <p>X@Around execution(* test.CFlowTest.step2_C()) AND !cflow(call(* test.CFlowTest.step1_C()) * AND within(test.CFlowTest)) */ public Object executeC(final JoinPoint joinPoint) throws Throwable { ((Loggable) joinPoint.getTarget()).log("advice-beforeC "); final Object result = joinPoint.proceed(); ((Loggable) joinPoint.getTarget()).log("advice-afterC "); return result; }