]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/runtime/AbstractAgent.java
Finalize agents
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.simple / src / main / java / org / argeo / slc / core / runtime / AbstractAgent.java
index fc34d1f178b13f003cc2b74b3ba49d6c4e38173e..d3647b7187b44343f20c0570fb3896a351bd0378 100644 (file)
@@ -5,6 +5,7 @@ import java.util.Properties;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.argeo.slc.execution.ExecutionModulesManager;
 import org.argeo.slc.process.SlcExecution;
 import org.argeo.slc.runtime.SlcApplication;
 import org.argeo.slc.runtime.SlcExecutionContext;
@@ -12,30 +13,37 @@ import org.argeo.slc.runtime.SlcExecutionContext;
 public abstract class AbstractAgent {
        private final static Log log = LogFactory.getLog(AbstractAgent.class);
 
-       private SlcApplication<SlcExecutionContext> slcApplication;
+//     private SlcApplication<SlcExecutionContext> slcApplication;
+       
+       private ExecutionModulesManager modulesManager;
 
        protected void runSlcExecution(final SlcExecution slcExecution) {
-               // TODO: in a separate process
-               Thread thread = new Thread("SlcExecution " + slcExecution.getUuid()) {
-                       public void run() {
-                               Properties props = new Properties();
-                               Map<String, String> attributes = slcExecution.getAttributes();
-                               for (String key : attributes.keySet()) {
-                                       props.setProperty(key, attributes.get(key));
-                                       if (log.isTraceEnabled())
-                                               log.trace(key + "=" + props.getProperty(key));
-                               }
-                               slcApplication.execute(slcExecution, props, null, null);
-                               log.debug("Thread for SLC execution #" + slcExecution.getUuid()
-                                               + " finished.");
-                       }
-               };
-               thread.start();
+               modulesManager.process(slcExecution);
+//             Thread thread = new Thread("SlcExecution " + slcExecution.getUuid()) {
+//                     public void run() {
+//                             Properties props = new Properties();
+//                             Map<String, String> attributes = slcExecution.getAttributes();
+//                             for (String key : attributes.keySet()) {
+//                                     props.setProperty(key, attributes.get(key));
+//                                     if (log.isTraceEnabled())
+//                                             log.trace(key + "=" + props.getProperty(key));
+//                             }
+//                             slcApplication.execute(slcExecution, props, null, null);
+//                             log.debug("Thread for SLC execution #" + slcExecution.getUuid()
+//                                             + " finished.");
+//                     }
+//             };
+//             thread.start();
        }
 
-       public void setSlcApplication(
-                       SlcApplication<SlcExecutionContext> application) {
-               this.slcApplication = application;
+       public void setModulesManager(ExecutionModulesManager modulesManager) {
+               this.modulesManager = modulesManager;
        }
 
+       
+//     public void setSlcApplication(
+//                     SlcApplication<SlcExecutionContext> application) {
+//             this.slcApplication = application;
+//     }
+
 }