]> git.argeo.org Git - gpl/argeo-slc.git/blob - sandbox/argeo.slc.executionflow/src/main/java/org/argeo/slc/executionflow/ExecutionTargetSource.java
Introduce aspects and execution parameters
[gpl/argeo-slc.git] / sandbox / argeo.slc.executionflow / src / main / java / org / argeo / slc / executionflow / ExecutionTargetSource.java
1 package org.argeo.slc.executionflow;
2
3 import org.apache.commons.logging.Log;
4 import org.apache.commons.logging.LogFactory;
5 import org.springframework.aop.TargetSource;
6
7 public class ExecutionTargetSource implements TargetSource {
8 private final static Log log = LogFactory
9 .getLog(ExecutionTargetSource.class);
10
11 private String name;
12 private Class targetClass;
13
14 public Object getTarget() throws Exception {
15 if (log.isTraceEnabled())
16 log.trace("Getting object " + name);
17 ExecutionFlow executionFlow = ExecutionContext.getCurrentFlow();
18 Object obj = executionFlow.getAttributes().get(name);
19 if (log.isTraceEnabled())
20 log.trace("Target object " + obj);
21 return obj;
22 }
23
24 public Class getTargetClass() {
25 return targetClass;
26 }
27
28 public boolean isStatic() {
29 return false;
30 }
31
32 public void releaseTarget(Object target) throws Exception {
33 // TODO Auto-generated method stub
34
35 }
36
37 public void setName(String name) {
38 this.name = name;
39 }
40
41 public void setTargetClass(Class targetClass) {
42 this.targetClass = targetClass;
43 }
44
45 }