]>
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
;
27 import org
.argeo
.slc
.execution
.ExecutionStep
;
29 /** @deprecated use other implementations of {@link ExecutionProcess} */
30 public class SlcExecution
implements ExecutionProcess
, Serializable
{
31 private static final long serialVersionUID
= -7607457971382118466L;
33 public final static String UNKOWN_HOST
= "UNKOWN_HOST";
39 private String status
= NEW
;
40 private Map
<String
, String
> attributes
= new TreeMap
<String
, String
>();
42 /** TODO: Synchronize */
43 private List
<SlcExecutionStep
> steps
= new ArrayList
<SlcExecutionStep
>();
44 private List
<RealizedFlow
> realizedFlows
= new ArrayList
<RealizedFlow
>();
46 /** Attachment uuid. */
47 private String realizedFlowsXml
= null;
49 public List
<RealizedFlow
> getRealizedFlows() {
53 public void setRealizedFlows(List
<RealizedFlow
> realizedFlows
) {
54 this.realizedFlows
= realizedFlows
;
57 public List
<SlcExecutionStep
> getSteps() {
61 public void setSteps(List
<SlcExecutionStep
> steps
) {
65 public void addSteps(List
<ExecutionStep
> steps
) {
66 // not implemented on deprecated
69 public String
getUuid() {
73 public void setUuid(String uuid
) {
77 public String
getHost() {
81 public void setHost(String host
) {
85 public String
getUser() {
89 public void setUser(String user
) {
93 public String
getType() {
97 public void setType(String type
) {
101 public String
getStatus() {
105 public void setStatus(String status
) {
106 this.status
= status
;
109 public SlcExecutionStep
currentStep() {
110 synchronized (steps
) {
111 if (steps
.size() > 0)
112 return steps
.get(steps
.size() - 1);
119 public boolean equals(Object obj
) {
120 if (obj
instanceof SlcExecution
) {
121 return getUuid().equals(((SlcExecution
) obj
).getUuid());
127 public int hashCode() {
128 return getUuid().hashCode();
131 public Map
<String
, String
> getAttributes() {
135 public void setAttributes(Map
<String
, String
> attributes
) {
136 this.attributes
= attributes
;
139 public String
toString() {
140 StringBuffer buf
= new StringBuffer(getClass().getSimpleName());
141 buf
.append('#').append(uuid
);
142 buf
.append(" status=").append(status
);
143 buf
.append(" attributes=").append(attributes
);
144 return buf
.toString();
147 public Date
getStartDate() {
148 synchronized (steps
) {
149 if (steps
.size() == 0)
152 return steps
.get(0).getTimestamp();
156 public Date
getEndDate() {
157 if (!status
.equals(COMPLETED
) && !status
.equals(ERROR
))
160 synchronized (steps
) {
161 if (steps
.size() == 0)
164 return steps
.get(steps
.size() - 1).getTimestamp();
169 * Not (yet) a stable API, should not be relied upon!
171 * @return an id or an url allowing to retrieve the XML, not the XML itself!
173 public String
getRealizedFlowsXml() {
174 return realizedFlowsXml
;
177 /** Not (yet) a stable API, should not be relied upon! */
178 public void setRealizedFlowsXml(String realizedFlowsXml
) {
179 this.realizedFlowsXml
= realizedFlowsXml
;