]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionAspect.java
Rename OverrideContextAware task
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.simple / src / main / java / org / argeo / slc / core / execution / ExecutionAspect.java
1 package org.argeo.slc.core.execution;
2
3 import org.apache.commons.logging.Log;
4 import org.apache.commons.logging.LogFactory;
5 import org.argeo.slc.execution.ExecutionContext;
6 import org.argeo.slc.execution.ExecutionFlow;
7 import org.aspectj.lang.JoinPoint;
8 import org.aspectj.lang.ProceedingJoinPoint;
9 import org.aspectj.lang.annotation.After;
10 import org.aspectj.lang.annotation.Around;
11 import org.aspectj.lang.annotation.Aspect;
12 import org.aspectj.lang.annotation.Before;
13 import org.aspectj.lang.annotation.Pointcut;
14
15 @Aspect
16 public class ExecutionAspect {
17 private static Log log = LogFactory.getLog(ExecutionAspect.class);
18
19 private ExecutionContext executionContext;
20
21 public ExecutionContext getExecutionContext() {
22 return executionContext;
23 }
24
25 public void setExecutionContext(ExecutionContext executionContext) {
26 this.executionContext = executionContext;
27 }
28
29 @Before("flowExecution()")
30 public void beforeFlow(JoinPoint jp) throws Throwable {
31 //log.debug("this " + jp.getThis().getClass());
32 //log.debug("target " + jp.getTarget().getClass());
33 // Thread.dumpStack();
34 ExecutionFlow executionFlow = (ExecutionFlow) jp.getTarget();
35 executionContext.enterFlow(executionFlow);
36 }
37
38 @After("flowExecution()")
39 public void afterFlow(JoinPoint jp) throws Throwable {
40 //log.debug("this " + jp.getThis().getClass());
41 //log.debug("target " + jp.getTarget().getClass());
42 ExecutionFlow executionFlow = (ExecutionFlow) jp.getTarget();
43 executionContext.leaveFlow(executionFlow);
44 }
45
46 @Pointcut("execution(void org.argeo.slc.execution.ExecutionFlow.execute())")
47 public void flowExecution() {
48 }
49
50
51 }