1 package org
.argeo
.slc
.core
.execution
;
3 import org
.argeo
.slc
.execution
.ExecutionContext
;
4 import org
.argeo
.slc
.execution
.ExecutionFlow
;
5 import org
.aspectj
.lang
.JoinPoint
;
6 import org
.aspectj
.lang
.annotation
.After
;
7 import org
.aspectj
.lang
.annotation
.Aspect
;
8 import org
.aspectj
.lang
.annotation
.Before
;
9 import org
.aspectj
.lang
.annotation
.Pointcut
;
12 public class ExecutionAspect
{
13 static ThreadLocal
<Boolean
> inModuleExecution
= new ThreadLocal
<Boolean
>() {
14 protected Boolean
initialValue() {
19 private ExecutionContext executionContext
;
21 public ExecutionContext
getExecutionContext() {
22 return executionContext
;
25 public void setExecutionContext(ExecutionContext executionContext
) {
26 this.executionContext
= executionContext
;
29 @Before("flowExecution()")
30 public void beforeFlow(JoinPoint jp
) throws Throwable
{
31 ExecutionFlow executionFlow
= (ExecutionFlow
) jp
.getTarget();
32 executionContext
.enterFlow(executionFlow
);
35 @After("flowExecution()")
36 public void afterFlow(JoinPoint jp
) throws Throwable
{
37 ExecutionFlow executionFlow
= (ExecutionFlow
) jp
.getTarget();
38 executionContext
.leaveFlow(executionFlow
);
41 @Before("moduleExecution()")
42 public void beforeModuleExecution(JoinPoint jp
) throws Throwable
{
43 inModuleExecution
.set(true);
46 @After("moduleExecution()")
47 public void afterModuleExecution(JoinPoint jp
) throws Throwable
{
48 inModuleExecution
.set(false);
51 @Pointcut("execution(void org.argeo.slc.execution.ExecutionFlow.run())")
52 public void flowExecution() {
55 @Pointcut("execution(void org.argeo.slc.execution.ExecutionModule.execute(..))")
56 public void moduleExecution() {