blob: eef1257db89655d12798624d5af037cc511f11e4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*
* Created on Aug 3, 2011
*
* PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
*/
package org.eclipse.osee.framework.core.client.internal;
import java.util.logging.Level;
import org.eclipse.osee.framework.logging.BaseStatus;
import org.eclipse.osee.framework.logging.OseeLog;
abstract class OseeServer {
private boolean isAlive;
private String message = "";
private final String name;
private Exception exception;
private Level level = Level.INFO;
public OseeServer(String serverName) {
this.name = serverName;
}
public void set(Level level, Exception ex, String message) {
this.level = level;
this.message = message;
this.exception = ex;
}
public String getName() {
return name;
}
public void setAlive(boolean isServerAlive) {
this.isAlive = isServerAlive;
}
public Exception getException() {
return exception;
}
public Level getLevel() {
return level;
}
public void reset() {
message = null;
level = null;
exception = null;
isAlive = false;
}
public String getMessage() {
return message;
}
public boolean isAlive() {
return isAlive;
}
public String report() {
OseeLog.reportStatus(new BaseStatus(getName(), level, message, getException()));
OseeLog.log(OseeApplicationServer.class, level, message, getException());
return String.format("%s: %s %s", level, message,
(getException() != null ? "[" + getException().getLocalizedMessage() + "]" : ""));
}
}
|