+/*\r
+ * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
package org.argeo.slc.process;\r
\r
+import java.io.Serializable;\r
import java.util.ArrayList;\r
+import java.util.Date;\r
import java.util.List;\r
import java.util.Map;\r
import java.util.TreeMap;\r
\r
-public class SlcExecution {\r
- public final static String STATUS_SCHEDULED = "SCHEDULED";\r
- public final static String STATUS_RUNNING = "RUNNING";\r
- public final static String STATUS_FINISHED = "FINISHED";\r
- public final static String STATUS_ERROR = "ERROR";\r
- public final static String STATUS_CLEANED = "CLEANED";\r
+import org.argeo.slc.execution.ExecutionProcess;\r
+\r
+/** @deprecated use other implementations of {@link ExecutionProcess} */\r
+public class SlcExecution implements ExecutionProcess, Serializable {\r
+ private static final long serialVersionUID = -7607457971382118466L;\r
\r
public final static String UNKOWN_HOST = "UNKOWN_HOST";\r
\r
private String host;\r
private String user;\r
private String type;\r
- private String status;\r
+ private String status = NEW;\r
private Map<String, String> attributes = new TreeMap<String, String>();\r
\r
+ /** TODO: Synchronize */\r
private List<SlcExecutionStep> steps = new ArrayList<SlcExecutionStep>();\r
private List<RealizedFlow> realizedFlows = new ArrayList<RealizedFlow>();\r
\r
+ /** Attachment uuid. */\r
+ private String realizedFlowsXml = null;\r
+\r
public List<RealizedFlow> getRealizedFlows() {\r
return realizedFlows;\r
}\r
}\r
\r
public SlcExecutionStep currentStep() {\r
- if (steps.size() > 0)\r
- return steps.get(steps.size() - 1);\r
- else\r
- return null;\r
+ synchronized (steps) {\r
+ if (steps.size() > 0)\r
+ return steps.get(steps.size() - 1);\r
+ else\r
+ return null;\r
+ }\r
}\r
\r
@Override\r
buf.append(" attributes=").append(attributes);\r
return buf.toString();\r
}\r
+\r
+ public Date getStartDate() {\r
+ synchronized (steps) {\r
+ if (steps.size() == 0)\r
+ return null;\r
+ else\r
+ return steps.get(0).getTimestamp();\r
+ }\r
+ }\r
+\r
+ public Date getEndDate() {\r
+ if (!status.equals(COMPLETED) && !status.equals(ERROR))\r
+ return null;\r
+\r
+ synchronized (steps) {\r
+ if (steps.size() == 0)\r
+ return null;\r
+ else\r
+ return steps.get(steps.size() - 1).getTimestamp();\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Not (yet) a stable API, should not be relied upon!\r
+ * \r
+ * @return an id or an url allowing to retrieve the XML, not the XML itself!\r
+ */\r
+ public String getRealizedFlowsXml() {\r
+ return realizedFlowsXml;\r
+ }\r
+\r
+ /** Not (yet) a stable API, should not be relied upon! */\r
+ public void setRealizedFlowsXml(String realizedFlowsXml) {\r
+ this.realizedFlowsXml = realizedFlowsXml;\r
+ }\r
+\r
}\r