]>
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 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 /** Empty constructor */
51 public ExecutionStep() {
52 thread
= Thread
.currentThread().getName();
55 /** Creates a step at the current date of type INFO */
56 public ExecutionStep(String log
) {
57 this(new Date(), INFO
, log
);
60 /** Creates a step at the current date */
61 public ExecutionStep(String type
, String log
) {
62 this(new Date(), type
, log
);
65 /** Creates a step of the given type. */
66 public ExecutionStep(Date timestamp
, String type
, String log
) {
67 this(timestamp
, type
, log
, Thread
.currentThread().getName());
70 public ExecutionStep(Date timestamp
, String type
, String log
, String thread
) {
72 this.timestamp
= timestamp
;
74 this.log
= addLog(log
);
77 public String
getType() {
81 public Date
getTimestamp() {
85 public String
getThread() {
90 * Return the string that should be stored in the log field. Can be null if
91 * another mechanism is used to store log lines.
93 protected String
addLog(String log
) {
97 public String
getLog() {
102 public String
toString() {
103 return "Execution step, thread=" + thread
+ ", type=" + type
;