X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=runtime%2Forg.argeo.slc.support.simple%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2FExecutionAspect.java;h=29942817d4e2343808d6a010a491def5e47bc829;hb=53146ebdda3a7c0c217c44d395d270a7e9d045be;hp=c2abfed27005ebde3fbc4c37918005aa05f36287;hpb=56f9a29fc3d208bb1a0e9476b9d67dc372098e70;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionAspect.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionAspect.java index c2abfed27..29942817d 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionAspect.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionAspect.java @@ -1,23 +1,23 @@ package org.argeo.slc.core.execution; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.argeo.slc.execution.ExecutionContext; import org.argeo.slc.execution.ExecutionFlow; import org.aspectj.lang.JoinPoint; -import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.After; -import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; @Aspect public class ExecutionAspect { - private static Log log = LogFactory.getLog(ExecutionAspect.class); + static ThreadLocal inModuleExecution = new ThreadLocal() { + protected Boolean initialValue() { + return false; + } + }; private ExecutionContext executionContext; - + public ExecutionContext getExecutionContext() { return executionContext; } @@ -28,24 +28,32 @@ public class ExecutionAspect { @Before("flowExecution()") public void beforeFlow(JoinPoint jp) throws Throwable { - //log.debug("this " + jp.getThis().getClass()); - //log.debug("target " + jp.getTarget().getClass()); - // Thread.dumpStack(); ExecutionFlow executionFlow = (ExecutionFlow) jp.getTarget(); executionContext.enterFlow(executionFlow); } @After("flowExecution()") public void afterFlow(JoinPoint jp) throws Throwable { - //log.debug("this " + jp.getThis().getClass()); - //log.debug("target " + jp.getTarget().getClass()); ExecutionFlow executionFlow = (ExecutionFlow) jp.getTarget(); executionContext.leaveFlow(executionFlow); } + @Before("moduleExecution()") + public void beforeModuleExecution(JoinPoint jp) throws Throwable { + inModuleExecution.set(true); + } + + @After("moduleExecution()") + public void afterModuleExecution(JoinPoint jp) throws Throwable { + inModuleExecution.set(false); + } + @Pointcut("execution(void org.argeo.slc.execution.ExecutionFlow.run())") public void flowExecution() { } - - + + @Pointcut("execution(void org.argeo.slc.execution.ExecutionModule.execute(..))") + public void moduleExecution() { + } + }