]>
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 /** @deprecated use other implementations of {@link ExecutionProcess} */
29 public class SlcExecution
implements ExecutionProcess
, Serializable
{
30 private static final long serialVersionUID
= -7607457971382118466L;
32 public final static String UNKOWN_HOST
= "UNKOWN_HOST";
38 private String status
= NEW
;
39 private Map
<String
, String
> attributes
= new TreeMap
<String
, String
>();
41 /** TODO: Synchronize */
42 private List
<SlcExecutionStep
> steps
= new ArrayList
<SlcExecutionStep
>();
43 private List
<RealizedFlow
> realizedFlows
= new ArrayList
<RealizedFlow
>();
45 /** Attachment uuid. */
46 private String realizedFlowsXml
= null;
48 public List
<RealizedFlow
> getRealizedFlows() {
52 public void setRealizedFlows(List
<RealizedFlow
> realizedFlows
) {
53 this.realizedFlows
= realizedFlows
;
56 public List
<SlcExecutionStep
> getSteps() {
60 public void setSteps(List
<SlcExecutionStep
> steps
) {
64 public String
getUuid() {
68 public void setUuid(String uuid
) {
72 public String
getHost() {
76 public void setHost(String host
) {
80 public String
getUser() {
84 public void setUser(String user
) {
88 public String
getType() {
92 public void setType(String type
) {
96 public String
getStatus() {
100 public void setStatus(String status
) {
101 this.status
= status
;
104 public SlcExecutionStep
currentStep() {
105 synchronized (steps
) {
106 if (steps
.size() > 0)
107 return steps
.get(steps
.size() - 1);
114 public boolean equals(Object obj
) {
115 if (obj
instanceof SlcExecution
) {
116 return getUuid().equals(((SlcExecution
) obj
).getUuid());
122 public int hashCode() {
123 return getUuid().hashCode();
126 public Map
<String
, String
> getAttributes() {
130 public void setAttributes(Map
<String
, String
> attributes
) {
131 this.attributes
= attributes
;
134 public String
toString() {
135 StringBuffer buf
= new StringBuffer(getClass().getSimpleName());
136 buf
.append('#').append(uuid
);
137 buf
.append(" status=").append(status
);
138 buf
.append(" attributes=").append(attributes
);
139 return buf
.toString();
142 public Date
getStartDate() {
143 synchronized (steps
) {
144 if (steps
.size() == 0)
147 return steps
.get(0).getTimestamp();
151 public Date
getEndDate() {
152 if (!status
.equals(COMPLETED
) && !status
.equals(ERROR
))
155 synchronized (steps
) {
156 if (steps
.size() == 0)
159 return steps
.get(steps
.size() - 1).getTimestamp();
164 * Not (yet) a stable API, should not be relied upon!
166 * @return an id or an url allowing to retrieve the XML, not the XML itself!
168 public String
getRealizedFlowsXml() {
169 return realizedFlowsXml
;
172 /** Not (yet) a stable API, should not be relied upon! */
173 public void setRealizedFlowsXml(String realizedFlowsXml
) {
174 this.realizedFlowsXml
= realizedFlowsXml
;