]>
git.argeo.org Git - gpl/argeo-slc.git/blob - org/argeo/slc/execution/ExecutionStep.java
1 package org
.argeo
.slc
.execution
;
3 import java
.io
.Serializable
;
7 * An atomic step to be notified in during an {@link ExecutionProcess}. Can be a
8 * log or the start/end of a phase, etc.
10 public class ExecutionStep
implements Serializable
{
11 private static final long serialVersionUID
= 798640526532912161L;
13 public final static String PHASE_START
= "PHASE_START";
14 public final static String PHASE_END
= "PHASE_END";
15 public final static String ERROR
= "ERROR";
16 public final static String WARNING
= "WARNING";
17 public final static String INFO
= "INFO";
18 public final static String DEBUG
= "DEBUG";
19 public final static String TRACE
= "TRACE";
22 public final static String START
= "START";
24 public final static String END
= "END";
26 // TODO make the fields final and private when we don't need POJO support
28 // is when SlcExecutionStep is removed)
29 protected String type
;
30 protected String thread
;
31 protected Date timestamp
;
34 private String location
;
36 /** Empty constructor */
37 public ExecutionStep() {
38 Thread currentThread
= Thread
.currentThread();
39 thread
= currentThread
.getName();
42 /** Creates a step at the current date */
43 public ExecutionStep(String location
, String type
, String log
) {
44 this(location
, new Date(), type
, log
);
47 /** Creates a step of the given type. */
48 public ExecutionStep(String location
, Date timestamp
, String type
,
50 this(location
, timestamp
, type
, log
, Thread
.currentThread().getName());
53 public ExecutionStep(String location
, Date timestamp
, String type
,
54 String log
, String thread
) {
55 this.location
= location
;
57 this.timestamp
= timestamp
;
59 this.log
= addLog(log
);
62 public String
getType() {
66 public Date
getTimestamp() {
70 public String
getThread() {
75 * Return the string that should be stored in the log field. Can be null if
76 * another mechanism is used to store log lines.
78 protected String
addLog(String log
) {
82 public String
getLog() {
87 public String
toString() {
88 return "Execution step, thread=" + thread
+ ", type=" + type
;
91 /** Typically the logging category */
92 public String
getLocation() {