1 package org
.argeo
.slc
.core
.runtime
;
4 import java
.util
.Properties
;
6 import org
.apache
.commons
.logging
.Log
;
7 import org
.apache
.commons
.logging
.LogFactory
;
8 import org
.argeo
.slc
.process
.SlcExecution
;
9 import org
.argeo
.slc
.runtime
.SlcApplication
;
10 import org
.argeo
.slc
.runtime
.SlcExecutionContext
;
12 public abstract class AbstractAgent
{
13 private final static Log log
= LogFactory
.getLog(AbstractAgent
.class);
15 private SlcApplication
<SlcExecutionContext
> slcApplication
;
17 protected void runSlcExecution(final SlcExecution slcExecution
) {
18 // TODO: in a separate process
19 Thread thread
= new Thread("SlcExecution " + slcExecution
.getUuid()) {
21 Properties props
= new Properties();
22 Map
<String
, String
> attributes
= slcExecution
.getAttributes();
23 for (String key
: attributes
.keySet()) {
24 props
.setProperty(key
, attributes
.get(key
));
25 if (log
.isTraceEnabled())
26 log
.trace(key
+ "=" + props
.getProperty(key
));
28 slcApplication
.execute(slcExecution
, props
, null, null);
29 log
.debug("Thread for SLC execution #" + slcExecution
.getUuid()
36 public void setSlcApplication(
37 SlcApplication
<SlcExecutionContext
> application
) {
38 this.slcApplication
= application
;