]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Introduce aspects and execution parameters
authorMathieu Baudier <mbaudier@argeo.org>
Wed, 18 Feb 2009 13:55:17 +0000 (13:55 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Wed, 18 Feb 2009 13:55:17 +0000 (13:55 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2154 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

13 files changed:
sandbox/argeo.slc.executionflow/pom.xml
sandbox/argeo.slc.executionflow/src/main/java/org/argeo/slc/executionflow/ExecutionAspect.java [new file with mode: 0644]
sandbox/argeo.slc.executionflow/src/main/java/org/argeo/slc/executionflow/ExecutionContext.java [new file with mode: 0644]
sandbox/argeo.slc.executionflow/src/main/java/org/argeo/slc/executionflow/ExecutionFlow.java
sandbox/argeo.slc.executionflow/src/main/java/org/argeo/slc/executionflow/ExecutionParameterPostProcessor.java [new file with mode: 0644]
sandbox/argeo.slc.executionflow/src/main/java/org/argeo/slc/executionflow/ExecutionScope.java
sandbox/argeo.slc.executionflow/src/main/java/org/argeo/slc/executionflow/ExecutionTargetSource.java
sandbox/argeo.slc.executionflow/src/main/java/org/argeo/slc/executionflow/SimpleExecutionFlow.java
sandbox/argeo.slc.executionflow/src/slc/conf/basic.xml
sandbox/argeo.slc.executionflow/src/slc/conf/common.xml
sandbox/argeo.slc.executionflow/src/slc/conf/main.xml
sandbox/argeo.slc.executionflow/src/slc/conf/slc.properties
sandbox/argeo.slc.executionflow/src/slc/conf/testCases/basic-001.xml

index 6a9248839776295c424e78ea81dc2315324ba78a..1025a48ce4c87aeeceb2093748b18a1dd7946185 100644 (file)
                        <artifactId>org.argeo.slc.support.simple</artifactId>
                </dependency>
 
                        <artifactId>org.argeo.slc.support.simple</artifactId>
                </dependency>
 
+               <dependency>
+                       <groupId>org.aspectj</groupId>
+                       <artifactId>com.springsource.org.aspectj.runtime</artifactId>
+                       <version>1.6.2.RELEASE</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.aspectj</groupId>
+                       <artifactId>com.springsource.org.aspectj.weaver</artifactId>
+                       <version>1.6.2.RELEASE</version>
+               </dependency>
                <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>com.springsource.org.codehaus.groovy</artifactId>
                <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>com.springsource.org.codehaus.groovy</artifactId>
diff --git a/sandbox/argeo.slc.executionflow/src/main/java/org/argeo/slc/executionflow/ExecutionAspect.java b/sandbox/argeo.slc.executionflow/src/main/java/org/argeo/slc/executionflow/ExecutionAspect.java
new file mode 100644 (file)
index 0000000..6d3257e
--- /dev/null
@@ -0,0 +1,48 @@
+package org.argeo.slc.executionflow;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.After;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+
+@Aspect
+public class ExecutionAspect {
+       private static Log log = LogFactory.getLog(ExecutionAspect.class);
+
+       // @Around("execution(void org.argeo.slc.executionflow.ExecutionFlow.execute()) && target(org.argeo.slc.executionflow.ExecutionFlow)")
+       public void registerFlow(ProceedingJoinPoint pjp) throws Throwable {
+               try {
+                       log.debug("registerFlow " + pjp.getTarget().getClass());
+                       ExecutionContext.enterFlow((ExecutionFlow) pjp.getTarget());
+                       pjp.proceed();
+               } finally {
+                       ExecutionContext.leaveFlow((ExecutionFlow) pjp.getTarget());
+               }
+       }
+
+       @Before("flowExecution()")
+       public void beforeFlow(JoinPoint jp) throws Throwable {
+               //log.debug("this " + jp.getThis().getClass());
+               //log.debug("target " + jp.getTarget().getClass());
+               // Thread.dumpStack();
+               ExecutionFlow executionFlow = (ExecutionFlow) jp.getTarget();
+               ExecutionContext.enterFlow(executionFlow);
+       }
+
+       @After("flowExecution()")
+       public void afterFlow(JoinPoint jp) throws Throwable {
+               //log.debug("this " + jp.getThis().getClass());
+               //log.debug("target " + jp.getTarget().getClass());
+               ExecutionFlow executionFlow = (ExecutionFlow) jp.getTarget();
+               ExecutionContext.leaveFlow(executionFlow);
+       }
+
+       @Pointcut("execution(void org.argeo.slc.executionflow.ExecutionFlow.execute())")
+       public void flowExecution() {
+       }
+}
diff --git a/sandbox/argeo.slc.executionflow/src/main/java/org/argeo/slc/executionflow/ExecutionContext.java b/sandbox/argeo.slc.executionflow/src/main/java/org/argeo/slc/executionflow/ExecutionContext.java
new file mode 100644 (file)
index 0000000..ed41152
--- /dev/null
@@ -0,0 +1,44 @@
+package org.argeo.slc.executionflow;
+
+import java.util.Stack;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.argeo.slc.SlcException;
+
+public class ExecutionContext {
+       private final static Log log = LogFactory.getLog(ExecutionContext.class);
+
+       private final static ThreadLocal<ExecutionContext> executionContext = new ThreadLocal<ExecutionContext>();
+
+       private final Stack<ExecutionFlow> stack = new Stack<ExecutionFlow>();
+
+       public static ExecutionFlow getCurrentFlow() {
+               if (executionContext.get() == null)
+                       return null;
+               return executionContext.get().stack.peek();
+       }
+
+       public static void enterFlow(ExecutionFlow executionFlow) {
+               if (executionContext.get() == null) {
+                       // TODO: deal with parallell flows
+                       executionContext.set(new ExecutionContext());
+               }
+               Stack<ExecutionFlow> stack = executionContext.get().stack;
+               stack.push(executionFlow);
+               if (log.isDebugEnabled())
+                       log.debug("Depth: " + stack.size() + ". Enter " + executionFlow);
+       }
+
+       public static void leaveFlow(ExecutionFlow executionFlow) {
+               Stack<ExecutionFlow> stack = executionContext.get().stack;
+               if (log.isDebugEnabled())
+                       log.debug("Depth: " + stack.size() + ". Leave " + executionFlow);
+               ExecutionFlow leftEf = stack.pop();
+               leftEf.getScopedObjects().clear();
+               if (!leftEf.getUuid().equals(executionFlow.getUuid())) {
+                       throw new SlcException("Asked to leave " + executionFlow
+                                       + " but last is " + leftEf);
+               }
+       }
+}
index 652218471e142a210681c6a33050d8f284f204dc..0d4ae934e51b05d5496ee45163b14ba752edb778 100644 (file)
@@ -6,5 +6,7 @@ import org.argeo.slc.process.Executable;
 
 public interface ExecutionFlow extends Executable{
        public Map<String, Object> getAttributes();
 
 public interface ExecutionFlow extends Executable{
        public Map<String, Object> getAttributes();
+       public ExecutionSpec getExecutionSpec();
        public String getUuid();
        public String getUuid();
+       public Map<String, Object> getScopedObjects();
 }
 }
diff --git a/sandbox/argeo.slc.executionflow/src/main/java/org/argeo/slc/executionflow/ExecutionParameterPostProcessor.java b/sandbox/argeo.slc.executionflow/src/main/java/org/argeo/slc/executionflow/ExecutionParameterPostProcessor.java
new file mode 100644 (file)
index 0000000..adeddaa
--- /dev/null
@@ -0,0 +1,104 @@
+package org.argeo.slc.executionflow;
+
+import java.beans.PropertyDescriptor;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.argeo.slc.SlcException;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.PropertyValue;
+import org.springframework.beans.PropertyValues;
+import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter;
+import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
+import org.springframework.beans.factory.config.TypedStringValue;
+
+public class ExecutionParameterPostProcessor extends
+               InstantiationAwareBeanPostProcessorAdapter {
+       private final static Log log = LogFactory
+                       .getLog(ExecutionParameterPostProcessor.class);
+
+       private String placeholderPrefix = "@{";
+       private String placeholderSuffix = "}";
+       private String nullValue;
+
+       @Override
+       public PropertyValues postProcessPropertyValues(PropertyValues pvs,
+                       PropertyDescriptor[] pds, Object bean, String beanName)
+                       throws BeansException {
+               ExecutionFlow currentFlow = ExecutionContext.getCurrentFlow();
+               if (currentFlow == null)
+                       return pvs;
+
+               Properties props = new Properties();
+               Map<String, Object> attributes = currentFlow.getAttributes();
+               Map<String, ExecutionSpecAttribute> specAttributes = currentFlow
+                               .getExecutionSpec().getAttributes();
+
+               for (String key : specAttributes.keySet()) {
+                       ExecutionSpecAttribute obj = specAttributes.get(key);
+                       if (!(obj instanceof RefSpecAttribute)) {
+                               if (!attributes.containsKey(key))
+                                       throw new SlcException("Specified attribute " + key
+                                                       + " is not set in " + currentFlow);
+
+                               props.setProperty(key, attributes.get(key).toString());
+//                             if (log.isTraceEnabled())
+//                                     log.trace("Use attribute " + key);
+                       }
+               }
+               CustomPpc ppc = new CustomPpc(props);
+
+               for (PropertyValue pv : pvs.getPropertyValues()) {
+                       if (pv.getValue() instanceof TypedStringValue) {
+                               TypedStringValue tsv = (TypedStringValue) pv.getValue();
+                               String originalValue = tsv.getValue();
+                               String convertedValue = ppc.process(originalValue);
+                               tsv.setValue(convertedValue);
+                               if (log.isTraceEnabled()) {
+                                       if (!originalValue.equals(convertedValue))
+                                               log.trace("Converted " + beanName + "[" + pv.getName()
+                                                               + "]: " + originalValue + " to "
+                                                               + convertedValue);
+                               }
+                       } else {
+//                             if (log.isTraceEnabled())
+//                                     log.trace(beanName + "[" + pv.getName() + "]: "
+//                                                     + pv.getValue().getClass());
+                       }
+               }
+
+               return pvs;
+       }
+
+       public void setPlaceholderPrefix(String placeholderPrefix) {
+               this.placeholderPrefix = placeholderPrefix;
+       }
+
+       public void setPlaceholderSuffix(String placeholderSuffix) {
+               this.placeholderSuffix = placeholderSuffix;
+       }
+
+       public void setNullValue(String nullValue) {
+               this.nullValue = nullValue;
+       }
+
+       private class CustomPpc extends PropertyPlaceholderConfigurer {
+               private final Properties props;
+
+               public CustomPpc(Properties props) {
+                       super();
+                       this.props = props;
+                       setPlaceholderPrefix(placeholderPrefix);
+                       setPlaceholderSuffix(placeholderSuffix);
+                       setSystemPropertiesMode(SYSTEM_PROPERTIES_MODE_NEVER);
+               }
+
+               public String process(String strVal) {
+                       String value = parseStringValue(strVal, this.props, new HashSet<String>());
+                       return (value.equals(nullValue) ? null : value);
+               }
+       }
+}
index 46d5d19f75139c02b9d396f05448b52a2bc38853..e608744358e63c8a4a5ec17091774bc73cb357b4 100644 (file)
@@ -7,28 +7,46 @@ import org.springframework.beans.factory.config.Scope;
 
 public class ExecutionScope implements Scope {
        private final static Log log = LogFactory.getLog(ExecutionScope.class);
 
 public class ExecutionScope implements Scope {
        private final static Log log = LogFactory.getLog(ExecutionScope.class);
-       
+
        public Object get(String name, ObjectFactory objectFactory) {
        public Object get(String name, ObjectFactory objectFactory) {
-               log.info("Getting bean "+name);
-               ExecutionFlow executionFlow = SimpleExecutionFlow.getCurrentExecutionFlow();
-               Object obj = executionFlow.getAttributes().get(name);
-               log.info("Scoped object "+obj);
+
+               if (log.isTraceEnabled())
+                       log.info("Getting scoped bean " + name);
+               ExecutionFlow executionFlow = ExecutionContext.getCurrentFlow();
+               // returns cached instance
+               if (executionFlow.getScopedObjects().containsKey(name)) {
+                       Object obj = executionFlow.getScopedObjects().get(name);
+                       if (log.isTraceEnabled())
+                               log.info("Return cached scoped object " + obj);
+                       return obj;
+               }
+               // creates instance
+               Object obj = objectFactory.getObject();
+               if (obj instanceof ExecutionFlow) {
+                       // add to itself (it is not yet the current flow)
+                       ((ExecutionFlow) obj).getScopedObjects().put(name, obj);
+                       if (log.isTraceEnabled())
+                               log.info("Cached flow object " + obj + " in itself");
+               } else {
+                       executionFlow.getScopedObjects().put(name, obj);
+                       if (log.isTraceEnabled())
+                               log.info("Created regular scoped object " + obj);
+               }
                return obj;
        }
 
        public String getConversationId() {
                return obj;
        }
 
        public String getConversationId() {
-               ExecutionFlow executionFlow = SimpleExecutionFlow.getCurrentExecutionFlow();
+               ExecutionFlow executionFlow = ExecutionContext.getCurrentFlow();
                return executionFlow.getUuid();
        }
 
        public void registerDestructionCallback(String name, Runnable callback) {
                return executionFlow.getUuid();
        }
 
        public void registerDestructionCallback(String name, Runnable callback) {
-               // TODO Auto-generated method stub
-
+               throw new UnsupportedOperationException();
        }
 
        public Object remove(String name) {
        }
 
        public Object remove(String name) {
-               // TODO Auto-generated method stub
-               return null;
+               log.debug("Remove object " + name);
+               throw new UnsupportedOperationException();
        }
 
 }
        }
 
 }
index 51bdf250f484631da340b29a88a4c7f1a7a62559..3b0153787f6dd116b91534ebf4c300e6f876f487 100644 (file)
@@ -14,8 +14,7 @@ public class ExecutionTargetSource implements TargetSource {
        public Object getTarget() throws Exception {
                if (log.isTraceEnabled())
                        log.trace("Getting object " + name);
        public Object getTarget() throws Exception {
                if (log.isTraceEnabled())
                        log.trace("Getting object " + name);
-               ExecutionFlow executionFlow = SimpleExecutionFlow
-                               .getCurrentExecutionFlow();
+               ExecutionFlow executionFlow = ExecutionContext.getCurrentFlow();
                Object obj = executionFlow.getAttributes().get(name);
                if (log.isTraceEnabled())
                        log.trace("Target object " + obj);
                Object obj = executionFlow.getAttributes().get(name);
                if (log.isTraceEnabled())
                        log.trace("Target object " + obj);
index 952bce0de2b8d6ee1f4b578d4ffa33a33762edf7..747fa1652fd1623909be0a61cfc86fc30cf9c442 100644 (file)
@@ -10,26 +10,31 @@ import org.apache.commons.lang.math.RandomUtils;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.process.Executable;
 import org.argeo.slc.test.ExecutableTestRun;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.process.Executable;
 import org.argeo.slc.test.ExecutableTestRun;
+import org.springframework.beans.factory.BeanNameAware;
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.validation.MapBindingResult;
 
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.validation.MapBindingResult;
 
-public class SimpleExecutionFlow implements ExecutionFlow, InitializingBean {
-       private static ThreadLocal<ExecutionFlow> executionFlow = new ThreadLocal<ExecutionFlow>();
+public class SimpleExecutionFlow implements ExecutionFlow, InitializingBean,
+               BeanNameAware {
+       // private static ThreadLocal<ExecutionFlow> executionFlow = new
+       // ThreadLocal<ExecutionFlow>();
 
 
-       private ExecutionSpec executionSpec;
+       private ExecutionSpec executionSpec = new SimpleExecutionSpec();
+       private String name = null;
        private Map<String, Object> attributes = new HashMap<String, Object>();
        private Map<String, Object> attributes = new HashMap<String, Object>();
+       private Map<String, Object> scopedObjects = new HashMap<String, Object>();
        private List<Executable> executables = new ArrayList<Executable>();
 
        private final String uuid = UUID.randomUUID().toString();
 
        public void execute() {
                try {
        private List<Executable> executables = new ArrayList<Executable>();
 
        private final String uuid = UUID.randomUUID().toString();
 
        public void execute() {
                try {
-                       executionFlow.set(this);
+                       // ExecutionContext.enterFlow(this);
                        for (Executable executable : executables) {
                                executable.execute();
                        }
                } finally {
                        for (Executable executable : executables) {
                                executable.execute();
                        }
                } finally {
-                       executionFlow.set(null);
+                       // ExecutionContext.leaveFlow(this);
                }
        }
 
                }
        }
 
@@ -67,6 +72,10 @@ public class SimpleExecutionFlow implements ExecutionFlow, InitializingBean {
                                        + errors.toString());
        }
 
                                        + errors.toString());
        }
 
+       public void setBeanName(String name) {
+               this.name = name;
+       }
+
        public void setExecutables(List<Executable> executables) {
                this.executables = executables;
        }
        public void setExecutables(List<Executable> executables) {
                this.executables = executables;
        }
@@ -79,10 +88,6 @@ public class SimpleExecutionFlow implements ExecutionFlow, InitializingBean {
                this.attributes = attributes;
        }
 
                this.attributes = attributes;
        }
 
-       public static ExecutionFlow getCurrentExecutionFlow() {
-               return executionFlow.get();
-       }
-
        public Map<String, Object> getAttributes() {
                return attributes;
        }
        public Map<String, Object> getAttributes() {
                return attributes;
        }
@@ -91,4 +96,16 @@ public class SimpleExecutionFlow implements ExecutionFlow, InitializingBean {
                return uuid;
        }
 
                return uuid;
        }
 
+       public Map<String, Object> getScopedObjects() {
+               return scopedObjects;
+       }
+
+       public ExecutionSpec getExecutionSpec() {
+               return executionSpec;
+       }
+
+       public String toString() {
+               return new StringBuffer("Flow ").append(name).append(" [#")
+                               .append(uuid).append(']').toString();
+       }
 }
 }
index 82e71d15a36effde84566d6278f7002c681a63aa..19e9735afab48e39c1389177d5f1e80d9cb2acac 100644 (file)
@@ -1,9 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <beans xmlns="http://www.springframework.org/schema/beans"\r
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
 <?xml version="1.0" encoding="UTF-8"?>\r
 <beans xmlns="http://www.springframework.org/schema/beans"\r
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
+       xmlns:aop="http://www.springframework.org/schema/aop"\r
        xsi:schemaLocation="\r
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
        xsi:schemaLocation="\r
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
-       http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd">\r
+       http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd\r
+       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">\r
 \r
        <import resource="common.xml" />\r
 \r
 \r
        <import resource="common.xml" />\r
 \r
@@ -54,9 +56,6 @@
        <bean id="testDef" class="org.argeo.slc.core.test.BasicTestDefinition"\r
                scope="prototype" />\r
 \r
        <bean id="testDef" class="org.argeo.slc.core.test.BasicTestDefinition"\r
                scope="prototype" />\r
 \r
-       <bean\r
-               class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />\r
-\r
        <bean id="testResult" parent="slcDefault.test.basicSimpleTestResult" />\r
 \r
        <bean id="testRun" class="org.argeo.slc.core.test.SimpleTestRun"\r
        <bean id="testResult" parent="slcDefault.test.basicSimpleTestResult" />\r
 \r
        <bean id="testRun" class="org.argeo.slc.core.test.SimpleTestRun"\r
                <property name="proxyTargetClass" value="true" /> </bean>\r
        -->\r
 \r
                <property name="proxyTargetClass" value="true" /> </bean>\r
        -->\r
 \r
-       <!--\r
-               <bean\r
-               class="org.springframework.beans.factory.config.CustomScopeConfigurer">\r
-               <property name="scopes"> <map> <entry key="execution"> <bean\r
-               class="org.argeo.slc.executionflow.ExecutionScope" /> </entry> </map>\r
-               </property> </bean>\r
-       -->\r
-\r
-\r
 </beans>
\ No newline at end of file
 </beans>
\ No newline at end of file
index 80f54b562b5268b2574ba2b2125b2719f8853a9b..44c84b5a13f4c423e678501ddcafd486bcea54e9 100644 (file)
@@ -1,9 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <beans xmlns="http://www.springframework.org/schema/beans"\r
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
 <?xml version="1.0" encoding="UTF-8"?>\r
 <beans xmlns="http://www.springframework.org/schema/beans"\r
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
+       xmlns:aop="http://www.springframework.org/schema/aop"\r
        xsi:schemaLocation="\r
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
        xsi:schemaLocation="\r
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
-       http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd">\r
+       http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd\r
+       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">\r
 \r
        <import\r
                resource="classpath:/org/argeo/slc/core/test/spring/applicationContext.xml" />\r
 \r
        <import\r
                resource="classpath:/org/argeo/slc/core/test/spring/applicationContext.xml" />\r
index 4d43965c5ef1b2b9b31bbf7c5a7ef0d5cea62f35..e2c8dbea0634fe158ba9de8472c9801ee695a809 100644 (file)
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <beans xmlns="http://www.springframework.org/schema/beans"\r
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
 <?xml version="1.0" encoding="UTF-8"?>\r
 <beans xmlns="http://www.springframework.org/schema/beans"\r
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
-       xmlns:lang="http://www.springframework.org/schema/lang"\r
+       xmlns:aop="http://www.springframework.org/schema/aop"\r
        xsi:schemaLocation="\r
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
        http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd\r
        xsi:schemaLocation="\r
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
        http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd\r
-       ">\r
+       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">\r
 \r
        <import resource="testCases/basic-001.xml" />\r
        <import resource="testCases/basic-002.xml" />\r
 \r
        <import resource="testCases/basic-001.xml" />\r
        <import resource="testCases/basic-002.xml" />\r
        <bean id="main" class="org.argeo.slc.executionflow.SimpleExecutionFlow">\r
                <property name="executables">\r
                        <list>\r
        <bean id="main" class="org.argeo.slc.executionflow.SimpleExecutionFlow">\r
                <property name="executables">\r
                        <list>\r
+                               <ref bean="basic.001" />\r
                                <ref bean="basic.001" />\r
                                <ref bean="basic.002" />\r
                        </list>\r
                </property>\r
        </bean>\r
                                <ref bean="basic.001" />\r
                                <ref bean="basic.002" />\r
                        </list>\r
                </property>\r
        </bean>\r
+\r
+       <bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">\r
+               <property name="scopes">\r
+                       <map>\r
+                               <entry key="execution">\r
+                                       <bean class="org.argeo.slc.executionflow.ExecutionScope" />\r
+                               </entry>\r
+                       </map>\r
+               </property>\r
+       </bean>\r
+\r
+       <bean\r
+               class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />\r
+       <bean class="org.argeo.slc.executionflow.ExecutionParameterPostProcessor" />\r
+\r
+       <bean class="org.argeo.slc.executionflow.ExecutionAspect"></bean>\r
+       <aop:aspectj-autoproxy />\r
+\r
 </beans>
\ No newline at end of file
 </beans>
\ No newline at end of file
index 7cce428ea487a0d5397a3dd298498b866dbc52e3..23475a1cd8ceb61d2e45cea821f26e24f188ae73 100644 (file)
@@ -2,6 +2,7 @@ log4j.rootLogger=WARN, console
 
 ## Levels
 log4j.logger.org.argeo=DEBUG
 
 ## Levels
 log4j.logger.org.argeo=DEBUG
+log4j.logger.org.argeo.slc.executionflow.ExecutionParameterPostProcessor=TRACE
 
 ## Appenders
 # console is set to be a ConsoleAppender.
 
 ## Appenders
 # console is set to be a ConsoleAppender.
index 494f9789de8080116dc252faaf51c945b1e90e74..c35361bdb409cca43a602e8954b1f0e560767945 100644 (file)
@@ -1,14 +1,19 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <beans xmlns="http://www.springframework.org/schema/beans"\r
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
 <?xml version="1.0" encoding="UTF-8"?>\r
 <beans xmlns="http://www.springframework.org/schema/beans"\r
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
-       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
+       xmlns:aop="http://www.springframework.org/schema/aop"\r
+       xsi:schemaLocation="\r
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
+       http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd\r
+       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">\r
 \r
        <import resource="../basic.xml" />\r
 \r
 \r
        <import resource="../basic.xml" />\r
 \r
-       <bean id="basic.001" parent="basic.executionFlowTemplate">\r
+       <bean id="basic.001" parent="basic.executionFlowTemplate" scope="execution">\r
+               <aop:scoped-proxy />\r
                <property name="attributes">\r
                        <map>\r
                <property name="attributes">\r
                        <map>\r
-                               <entry key="testData1" value-ref="basic.001.testData"/>\r
+                               <entry key="testData1" value-ref="basic.001.testData" />\r
                                <entry key="testData2">\r
                                        <bean class="org.argeo.slc.core.test.BasicTestData">\r
                                                <property name="expected" value="tata" />\r
                                <entry key="testData2">\r
                                        <bean class="org.argeo.slc.core.test.BasicTestData">\r
                                                <property name="expected" value="tata" />\r
                </property>\r
        </bean>\r
 \r
                </property>\r
        </bean>\r
 \r
-       <bean id="basic.001.testData" class="org.argeo.slc.core.test.BasicTestData">\r
-               <property name="expected" value="toto" />\r
-               <property name="reached" value="toto" />\r
+       <bean id="basic.001.testData" class="org.argeo.slc.core.test.BasicTestData"\r
+               scope="execution">\r
+               <aop:scoped-proxy />\r
+               <property name="expected" value="tata100" />\r
+               <property name="reached" value="tata@{testedComponentId}" />\r
        </bean>\r
 \r
        <bean id="basic.001.testData2" class="org.argeo.slc.core.test.context.DefaultContextTestData">\r
        </bean>\r
 \r
        <bean id="basic.001.testData2" class="org.argeo.slc.core.test.context.DefaultContextTestData">\r