]>
git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionStep.java
74201c0e2ff4cea0f08a3a16dab76cd3e24df3db
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 PHASE_START
= "PHASE_START";
30 public final static String PHASE_END
= "PHASE_END";
31 public final static String ERROR
= "ERROR";
32 public final static String WARNING
= "WARNING";
33 public final static String INFO
= "INFO";
34 public final static String DEBUG
= "DEBUG";
35 public final static String TRACE
= "TRACE";
38 public final static String START
= "START";
40 public final static String END
= "END";
42 // TODO make the fields final and private when we don't need POJO support
44 // is when SlcExecutionStep is removed)
45 protected String type
;
46 protected String thread
;
47 protected Date timestamp
;
50 private String location
;
52 /** Empty constructor */
53 public ExecutionStep() {
54 Thread currentThread
= Thread
.currentThread();
55 thread
= currentThread
.getName();
58 /** Creates a step at the current date */
59 public ExecutionStep(String location
, String type
, String log
) {
60 this(location
, new Date(), type
, log
);
63 /** Creates a step of the given type. */
64 public ExecutionStep(String location
, Date timestamp
, String type
,
66 this(location
, timestamp
, type
, log
, Thread
.currentThread().getName());
69 public ExecutionStep(String location
, Date timestamp
, String type
,
70 String log
, String thread
) {
71 this.location
= location
;
73 this.timestamp
= timestamp
;
75 this.log
= addLog(log
);
78 public String
getType() {
82 public Date
getTimestamp() {
86 public String
getThread() {
91 * Return the string that should be stored in the log field. Can be null if
92 * another mechanism is used to store log lines.
94 protected String
addLog(String log
) {
98 public String
getLog() {
103 public String
toString() {
104 return "Execution step, thread=" + thread
+ ", type=" + type
;
107 /** Typically the logging category */
108 public String
getLocation() {