]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionAspect.java
Runtime improvements
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.simple / src / main / java / org / argeo / slc / core / execution / ExecutionAspect.java
index c2abfed27005ebde3fbc4c37918005aa05f36287..29942817d4e2343808d6a010a491def5e47bc829 100644 (file)
@@ -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<Boolean> inModuleExecution = new ThreadLocal<Boolean>() {
+               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() {
+       }
+
 }