]>
git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionStep.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
.execution
;
19 import java
.io
.Serializable
;
20 import java
.util
.Date
;
23 * An atomic step to be notified in during an {@link ExecutionProcess}. Can be a
24 * log or the start/end of a phase, etc.
26 public class ExecutionStep
implements Serializable
{
27 private static final long serialVersionUID
= 798640526532912161L;
29 // public final static String START = "START";
30 // public final static String END = "END";
31 public final static String PHASE_START
= "PHASE_START";
32 public final static String PHASE_END
= "PHASE_END";
33 public final static String ERROR
= "ERROR";
34 public final static String WARNING
= "WARNING";
35 public final static String INFO
= "INFO";
36 public final static String DEBUG
= "DEBUG";
37 public final static String TRACE
= "TRACE";
39 // TODO make the fields final and private when we don't need POJO support
41 // is when SlcExecutionStep is removed)
42 protected String type
;
43 protected String thread
;
44 protected Date timestamp
;
47 /** Empty constructor */
48 public ExecutionStep() {
49 thread
= Thread
.currentThread().getName();
52 /** Creates a step at the current date of type INFO */
53 public ExecutionStep(String log
) {
54 this(new Date(), INFO
, log
);
57 /** Creates a step at the current date */
58 public ExecutionStep(String type
, String log
) {
59 this(new Date(), type
, log
);
62 /** Creates a step of the given type. */
63 public ExecutionStep(Date timestamp
, String type
, String log
) {
64 this(timestamp
, type
, log
, Thread
.currentThread().getName());
67 public ExecutionStep(Date timestamp
, String type
, String log
, String thread
) {
69 this.timestamp
= timestamp
;
71 this.log
= addLog(log
);
74 public String
getType() {
78 public Date
getTimestamp() {
82 public String
getThread() {
87 * Return the string that should be stored in the log field. Can be null if
88 * another mechanism is used to store log lines.
90 protected String
addLog(String log
) {
94 public String
getLog() {
99 public String
toString() {
100 return "Execution step, thread=" + thread
+ ", type=" + type
;