]> git.argeo.org Git - gpl/argeo-slc.git/blob - sandbox/argeo.slc.executionflow/src/main/java/org/argeo/slc/executionflow/SimpleExecutionSpec.java
Introduce aspects and execution parameters
[gpl/argeo-slc.git] / sandbox / argeo.slc.executionflow / src / main / java / org / argeo / slc / executionflow / SimpleExecutionSpec.java
1 package org.argeo.slc.executionflow;
2
3 import java.util.HashMap;
4 import java.util.Map;
5
6 import org.springframework.aop.framework.ProxyFactory;
7
8 public class SimpleExecutionSpec implements ExecutionSpec {
9 private Map<String, ExecutionSpecAttribute> attributes = new HashMap<String, ExecutionSpecAttribute>();
10
11 public Map<String, ExecutionSpecAttribute> getAttributes() {
12 return attributes;
13 }
14
15 public void setAttributes(Map<String, ExecutionSpecAttribute> attributes) {
16 this.attributes = attributes;
17 }
18
19 public Object createRef(String name) {
20 RefSpecAttribute refSpecAttribute = (RefSpecAttribute) attributes
21 .get(name);
22 Class targetClass = refSpecAttribute.getTargetClass();
23 ExecutionTargetSource targetSource = new ExecutionTargetSource();
24 targetSource.setName(name);
25 targetSource.setTargetClass(targetClass);
26 ProxyFactory proxyFactory = new ProxyFactory();
27 proxyFactory.setTargetClass(targetClass);
28 proxyFactory.setProxyTargetClass(true);
29 proxyFactory.setTargetSource(targetSource);
30
31 return proxyFactory.getProxy();
32 }
33 }