import org.argeo.slc.process.SlcExecution;\r
import org.argeo.slc.runtime.SlcAgent;\r
import org.argeo.slc.runtime.SlcAgentFactory;\r
+import org.argeo.slc.services.process.SlcExecutionService;\r
import org.argeo.slc.web.mvc.AbstractServiceController;\r
import org.springframework.oxm.Unmarshaller;\r
import org.springframework.web.servlet.ModelAndView;\r
\r
private SlcAgentFactory agentFactory;\r
private Unmarshaller unmarshaller;\r
+ private SlcExecutionService slcExecutionService;\r
\r
@Override\r
protected void handleServiceRequest(HttpServletRequest request,\r
HttpServletResponse response, ModelAndView modelAndView)\r
throws Exception {\r
- \r
- if(log.isDebugEnabled()){\r
- log.debug("Content-Type: "+request.getContentType());\r
- log.debug("Content-Length: "+request.getContentLength());\r
+\r
+ if (log.isTraceEnabled()) {\r
+ log.debug("Content-Type: " + request.getContentType());\r
+ log.debug("Content-Length: " + request.getContentLength());\r
}\r
\r
String agentId = request\r
BufferedReader reader = request.getReader();\r
StringBuffer buffer = new StringBuffer();\r
String line = null;\r
- while (((line = reader.readLine())!=null)) {\r
+ while (((line = reader.readLine()) != null)) {\r
buffer.append(line);\r
}\r
answer = buffer.toString();\r
}\r
\r
- if (log.isDebugEnabled())\r
+ if (log.isTraceEnabled())\r
log.debug("Received message:\n" + answer);\r
\r
StringSource source = new StringSource(answer);\r
SlcExecution slcExecution = (SlcExecution) unmarshaller\r
.unmarshal(source);\r
\r
+ slcExecution.setStatus(SlcExecution.STATUS_SCHEDULED);\r
+ slcExecutionService.newExecution(slcExecution);\r
+\r
SlcAgent agent = agentFactory.getAgent(agentId);\r
agent.runSlcExecution(slcExecution);\r
}\r
this.agentFactory = agentFactory;\r
}\r
\r
+ public void setSlcExecutionService(SlcExecutionService slcExecutionService) {\r
+ this.slcExecutionService = slcExecutionService;\r
+ }\r
+\r
}\r