]>
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 import org
.argeo
.slc
.execution
.ExecutionProcess
;
28 public class SlcExecution
implements ExecutionProcess
, Serializable
{
29 private static final long serialVersionUID
= -7607457971382118466L;
31 public final static String UNKOWN_HOST
= "UNKOWN_HOST";
37 private String status
= NEW
;
38 private Map
<String
, String
> attributes
= new TreeMap
<String
, String
>();
40 /** TODO: Synchronize */
41 private List
<SlcExecutionStep
> steps
= new ArrayList
<SlcExecutionStep
>();
42 private List
<RealizedFlow
> realizedFlows
= new ArrayList
<RealizedFlow
>();
44 /** Attachment uuid. */
45 private String realizedFlowsXml
= null;
47 public List
<RealizedFlow
> getRealizedFlows() {
51 public void setRealizedFlows(List
<RealizedFlow
> realizedFlows
) {
52 this.realizedFlows
= realizedFlows
;
55 public List
<SlcExecutionStep
> getSteps() {
59 public void setSteps(List
<SlcExecutionStep
> steps
) {
63 public String
getUuid() {
67 public void setUuid(String uuid
) {
71 public String
getHost() {
75 public void setHost(String host
) {
79 public String
getUser() {
83 public void setUser(String user
) {
87 public String
getType() {
91 public void setType(String type
) {
95 public String
getStatus() {
99 public void setStatus(String status
) {
100 this.status
= status
;
103 public SlcExecutionStep
currentStep() {
104 synchronized (steps
) {
105 if (steps
.size() > 0)
106 return steps
.get(steps
.size() - 1);
113 public boolean equals(Object obj
) {
114 if (obj
instanceof SlcExecution
) {
115 return getUuid().equals(((SlcExecution
) obj
).getUuid());
121 public int hashCode() {
122 return getUuid().hashCode();
125 public Map
<String
, String
> getAttributes() {
129 public void setAttributes(Map
<String
, String
> attributes
) {
130 this.attributes
= attributes
;
133 public String
toString() {
134 StringBuffer buf
= new StringBuffer(getClass().getSimpleName());
135 buf
.append('#').append(uuid
);
136 buf
.append(" status=").append(status
);
137 buf
.append(" attributes=").append(attributes
);
138 return buf
.toString();
141 public Date
getStartDate() {
142 synchronized (steps
) {
143 if (steps
.size() == 0)
146 return steps
.get(0).getTimestamp();
150 public Date
getEndDate() {
151 if (!status
.equals(COMPLETED
) && !status
.equals(ERROR
))
154 synchronized (steps
) {
155 if (steps
.size() == 0)
158 return steps
.get(steps
.size() - 1).getTimestamp();
163 * Not (yet) a stable API, should not be relied upon!
165 * @return an id or an url allowing to retrieve the XML, not the XML itself!
167 public String
getRealizedFlowsXml() {
168 return realizedFlowsXml
;
171 /** Not (yet) a stable API, should not be relied upon! */
172 public void setRealizedFlowsXml(String realizedFlowsXml
) {
173 this.realizedFlowsXml
= realizedFlowsXml
;