]> git.argeo.org Git - gpl/argeo-slc.git/blob - sandbox/argeo.slc.executionflow/src/main/java/org/argeo/slc/executionflow/ExecutionTargetSource.java
51bdf250f484631da340b29a88a4c7f1a7a62559
[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 = SimpleExecutionFlow
18 .getCurrentExecutionFlow();
19 Object obj = executionFlow.getAttributes().get(name);
20 if (log.isTraceEnabled())
21 log.trace("Target object " + obj);
22 return obj;
23 }
24
25 public Class getTargetClass() {
26 return targetClass;
27 }
28
29 public boolean isStatic() {
30 return false;
31 }
32
33 public void releaseTarget(Object target) throws Exception {
34 // TODO Auto-generated method stub
35
36 }
37
38 public void setName(String name) {
39 this.name = name;
40 }
41
42 public void setTargetClass(Class targetClass) {
43 this.targetClass = targetClass;
44 }
45
46 }