]>
git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecution.java
2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org
.argeo
.slc
.process
;
19 import java
.io
.Serializable
;
20 import java
.util
.ArrayList
;
21 import java
.util
.Date
;
22 import java
.util
.List
;
24 import java
.util
.TreeMap
;
26 public class SlcExecution
implements Serializable
{
27 private static final long serialVersionUID
= 1L;
28 public final static String STATUS_NONE
= "DEFAULT";
29 public final static String STATUS_SCHEDULED
= "SCHEDULED";
30 public final static String STATUS_RUNNING
= "RUNNING";
31 public final static String STATUS_FINISHED
= "FINISHED";
32 public final static String STATUS_ERROR
= "ERROR";
33 public final static String STATUS_CLEANED
= "CLEANED";
35 public final static String UNKOWN_HOST
= "UNKOWN_HOST";
41 private String status
= STATUS_NONE
;
42 private Map
<String
, String
> attributes
= new TreeMap
<String
, String
>();
44 /** TODO: Synchronize */
45 private List
<SlcExecutionStep
> steps
= new ArrayList
<SlcExecutionStep
>();
46 private List
<RealizedFlow
> realizedFlows
= new ArrayList
<RealizedFlow
>();
48 /** Attachment uuid. */
49 private String realizedFlowsXml
= null;
51 public List
<RealizedFlow
> getRealizedFlows() {
55 public void setRealizedFlows(List
<RealizedFlow
> realizedFlows
) {
56 this.realizedFlows
= realizedFlows
;
59 public List
<SlcExecutionStep
> getSteps() {
63 public void setSteps(List
<SlcExecutionStep
> steps
) {
67 public String
getUuid() {
71 public void setUuid(String uuid
) {
75 public String
getHost() {
79 public void setHost(String host
) {
83 public String
getUser() {
87 public void setUser(String user
) {
91 public String
getType() {
95 public void setType(String type
) {
99 public String
getStatus() {
103 public void setStatus(String status
) {
104 this.status
= status
;
107 public SlcExecutionStep
currentStep() {
108 synchronized (steps
) {
109 if (steps
.size() > 0)
110 return steps
.get(steps
.size() - 1);
117 public boolean equals(Object obj
) {
118 if (obj
instanceof SlcExecution
) {
119 return getUuid().equals(((SlcExecution
) obj
).getUuid());
125 public int hashCode() {
126 return getUuid().hashCode();
129 public Map
<String
, String
> getAttributes() {
133 public void setAttributes(Map
<String
, String
> attributes
) {
134 this.attributes
= attributes
;
137 public String
toString() {
138 StringBuffer buf
= new StringBuffer(getClass().getSimpleName());
139 buf
.append('#').append(uuid
);
140 buf
.append(" status=").append(status
);
141 buf
.append(" attributes=").append(attributes
);
142 return buf
.toString();
145 public Date
getStartDate() {
146 synchronized (steps
) {
147 if (steps
.size() == 0)
150 return steps
.get(0).getBegin();
154 public Date
getEndDate() {
155 if (!status
.equals(STATUS_FINISHED
) && !status
.equals(STATUS_ERROR
))
158 synchronized (steps
) {
159 if (steps
.size() == 0)
162 return steps
.get(steps
.size() - 1).getBegin();
167 * Not (yet) a stable API, should not be relied upon!
169 * @return an id or an url allowing to retrieve the XML, not the XML itself!
171 public String
getRealizedFlowsXml() {
172 return realizedFlowsXml
;
175 /** Not (yet) a stable API, should not be relied upon! */
176 public void setRealizedFlowsXml(String realizedFlowsXml
) {
177 this.realizedFlowsXml
= realizedFlowsXml
;