]>
git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionStep.java
2 * Copyright (C) 2007-2012 Argeo GmbH
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.
16 package org
.argeo
.slc
.execution
;
18 import java
.io
.Serializable
;
19 import java
.util
.Date
;
22 * An atomic step to be notified in during an {@link ExecutionProcess}. Can be a
23 * log or the start/end of a phase, etc.
25 public class ExecutionStep
implements Serializable
{
26 private static final long serialVersionUID
= 798640526532912161L;
28 public final static String PHASE_START
= "PHASE_START";
29 public final static String PHASE_END
= "PHASE_END";
30 public final static String ERROR
= "ERROR";
31 public final static String WARNING
= "WARNING";
32 public final static String INFO
= "INFO";
33 public final static String DEBUG
= "DEBUG";
34 public final static String TRACE
= "TRACE";
37 public final static String START
= "START";
39 public final static String END
= "END";
41 // TODO make the fields final and private when we don't need POJO support
43 // is when SlcExecutionStep is removed)
44 protected String type
;
45 protected String thread
;
46 protected Date timestamp
;
49 private String location
;
51 /** Empty constructor */
52 public ExecutionStep() {
53 Thread currentThread
= Thread
.currentThread();
54 thread
= currentThread
.getName();
57 /** Creates a step at the current date */
58 public ExecutionStep(String location
, String type
, String log
) {
59 this(location
, new Date(), type
, log
);
62 /** Creates a step of the given type. */
63 public ExecutionStep(String location
, Date timestamp
, String type
,
65 this(location
, timestamp
, type
, log
, Thread
.currentThread().getName());
68 public ExecutionStep(String location
, Date timestamp
, String type
,
69 String log
, String thread
) {
70 this.location
= location
;
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
;
106 /** Typically the logging category */
107 public String
getLocation() {