Child: [r23] (diff)

Download this file

is.java    200 lines (173 with data), 5.8 kB

  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
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
package definitions;
/*
* Provides static definitions that we can use in other classes
*/
/**
*
* @author Nuno Brito, 7th of December 2012 in Darmstadt, Germany.
*/
public class is {
final public static String
defaultIcon = "validation3check.png",
plugin = "Plugin",
extension = "FileExtension",
license = "License",
methodStartUp = "startup",
script = "script",
project = "project",
settings = "settings",
folderSPDX = "folderSPDX",
library = "library",
products = "products",
textStart = "<text>",
textEnd = "</text>",
iconFolder = "icons",
contentHTML = "text/html",
contentText = "text/plain",
methodDefault = "main",
methodExecute = "x",
ID = "id";
// related to processes
public final static int
// things we really need
COMMAND = 1000,
HOOK = 1001,
// related to processes
MAINTENANCE = 4,
LISTENING = 3,
RUNNING = 2,
ACTIVE = 2,
STARTING = 1,
SUSPENDED = 1,
PAUSED = 1,
INACTIVE = 0,
STOPPED = 0,
ERROR = -1,
FAILED = -5,
// related to log entry types
INFO = 30,
DEBUG = 31,
EXTRA = 32,
ROUTINE = 33,
WARNING = 34,
CREDITS = 35,
ABORTED = 36,
//ERROR = 30, defined previously, no problem in using the same
// related to messages
COMPLETED = 20,
ACCEPTED = 10,
FORGET = 6,
PENDING = 5,
EXPIRED = 4,
IGNORED = 3,
TIMEOUT = -10,
REFUSED = -2,
CONFLICT = -3,
INVALID = -4,
// ongoing actions (all things that end at "ing")
ADDING = 500,
REMOVING = 501,
INSTALLING = 502,
FIXING = 503,
DELETING = 504,
COPYING = 505,
CREATING = 506,
EXTRACTING = 507,
OPENING = 508,
CLOSING = 509,
// related to status commands
START = 100,
RESUME = 103,
CLOSE = 104,
// web like
NOTFOUND = 404,
TEST = 311;
/**
* Provide a textual representation of our system status value
* @param status
* @return
*/
public static String translateStatus(String status){
return translated(Integer.parseInt(status));
}
public static String translated(int status){
String s;
switch (status) {
case is.ADDING: s = "ADDING"; break;
case is.REMOVING: s = "REMOVING"; break;
case is.INSTALLING: s = "INSTALLING"; break;
case is.FIXING: s = "FIXING"; break;
case is.DELETING: s = "DELETING"; break;
case is.COPYING: s = "COPYING"; break;
case is.CREATING: s = "CREATING"; break;
case is.EXTRACTING: s = "EXTRACTING"; break;
case is.OPENING: s = "OPENING"; break;
case is.CLOSING: s = "CLOSING"; break;
case is.COMPLETED:
s = "COMPLETED";
break;
case is.PENDING:
s = "PENDING";
break;
case is.NOTFOUND:
s = "NOT FOUND";
break;
case is.COMMAND:
s = "COMMAND";
break;
case is.EXPIRED:
s = "EXPIRED";
break;
case is.TIMEOUT:
s = "TIMEOUT";
break;
case is.REFUSED:
s = "REFUSED";
break;
case is.FAILED:
s = "FAILED";
break;
case is.ERROR:
s = "ERROR";
break;
case is.INVALID:
s = "INVALID";
break;
case is.STOPPED:
s = "STOPPED";
break;
case is.RUNNING:
s = "RUNNING";
break;
case is.PAUSED:
s = "PAUSED";
break;
case is.RESUME:
s = "RESUME";
break;
case is.TEST:
s = "TEST";
break;
case is.IGNORED:
s = "IGNORED";
break;
case is.HOOK:
s = "HOOK";
break;
case is.ABORTED:
s = "ABORTED";
break;
case is.INFO: s = "INFO"; break;
case is.CREDITS: s = "CREDITS"; break;
case is.DEBUG: s = "DEBUG"; break;
case is.EXTRA: s = "EXTRA"; break;
case is.ROUTINE: s = "ROUTINE"; break;
case is.WARNING: s = "WARNING"; break;
case is.ACCEPTED: s = "ACCEPTED"; break;
default:
s = Integer.toString(status);
break;
}
return s;
}
}