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 package fr.paris.lutece.portal.service.daemon;
35
36 import java.text.SimpleDateFormat;
37 import java.util.Date;
38 import java.util.Locale;
39
40 import fr.paris.lutece.portal.service.spring.SpringContextService;
41
42
43
44
45 public final class DaemonEntry
46 {
47 private SimpleDateFormat _formatterDateTime = new SimpleDateFormat( "dd'/'MM'/'yyyy' 'HH':'mm", Locale.FRANCE );
48 private String _strId;
49 private String _strNameKey;
50 private String _strDescriptionKey;
51 private String _strClassName;
52 private Date _dateLastRunDate;
53 private String _strLastRunLogs;
54 private long _lInterval;
55 private boolean _bOnStartup;
56 private boolean _bIsRunning;
57 private Daemon _daemon;
58 private final DaemonThread _thread;
59 private String _strPluginName;
60
61
62
63
64
65
66 public DaemonEntry( )
67 {
68 _thread = SpringContextService.getBean( DaemonThread.DEAMON_THREAD_BEAN_NAME );
69 _thread.setDaemonEntry( this );
70 }
71
72
73
74
75
76
77 public String getId( )
78 {
79 return _strId;
80 }
81
82
83
84
85
86
87
88 public void setId( String strId )
89 {
90 _strId = strId;
91 }
92
93
94
95
96
97
98 public String getNameKey( )
99 {
100 return _strNameKey;
101 }
102
103
104
105
106
107
108
109 public void setNameKey( String strNameKey )
110 {
111 _strNameKey = strNameKey;
112 }
113
114
115
116
117
118
119 public String getDescriptionKey( )
120 {
121 return _strDescriptionKey;
122 }
123
124
125
126
127
128
129
130 public void setDescriptionKey( String strDescriptionKey )
131 {
132 _strDescriptionKey = strDescriptionKey;
133 }
134
135
136
137
138
139
140 public String getClassName( )
141 {
142 return _strClassName;
143 }
144
145
146
147
148
149
150
151 public void setClassName( String strClassName )
152 {
153 _strClassName = strClassName;
154 }
155
156
157
158
159
160
161
162
163
164
165
166 public void loadDaemon( ) throws ClassNotFoundException, InstantiationException, IllegalAccessException
167 {
168 _daemon = (Daemon) Class.forName( _strClassName ).newInstance( );
169 }
170
171
172
173
174
175
176 protected Daemon getDaemon( )
177 {
178 return _daemon;
179 }
180
181
182
183
184
185
186 public DaemonThread getDaemonThread( )
187 {
188 return _thread;
189 }
190
191
192
193
194
195
196 public long getInterval( )
197 {
198 return _lInterval;
199 }
200
201
202
203
204
205
206 public boolean onStartup( )
207 {
208 return _bOnStartup;
209 }
210
211
212
213
214
215
216 public boolean isRunning( )
217 {
218 return _bIsRunning;
219 }
220
221
222
223
224
225
226
227 public void setIsRunning( boolean bIsRunning )
228 {
229 _bIsRunning = bIsRunning;
230 }
231
232
233
234
235
236
237 public String getPluginName( )
238 {
239 return _strPluginName;
240 }
241
242
243
244
245
246
247
248 public void setPluginName( String strPluginName )
249 {
250 _strPluginName = strPluginName;
251 }
252
253
254
255
256
257
258 public String getLastRunDate( )
259 {
260 if ( _dateLastRunDate == null )
261 {
262 return "";
263 }
264 return _formatterDateTime.format( new Date( _dateLastRunDate.getTime( ) ) );
265 }
266
267
268
269
270
271
272
273 public void setLastRunDate( Date dateLastRunDate )
274 {
275 _dateLastRunDate = dateLastRunDate;
276 }
277
278
279
280
281
282
283 public String getLastRunLogs( )
284 {
285 return ( _strLastRunLogs != null ) ? _strLastRunLogs : "";
286 }
287
288
289
290
291
292
293
294 public void setLastRunLogs( String strLastRunLogs )
295 {
296 _strLastRunLogs = strLastRunLogs;
297 }
298
299
300
301
302
303
304
305 public void setInterval( long lInterval )
306 {
307 _lInterval = lInterval;
308 }
309
310
311
312
313
314
315
316 public void setOnStartUp( boolean bOnStartup )
317 {
318 _bOnStartup = bOnStartup;
319 }
320 }