@@ -82,6 +82,9 @@ public class Config {
82
82
private final String emailAttachExtEnc ;
83
83
private final int emailAttachMaxSize ;
84
84
85
+ private final String pidFile ;
86
+ private final boolean pidFileKeep ;
87
+
85
88
public Config (String propertiesFileName ) throws IOException {
86
89
Properties config = new Properties ();
87
90
config .load (new FileInputStream (propertiesFileName ));
@@ -165,133 +168,145 @@ public Config(String propertiesFileName) throws IOException {
165
168
emailAttachExtEnc = checkExt (s .isEmpty () ? ".enc" : s );
166
169
s = config .getProperty ("email.attach.max.size" , "" );
167
170
emailAttachMaxSize = s .isEmpty () ? 5 : Integer .parseInt (s );
171
+
172
+ pidFile = config .getProperty ("pid.file" , "" );
173
+ s = config .getProperty ("pid.file.keep" , "" );
174
+ pidFileKeep = !s .isEmpty () && Boolean .parseBoolean (s );
168
175
}
169
176
170
- public String getEwsEmail () {
177
+ String getEwsEmail () {
171
178
return ewsEmail ;
172
179
}
173
180
174
- public String getEwsDomain () {
181
+ String getEwsDomain () {
175
182
return ewsDomain ;
176
183
}
177
184
178
- public String getEwsUsername () {
185
+ String getEwsUsername () {
179
186
return ewsUsername ;
180
187
}
181
188
182
- public String getEwsPassword () {
189
+ String getEwsPassword () {
183
190
return ewsPassword ;
184
191
}
185
192
186
- public String getEwsServer () {
193
+ String getEwsServer () {
187
194
return ewsServer ;
188
195
}
189
196
190
- public int getEwsViewSize () {
197
+ int getEwsViewSize () {
191
198
return ewsViewSize ;
192
199
}
193
200
194
- public int getEwsSubscriptionLifetime () {
201
+ int getEwsSubscriptionLifetime () {
195
202
return ewsSubscriptionLifetime ;
196
203
}
197
204
198
- public String getProxyHost () {
205
+ String getProxyHost () {
199
206
return proxyHost ;
200
207
}
201
208
202
- public int getProxyPort () {
209
+ int getProxyPort () {
203
210
return proxyPort ;
204
211
}
205
212
206
- public String getProxyUsername () {
213
+ String getProxyUsername () {
207
214
return proxyUsername ;
208
215
}
209
216
210
- public String getProxyPassword () {
217
+ String getProxyPassword () {
211
218
return proxyPassword ;
212
219
}
213
220
214
- public String getProxyDomain () {
221
+ String getProxyDomain () {
215
222
return proxyDomain ;
216
223
}
217
224
218
- public String getOutboxFolder () {
225
+ String getOutboxFolder () {
219
226
return outboxFolder ;
220
227
}
221
228
222
- public boolean isOutboxCleanup () {
229
+ boolean isOutboxCleanup () {
223
230
return outboxCleanup ;
224
231
}
225
232
226
- public String getOutboxFileRegexp () {
233
+ String getOutboxFileRegexp () {
227
234
return outboxFileRegexp ;
228
235
}
229
236
230
- public String getInboxFolder () {
237
+ String getInboxFolder () {
231
238
return inboxFolder ;
232
239
}
233
240
234
- public String getInboxScript () {
241
+ String getInboxScript () {
235
242
return inboxScript ;
236
243
}
237
244
238
- public int getInboxScriptStopCode () {
245
+ int getInboxScriptStopCode () {
239
246
return inboxScriptStopCode ;
240
247
}
241
248
242
- public boolean isEmailInboxCleanup () {
249
+ boolean isEmailInboxCleanup () {
243
250
return emailInboxCleanup ;
244
251
}
245
252
246
- public String getEmailTagIncoming () {
253
+ String getEmailTagIncoming () {
247
254
return emailTagIncoming ;
248
255
}
249
256
250
- public String getEmailTagOutgoing () {
257
+ String getEmailTagOutgoing () {
251
258
return emailTagOutgoing ;
252
259
}
253
260
254
- public MessageFormat getEmailSubjectFormat () {
261
+ MessageFormat getEmailSubjectFormat () {
255
262
return emailSubjectFormat ;
256
263
}
257
264
258
- public MessageFormat getEmailBodyFormat () {
265
+ MessageFormat getEmailBodyFormat () {
259
266
return emailBodyFormat ;
260
267
}
261
268
262
- public String [] getEmailRecipientsTo () {
269
+ String [] getEmailRecipientsTo () {
263
270
return emailRecipientsTo ;
264
271
}
265
272
266
- public String [] getEmailRecipientsCc () {
273
+ String [] getEmailRecipientsCc () {
267
274
return emailRecipientsCc ;
268
275
}
269
276
270
- public String [] getEmailRecipientsBcc () {
277
+ String [] getEmailRecipientsBcc () {
271
278
return emailRecipientsBcc ;
272
279
}
273
280
274
- public String getEmailAttachPassword () {
281
+ String getEmailAttachPassword () {
275
282
return emailAttachPassword ;
276
283
}
277
284
278
- public boolean isEmailAttachGzip () {
285
+ boolean isEmailAttachGzip () {
279
286
return emailAttachGzip ;
280
287
}
281
288
282
- public String getEmailAttachExtGzip () {
289
+ String getEmailAttachExtGzip () {
283
290
return emailAttachExtGzip ;
284
291
}
285
292
286
- public String getEmailAttachExtEnc () {
293
+ String getEmailAttachExtEnc () {
287
294
return emailAttachExtEnc ;
288
295
}
289
296
290
- public int getEmailAttachMaxSize () {
297
+ int getEmailAttachMaxSize () {
291
298
return emailAttachMaxSize ;
292
299
}
293
300
294
- public Map <String , String > asEnvironmentMap () {
301
+ String getPidFile () {
302
+ return pidFile ;
303
+ }
304
+
305
+ boolean isPidFileKeep () {
306
+ return pidFileKeep ;
307
+ }
308
+
309
+ Map <String , String > asEnvironmentMap () {
295
310
Map <String , String > result = new HashMap <>();
296
311
result .put ("EWS_EMAIL" , ewsEmail );
297
312
result .put ("EWS_DOMAIN" , ewsDomain );
@@ -324,6 +339,8 @@ public Map<String, String> asEnvironmentMap() {
324
339
result .put ("EMAIL_ATTACH_EXT_GZIP" , emailAttachExtGzip );
325
340
result .put ("EMAIL_ATTACH_EXT_ENC" , emailAttachExtEnc );
326
341
result .put ("EMAIL_ATTACH_MAX_SIZE" , "" + emailAttachMaxSize );
342
+ result .put ("PID_FILE" , pidFile );
343
+ result .put ("PID_FILE_KEEP" , "" + pidFileKeep );
327
344
return result ;
328
345
}
329
346
@@ -367,6 +384,8 @@ public String toString() {
367
384
",\n \t emailAttachExtGzip='" + emailAttachExtGzip + '\'' +
368
385
",\n \t emailAttachExtEnc='" + emailAttachExtEnc + '\'' +
369
386
",\n \t emailAttachMaxSize=" + emailAttachMaxSize +
387
+ ",\n \t pidFile='" + pidFile + '\'' +
388
+ ",\n \t pidFileKeep=" + pidFileKeep +
370
389
'}' ;
371
390
}
372
391
}
0 commit comments