OW2 Consortium jonas

Rev

Rev 22396 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 22396 Rev 22426
1
/**
1
/**
2
 * JOnAS Configurator
2
 * JOnAS Configurator
3
 * Copyright (C) 2008-2010 Bull S.A.S.
3
 * Copyright (C) 2008-2010 Bull S.A.S.
4
 * Copyright (C) 2008-2010 France Telecom R&D
4
 * Copyright (C) 2008-2010 France Telecom R&D
5
 * Contact: jonas-team@ow2.org
5
 * Contact: jonas-team@ow2.org
6
 *
6
 *
7
 * This library is free software; you can redistribute it and/or
7
 * This library is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
9
 * License as published by the Free Software Foundation; either
10
 * version 2.1 of the License, or any later version.
10
 * version 2.1 of the License, or any later version.
11
 *
11
 *
12
 * This library is distributed in the hope that it will be useful,
12
 * This library is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
15
 * Lesser General Public License for more details.
16
 *
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with this library; if not, write to the Free Software
18
 * License along with this library; if not, write to the Free Software
19
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
19
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
20
 * USA
20
 * USA
21
 *
21
 *
22
 * --------------------------------------------------------------------------
22
 * --------------------------------------------------------------------------
23
 * $Id: Jonas53.java 22396 2012-04-25 07:51:54Z cazauxj $
-
 
-
 
23
 * $Id: Jonas53.java 22426 2012-05-04 17:05:04Z cazauxj $
24
 * --------------------------------------------------------------------------
24
 * --------------------------------------------------------------------------
25
 */
25
 */
26
package org.ow2.jonas.tools.configurator.impl;
26
package org.ow2.jonas.tools.configurator.impl;
27

27

28
import java.io.File;
28
import java.io.File;
29
import java.io.FileInputStream;
29
import java.io.FileInputStream;
30
import java.io.IOException;
30
import java.io.IOException;
31
import java.io.InputStream;
31
import java.io.InputStream;
32
import java.io.OutputStream;
32
import java.io.OutputStream;
33
import java.io.PrintStream;
33
import java.io.PrintStream;
34
import java.lang.reflect.Method;
34
import java.lang.reflect.Method;
35
import java.lang.reflect.Modifier;
35
import java.lang.reflect.Modifier;
36
import java.net.MalformedURLException;
36
import java.net.MalformedURLException;
37
import java.net.URISyntaxException;
37
import java.net.URISyntaxException;
38
import java.net.URL;
38
import java.net.URL;
39
import java.net.URLClassLoader;
39
import java.net.URLClassLoader;
40
import java.util.ArrayList;
40
import java.util.ArrayList;
41
import java.util.Enumeration;
41
import java.util.Enumeration;
42
import java.util.List;
42
import java.util.List;
43
import java.util.Map;
43
import java.util.Map;
44
import java.util.Properties;
44
import java.util.Properties;
45
import java.util.SortedSet;
45
import java.util.SortedSet;
46
import java.util.TreeSet;
46
import java.util.TreeSet;
47
import java.util.jar.JarEntry;
47
import java.util.jar.JarEntry;
48
import java.util.jar.JarFile;
48
import java.util.jar.JarFile;
49
import java.util.logging.Logger;
49
import java.util.logging.Logger;
50

50

51
import org.apache.tools.ant.Project;
51
import org.apache.tools.ant.Project;
52
import org.apache.tools.ant.listener.TimestampedLogger;
52
import org.apache.tools.ant.listener.TimestampedLogger;
53
import org.ow2.jonas.antmodular.cluster.clusterdaemon.ClusterDaemon;
53
import org.ow2.jonas.antmodular.cluster.clusterdaemon.ClusterDaemon;
54
import org.ow2.jonas.antmodular.cmi.Cmi;
54
import org.ow2.jonas.antmodular.cmi.Cmi;
55
import org.ow2.jonas.antmodular.jonasbase.bootstrap.JOnASBaseTask;
55
import org.ow2.jonas.antmodular.jonasbase.bootstrap.JOnASBaseTask;
56
import org.ow2.jonas.antmodular.jonasbase.bootstrap.JonasProperties;
56
import org.ow2.jonas.antmodular.jonasbase.bootstrap.JonasProperties;
57
import org.ow2.jonas.antmodular.jonasbase.bootstrap.Services;
57
import org.ow2.jonas.antmodular.jonasbase.bootstrap.Services;
58
import org.ow2.jonas.antmodular.jonasbase.carol.Carol;
58
import org.ow2.jonas.antmodular.jonasbase.carol.Carol;
59
import org.ow2.jonas.antmodular.jonasbase.db.base.Db;
59
import org.ow2.jonas.antmodular.jonasbase.db.base.Db;
60
import org.ow2.jonas.antmodular.jonasbase.db.h2.DbH2;
60
import org.ow2.jonas.antmodular.jonasbase.db.h2.DbH2;
61
import org.ow2.jonas.antmodular.jonasbase.discovery.multicast.DiscoveryMulticast;
61
import org.ow2.jonas.antmodular.jonasbase.discovery.multicast.DiscoveryMulticast;
62
import org.ow2.jonas.antmodular.jonasbase.ha.Ha;
62
import org.ow2.jonas.antmodular.jonasbase.ha.Ha;
63
import org.ow2.jonas.antmodular.jonasbase.jms.Jms;
63
import org.ow2.jonas.antmodular.jonasbase.jms.Jms;
64
import org.ow2.jonas.antmodular.jonasbase.mail.Mail;
64
import org.ow2.jonas.antmodular.jonasbase.mail.Mail;
65
import org.ow2.jonas.antmodular.jonasbase.resource.JdbcXml;
65
import org.ow2.jonas.antmodular.jonasbase.resource.JdbcXml;
66
import org.ow2.jonas.antmodular.jonasbase.security.User;
66
import org.ow2.jonas.antmodular.jonasbase.security.User;
67
import org.ow2.jonas.antmodular.jonasbase.security.Jaas;
67
import org.ow2.jonas.antmodular.jonasbase.security.Jaas;
68
import org.ow2.jonas.antmodular.jonasbase.smartclient.SmartClient;
68
import org.ow2.jonas.antmodular.jonasbase.smartclient.SmartClient;
69
import org.ow2.jonas.antmodular.jonasbase.web.tomcat.TomcatSessionManager;
69
import org.ow2.jonas.antmodular.jonasbase.web.tomcat.TomcatSessionManager;
70
import org.ow2.jonas.antmodular.jonasbase.wsdl.WsdlPublish;
70
import org.ow2.jonas.antmodular.jonasbase.wsdl.WsdlPublish;
71
import org.ow2.jonas.antmodular.web.base.Ajp;
71
import org.ow2.jonas.antmodular.web.base.Ajp;
72
import org.ow2.jonas.antmodular.web.base.Connectors;
72
import org.ow2.jonas.antmodular.web.base.Connectors;
73
import org.ow2.jonas.antmodular.web.base.Http;
73
import org.ow2.jonas.antmodular.web.base.Http;
74
import org.ow2.jonas.antmodular.web.base.Https;
74
import org.ow2.jonas.antmodular.web.base.Https;
75
import org.ow2.jonas.antmodular.web.base.SessionReplication;
75
import org.ow2.jonas.antmodular.web.base.SessionReplication;
76
import org.ow2.jonas.antmodular.web.base.WebContainer;
76
import org.ow2.jonas.antmodular.web.base.WebContainer;
77
import org.ow2.jonas.tools.configurator.api.JDBCConfiguration;
77
import org.ow2.jonas.tools.configurator.api.JDBCConfiguration;
78
import org.ow2.jonas.tools.configurator.api.JdbcXMLConfiguration;
78
import org.ow2.jonas.tools.configurator.api.JdbcXMLConfiguration;
79
import org.ow2.jonas.tools.configurator.api.JonasConfigurator;
79
import org.ow2.jonas.tools.configurator.api.JonasConfigurator;
80

80

81
/**
81
/**
82
 * JonasConfigurator implementation for Jonas 5.3.x
82
 * JonasConfigurator implementation for Jonas 5.3.x
83
 * 
83
 * 
84
 * @author S. Ali Tokmen
84
 * @author S. Ali Tokmen
85
 * @author Jeremy Cazaux (support to extensible parameters according to a specific implementation)
85
 * @author Jeremy Cazaux (support to extensible parameters according to a specific implementation)
86
 */
86
 */
87
public class Jonas53 extends FileReplacerHelper implements JonasConfigurator {
87
public class Jonas53 extends FileReplacerHelper implements JonasConfigurator {
88

88

89
    /**
89
    /**
90
     * JONAS_BASE
90
     * JONAS_BASE
91
     */
91
     */
92
    private File jonasFileBase;
92
    private File jonasFileBase;
93

93

94
    /**
94
    /**
95
     * Link to the jonas ant task
95
     * Link to the jonas ant task
96
     */
96
     */
97
    private JOnASBaseTask jonasBase;
97
    private JOnASBaseTask jonasBase;
98

98

99
    /**
99
    /**
100
     * To configure databases service
100
     * To configure databases service
101
     */
101
     */
102
    private DbH2 db;
102
    private DbH2 db;
103

103

104
    /**
104
    /**
105
     * The cluster daemon configuration
105
     * The cluster daemon configuration
106
     */
106
     */
107
    private ClusterDaemon clusterDaemon;
107
    private ClusterDaemon clusterDaemon;
108

108

109
    /**
109
    /**
110
     * Configuration logger
110
     * Configuration logger
111
     */
111
     */
112
    private static Logger logger = Logger.getLogger(Jonas53.class.getName());
112
    private static Logger logger = Logger.getLogger(Jonas53.class.getName());
113

113

114
    /**
114
    /**
115
     * To configure protocols
115
     * To configure protocols
116
     */
116
     */
117
    private Carol carol;
117
    private Carol carol;
118

118

119
    /**
119
    /**
120
     * Has JOnAS protocols list been set?
120
     * Has JOnAS protocols list been set?
121
     */
121
     */
122
    private boolean isProtocolsListSet = false;
122
    private boolean isProtocolsListSet = false;
123

123

124
    /**
124
    /**
125
     * To configure discovery sevice
125
     * To configure discovery sevice
126
     */
126
     */
127
    private DiscoveryMulticast discovery;
127
    private DiscoveryMulticast discovery;
128

128

129
    /**
129
    /**
130
     * JDBC resources
130
     * JDBC resources
131
     */
131
     */
132
    private List<JdbcXml> jdbcXmlList;
132
    private List<JdbcXml> jdbcXmlList;
133

133

134
    /**
134
    /**
135
     * To configure jms
135
     * To configure jms
136
     */
136
     */
137
    private Jms jms;
137
    private Jms jms;
138

138

139
    /**
139
    /**
140
     * To configure jonas global properties
140
     * To configure jonas global properties
141
     */
141
     */
142
    private JonasProperties jonasProperties;
142
    private JonasProperties jonasProperties;
143

143

144
    /**
144
    /**
145
     * To configure mails
145
     * To configure mails
146
     */
146
     */
147
    private List<Mail> mails; 
147
    private List<Mail> mails; 
148

148

149
    /**
149
    /**
150
     * To configure active services
150
     * To configure active services
151
     */
151
     */
152
    private Services services;
152
    private Services services;
153

153

154
    /**
154
    /**
155
     * To configure web container
155
     * To configure web container
156
     */
156
     */
157
    private String webContainer;
157
    private String webContainer;
158

158

159
    /**
159
    /**
160
     * To configure web container
160
     * To configure web container
161
     */
161
     */
162
    private String jvmRoute;
162
    private String jvmRoute;
163

163

164
    /**
164
    /**
165
     * To configure the algorithm of the web session replication
165
     * To configure the algorithm of the web session replication
166
     */
166
     */
167
    private String sessionReplicationAlgorithm;
167
    private String sessionReplicationAlgorithm;
168

168

169
    /**
169
    /**
170
     * Cluster name of the web session replication
170
     * Cluster name of the web session replication
171
     */
171
     */
172
    private String sessionReplicationClusterName;
172
    private String sessionReplicationClusterName;
173

173

174
    /**
174
    /**
175
     * Multicast address usefull to configure the web session replication
175
     * Multicast address usefull to configure the web session replication
176
     */
176
     */
177
    private String sessionReplicationMulticastAddress;
177
    private String sessionReplicationMulticastAddress;
178

178

179
    /**
179
    /**
180
     * Multicast port usefull to configure the web session replication
180
     * Multicast port usefull to configure the web session replication
181
     */
181
     */
182
    private String sessionReplicationMulticastPort;
182
    private String sessionReplicationMulticastPort;
183

183

184
    /**
184
    /**
185
     * Listen port usefull to configure the web session replication
185
     * Listen port usefull to configure the web session replication
186
     */
186
     */
187
    private String sessionReplicationListenPort;
187
    private String sessionReplicationListenPort;
188

188

189
    /**
189
    /**
190
     * To configure wsdl wsdlPublisherFile
190
     * To configure wsdl wsdlPublisherFile
191
     */
191
     */
192
    private org.ow2.jonas.antmodular.jonasbase.wsdl.File wsdlPublisherFile;
192
    private org.ow2.jonas.antmodular.jonasbase.wsdl.File wsdlPublisherFile;
193

193

194
    /**
194
    /**
195
     * To configure WSDL publishing
195
     * To configure WSDL publishing
196
     */
196
     */
197
    private WsdlPublish wsdlPublish;
197
    private WsdlPublish wsdlPublish;
198

198

199
    /**
199
    /**
200
     * To configure ejb clustering
200
     * To configure ejb clustering
201
     */
201
     */
202
    private Cmi cmi;
202
    private Cmi cmi;
203

203

204
    /**
204
    /**
205
     * To configure ha cluster
205
     * To configure ha cluster
206
     */
206
     */
207
    private Ha ha;
207
    private Ha ha;
208

208

209
    /**
209
    /**
210
     * To configure the smartclient service
210
     * To configure the smartclient service
211
     */
211
     */
212
    private SmartClient smartClient;
212
    private SmartClient smartClient;
213

213

214
    /**
214
    /**
215
     * To configure the security
215
     * To configure the security
216
     */
216
     */
217
    private Jaas security;
217
    private Jaas security;
218

218

219
    /**
219
    /**
220
     * The project, not really usefull, only to have a project to pass to ant
220
     * The project, not really usefull, only to have a project to pass to ant
221
     * task.
221
     * task.
222
     */
222
     */
223
    private Project project;
223
    private Project project;
224

224

225
    /**
225
    /**
226
     * Is jonas root set
226
     * Is jonas root set
227
     */
227
     */
228
    private boolean isJonasRootSet = false;
228
    private boolean isJonasRootSet = false;
229

229

230
    /**
230
    /**
231
     * Is jonas base set
231
     * Is jonas base set
232
     */
232
     */
233
    private boolean isJonasBaseSet = false;
233
    private boolean isJonasBaseSet = false;
234

234

235
    /**
235
    /**
236
     * Is http webservice activated
236
     * Is http webservice activated
237
     */
237
     */
238
    private Boolean isHttpActivated = false;
238
    private Boolean isHttpActivated = false;
239

239

240
    /**
240
    /**
241
     * Is https webservice activated
241
     * Is https webservice activated
242
     */
242
     */
243
    private Boolean isHttpsActivated = false;
243
    private Boolean isHttpsActivated = false;
244

244

245
    /**
245
    /**
246
     * Is ajp webservice activated
246
     * Is ajp webservice activated
247
     */
247
     */
248
    private Boolean isAjpActivated = false;
248
    private Boolean isAjpActivated = false;
249

249

250
    /**
250
    /**
251
     * Is http replication webservice activated
251
     * Is http replication webservice activated
252
     */
252
     */
253
    private Boolean isHttpReplicationActivated = false;
253
    private Boolean isHttpReplicationActivated = false;
254

254

255
    /**
255
    /**
256
     * Is http session manager activated (only usefull for tomcat7 currently)
256
     * Is http session manager activated (only usefull for tomcat7 currently)
257
     */
257
     */
258
    private Boolean isHttpSessionManagerActivated = false;
258
    private Boolean isHttpSessionManagerActivated = false;
259

259

260
    /**
260
    /**
261
     * Is web on demand activated
261
     * Is web on demand activated
262
     */
262
     */
263
    private Boolean isWebOnDemandActivated = false;
263
    private Boolean isWebOnDemandActivated = false;
264

264

265
    /**
265
    /**
266
     * Web ondemand redirect port
266
     * Web ondemand redirect port
267
     */
267
     */
268
    private String webOnDemandRedirectPort;
268
    private String webOnDemandRedirectPort;
269

269

270
    /**
270
    /**
271
     * The http port to configure
271
     * The http port to configure
272
     */
272
     */
273
    private String httpPort;
273
    private String httpPort;
274

274

275
    /**
275
    /**
276
     * The max http threads to configure
276
     * The max http threads to configure
277
     */
277
     */
278
    private String httpMaxThreads;
278
    private String httpMaxThreads;
279

279

280
    /**
280
    /**
281
     * The min spare threads to configure
281
     * The min spare threads to configure
282
     */
282
     */
283
    private String httpMinSpareThreads;
283
    private String httpMinSpareThreads;
284

284

285
    /**
285
    /**
286
     * The enable http lookups property to configure
286
     * The enable http lookups property to configure
287
     */
287
     */
288
    private Boolean httpEnableLookups;
288
    private Boolean httpEnableLookups;
289

289

290
    /**
290
    /**
291
     * The http connection timeout to configure
291
     * The http connection timeout to configure
292
     */
292
     */
293
    private String httpConnectionTimeout;
293
    private String httpConnectionTimeout;
294

294

295
    /**
295
    /**
296
     * The http accept count to configure
296
     * The http accept count to configure
297
     */
297
     */
298
    private String httpAcceptCount;
298
    private String httpAcceptCount;
299

299

300
    /**
300
    /**
301
     * The max keep alive http request 
301
     * The max keep alive http request 
302
     */
302
     */
303
    private String httpMaxKeepAliveRequest;
303
    private String httpMaxKeepAliveRequest;
304

304

305
    /**
305
    /**
306
     * The http compression
306
     * The http compression
307
     */
307
     */
308
    private String httpCompression;
308
    private String httpCompression;
309

309

310
    /**
310
    /**
311
     * The http redirect port
311
     * The http redirect port
312
     */
312
     */
313
    private String httpRedirectPort;
313
    private String httpRedirectPort;
314

314

315
    /**
315
    /**
316
     * The https port
316
     * The https port
317
     */
317
     */
318
    private String httpsPort;
318
    private String httpsPort;
319

319

320
    /**
320
    /**
321
     * The max https threads
321
     * The max https threads
322
     */
322
     */
323
    private String httpsMaxThreads;
323
    private String httpsMaxThreads;
324

324

325
    /**
325
    /**
326
     * The min spare https threads
326
     * The min spare https threads
327
     */
327
     */
328
    private String httpsMinSpareThreads;
328
    private String httpsMinSpareThreads;
329

329

330
    /**
330
    /**
331
     * The enable https lookups property to configure
331
     * The enable https lookups property to configure
332
     */
332
     */
333
    private Boolean httpsEnableLookups;
333
    private Boolean httpsEnableLookups;
334

334

335
    /**
335
    /**
336
     * The https connection timeout
336
     * The https connection timeout
337
     */
337
     */
338
    private String httpsConnectionTimeout;
338
    private String httpsConnectionTimeout;
339

339

340
    /**
340
    /**
341
     * The https accept count
341
     * The https accept count
342
     */
342
     */
343
    private String httpsAcceptCount;
343
    private String httpsAcceptCount;
344

344

345
    /**
345
    /**
346
     * The max keep alive https requests
346
     * The max keep alive https requests
347
     */
347
     */
348
    private String httpsMaxKeepAliveRequest;
348
    private String httpsMaxKeepAliveRequest;
349

349

350
    /**
350
    /**
351
     * The https compression
351
     * The https compression
352
     */
352
     */
353
    private String httpsCompression;
353
    private String httpsCompression;
354

354

355
    /**
355
    /**
356
     * The https redirect port
356
     * The https redirect port
357
     */
357
     */
358
    private String httpsRedirectPort;
358
    private String httpsRedirectPort;
359

359

360
    /**
360
    /**
361
     * The https keystore file
361
     * The https keystore file
362
     */
362
     */
363
    private String httpsKeystoreFile;
363
    private String httpsKeystoreFile;
364

364

365
    /**
365
    /**
366
     * The https keystore password
366
     * The https keystore password
367
     */
367
     */
368
    private String httpsKeystorePass;
368
    private String httpsKeystorePass;
369

369

370
    /**
370
    /**
371
     * The ajp port
371
     * The ajp port
372
     */
372
     */
373
    private String ajpPort;
373
    private String ajpPort;
374

374

375
    /**
375
    /**
376
     * The max ajp threads
376
     * The max ajp threads
377
     */
377
     */
378
    private String ajpMaxThreads;
378
    private String ajpMaxThreads;
379

379

380
    /**
380
    /**
381
     * The min spare ajp threads
381
     * The min spare ajp threads
382
     */
382
     */
383
    private String ajpMinSpareThreads;
383
    private String ajpMinSpareThreads;
384

384

385
    /**
385
    /**
386
     * The enable ajp lookups property to configure
386
     * The enable ajp lookups property to configure
387
     */
387
     */
388
    private Boolean ajpEnableLookups;
388
    private Boolean ajpEnableLookups;
389

389

390
    /**
390
    /**
391
     * The ajp connection timeout
391
     * The ajp connection timeout
392
     */
392
     */
393
    private String ajpConnectionTimeout;
393
    private String ajpConnectionTimeout;
394

394

395
    /**
395
    /**
396
     * The ajp accept count
396
     * The ajp accept count
397
     */
397
     */
398
    private String ajpAcceptCount;
398
    private String ajpAcceptCount;
399

399

400
    /**
400
    /**
401
     * The ajp redirect port
401
     * The ajp redirect port
402
     */
402
     */
403
    private String ajpRedirectPort;
403
    private String ajpRedirectPort;
404

404

405
    /**
405
    /**
406
     * Max active web sessions
406
     * Max active web sessions
407
     */
407
     */
408
    private String maxActiveSession;
408
    private String maxActiveSession;
409

409

410
    /**
410
    /**
411
     * Database id
411
     * Database id
412
     */
412
     */
413
    private String dbId;
413
    private String dbId;
414

414

415
    /**
415
    /**
416
     * List of users 
416
     * List of users 
417
     */
417
     */
418
    List<User> users;
418
    List<User> users;
419

419

420
    /**
420
    /**
421
     * List of admins
421
     * List of admins
422
     */
422
     */
423
    List<User> admins;
423
    List<User> admins;
424

424

425
    /**
425
    /**
426
     * Wrapper Configurator api
426
     * Wrapper Configurator api
427
     */
427
     */
428
    JOnASWrapper wrapper;
428
    JOnASWrapper wrapper;
429

429

430
    /**
430
    /**
431
     * Derfault constructor
431
     * Derfault constructor
432
     */
432
     */
433
    public Jonas53() {
433
    public Jonas53() {
434
        this.createProject();
434
        this.createProject();
435
        this.jonasBase = new JOnASBaseTask();
435
        this.jonasBase = new JOnASBaseTask();
436
        this.jonasBase.setProject(this.project);
436
        this.jonasBase.setProject(this.project);
437
        this.jonasBase.setSkipDeployablesTemplateCopy(false);
-
 
-
 
437
        this.jonasBase.setSkipOptionalDeployablesCopy(true);
438

438

439
        this.jonasProperties = new JonasProperties();
439
        this.jonasProperties = new JonasProperties();
440
        this.jonasProperties.setProject(this.project);
440
        this.jonasProperties.setProject(this.project);
441

441

442
        this.services = new Services();
442
        this.services = new Services();
443
        this.services.setProject(this.project);
443
        this.services.setProject(this.project);
444

444

445
        this.carol = new Carol();
445
        this.carol = new Carol();
446
        this.carol.setProject(this.project);
446
        this.carol.setProject(this.project);
447

447

448
        this.security = new Jaas();
448
        this.security = new Jaas();
449
        this.security.setProject(this.project);
449
        this.security.setProject(this.project);
450

450

451
        this.jdbcXmlList = new ArrayList<JdbcXml>();
451
        this.jdbcXmlList = new ArrayList<JdbcXml>();
452
        this.mails = new ArrayList<Mail>();
452
        this.mails = new ArrayList<Mail>();
453
        
453
        
454
        this.users = new ArrayList<User>();
454
        this.users = new ArrayList<User>();
455
        this.admins = new ArrayList<User>();
455
        this.admins = new ArrayList<User>();
456

456

457
        Jonas53.logger.finest("Created the JOnAS 5 configurator instance");
457
        Jonas53.logger.finest("Created the JOnAS 5 configurator instance");
458
    }
458
    }
459

459

460
    /**
460
    /**
461
     * Create the project
461
     * Create the project
462
     */
462
     */
463
    private void createProject() {
463
    private void createProject() {
464
        this.project = new Project();
464
        this.project = new Project();
465
        this.project.init();
465
        this.project.init();
466
        this.project.initProperties();
466
        this.project.initProperties();
467

467

468
        TimestampedLogger logger = new TimestampedLogger();
468
        TimestampedLogger logger = new TimestampedLogger();
469
        logger.setMessageOutputLevel(Project.MSG_DEBUG);
469
        logger.setMessageOutputLevel(Project.MSG_DEBUG);
470

470

471
        logger.setOutputPrintStream(new PrintStream(new OutputStream() {
471
        logger.setOutputPrintStream(new PrintStream(new OutputStream() {
472
            StringBuffer buf = new StringBuffer();
472
            StringBuffer buf = new StringBuffer();
473

473

474
            @Override
474
            @Override
475
            public void write(final int b) throws IOException {
475
            public void write(final int b) throws IOException {
476
                if (b == '\n' || b == '\r') {
476
                if (b == '\n' || b == '\r') {
477
                    if (this.buf.length() > 0) {
477
                    if (this.buf.length() > 0) {
478
                        Jonas53.logger.finest(this.buf.toString());
478
                        Jonas53.logger.finest(this.buf.toString());
479
                        this.buf.setLength(0);
479
                        this.buf.setLength(0);
480
                    }
480
                    }
481
                } else {
481
                } else {
482
                    this.buf.append((char) b);
482
                    this.buf.append((char) b);
483
                }
483
                }
484
            }
484
            }
485
        }));
485
        }));
486

486

487
        this.project.addBuildListener(logger);
487
        this.project.addBuildListener(logger);
488
    }
488
    }
489

489

490
    /* ------------------------------- */
490
    /* ------------------------------- */
491
    /* Jonas global parameters */
491
    /* Jonas global parameters */
492
    /**
492
    /**
493
     * {@inheritDoc}
493
     * {@inheritDoc}
494
     */
494
     */
495
    public void setJdk(final String jdk) {
495
    public void setJdk(final String jdk) {
496
        Jonas53.logger.finest("[GlobalParameters] setting jdk : " + jdk);
496
        Jonas53.logger.finest("[GlobalParameters] setting jdk : " + jdk);
497
        NotApplicableHelper.notApplicable("GlobalParameters.Jdk");
497
        NotApplicableHelper.notApplicable("GlobalParameters.Jdk");
498
    }
498
    }
499

499

500
    /**
500
    /**
501
     * {@inheritDoc}
501
     * {@inheritDoc}
502
     */
502
     */
503
    public void setJavaOpts(final String javaOpts) {
503
    public void setJavaOpts(final String javaOpts) {
504
        Jonas53.logger.finest("[GlobalParameters] setting java opts : " + javaOpts);
504
        Jonas53.logger.finest("[GlobalParameters] setting java opts : " + javaOpts);
505
        NotApplicableHelper.notApplicable("GlobalParameters.JavaOpts");
505
        NotApplicableHelper.notApplicable("GlobalParameters.JavaOpts");
506
    }
506
    }
507

507

508
    /**
508
    /**
509
     * {@inheritDoc}
509
     * {@inheritDoc}
510
     */
510
     */
511
    public void setJonasRoot(final String jonasRoot) {
511
    public void setJonasRoot(final String jonasRoot) {
512
        Jonas53.logger.finest("[GlobalParameters] setting jonas root : " + jonasRoot);
512
        Jonas53.logger.finest("[GlobalParameters] setting jonas root : " + jonasRoot);
513
        this.project.setProperty("jonas.root", jonasRoot);
513
        this.project.setProperty("jonas.root", jonasRoot);
514

514

515
        this.isJonasRootSet = true;
515
        this.isJonasRootSet = true;
516
    }
516
    }
517

517

518
    /**
518
    /**
519
     * {@inheritDoc}
519
     * {@inheritDoc}
520
     */
520
     */
521
    public void setJonasBase(final String jonasBase) {
521
    public void setJonasBase(final String jonasBase) {
522
        Jonas53.logger.finest("[GlobalParameters] setting jonas base : " + jonasBase);
522
        Jonas53.logger.finest("[GlobalParameters] setting jonas base : " + jonasBase);
523
        this.jonasFileBase = new File(jonasBase);
523
        this.jonasFileBase = new File(jonasBase);
524
        this.project.setProperty("jonas.base", jonasBase);
524
        this.project.setProperty("jonas.base", jonasBase);
525

525

526
        this.isJonasBaseSet = true;
526
        this.isJonasBaseSet = true;
527
    }
527
    }
528

528

529
    /**
529
    /**
530
     * {@inheritDoc}
530
     * {@inheritDoc}
531
     */
531
     */
532
    public void isJOnASBaseToUpdate(final Boolean update) {
532
    public void isJOnASBaseToUpdate(final Boolean update) {
533
        Jonas53.logger.finest("[GlobalParameters] setting isJonasBaseToUpdate : " + update);
533
        Jonas53.logger.finest("[GlobalParameters] setting isJonasBaseToUpdate : " + update);
534
        if (update != null) {
534
        if (update != null) {
535
            this.jonasBase.setUpdate(update);
535
            this.jonasBase.setUpdate(update);
536
        }
536
        }
537
    }
537
    }
538

538

539
    /**
539
    /**
540
     * {@inheritDoc}
540
     * {@inheritDoc}
541
     */
541
     */
542
    public void setJonasName(final String jonasName) {
542
    public void setJonasName(final String jonasName) {
543
        Jonas53.logger.finest("[GlobalParameters] setting jonas name : " + jonasName);
543
        Jonas53.logger.finest("[GlobalParameters] setting jonas name : " + jonasName);
544
        this.addReplacement("jonas.properties", "jonas.name    jonas", "jonas.name    " + jonasName);
544
        this.addReplacement("jonas.properties", "jonas.name    jonas", "jonas.name    " + jonasName);
545
    }
545
    }
546

546

547
    /**
547
    /**
548
     * {@inheritDoc}
548
     * {@inheritDoc}
549
     */
549
     */
550
    public void setJonasDomain(final String jonasDomain) {
550
    public void setJonasDomain(final String jonasDomain) {
551
        Jonas53.logger.finest("[GlobalParameters] setting jonas domain : " + jonasDomain);
551
        Jonas53.logger.finest("[GlobalParameters] setting jonas domain : " + jonasDomain);
552
        this.addReplacement("jonas.properties", "domain.name    jonas", "domain.name    " + jonasDomain);
552
        this.addReplacement("jonas.properties", "domain.name    jonas", "domain.name    " + jonasDomain);
553
    }
553
    }
554

554

555
    /**
555
    /**
556
     * {@inheritDoc}
556
     * {@inheritDoc}
557
     */
557
     */
558
    public void setHost(final String jonasHost) {
558
    public void setHost(final String jonasHost) {
559
        Jonas53.logger.finest("[GlobalParameters] setting host : " + jonasHost);
559
        Jonas53.logger.finest("[GlobalParameters] setting host : " + jonasHost);
560
        NotApplicableHelper.notApplicable("Host.");
560
        NotApplicableHelper.notApplicable("Host.");
561
    }
561
    }
562

562

563
    /**
563
    /**
564
     * {@inheritDoc}
564
     * {@inheritDoc}
565
     */
565
     */
566
    public void setJonasDevelopment(final boolean development) {
566
    public void setJonasDevelopment(final boolean development) {
567
        logger.finest("[GlobalParameters] setting jonas.development : " + development);
567
        logger.finest("[GlobalParameters] setting jonas.development : " + development);
568
        this.jonasProperties.setDevelopment(development);
568
        this.jonasProperties.setDevelopment(development);
569
    }
569
    }
570

570

571
    /**
571
    /**
572
     * {@inheritDoc}
572
     * {@inheritDoc}
573
     */
573
     */
574
    public void setLogConfigFile(final String logConfigFile) {
574
    public void setLogConfigFile(final String logConfigFile) {
575
        this.jonasProperties.setConfigfile(logConfigFile);
575
        this.jonasProperties.setConfigfile(logConfigFile);
576
    }
576
    }
577

577

578
    /**
578
    /**
579
     * {@inheritDoc}
579
     * {@inheritDoc}
580
     */
580
     */
581
    public void setMaster(final Boolean isMaster) {
581
    public void setMaster(final Boolean isMaster) {
582
        this.jonasProperties.setMaster(isMaster);
582
        this.jonasProperties.setMaster(isMaster);
583
    }
583
    }
584

584

585
    /**
585
    /**
586
     * {@inheritDoc}
586
     * {@inheritDoc}
587
     */
587
     */
588
    public void setSecurityPropagation(final Boolean securityPropagation) {
588
    public void setSecurityPropagation(final Boolean securityPropagation) {
589
        this.jonasProperties.setSecurityPropagation(securityPropagation);
589
        this.jonasProperties.setSecurityPropagation(securityPropagation);
590
    }
590
    }
591

591

592
    /**
592
    /**
593
     * {@inheritDoc}
593
     * {@inheritDoc}
594
     */
594
     */
595
    public void setTransactionPropagation(final Boolean transactionPropagation) {
595
    public void setTransactionPropagation(final Boolean transactionPropagation) {
596
        this.jonasProperties.setTransactionPropagation(transactionPropagation);
596
        this.jonasProperties.setTransactionPropagation(transactionPropagation);
597
    }
597
    }
598

598

599
    /**
599
    /**
600
     * {@inheritDoc}
600
     * {@inheritDoc}
601
     */
601
     */
602
    public void setCsiv2Propagation(final Boolean csiv2Propagation) {
602
    public void setCsiv2Propagation(final Boolean csiv2Propagation) {
603
        this.jonasProperties.setCsiv2Propagation(csiv2Propagation);
603
        this.jonasProperties.setCsiv2Propagation(csiv2Propagation);
604
    }
604
    }
605

605

606
    /* ------------------------------- */
606
    /* ------------------------------- */
607

607

608
    /* ------------------------------- */
608
    /* ------------------------------- */
609
    /* Jonas protocols configuation */
609
    /* Jonas protocols configuation */
610
    /**
610
    /**
611
     * {@inheritDoc}
611
     * {@inheritDoc}
612
     */
612
     */
613
    public void setProtocolsList(final String protocolsList) {
613
    public void setProtocolsList(final String protocolsList) {
614
        if (protocolsList != null && protocolsList.contains("cmi")) {
614
        if (protocolsList != null && protocolsList.contains("cmi")) {
615
            throw new IllegalArgumentException("In JOnAS 5, CMI has become a service. To enable CMI, follow these steps:"
615
            throw new IllegalArgumentException("In JOnAS 5, CMI has become a service. To enable CMI, follow these steps:"
616
                + "\n\t1) In the CAROL protocols list, use JRMP, IIOP and/or IRMI as usual"
616
                + "\n\t1) In the CAROL protocols list, use JRMP, IIOP and/or IRMI as usual"
617
                + "\n\t2) In the JOnAS services list, add the \"cmi\" service");
617
                + "\n\t2) In the JOnAS services list, add the \"cmi\" service");
618
        }
618
        }
619

619

620
        Jonas53.logger.finest("[Protocols configuration] setting protocols list : " + protocolsList);
620
        Jonas53.logger.finest("[Protocols configuration] setting protocols list : " + protocolsList);
621
        this.carol.setProtocols(protocolsList);
621
        this.carol.setProtocols(protocolsList);
622
        this.isProtocolsListSet = true;
622
        this.isProtocolsListSet = true;
623
    }
623
    }
624

624

625
    /**
625
    /**
626
     * {@inheritDoc}
626
     * {@inheritDoc}
627
     */
627
     */
628
    public void setProtocolsIrmiPort(final String irmiPort) {
628
    public void setProtocolsIrmiPort(final String irmiPort) {
629
        Jonas53.logger.finest("[Protocols configuration] setting irmi port : " + irmiPort);
629
        Jonas53.logger.finest("[Protocols configuration] setting irmi port : " + irmiPort);
630
        this.carol.setIrmiPort(irmiPort);
630
        this.carol.setIrmiPort(irmiPort);
631
    }
631
    }
632

632

633
    /**
633
    /**
634
     * {@inheritDoc}
634
     * {@inheritDoc}
635
     */
635
     */
636
    public void setProtocolsIiopPort(final String iiopPort) {
636
    public void setProtocolsIiopPort(final String iiopPort) {
637
        Jonas53.logger.finest("[Protocols configuration] setting iiop port : " + iiopPort);
637
        Jonas53.logger.finest("[Protocols configuration] setting iiop port : " + iiopPort);
638
        this.carol.setIiopPort(iiopPort);
638
        this.carol.setIiopPort(iiopPort);
639
    }
639
    }
640

640

641
    /**
641
    /**
642
     * {@inheritDoc}
642
     * {@inheritDoc}
643
     */
643
     */
644
    public void setProtocolsJrmpPort(final String jrmpPort) {
644
    public void setProtocolsJrmpPort(final String jrmpPort) {
645
        Jonas53.logger.finest("[Protocols configuration] setting jrmp port : " + jrmpPort);
645
        Jonas53.logger.finest("[Protocols configuration] setting jrmp port : " + jrmpPort);
646
        this.carol.setJrmpPort(jrmpPort);
646
        this.carol.setJrmpPort(jrmpPort);
647
    }
647
    }
648

648

649
    /**
649
    /**
650
     * {@inheritDoc}
650
     * {@inheritDoc}
651
     */
651
     */
652
    public void setProtocolsJrmLocalRegistry(final Boolean localRegistry) {
652
    public void setProtocolsJrmLocalRegistry(final Boolean localRegistry) {
653
        Jonas53.logger.finest("[Protocols configuration] setting jrmp local registry : " + localRegistry);
653
        Jonas53.logger.finest("[Protocols configuration] setting jrmp local registry : " + localRegistry);
654
        this.carol.setLocalRegistry(localRegistry);
654
        this.carol.setLocalRegistry(localRegistry);
655
    }
655
    }
656

656

657
    /**
657
    /**
658
     * {@inheritDoc}
658
     * {@inheritDoc}
659
     */
659
     */
660
    public void setCarolHost(final String host) {
660
    public void setCarolHost(final String host) {
661
        Jonas53.logger.finest("[Protocols configuration] setting host : " + host);
661
        Jonas53.logger.finest("[Protocols configuration] setting host : " + host);
662
        this.carol.setHost(host);
662
        this.carol.setHost(host);
663
    }
663
    }
664

664

665
    /**
665
    /**
666
     * {@inheritDoc}
666
     * {@inheritDoc}
667
     */
667
     */
668
    public void setProtocolsCmiPort(final String cmiPort) {
668
    public void setProtocolsCmiPort(final String cmiPort) {
669
        Jonas53.logger.finest("[Protocols configuration] setting cmi port : " + cmiPort);
669
        Jonas53.logger.finest("[Protocols configuration] setting cmi port : " + cmiPort);
670
        NotApplicableHelper.notApplicable("Protocols.CmiPort");
670
        NotApplicableHelper.notApplicable("Protocols.CmiPort");
671
    }
671
    }
672

672

673
    /**
673
    /**
674
     * {@inheritDoc}
674
     * {@inheritDoc}
675
     */
675
     */
676
    public void setProtocolsLocalCallOptimized(final Boolean localCallOptimized) {
676
    public void setProtocolsLocalCallOptimized(final Boolean localCallOptimized) {
677
        Jonas53.logger.finest("[Protocols configuration] setting jndi local call optimisation : " + localCallOptimized);
677
        Jonas53.logger.finest("[Protocols configuration] setting jndi local call optimisation : " + localCallOptimized);
678
        this.carol.setJrmpOptimization(localCallOptimized);
678
        this.carol.setJrmpOptimization(localCallOptimized);
679
    }
679
    }
680

680

681
    /* ------------------------------- */
681
    /* ------------------------------- */
682

682

683
    /* ------------------------------- */
683
    /* ------------------------------- */
684
    /* Active services */
684
    /* Active services */
685
    /**
685
    /**
686
     * {@inheritDoc}
686
     * {@inheritDoc}
687
     */
687
     */
688
    public void setServices(final String services) {
688
    public void setServices(final String services) {
689
        Jonas53.logger.finest("setting actives services list : " + services);
689
        Jonas53.logger.finest("setting actives services list : " + services);
690
        this.services.setNames(services);
690
        this.services.setNames(services);
691
        this.jonasProperties.setServices(services);
691
        this.jonasProperties.setServices(services);
692
    }
692
    }
693

693

694
    /* ------------------------------- */
694
    /* ------------------------------- */
695

695

696
    /* ------------------------------- */
696
    /* ------------------------------- */
697
    /* Service web configuration */
697
    /* Service web configuration */
698
    /**
698
    /**
699
     * {@inheritDoc}
699
     * {@inheritDoc}
700
     */
700
     */
701
    public void setWebcontainer(final String webContainer) {
701
    public void setWebcontainer(final String webContainer) {
702
        Jonas53.logger.finest("[Web configuration] setting webContainer : " + webContainer);
702
        Jonas53.logger.finest("[Web configuration] setting webContainer : " + webContainer);
703
        this.webContainer = webContainer;
703
        this.webContainer = webContainer;
704
    }
704
    }
705

705

706
    /**
706
    /**
707
     * {@inheritDoc}
707
     * {@inheritDoc}
708
     */
708
     */
709
    public void setHttpConnectorActivation(final Boolean activation) {
709
    public void setHttpConnectorActivation(final Boolean activation) {
710
        Jonas53.logger.finest("[Web configuration] setting isHttpActivated : " + activation);
710
        Jonas53.logger.finest("[Web configuration] setting isHttpActivated : " + activation);
711
        this.isHttpActivated = activation;
711
        this.isHttpActivated = activation;
712
    }
712
    }
713

713

714
    /**
714
    /**
715
     * {@inheritDoc}
715
     * {@inheritDoc}
716
     */
716
     */
717
    public void setHttpsConnectorActivation(final Boolean activation) {
717
    public void setHttpsConnectorActivation(final Boolean activation) {
718
        Jonas53.logger.finest("[Web configuration] setting isHttpsActivated : " + activation);
718
        Jonas53.logger.finest("[Web configuration] setting isHttpsActivated : " + activation);
719
        this.isHttpsActivated = activation;
719
        this.isHttpsActivated = activation;
720
    }
720
    }
721

721

722
    /**
722
    /**
723
     * {@inheritDoc}
723
     * {@inheritDoc}
724
     */
724
     */
725
    public void setAjpConnectorActivation(final Boolean activation) {
725
    public void setAjpConnectorActivation(final Boolean activation) {
726
        Jonas53.logger.finest("[Web configuration] setting isAjpActivated : " + activation);
726
        Jonas53.logger.finest("[Web configuration] setting isAjpActivated : " + activation);
727
        this.isAjpActivated = activation;
727
        this.isAjpActivated = activation;
728
    }
728
    }
729

729

730
    /**
730
    /**
731
     * {@inheritDoc}
731
     * {@inheritDoc}
732
     */
732
     */
733
    public void setHttpSessionReplicationActivation(final Boolean activation) {
733
    public void setHttpSessionReplicationActivation(final Boolean activation) {
734
        Jonas53.logger.finest("[Web configuration] setting isHttpReplicationActivated : " + activation);
734
        Jonas53.logger.finest("[Web configuration] setting isHttpReplicationActivated : " + activation);
735
        this.isHttpReplicationActivated = activation;
735
        this.isHttpReplicationActivated = activation;
736
    }
736
    }
737

737

738
    /**
738
    /**
739
     * {@inheritDoc}
739
     * {@inheritDoc}
740
     */
740
     */
741
    public void setHttpSessionManagerActivation(final Boolean activation) {
741
    public void setHttpSessionManagerActivation(final Boolean activation) {
742
        Jonas53.logger.finest("[Web configuration] setting isHttpSessionManagerActivated : " + activation);
742
        Jonas53.logger.finest("[Web configuration] setting isHttpSessionManagerActivated : " + activation);
743
        this.isHttpSessionManagerActivated = activation;
743
        this.isHttpSessionManagerActivated = activation;
744
    }
744
    }
745

745

746
    /**
746
    /**
747
     * {@inheritDoc}
747
     * {@inheritDoc}
748
     */
748
     */
749
    public void setWebOndemandActivation(final Boolean activation) {
749
    public void setWebOndemandActivation(final Boolean activation) {
750
        Jonas53.logger.finest("[Web configuration] setting isWebOnDemandActivated : " + activation);
750
        Jonas53.logger.finest("[Web configuration] setting isWebOnDemandActivated : " + activation);
751
        this.isWebOnDemandActivated = activation;
751
        this.isWebOnDemandActivated = activation;
752
    }
752
    }
753

753

754
    /**
754
    /**
755
     * {@inheritDoc}
755
     * {@inheritDoc}
756
     */
756
     */
757
    public void setWebOndemandRedirectPort(final String redirectPort) {
757
    public void setWebOndemandRedirectPort(final String redirectPort) {
758
        Jonas53.logger.finest("[Web configuration] setting ondemand redirect port : " + redirectPort);
758
        Jonas53.logger.finest("[Web configuration] setting ondemand redirect port : " + redirectPort);
759
        this.webOnDemandRedirectPort = redirectPort;
759
        this.webOnDemandRedirectPort = redirectPort;
760
    }
760
    }
761

761

762
    /**
762
    /**
763
     * {@inheritDoc}
763
     * {@inheritDoc}
764
     */
764
     */
765
    public void setHttpPort(final String httpPort) {
765
    public void setHttpPort(final String httpPort) {
766
        Jonas53.logger.finest("[Web configuration] setting http port : " + httpPort);
766
        Jonas53.logger.finest("[Web configuration] setting http port : " + httpPort);
767
        this.httpPort = httpPort;
767
        this.httpPort = httpPort;
768
    }
768
    }
769

769

770
    /**
770
    /**
771
     * {@inheritDoc}
771
     * {@inheritDoc}
772
     */
772
     */
773
    public void setHttpMaxThreads(final String httpMaxThreads) {
773
    public void setHttpMaxThreads(final String httpMaxThreads) {
774
        Jonas53.logger.finest("[Web configuration] setting max http threads : " + httpMaxThreads);
774
        Jonas53.logger.finest("[Web configuration] setting max http threads : " + httpMaxThreads);
775
        this.httpMaxThreads = httpMaxThreads;
775
        this.httpMaxThreads = httpMaxThreads;
776
    }
776
    }
777

777

778
    /**
778
    /**
779
     * {@inheritDoc}
779
     * {@inheritDoc}
780
     */
780
     */
781
    public void setHttpMinSpareThreads(final String httpMinSpareThreads) {
781
    public void setHttpMinSpareThreads(final String httpMinSpareThreads) {
782
        Jonas53.logger.finest("[Web configuration] setting min http spare threads : " + httpMinSpareThreads);
782
        Jonas53.logger.finest("[Web configuration] setting min http spare threads : " + httpMinSpareThreads);
783
        this.httpMinSpareThreads = httpMinSpareThreads;
783
        this.httpMinSpareThreads = httpMinSpareThreads;
784
    }
784
    }
785

785

786
    /**
786
    /**
787
     * {@inheritDoc}
787
     * {@inheritDoc}
788
     */
788
     */
789
    @Deprecated // not used..
789
    @Deprecated // not used..
790
    public void setHttpMaxSpareThreads(final String httpMaxSpareThreads) {
790
    public void setHttpMaxSpareThreads(final String httpMaxSpareThreads) {
791
        Jonas53.logger.finest("[Web configuration] setting max http spare threads : " + httpMaxSpareThreads);
791
        Jonas53.logger.finest("[Web configuration] setting max http spare threads : " + httpMaxSpareThreads);
792
        NotApplicableHelper.notApplicable("HTTP.maxSpareThreads");
792
        NotApplicableHelper.notApplicable("HTTP.maxSpareThreads");
793
    }
793
    }
794

794

795
    /**
795
    /**
796
     * {@inheritDoc}
796
     * {@inheritDoc}
797
     */
797
     */
798
    public void setHttpEnableLookups(final Boolean enableLookups) {
798
    public void setHttpEnableLookups(final Boolean enableLookups) {
799
        Jonas53.logger.finest("setting http enable lookups : " + enableLookups);
799
        Jonas53.logger.finest("setting http enable lookups : " + enableLookups);
800
        this.httpEnableLookups = enableLookups;
800
        this.httpEnableLookups = enableLookups;
801
    } 
801
    } 
802

802

803
    /**
803
    /**
804
     * {@inheritDoc}
804
     * {@inheritDoc}
805
     */
805
     */
806
    public void setHttpConnectionTimeout(final String connectionTimeout) {
806
    public void setHttpConnectionTimeout(final String connectionTimeout) {
807
        Jonas53.logger.finest("setting http connection timeout : " + connectionTimeout);
807
        Jonas53.logger.finest("setting http connection timeout : " + connectionTimeout);
808
        this.httpConnectionTimeout = connectionTimeout;
808
        this.httpConnectionTimeout = connectionTimeout;
809
    }
809
    }
810

810

811
    /**
811
    /**
812
     * {@inheritDoc}
812
     * {@inheritDoc}
813
     */
813
     */
814
    public void setHttpAcceptCount(final String acceptCount) {
814
    public void setHttpAcceptCount(final String acceptCount) {
815
        Jonas53.logger.finest("setting http accept count : " + acceptCount);
815
        Jonas53.logger.finest("setting http accept count : " + acceptCount);
816
        this.httpAcceptCount = acceptCount;
816
        this.httpAcceptCount = acceptCount;
817
    }
817
    }
818

818

819
    /**
819
    /**
820
     * {@inheritDoc}
820
     * {@inheritDoc}
821
     */
821
     */
822
    public void setHttpMaxKeepAliveRequest(final String maxKeepAliveRequest) {
822
    public void setHttpMaxKeepAliveRequest(final String maxKeepAliveRequest) {
823
        Jonas53.logger.finest("setting max keep alive http request : " + maxKeepAliveRequest);
823
        Jonas53.logger.finest("setting max keep alive http request : " + maxKeepAliveRequest);
824
        this.httpMaxKeepAliveRequest = maxKeepAliveRequest;
824
        this.httpMaxKeepAliveRequest = maxKeepAliveRequest;
825
    }
825
    }
826

826

827
    /**
827
    /**
828
     * {@inheritDoc}
828
     * {@inheritDoc}
829
     */
829
     */
830
    public void setHttpCompression(final String compression) {
830
    public void setHttpCompression(final String compression) {
831
        Jonas53.logger.finest("setting http compression : " + compression);
831
        Jonas53.logger.finest("setting http compression : " + compression);
832
        this.httpCompression = compression;
832
        this.httpCompression = compression;
833
    }
833
    }
834

834

835
    /**
835
    /**
836
     * {@inheritDoc}
836
     * {@inheritDoc}
837
     */
837
     */
838
    public void setHttpRedirectPort(final String redirectPort) {
838
    public void setHttpRedirectPort(final String redirectPort) {
839
        Jonas53.logger.finest("setting http redirect port : " + redirectPort);
839
        Jonas53.logger.finest("setting http redirect port : " + redirectPort);
840
        this.httpRedirectPort = redirectPort;
840
        this.httpRedirectPort = redirectPort;
841
    }
841
    }
842

842

843
    /**
843
    /**
844
     * {@inheritDoc}
844
     * {@inheritDoc}
845
     */
845
     */
846
    public void setHttpsPort(final String httpsPort) {
846
    public void setHttpsPort(final String httpsPort) {
847
        Jonas53.logger.finest("[Web configuration] setting https port : " + httpsPort);
847
        Jonas53.logger.finest("[Web configuration] setting https port : " + httpsPort);
848
        this.httpsPort = httpsPort;
848
        this.httpsPort = httpsPort;
849
    }
849
    }
850

850

851
    /**
851
    /**
852
     * {@inheritDoc}
852
     * {@inheritDoc}
853
     */
853
     */
854
    public void setHttpsMaxThreads(final String httpsMaxThreads) {
854
    public void setHttpsMaxThreads(final String httpsMaxThreads) {
855
        Jonas53.logger.finest("[Web configuration] setting max https threads : " + httpsMaxThreads);
855
        Jonas53.logger.finest("[Web configuration] setting max https threads : " + httpsMaxThreads);
856
        this.httpsMaxThreads = httpsMaxThreads;
856
        this.httpsMaxThreads = httpsMaxThreads;
857
    }
857
    }
858

858

859
    /**
859
    /**
860
     * {@inheritDoc}
860
     * {@inheritDoc}
861
     */
861
     */
862
    public void setHttpsMinSpareThreads(final String httpsMinSpareThreads) {
862
    public void setHttpsMinSpareThreads(final String httpsMinSpareThreads) {
863
        Jonas53.logger.finest("setting min https spare threads : " + httpsMinSpareThreads);
863
        Jonas53.logger.finest("setting min https spare threads : " + httpsMinSpareThreads);
864
        this.httpsMinSpareThreads = httpsMinSpareThreads;
864
        this.httpsMinSpareThreads = httpsMinSpareThreads;
865
    }
865
    }
866

866

867
    /**
867
    /**
868
     * {@inheritDoc}
868
     * {@inheritDoc}
869
     */
869
     */
870
    @Deprecated //never used...
870
    @Deprecated //never used...
871
    public void setHttpsMaxSpareThreads(final String httpsMaxSpareThreads) {
871
    public void setHttpsMaxSpareThreads(final String httpsMaxSpareThreads) {
872
        Jonas53.logger.finest("setting max https spare threads : " + httpsMaxSpareThreads);
872
        Jonas53.logger.finest("setting max https spare threads : " + httpsMaxSpareThreads);
873
        NotApplicableHelper.notApplicable("HTTPS.maxSpareThreads");
873
        NotApplicableHelper.notApplicable("HTTPS.maxSpareThreads");
874
    }
874
    }
875

875

876
    /**
876
    /**
877
     * {@inheritDoc}
877
     * {@inheritDoc}
878
     */
878
     */
879
    public void setHttpsEnableLookups(final Boolean enableLookups) {
879
    public void setHttpsEnableLookups(final Boolean enableLookups) {
880
        Jonas53.logger.finest("setting https enable lookups property : " + enableLookups);
880
        Jonas53.logger.finest("setting https enable lookups property : " + enableLookups);
881
        this.httpsEnableLookups = enableLookups;
881
        this.httpsEnableLookups = enableLookups;
882
    }
882
    }
883

883

884
    /**
884
    /**
885
     * {@inheritDoc}
885
     * {@inheritDoc}
886
     */
886
     */
887
    public void setHttpsConnectionTimeout(final String connectionTimeout) {
887
    public void setHttpsConnectionTimeout(final String connectionTimeout) {
888
        Jonas53.logger.finest("setting https connection timeout : " + connectionTimeout);
888
        Jonas53.logger.finest("setting https connection timeout : " + connectionTimeout);
889
        this.httpsConnectionTimeout = connectionTimeout;
889
        this.httpsConnectionTimeout = connectionTimeout;
890
    }
890
    }
891

891

892
    /**
892
    /**
893
     * {@inheritDoc}
893
     * {@inheritDoc}
894
     */
894
     */
895
    public void setHttpsAcceptCount(final String acceptCount) {
895
    public void setHttpsAcceptCount(final String acceptCount) {
896
        Jonas53.logger.finest("setting https accept count : " + acceptCount);
896
        Jonas53.logger.finest("setting https accept count : " + acceptCount);
897
        this.httpsAcceptCount = acceptCount;
897
        this.httpsAcceptCount = acceptCount;
898
    }
898
    }
899

899

900
    /**
900
    /**
901
     * {@inheritDoc}
901
     * {@inheritDoc}
902
     */
902
     */
903
    public void setHttpsMaxKeepAliveRequest(final String maxKeepAliveRequest) {
903
    public void setHttpsMaxKeepAliveRequest(final String maxKeepAliveRequest) {
904
        Jonas53.logger.finest("setting max keep alive https request : " + maxKeepAliveRequest);
904
        Jonas53.logger.finest("setting max keep alive https request : " + maxKeepAliveRequest);
905
        this.httpsMaxKeepAliveRequest = maxKeepAliveRequest;
905
        this.httpsMaxKeepAliveRequest = maxKeepAliveRequest;
906
    }
906
    }
907

907

908
    /**
908
    /**
909
     * {@inheritDoc}
909
     * {@inheritDoc}
910
     */
910
     */
911
    public void setHttpsCompression(final String compression) {
911
    public void setHttpsCompression(final String compression) {
912
        Jonas53.logger.finest("setting https compression : " + compression);
912
        Jonas53.logger.finest("setting https compression : " + compression);
913
        this.httpsCompression = compression;
913
        this.httpsCompression = compression;
914
    }
914
    }
915

915

916
    /**
916
    /**
917
     * {@inheritDoc}
917
     * {@inheritDoc}
918
     */
918
     */
919
    public void setHttpsRedirectPort(final String redirectPort) {
919
    public void setHttpsRedirectPort(final String redirectPort) {
920
        Jonas53.logger.finest("setting https redirect port : " + redirectPort);
920
        Jonas53.logger.finest("setting https redirect port : " + redirectPort);
921
        this.httpsRedirectPort = redirectPort;
921
        this.httpsRedirectPort = redirectPort;
922
    }
922
    }
923

923

924
    /**
924
    /**
925
     * {@inheritDoc}
925
     * {@inheritDoc}
926
     */
926
     */
927
    public void setHttpsKeystoreFile(final String keystoreFile) {
927
    public void setHttpsKeystoreFile(final String keystoreFile) {
928
        Jonas53.logger.finest("setting https keystore file : " + keystoreFile);
928
        Jonas53.logger.finest("setting https keystore file : " + keystoreFile);
929
        this.httpsKeystoreFile = keystoreFile;
929
        this.httpsKeystoreFile = keystoreFile;
930
    }
930
    }
931

931

932
    /**
932
    /**
933
     * {@inheritDoc}
933
     * {@inheritDoc}
934
     */
934
     */
935
    public void setHttpsKeystorePass(final String keystorePass) {
935
    public void setHttpsKeystorePass(final String keystorePass) {
936
        Jonas53.logger.finest("setting https keystore password : " + keystorePass);
936
        Jonas53.logger.finest("setting https keystore password : " + keystorePass);
937
        this.httpsKeystorePass = keystorePass;
937
        this.httpsKeystorePass = keystorePass;
938
    }
938
    }
939

939

940
    /**
940
    /**
941
     * {@inheritDoc}
941
     * {@inheritDoc}
942
     */
942
     */
943
    public void setAjpPort(final String ajpPort) {
943
    public void setAjpPort(final String ajpPort) {
944
        Jonas53.logger.finest("[Web configuration] setting ajp port : " + ajpPort);
944
        Jonas53.logger.finest("[Web configuration] setting ajp port : " + ajpPort);
945
        this.ajpPort = ajpPort;
945
        this.ajpPort = ajpPort;
946
    }
946
    }
947

947

948
    /**
948
    /**
949
     * {@inheritDoc}
949
     * {@inheritDoc}
950
     */
950
     */
951
    public void setAjpMaxThreads(final String ajpMaxThreads) {
951
    public void setAjpMaxThreads(final String ajpMaxThreads) {
952
        Jonas53.logger.finest("[Web configuration] setting max ajp threads : " + ajpMaxThreads);
952
        Jonas53.logger.finest("[Web configuration] setting max ajp threads : " + ajpMaxThreads);
953
        this.ajpMaxThreads = ajpMaxThreads;
953
        this.ajpMaxThreads = ajpMaxThreads;
954
    }
954
    }
955

955

956
    /**
956
    /**
957
     * {@inheritDoc}
957
     * {@inheritDoc}
958
     */
958
     */
959
    public void setAjpMinSpareThreads(final String ajpMinSpareThreads) {
959
    public void setAjpMinSpareThreads(final String ajpMinSpareThreads) {
960
        Jonas53.logger.finest("[Web configuration] setting min ajp spare threads : " + ajpMinSpareThreads);
960
        Jonas53.logger.finest("[Web configuration] setting min ajp spare threads : " + ajpMinSpareThreads);
961
        this.ajpMinSpareThreads = ajpMinSpareThreads;
961
        this.ajpMinSpareThreads = ajpMinSpareThreads;
962
    }
962
    }
963

963

964
    /**
964
    /**
965
     * {@inheritDoc}
965
     * {@inheritDoc}
966
     */
966
     */
967
    @Deprecated //never used...
967
    @Deprecated //never used...
968
    public void setAjpMaxSpareThreads(final String ajpMaxSpareThreads) {
968
    public void setAjpMaxSpareThreads(final String ajpMaxSpareThreads) {
969
        Jonas53.logger.finest("[Web configuration] setting max ajp spare threads : " + ajpMaxSpareThreads);
969
        Jonas53.logger.finest("[Web configuration] setting max ajp spare threads : " + ajpMaxSpareThreads);
970
        NotApplicableHelper.notApplicable("AJP.maxSpareThreads");
970
        NotApplicableHelper.notApplicable("AJP.maxSpareThreads");
971
    }
971
    }
972

972

973
    /**
973
    /**
974
     * {@inheritDoc}
974
     * {@inheritDoc}
975
     */
975
     */
976
    public void setAjpEnableLookups(final Boolean enableLookups) {
976
    public void setAjpEnableLookups(final Boolean enableLookups) {
977
        Jonas53.logger.finest("setting ajp enable lookups property : " + enableLookups);
977
        Jonas53.logger.finest("setting ajp enable lookups property : " + enableLookups);
978
        this.ajpEnableLookups = enableLookups;
978
        this.ajpEnableLookups = enableLookups;
979
    }
979
    }
980

980

981
    /**
981
    /**
982
     * {@inheritDoc}
982
     * {@inheritDoc}
983
     */
983
     */
984
    public void setAjpConnectionTimeout(final String connectionTimeout) {
984
    public void setAjpConnectionTimeout(final String connectionTimeout) {
985
        Jonas53.logger.finest("setting ajp connection timeout : " + connectionTimeout);
985
        Jonas53.logger.finest("setting ajp connection timeout : " + connectionTimeout);
986
        this.ajpConnectionTimeout = connectionTimeout;        
986
        this.ajpConnectionTimeout = connectionTimeout;        
987
    }
987
    }
988

988

989
    /**
989
    /**
990
     * {@inheritDoc}
990
     * {@inheritDoc}
991
     */
991
     */
992
    public void setAjpAcceptCount(final String acceptCount) {
992
    public void setAjpAcceptCount(final String acceptCount) {
993
        Jonas53.logger.finest("setting ajp accept count : " + acceptCount);
993
        Jonas53.logger.finest("setting ajp accept count : " + acceptCount);
994
        this.ajpAcceptCount = acceptCount;
994
        this.ajpAcceptCount = acceptCount;
995
    }
995
    }
996

996

997
    /**
997
    /**
998
     * {@inheritDoc}
998
     * {@inheritDoc}
999
     */
999
     */
1000
    public void setAjpRedirectPort(final String redirectPort) {
1000
    public void setAjpRedirectPort(final String redirectPort) {
1001
        Jonas53.logger.finest("setting ajp redirect port : " + redirectPort);
1001
        Jonas53.logger.finest("setting ajp redirect port : " + redirectPort);
1002
        this.ajpRedirectPort = redirectPort;
1002
        this.ajpRedirectPort = redirectPort;
1003
    }
1003
    }
1004

1004

1005
    /**
1005
    /**
1006
     * {@inheritDoc}
1006
     * {@inheritDoc}
1007
     */
1007
     */
1008
    public void setMaxActiveWebSessions(final String maxActiveSession) {
1008
    public void setMaxActiveWebSessions(final String maxActiveSession) {
1009
        Jonas53.logger.finest("setting max active session : " + maxActiveSession);
1009
        Jonas53.logger.finest("setting max active session : " + maxActiveSession);
1010
        this.maxActiveSession = maxActiveSession;
1010
        this.maxActiveSession = maxActiveSession;
1011
    }
1011
    }
1012

1012

1013
    /**
1013
    /**
1014
     * {@inheritDoc}
1014
     * {@inheritDoc}
1015
     */
1015
     */
1016
    public void setJmxSecured(final boolean enabled) {
1016
    public void setJmxSecured(final boolean enabled) {
1017
        Jonas53.logger.finest("[Security] setting JMX security:" + enabled);
1017
        Jonas53.logger.finest("[Security] setting JMX security:" + enabled);
1018
        security.setSecureJmx(enabled);
1018
        security.setSecureJmx(enabled);
1019
    }
1019
    }
1020

1020

1021
    /**
1021
    /**
1022
     * {@inheritDoc}
1022
     * {@inheritDoc}
1023
     */
1023
     */
1024
    public void addUser(final String username, final String password, final String roles, final String groups, 
1024
    public void addUser(final String username, final String password, final String roles, final String groups, 
1025
                        final String description) {
1025
                        final String description) {
1026
        User user = new User();
1026
        User user = new User();
1027
        user.setName(username);
1027
        user.setName(username);
1028
        user.setPassword(password);
1028
        user.setPassword(password);
1029
        user.setGroups(groups);
1029
        user.setGroups(groups);
1030
        user.setRoles(roles);
1030
        user.setRoles(roles);
1031
        user.setDescription(description);
1031
        user.setDescription(description);
1032
        this.users.add(user);
1032
        this.users.add(user);
1033
    }
1033
    }
1034

1034

1035
    /**
1035
    /**
1036
     * {@inheritDoc}
1036
     * {@inheritDoc}
1037
     */
1037
     */
1038
    public void addAdmin(final String username, final String password) {
1038
    public void addAdmin(final String username, final String password) {
1039
        User admin = new User();
1039
        User admin = new User();
1040
        admin.setName(username);
1040
        admin.setName(username);
1041
        admin.setPassword(password);
1041
        admin.setPassword(password);
1042
        this.admins.add(admin);
1042
        this.admins.add(admin);
1043
    }
1043
    }
1044

1044

1045
    /**
1045
    /**
1046
     * {@inheritDoc}
1046
     * {@inheritDoc}
1047
     */
1047
     */
1048
    public void setJvmRoute(final String jvmRoute) {
1048
    public void setJvmRoute(final String jvmRoute) {
1049
        Jonas53.logger.finest("[Web configuration] setting jvm route : " + jvmRoute);
1049
        Jonas53.logger.finest("[Web configuration] setting jvm route : " + jvmRoute);
1050
        this.jvmRoute = jvmRoute;
1050
        this.jvmRoute = jvmRoute;
1051
    }
1051
    }
1052

1052

1053
    /**
1053
    /**
1054
     * {@inheritDoc}
1054
     * {@inheritDoc}
1055
     */
1055
     */
1056
    public void setHttpReplicationClusterName(final String clusterName) {
1056
    public void setHttpReplicationClusterName(final String clusterName) {
1057
        Jonas53.logger.finest("[Web configuration] setting cluster name : " + clusterName);
1057
        Jonas53.logger.finest("[Web configuration] setting cluster name : " + clusterName);
1058
        this.sessionReplicationClusterName = clusterName; 
1058
        this.sessionReplicationClusterName = clusterName; 
1059
    }
1059
    }
1060

1060

1061
    /**
1061
    /**
1062
     * {@inheritDoc}
1062
     * {@inheritDoc}
1063
     */
1063
     */
1064
    public void setHttpReplicationMulticastAddress(final String mCastAddr) {
1064
    public void setHttpReplicationMulticastAddress(final String mCastAddr) {
1065
        Jonas53.logger.finest("[Web configuration] setting multi cast address : " + mCastAddr);
1065
        Jonas53.logger.finest("[Web configuration] setting multi cast address : " + mCastAddr);
1066
        this.sessionReplicationMulticastAddress = mCastAddr;
1066
        this.sessionReplicationMulticastAddress = mCastAddr;
1067
    }
1067
    }
1068

1068

1069
    /**
1069
    /**
1070
     * {@inheritDoc}
1070
     * {@inheritDoc}
1071
     */
1071
     */
1072
    public void setHttpReplicationMulticastPort(final String mCastPort) {
1072
    public void setHttpReplicationMulticastPort(final String mCastPort) {
1073
        Jonas53.logger.finest("[Web configuration] setting multi cast port : " + mCastPort);
1073
        Jonas53.logger.finest("[Web configuration] setting multi cast port : " + mCastPort);
1074
        this.sessionReplicationMulticastPort = mCastPort;
1074
        this.sessionReplicationMulticastPort = mCastPort;
1075
    }
1075
    }
1076

1076

1077
    /**
1077
    /**
1078
     * {@inheritDoc}
1078
     * {@inheritDoc}
1079
     */
1079
     */
1080
    public void setHttpReplicationListenPort(final String listenPort) {
1080
    public void setHttpReplicationListenPort(final String listenPort) {
1081
        Jonas53.logger.finest("[Web configuration] setting listen port : " + listenPort);
1081
        Jonas53.logger.finest("[Web configuration] setting listen port : " + listenPort);
1082
        this.sessionReplicationListenPort = listenPort;
1082
        this.sessionReplicationListenPort = listenPort;
1083
    }
1083
    }
1084

1084

1085
    /**
1085
    /**
1086
     * {@inheritDoc}
1086
     * {@inheritDoc}
1087
     */
1087
     */
1088
    public void setHttpReplicationAlgorithm(final String algorithm) {
1088
    public void setHttpReplicationAlgorithm(final String algorithm) {
1089
        Jonas53.logger.finest("[Web configuration] setting http replication algorithm : " + algorithm);
1089
        Jonas53.logger.finest("[Web configuration] setting http replication algorithm : " + algorithm);
1090
        this.sessionReplicationAlgorithm = algorithm;
1090
        this.sessionReplicationAlgorithm = algorithm;
1091
    }
1091
    }
1092

1092

1093
    /* ------------------------------- */
1093
    /* ------------------------------- */
1094

1094

1095
    /* ------------------------------- */
1095
    /* ------------------------------- */
1096
    /**
1096
    /**
1097
     * Active db service
1097
     * Active db service
1098
     */
1098
     */
1099
    private void initDb() {
1099
    private void initDb() {
1100
        if (this.db == null) {
1100
        if (this.db == null) {
1101
            this.db = new DbH2();
1101
            this.db = new DbH2();
1102
            this.db.setProject(this.project);
1102
            this.db.setProject(this.project);
1103
        }
1103
        }
1104
    }
1104
    }
1105

1105

1106
    /* Service db configuration */
1106
    /* Service db configuration */
1107
    /**
1107
    /**
1108
     * {@inheritDoc}
1108
     * {@inheritDoc}
1109
     */
1109
     */
1110
    public void setDbPort(final String port) {
1110
    public void setDbPort(final String port) {
1111
        Jonas53.logger.finest("[Database configuration] setting db port: " + port);
1111
        Jonas53.logger.finest("[Database configuration] setting db port: " + port);
1112
        initDb();
1112
        initDb();
1113
        this.db.setPort(port);
1113
        this.db.setPort(port);
1114
    }
1114
    }
1115

1115

1116
    /**
1116
    /**
1117
     * {@inheritDoc}
1117
     * {@inheritDoc}
1118
     */
1118
     */
1119
    public void setDbName(final String name) {
1119
    public void setDbName(final String name) {
1120
        Jonas53.logger.finest("[Database configuration] setting db name: " + name);
1120
        Jonas53.logger.finest("[Database configuration] setting db name: " + name);
1121
        initDb();
1121
        initDb();
1122
        this.db.setDbName(name);
1122
        this.db.setDbName(name);
1123
    }
1123
    }
1124

1124

1125
    /**
1125
    /**
1126
     * {@inheritDoc}
1126
     * {@inheritDoc}
1127
     */
1127
     */
1128
    public void setDbUsers(final String users) {
1128
    public void setDbUsers(final String users) {
1129
        Jonas53.logger.finest("[Database configuration] setting db users: " + users);
1129
        Jonas53.logger.finest("[Database configuration] setting db users: " + users);
1130
        initDb();
1130
        initDb();
1131
        this.db.setUsers(users);
1131
        this.db.setUsers(users);
1132
    }
1132
    }
1133
 
1133
 
1134
    /**
1134
    /**
1135
     * {@inheritDoc}
1135
     * {@inheritDoc}
1136
     */
1136
     */
1137
    public void setDbId(final String dbId) {
1137
    public void setDbId(final String dbId) {
1138
        this.dbId = dbId;
1138
        this.dbId = dbId;
1139
    }
1139
    }
1140

1140

1141
    /* ------------------------------- */
1141
    /* ------------------------------- */
1142

1142

1143
    /* ------------------------------- */
1143
    /* ------------------------------- */
1144
    /* Service discovery configuration */
1144
    /* Service discovery configuration */
1145
    /**
1145
    /**
1146
     * {@inheritDoc}
1146
     * {@inheritDoc}
1147
     */
1147
     */
1148
    public void setDiscoveryMasterActivated(final Boolean masterActivated) {
1148
    public void setDiscoveryMasterActivated(final Boolean masterActivated) {
1149
        Jonas53.logger.finest("[Discovery configuration] setting masterActivated : " + masterActivated);
1149
        Jonas53.logger.finest("[Discovery configuration] setting masterActivated : " + masterActivated);
1150
        this.jonasProperties.setMaster(masterActivated);
1150
        this.jonasProperties.setMaster(masterActivated);
1151
    }
1151
    }
1152

1152

1153
    /**
1153
    /**
1154
     * {@inheritDoc}
1154
     * {@inheritDoc}
1155
     */
1155
     */
1156
    public void setDiscoverySourcePort(final String sourcePort) {
1156
    public void setDiscoverySourcePort(final String sourcePort) {
1157
        Jonas53.logger.finest("[Discovery configuration] setting source port : " + sourcePort);
1157
        Jonas53.logger.finest("[Discovery configuration] setting source port : " + sourcePort);
1158
        initDiscovery();
1158
        initDiscovery();
1159
        this.discovery.setSourcePort(sourcePort);
1159
        this.discovery.setSourcePort(sourcePort);
1160
    }
1160
    }
1161

1161

1162
    /**
1162
    /**
1163
     * {@inheritDoc}
1163
     * {@inheritDoc}
1164
     */
1164
     */
1165
    public void setDiscoveryDomainName(final String domainName) {
1165
    public void setDiscoveryDomainName(final String domainName) {
1166
        Jonas53.logger.finest("[Discovery configuration] setting domain name : " + domainName);
1166
        Jonas53.logger.finest("[Discovery configuration] setting domain name : " + domainName);
1167
        this.addReplacement("jonas.properties", "domain.name    jonas", "domain.name    " + domainName);
1167
        this.addReplacement("jonas.properties", "domain.name    jonas", "domain.name    " + domainName);
1168
    }
1168
    }
1169

1169

1170
    /**
1170
    /**
1171
     * {@inheritDoc}
1171
     * {@inheritDoc}
1172
     */
1172
     */
1173
    public void setDiscoveryGreetingPort(final String greetingPort) {
1173
    public void setDiscoveryGreetingPort(final String greetingPort) {
1174
        Jonas53.logger.finest("[Discovery configuration] setting greeting port : " + greetingPort);
1174
        Jonas53.logger.finest("[Discovery configuration] setting greeting port : " + greetingPort);
1175
        initDiscovery();
1175
        initDiscovery();
1176
        this.discovery.setGreetingPort(greetingPort);
1176
        this.discovery.setGreetingPort(greetingPort);
1177
    }
1177
    }
1178

1178

1179
    /**
1179
    /**
1180
     * {@inheritDoc}
1180
     * {@inheritDoc}
1181
     */
1181
     */
1182
    public void setDiscoveryMulticastAddress(final String multicastAddress) {
1182
    public void setDiscoveryMulticastAddress(final String multicastAddress) {
1183
        Jonas53.logger.finest("[Discovery configuration] setting multicast address : " + multicastAddress);
1183
        Jonas53.logger.finest("[Discovery configuration] setting multicast address : " + multicastAddress);
1184
        initDiscovery();
1184
        initDiscovery();
1185
        this.discovery.setMcastAddr(multicastAddress);
1185
        this.discovery.setMcastAddr(multicastAddress);
1186
    }
1186
    }
1187

1187

1188
    /**
1188
    /**
1189
     * {@inheritDoc}
1189
     * {@inheritDoc}
1190
     */
1190
     */
1191
    public void setDiscoveryMulticastPort(final String multicastPort) {
1191
    public void setDiscoveryMulticastPort(final String multicastPort) {
1192
        Jonas53.logger.finest("[Discovery configuration] setting multicast port : " + multicastPort);
1192
        Jonas53.logger.finest("[Discovery configuration] setting multicast port : " + multicastPort);
1193
        initDiscovery();
1193
        initDiscovery();
1194
        this.discovery.setMcastPort(multicastPort);
1194
        this.discovery.setMcastPort(multicastPort);
1195
    }
1195
    }
1196

1196

1197
    /**
1197
    /**
1198
     * {@inheritDoc}
1198
     * {@inheritDoc}
1199
     */
1199
     */
1200
    public void setDiscoveryTTL(final String ttl) {
1200
    public void setDiscoveryTTL(final String ttl) {
1201
        Jonas53.logger.finest("[Discovery configuration] setting ttl : " + ttl);
1201
        Jonas53.logger.finest("[Discovery configuration] setting ttl : " + ttl);
1202
        initDiscovery();
1202
        initDiscovery();
1203
        this.discovery.setTtl(ttl);
1203
        this.discovery.setTtl(ttl);
1204
    }
1204
    }
1205

1205

1206
    /**
1206
    /**
1207
     * Init discovery object if not set
1207
     * Init discovery object if not set
1208
     */
1208
     */
1209
    private void initDiscovery() {
1209
    private void initDiscovery() {
1210
        if (this.discovery == null) {
1210
        if (this.discovery == null) {
1211
            this.discovery = new DiscoveryMulticast();
1211
            this.discovery = new DiscoveryMulticast();
1212
            this.discovery.setProject(this.project);
1212
            this.discovery.setProject(this.project);
1213
        }
1213
        }
1214
    }
1214
    }
1215

1215

1216
    /* ------------------------------- */
1216
    /* ------------------------------- */
1217

1217

1218
    /* ------------------------------- */
1218
    /* ------------------------------- */
1219
    /* Service mail configuration */
1219
    /* Service mail configuration */
1220
    /**
1220
    /**
1221
     * {@inheritDoc}
1221
     * {@inheritDoc}
1222
     */
1222
     */
1223
    public void setMailFactoryType(final String factoryType) {
1223
    public void setMailFactoryType(final String factoryType) {
1224
        Jonas53.logger.finest("[Mail Service Configuration] setting mail factory type : " + factoryType);
1224
        Jonas53.logger.finest("[Mail Service Configuration] setting mail factory type : " + factoryType);
1225
        NotApplicableHelper.notApplicable("Mail.factoryType");
1225
        NotApplicableHelper.notApplicable("Mail.factoryType");
1226
    }
1226
    }
1227

1227

1228
    /**
1228
    /**
1229
     * {@inheritDoc}
1229
     * {@inheritDoc}
1230
     */
1230
     */
1231
    public void setMailFactoryName(final String factoryName) {
1231
    public void setMailFactoryName(final String factoryName) {
1232
        Jonas53.logger.finest("[Mail Service Configuration] setting mail factory name : " + factoryName);
1232
        Jonas53.logger.finest("[Mail Service Configuration] setting mail factory name : " + factoryName);
1233
        NotApplicableHelper.notApplicable("Mail.factoryName");
1233
        NotApplicableHelper.notApplicable("Mail.factoryName");
1234
    }
1234
    }
1235

1235

1236
    /**
1236
    /**
1237
     * {@inheritDoc}
1237
     * {@inheritDoc}
1238
     */
1238
     */
1239
    public void addMailMimme(final String name, final String host, final String mailto, final String subject) {
1239
    public void addMailMimme(final String name, final String host, final String mailto, final String subject) {
1240
        Jonas53.logger.finest("[Mail Service Configuration] addition of a new mail mimme configuration file.");
1240
        Jonas53.logger.finest("[Mail Service Configuration] addition of a new mail mimme configuration file.");
1241
        Mail mail = new Mail();
1241
        Mail mail = new Mail();
1242
        mail.setProject(this.project);
1242
        mail.setProject(this.project);
1243
        mail.setName(name);
1243
        mail.setName(name);
1244
        mail.setHost(host);
1244
        mail.setHost(host);
1245
        mail.setMailTo(mailto);
1245
        mail.setMailTo(mailto);
1246
        mail.setSubject(subject);
1246
        mail.setSubject(subject);
1247
        mail.setType("MimePartDataSource");
1247
        mail.setType("MimePartDataSource");
1248
        this.mails.add(mail);
1248
        this.mails.add(mail);
1249
    }
1249
    }
1250

1250

1251
    /**
1251
    /**
1252
     * {@inheritDoc}
1252
     * {@inheritDoc}
1253
     */
1253
     */
1254
    public void addMailSession(final String name) {
1254
    public void addMailSession(final String name) {
1255
        Jonas53.logger.finest("[Mail Service Configuration] addition of a new mail session configuration file.");
1255
        Jonas53.logger.finest("[Mail Service Configuration] addition of a new mail session configuration file.");
1256
        Mail mail = new Mail();
1256
        Mail mail = new Mail();
1257
        mail.setProject(this.project);
1257
        mail.setProject(this.project);
1258
        mail.setName(name);
1258
        mail.setName(name);
1259
        mail.setType("Session");
1259
        mail.setType("Session");
1260
        this.mails.add(mail);
1260
        this.mails.add(mail);
1261
    }
1261
    }
1262

1262

1263
    /* ------------------------------- */
1263
    /* ------------------------------- */
1264

1264

1265
    /* ------------------------------- */
1265
    /* ------------------------------- */
1266
    /* Service WS configuration */
1266
    /* Service WS configuration */
1267

1267

1268
    /**
1268
    /**
1269
     * Init WsdlPublisherFile if not set
1269
     * Init WsdlPublisherFile if not set
1270
     */
1270
     */
1271
    private void initWsdlPublisherFile() {
1271
    private void initWsdlPublisherFile() {
1272
        if (this.wsdlPublisherFile == null) {
1272
        if (this.wsdlPublisherFile == null) {
1273
            this.wsdlPublisherFile = new org.ow2.jonas.antmodular.jonasbase.wsdl.File();
1273
            this.wsdlPublisherFile = new org.ow2.jonas.antmodular.jonasbase.wsdl.File();
1274
        }
1274
        }
1275
    }
1275
    }
1276

1276

1277
    /**
1277
    /**
1278
     * {@inheritDoc}
1278
     * {@inheritDoc}
1279
     */
1279
     */
1280
    public void setWsdlPublisherFileName(final String fileName) {
1280
    public void setWsdlPublisherFileName(final String fileName) {
1281
        Jonas53.logger.finest("[WS Service configuration] setting wsdlPublisherFile name : " + fileName);
1281
        Jonas53.logger.finest("[WS Service configuration] setting wsdlPublisherFile name : " + fileName);
1282
        initWsdlPublisherFile();
1282
        initWsdlPublisherFile();
1283
        this.wsdlPublisherFile.setName(fileName);
1283
        this.wsdlPublisherFile.setName(fileName);
1284
    }
1284
    }
1285

1285

1286
    /**
1286
    /**
1287
     * {@inheritDoc}
1287
     * {@inheritDoc}
1288
     */
1288
     */
1289
    public void setWsdlPublisherFileDirectory(final String fileDir) {
1289
    public void setWsdlPublisherFileDirectory(final String fileDir) {
1290
        Jonas53.logger.finest("[WS Service configuration] setting wsdlPublisherFile directory : " + fileDir);
1290
        Jonas53.logger.finest("[WS Service configuration] setting wsdlPublisherFile directory : " + fileDir);
1291
        initWsdlPublisherFile();
1291
        initWsdlPublisherFile();
1292
        this.wsdlPublisherFile.setDir(fileDir);
1292
        this.wsdlPublisherFile.setDir(fileDir);
1293
    }
1293
    }
1294

1294

1295
    /* ------------------------------- */
1295
    /* ------------------------------- */
1296

1296

1297
    /* ------------------------------- */
1297
    /* ------------------------------- */
1298
    /* Service HA configuration */
1298
    /* Service HA configuration */
1299
    /**
1299
    /**
1300
     * {@inheritDoc}
1300
     * {@inheritDoc}
1301
     */
1301
     */
1302
    public void setHaActivated(final Boolean activated) {
1302
    public void setHaActivated(final Boolean activated) {
1303
        Jonas53.logger.finest("[HA Service configuration] setting ha activated : " + activated);
1303
        Jonas53.logger.finest("[HA Service configuration] setting ha activated : " + activated);
1304
        //do nothing
1304
        //do nothing
1305
    }
1305
    }
1306

1306

1307
    /**
1307
    /**
1308
     * {@inheritDoc}
1308
     * {@inheritDoc}
1309
     */
1309
     */
1310
    public void setHaMulticastAddress(final String multicastAddr) {
1310
    public void setHaMulticastAddress(final String multicastAddr) {
1311
        Jonas53.logger.finest("[HA Service configuration] setting multicast address : " + multicastAddr);
1311
        Jonas53.logger.finest("[HA Service configuration] setting multicast address : " + multicastAddr);
1312
        initHa();
1312
        initHa();
1313
        this.ha.setMcastAddr(multicastAddr);
1313
        this.ha.setMcastAddr(multicastAddr);
1314
    }
1314
    }
1315

1315

1316
    /**
1316
    /**
1317
     * {@inheritDoc}
1317
     * {@inheritDoc}
1318
     */
1318
     */
1319
    public void setHaMulticastPort(final String multicastPort) {
1319
    public void setHaMulticastPort(final String multicastPort) {
1320
        Jonas53.logger.finest("[HA Service configuration] setting multicast port : " + multicastPort);
1320
        Jonas53.logger.finest("[HA Service configuration] setting multicast port : " + multicastPort);
1321
        initHa();
1321
        initHa();
1322
        this.ha.setMcastPort(multicastPort);
1322
        this.ha.setMcastPort(multicastPort);
1323
    }
1323
    }
1324

1324

1325
    /**
1325
    /**
1326
     * Activate HA
1326
     * Activate HA
1327
     */
1327
     */
1328
    private void initHa() {
1328
    private void initHa() {
1329
        if (this.ha == null) {
1329
        if (this.ha == null) {
1330
            this.ha = new Ha();
1330
            this.ha = new Ha();
1331
            this.ha.setProject(this.project);
1331
            this.ha.setProject(this.project);
1332
        }
1332
        }
1333
    }
1333
    }
1334

1334

1335
    /* ------------------------------- */
1335
    /* ------------------------------- */
1336

1336

1337
    /* ------------------------------- */
1337
    /* ------------------------------- */
1338
    /* Security manager configuration */
1338
    /* Security manager configuration */
1339
    /**
1339
    /**
1340
     * {@inheritDoc}
1340
     * {@inheritDoc}
1341
     */
1341
     */
1342
    public void setSecurityManagerActivated(final Boolean activation) {
1342
    public void setSecurityManagerActivated(final Boolean activation) {
1343
        Jonas53.logger.finest("[Security Manager configuration] setting isActivates : " + activation);
1343
        Jonas53.logger.finest("[Security Manager configuration] setting isActivates : " + activation);
1344
        this.jonasProperties.setSecurityManager(activation);
1344
        this.jonasProperties.setSecurityManager(activation);
1345
    }
1345
    }
1346

1346

1347
    /* ------------------------------- */
1347
    /* ------------------------------- */
1348

1348

1349
    /* ------------------------------- */
1349
    /* ------------------------------- */
1350
    /* Ejb clustering configuration */
1350
    /* Ejb clustering configuration */
1351
    /**
1351
    /**
1352
     * {@inheritDoc}
1352
     * {@inheritDoc}
1353
     */
1353
     */
1354
    /**
1354
    /**
1355
     * {@inheritDoc}
1355
     * {@inheritDoc}
1356
     */
1356
     */
1357
    public void setEjbClusteringActivated(final Boolean activated) {
1357
    public void setEjbClusteringActivated(final Boolean activated) {
1358
        Jonas53.logger.finest("[Ejb Clustering configuration] setting ejb clustering activated activated : " + activated);
1358
        Jonas53.logger.finest("[Ejb Clustering configuration] setting ejb clustering activated activated : " + activated);
1359
        if (activated) {
1359
        if (activated) {
1360
            this.cmi = new Cmi();
1360
            this.cmi = new Cmi();
1361
            this.cmi.setProject(this.project);
1361
            this.cmi.setProject(this.project);
1362
        }
1362
        }
1363
    }
1363
    }
1364

1364

1365
    public void setEjbClusteringMulticastAddress(final String multicastAddr) {
1365
    public void setEjbClusteringMulticastAddress(final String multicastAddr) {
1366
        Jonas53.logger.finest("[Ejb Clustering configuration] setting multicast address : " + multicastAddr);
1366
        Jonas53.logger.finest("[Ejb Clustering configuration] setting multicast address : " + multicastAddr);
1367
        if (this.cmi != null) {
1367
        if (this.cmi != null) {
1368
            this.cmi.setMcastAddr(multicastAddr);
1368
            this.cmi.setMcastAddr(multicastAddr);
1369
        }
1369
        }
1370
    }
1370
    }
1371

1371

1372
    /**
1372
    /**
1373
     * {@inheritDoc}
1373
     * {@inheritDoc}
1374
     */
1374
     */
1375
    public void setEjbClusteringMulticastPort(final String multicastPort) {
1375
    public void setEjbClusteringMulticastPort(final String multicastPort) {
1376
        Jonas53.logger.finest("[Ejb Clustering configuration] setting multicast port : " + multicastPort);
1376
        Jonas53.logger.finest("[Ejb Clustering configuration] setting multicast port : " + multicastPort);
1377
        if (this.cmi != null) {
1377
        if (this.cmi != null) {
1378
            this.cmi.setMcastPort(multicastPort);
1378
            this.cmi.setMcastPort(multicastPort);
1379
        }
1379
        }
1380
    }
1380
    }
1381

1381

1382
    /**
1382
    /**
1383
     * {@inheritDoc}
1383
     * {@inheritDoc}
1384
     */
1384
     */
1385
    public void setEjbClusteringReplicationEnable(final Boolean enable) {
1385
    public void setEjbClusteringReplicationEnable(final Boolean enable) {
1386
        Jonas53.logger.finest("[EJB Clustering configuration] : " + enable);
1386
        Jonas53.logger.finest("[EJB Clustering configuration] : " + enable);
1387
        if (this.cmi != null) {
1387
        if (this.cmi != null) {
1388
            this.cmi.setReplicationEnabled(enable);
1388
            this.cmi.setReplicationEnabled(enable);
1389
        }
1389
        }
1390
    }
1390
    }
1391

1391

1392
    /* ------------------------------- */
1392
    /* ------------------------------- */
1393

1393

1394
    /* ------------------------------- */
1394
    /* ------------------------------- */
1395
    /* Jms configuration */
1395
    /* Jms configuration */
1396

1396

1397
    /**
1397
    /**
1398
     * Initialize JMS if not set
1398
     * Initialize JMS if not set
1399
     */
1399
     */
1400
    private void initJms() {
1400
    private void initJms() {
1401
        if (this.jms == null) {
1401
        if (this.jms == null) {
1402
            this.jms = new Jms();
1402
            this.jms = new Jms();
1403
            this.jms.setProject(this.project);
1403
            this.jms.setProject(this.project);
1404
        }
1404
        }
1405
    }
1405
    }
1406

1406

1407
    /**
1407
    /**
1408
     * {@inheritDoc}
1408
     * {@inheritDoc}
1409
     */
1409
     */
1410
    public void setJmsPort(final String port) {
1410
    public void setJmsPort(final String port) {
1411
        Jonas53.logger.finest("[Jms configuration] setting port : " + port);
1411
        Jonas53.logger.finest("[Jms configuration] setting port : " + port);
1412
        initJms();
1412
        initJms();
1413
        this.jms.setPort(port);
1413
        this.jms.setPort(port);
1414
    }
1414
    }
1415

1415

1416
    /**
1416
    /**
1417
     * {@inheritDoc}
1417
     * {@inheritDoc}
1418
     */
1418
     */
1419
    public void setJmsQueues(final String queue) {
1419
    public void setJmsQueues(final String queue) {
1420
        Jonas53.logger.finest("[Jms configuration] setting queue : " + queue);
1420
        Jonas53.logger.finest("[Jms configuration] setting queue : " + queue);
1421
        initJms();
1421
        initJms();
1422
        this.jms.setInitialQueues(queue);
1422
        this.jms.setInitialQueues(queue);
1423
    }
1423
    }
1424

1424

1425
    /**
1425
    /**
1426
     * {@inheritDoc}
1426
     * {@inheritDoc}
1427
     */
1427
     */
1428
    public void setJmsTopics(final String topic) {
1428
    public void setJmsTopics(final String topic) {
1429
        Jonas53.logger.finest("[Jms configuration] setting topic : " + topic);
1429
        Jonas53.logger.finest("[Jms configuration] setting topic : " + topic);
1430
        initJms();
1430
        initJms();
1431
        this.jms.setInitialTopics(topic);
1431
        this.jms.setInitialTopics(topic);
1432
    }
1432
    }
1433

1433

1434
    /**
1434
    /**
1435
     * {@inheritDoc}
1435
     * {@inheritDoc}
1436
     */
1436
     */
1437
    public void setJmsHost(final String host) {
1437
    public void setJmsHost(final String host) {
1438
        Jonas53.logger.finest("[Jms configuration] setting host : " + host);
1438
        Jonas53.logger.finest("[Jms configuration] setting host : " + host);
1439
        initJms();
1439
        initJms();
1440
        this.jms.setHost(host);
1440
        this.jms.setHost(host);
1441
    }
1441
    }
1442

1442

1443
    /**
1443
    /**
1444
     * {@inheritDoc}
1444
     * {@inheritDoc}
1445
     */
1445
     */
1446
    public void addJdbcResource(final JdbcXMLConfiguration jdbcXMLConfiguration) {
1446
    public void addJdbcResource(final JdbcXMLConfiguration jdbcXMLConfiguration) {
1447
        JdbcXml jdbcXml = new JdbcXml();
1447
        JdbcXml jdbcXml = new JdbcXml();
1448
        jdbcXml.setProject(this.project);
1448
        jdbcXml.setProject(this.project);
1449
        if (jdbcXMLConfiguration.classname != null) {
1449
        if (jdbcXMLConfiguration.classname != null) {
1450
            Jonas53.logger.finest("[JdbcXML configuration] setting classname: " + jdbcXMLConfiguration.classname);
1450
            Jonas53.logger.finest("[JdbcXML configuration] setting classname: " + jdbcXMLConfiguration.classname);
1451
            jdbcXml.setClassName(jdbcXMLConfiguration.classname);
1451
            jdbcXml.setClassName(jdbcXMLConfiguration.classname);
1452
        }
1452
        }
1453
        if (jdbcXMLConfiguration.mapper != null) {
1453
        if (jdbcXMLConfiguration.mapper != null) {
1454
            Jonas53.logger.finest("[JdbcXML configuration] setting mapper: " + jdbcXMLConfiguration.mapper);
1454
            Jonas53.logger.finest("[JdbcXML configuration] setting mapper: " + jdbcXMLConfiguration.mapper);
1455
            jdbcXml.setMapper(jdbcXMLConfiguration.mapper);    
1455
            jdbcXml.setMapper(jdbcXMLConfiguration.mapper);    
1456
        }
1456
        }
1457
        if (jdbcXMLConfiguration.name != null) {
1457
        if (jdbcXMLConfiguration.name != null) {
1458
            Jonas53.logger.finest("[JdbcXML configuration] setting name: " + jdbcXMLConfiguration.name);
1458
            Jonas53.logger.finest("[JdbcXML configuration] setting name: " + jdbcXMLConfiguration.name);
1459
            jdbcXml.setName(jdbcXMLConfiguration.name);
1459
            jdbcXml.setName(jdbcXMLConfiguration.name);
1460
        }
1460
        }
1461
        if (jdbcXMLConfiguration.username != null) {
1461
        if (jdbcXMLConfiguration.username != null) {
1462
            Jonas53.logger.finest("[JdbcXML configuration] setting username: " + jdbcXMLConfiguration.username);
1462
            Jonas53.logger.finest("[JdbcXML configuration] setting username: " + jdbcXMLConfiguration.username);
1463
            jdbcXml.setUserName(jdbcXMLConfiguration.username);
1463
            jdbcXml.setUserName(jdbcXMLConfiguration.username);
1464
        }
1464
        }
1465
        if (jdbcXMLConfiguration.password != null) {
1465
        if (jdbcXMLConfiguration.password != null) {
1466
            Jonas53.logger.finest("[JdbcXML configuration] setting password: " + jdbcXMLConfiguration.password);
1466
            Jonas53.logger.finest("[JdbcXML configuration] setting password: " + jdbcXMLConfiguration.password);
1467
            jdbcXml.setPassword(jdbcXMLConfiguration.password);
1467
            jdbcXml.setPassword(jdbcXMLConfiguration.password);
1468
        } 
1468
        } 
1469
        if (jdbcXMLConfiguration.url != null) {
1469
        if (jdbcXMLConfiguration.url != null) {
1470
            Jonas53.logger.finest("[JdbcXML configuration] setting url: " + jdbcXMLConfiguration.url);
1470
            Jonas53.logger.finest("[JdbcXML configuration] setting url: " + jdbcXMLConfiguration.url);
1471
            jdbcXml.setUrl(jdbcXMLConfiguration.url);
1471
            jdbcXml.setUrl(jdbcXMLConfiguration.url);
1472
        } 
1472
        } 
1473
        if (jdbcXMLConfiguration.conCheckLevel != null)  {
1473
        if (jdbcXMLConfiguration.conCheckLevel != null)  {
1474
            Jonas53.logger.finest("[JdbcXML configuration] setting conCheckLevel: " + jdbcXMLConfiguration.conCheckLevel);
1474
            Jonas53.logger.finest("[JdbcXML configuration] setting conCheckLevel: " + jdbcXMLConfiguration.conCheckLevel);
1475
            jdbcXml.setConCheckLevel(jdbcXMLConfiguration.conCheckLevel);
1475
            jdbcXml.setConCheckLevel(jdbcXMLConfiguration.conCheckLevel);
1476
        }
1476
        }
1477
        if (jdbcXMLConfiguration.connMaxAge != null) {
1477
        if (jdbcXMLConfiguration.connMaxAge != null) {
1478
            Jonas53.logger.finest("[JdbcXML configuration] setting connMaxAge: " + jdbcXMLConfiguration.connMaxAge);
1478
            Jonas53.logger.finest("[JdbcXML configuration] setting connMaxAge: " + jdbcXMLConfiguration.connMaxAge);
1479
            jdbcXml.setConnMaxAge(jdbcXMLConfiguration.connMaxAge);
1479
            jdbcXml.setConnMaxAge(jdbcXMLConfiguration.connMaxAge);
1480
        }  
1480
        }  
1481
        if (jdbcXMLConfiguration.conTestStmt != null) {
1481
        if (jdbcXMLConfiguration.conTestStmt != null) {
1482
            Jonas53.logger.finest("[JdbcXML configuration] setting conTestStmt: " + jdbcXMLConfiguration.conTestStmt);
1482
            Jonas53.logger.finest("[JdbcXML configuration] setting conTestStmt: " + jdbcXMLConfiguration.conTestStmt);
1483
            jdbcXml.setConTestStmt(jdbcXMLConfiguration.conTestStmt);
1483
            jdbcXml.setConTestStmt(jdbcXMLConfiguration.conTestStmt);
1484
        } 
1484
        } 
1485
        if (jdbcXMLConfiguration.initConPool != null) {
1485
        if (jdbcXMLConfiguration.initConPool != null) {
1486
            Jonas53.logger.finest("[JdbcXML configuration] setting initConPool: " + jdbcXMLConfiguration.initConPool);
1486
            Jonas53.logger.finest("[JdbcXML configuration] setting initConPool: " + jdbcXMLConfiguration.initConPool);
1487
            jdbcXml.setInitConPool(jdbcXMLConfiguration.initConPool);
1487
            jdbcXml.setInitConPool(jdbcXMLConfiguration.initConPool);
1488
        } 
1488
        } 
1489
        if (jdbcXMLConfiguration.maxConPool != null) {
1489
        if (jdbcXMLConfiguration.maxConPool != null) {
1490
            Jonas53.logger.finest("[JdbcXML configuration] setting maxConPool: " + jdbcXMLConfiguration.maxConPool);
1490
            Jonas53.logger.finest("[JdbcXML configuration] setting maxConPool: " + jdbcXMLConfiguration.maxConPool);
1491
            jdbcXml.setMaxConPool(jdbcXMLConfiguration.maxConPool);
1491
            jdbcXml.setMaxConPool(jdbcXMLConfiguration.maxConPool);
1492
        } 
1492
        } 
1493
        if (jdbcXMLConfiguration.maxOpenTime != null) {
1493
        if (jdbcXMLConfiguration.maxOpenTime != null) {
1494
            Jonas53.logger.finest("[JdbcXML configuration] setting maxOpenTime: " + jdbcXMLConfiguration.maxOpenTime);
1494
            Jonas53.logger.finest("[JdbcXML configuration] setting maxOpenTime: " + jdbcXMLConfiguration.maxOpenTime);
1495
            jdbcXml.setMaxOpenTime(jdbcXMLConfiguration.maxOpenTime);
1495
            jdbcXml.setMaxOpenTime(jdbcXMLConfiguration.maxOpenTime);
1496
        }
1496
        }
1497
        if (jdbcXMLConfiguration.maxWaiters != null) {
1497
        if (jdbcXMLConfiguration.maxWaiters != null) {
1498
            Jonas53.logger.finest("[JdbcXML configuration] setting maxWaiters: " + jdbcXMLConfiguration.maxWaiters);
1498
            Jonas53.logger.finest("[JdbcXML configuration] setting maxWaiters: " + jdbcXMLConfiguration.maxWaiters);
1499
            jdbcXml.setMaxWaiters(jdbcXMLConfiguration.maxWaiters);
1499
            jdbcXml.setMaxWaiters(jdbcXMLConfiguration.maxWaiters);
1500
        }
1500
        }
1501
        if (jdbcXMLConfiguration.minConPool != null) {
1501
        if (jdbcXMLConfiguration.minConPool != null) {
1502
            Jonas53.logger.finest("[JdbcXML configuration] setting minConPool: " + jdbcXMLConfiguration.minConPool);
1502
            Jonas53.logger.finest("[JdbcXML configuration] setting minConPool: " + jdbcXMLConfiguration.minConPool);
1503
            jdbcXml.setMinConPool(jdbcXMLConfiguration.minConPool);
1503
            jdbcXml.setMinConPool(jdbcXMLConfiguration.minConPool);
1504
        }
1504
        }
1505
        if (jdbcXMLConfiguration.maxWaitTime != null) {
1505
        if (jdbcXMLConfiguration.maxWaitTime != null) {
1506
            Jonas53.logger.finest("[JdbcXML configuration] setting maxWaiters: " + jdbcXMLConfiguration.maxWaiters);
1506
            Jonas53.logger.finest("[JdbcXML configuration] setting maxWaiters: " + jdbcXMLConfiguration.maxWaiters);
1507
            jdbcXml.setMaxWaitTime(jdbcXMLConfiguration.maxWaitTime);
1507
            jdbcXml.setMaxWaitTime(jdbcXMLConfiguration.maxWaitTime);
1508
        }
1508
        }
1509
        if (jdbcXMLConfiguration.pstmtCachePolicy != null) {
1509
        if (jdbcXMLConfiguration.pstmtCachePolicy != null) {
1510
            Jonas53.logger.finest("[JdbcXML configuration] setting pstmtCachePolicy: " + jdbcXMLConfiguration.pstmtCachePolicy);
1510
            Jonas53.logger.finest("[JdbcXML configuration] setting pstmtCachePolicy: " + jdbcXMLConfiguration.pstmtCachePolicy);
1511
            jdbcXml.setPstmtCachePolicy(jdbcXMLConfiguration.pstmtCachePolicy);
1511
            jdbcXml.setPstmtCachePolicy(jdbcXMLConfiguration.pstmtCachePolicy);
1512
        }
1512
        }
1513
        if (jdbcXMLConfiguration.pstmtMax != null) {
1513
        if (jdbcXMLConfiguration.pstmtMax != null) {
1514
            Jonas53.logger.finest("[JdbcXML configuration] setting pstmtMax: " + jdbcXMLConfiguration.pstmtMax);
1514
            Jonas53.logger.finest("[JdbcXML configuration] setting pstmtMax: " + jdbcXMLConfiguration.pstmtMax);
1515
            jdbcXml.setPstmtMax(jdbcXMLConfiguration.pstmtMax);
1515
            jdbcXml.setPstmtMax(jdbcXMLConfiguration.pstmtMax);
1516
        }
1516
        }
1517
        if (jdbcXMLConfiguration.samplingPeriod != null) {
1517
        if (jdbcXMLConfiguration.samplingPeriod != null) {
1518
            Jonas53.logger.finest("[JdbcXML configuration] setting samplingPeriod: " + jdbcXMLConfiguration.samplingPeriod);
1518
            Jonas53.logger.finest("[JdbcXML configuration] setting samplingPeriod: " + jdbcXMLConfiguration.samplingPeriod);
1519
            jdbcXml.setSamplingPeriod(jdbcXMLConfiguration.samplingPeriod);
1519
            jdbcXml.setSamplingPeriod(jdbcXMLConfiguration.samplingPeriod);
1520
        }
1520
        }
1521
        if (jdbcXMLConfiguration.description != null) {
1521
        if (jdbcXMLConfiguration.description != null) {
1522
            Jonas53.logger.finest("[JdbcXML configuration] setting description: " + jdbcXMLConfiguration.description);
1522
            Jonas53.logger.finest("[JdbcXML configuration] setting description: " + jdbcXMLConfiguration.description);
1523
            jdbcXml.setDescription(jdbcXMLConfiguration.description);
1523
            jdbcXml.setDescription(jdbcXMLConfiguration.description);
1524
        }
1524
        }
1525
        this.jdbcXmlList.add(jdbcXml);
1525
        this.jdbcXmlList.add(jdbcXml);
1526
    }
1526
    }
1527

1527

1528
    /**
1528
    /**
1529
     * {@inheritDoc}
1529
     * {@inheritDoc}
1530
     */
1530
     */
1531
    public void addJdbcResource(final String ref, final JdbcXMLConfiguration jdbcXMLConfiguration) {
1531
    public void addJdbcResource(final String ref, final JdbcXMLConfiguration jdbcXMLConfiguration) {
1532
        if (ref.equals(dbId)) {
1532
        if (ref.equals(dbId)) {
1533
            initDb();
1533
            initDb();
1534
            jdbcXMLConfiguration.classname = this.db.getClassname();
1534
            jdbcXMLConfiguration.classname = this.db.getClassname();
1535
            jdbcXMLConfiguration.mapper = this.db.getMapper();
1535
            jdbcXMLConfiguration.mapper = this.db.getMapper();
1536
            jdbcXMLConfiguration.url = this.db.getUrl("localhost");
1536
            jdbcXMLConfiguration.url = this.db.getUrl("localhost");
1537
            Map.Entry<String, String> user = this.db.getFirstUsernameAndPassword();
1537
            Map.Entry<String, String> user = this.db.getFirstUsernameAndPassword();
1538
            jdbcXMLConfiguration.username = user.getKey();
1538
            jdbcXMLConfiguration.username = user.getKey();
1539
            jdbcXMLConfiguration.password = user.getValue();
1539
            jdbcXMLConfiguration.password = user.getValue();
1540
            addJdbcResource(jdbcXMLConfiguration);
1540
            addJdbcResource(jdbcXMLConfiguration);
1541
        } else {
1541
        } else {
1542
            NotApplicableHelper.notApplicable("Resource.Jdbc. The reference " + ref + " is invalid.");
1542
            NotApplicableHelper.notApplicable("Resource.Jdbc. The reference " + ref + " is invalid.");
1543
        }
1543
        }
1544
    }
1544
    }
1545

1545

1546
    /**
1546
    /**
1547
     * {@inheritDoc}
1547
     * {@inheritDoc}
1548
     */
1548
     */
1549
    public void addJdbcRA(final String raName, final JDBCConfiguration configuration) {
1549
    public void addJdbcRA(final String raName, final JDBCConfiguration configuration) {
1550
        NotApplicableHelper.notApplicable("resource.addJdbcRa");
1550
        NotApplicableHelper.notApplicable("resource.addJdbcRa");
1551
    }
1551
    }
1552

1552

1553
    /**
1553
    /**
1554
     * Initialize Smartclient if not set
1554
     * Initialize Smartclient if not set
1555
     */
1555
     */
1556
    private void initSmartclient() {
1556
    private void initSmartclient() {
1557
        if (this.smartClient == null) {
1557
        if (this.smartClient == null) {
1558
            this.smartClient = new SmartClient();
1558
            this.smartClient = new SmartClient();
1559
            this.smartClient.setProject(this.project);
1559
            this.smartClient.setProject(this.project);
1560
        }
1560
        }
1561
    }
1561
    }
1562

1562

1563
    /**
1563
    /**
1564
     * {@inheritDoc}
1564
     * {@inheritDoc}
1565
     */
1565
     */
1566
    public void setSmartClientPort(final String port) {
1566
    public void setSmartClientPort(final String port) {
1567
        Jonas53.logger.finest("[Smartclient configuration] setting port: " + port);
1567
        Jonas53.logger.finest("[Smartclient configuration] setting port: " + port);
1568
        initSmartclient();
1568
        initSmartclient();
1569
        this.smartClient.setPort(port);
1569
        this.smartClient.setPort(port);
1570
    }
1570
    }
1571

1571

1572
    /* ------------------------------- */
1572
    /* ------------------------------- */
1573

1573

1574
    /**
1574
    /**
1575
     * {@inheritDoc}
1575
     * {@inheritDoc}
1576
     */
1576
     */
1577
    public void execute() {
1577
    public void execute() {
1578
        if (!this.isJonasRootSet) {
1578
        if (!this.isJonasRootSet) {
1579
            throw new IllegalArgumentException("Jonas root is not set.");
1579
            throw new IllegalArgumentException("Jonas root is not set.");
1580
        }
1580
        }
1581
        if (!this.isJonasBaseSet) {
1581
        if (!this.isJonasBaseSet) {
1582
            throw new IllegalArgumentException("Jonas base is not set.");
1582
            throw new IllegalArgumentException("Jonas base is not set.");
1583
        }
1583
        }
1584

1584

1585
        this.jonasBase.addConfiguredServices(this.services);
1585
        this.jonasBase.addConfiguredServices(this.services);
1586
        this.jonasBase.execute();
1586
        this.jonasBase.execute();
1587
        this.jonasProperties.execute();
1587
        this.jonasProperties.execute();
1588
        this.doReplacements(new File(this.jonasFileBase, "conf"));
1588
        this.doReplacements(new File(this.jonasFileBase, "conf"));
1589

1589

1590
        if (this.ha != null) {
1590
        if (this.ha != null) {
1591
            this.ha.execute();
1591
            this.ha.execute();
1592
        }
1592
        }
1593
        if (this.cmi != null) {
1593
        if (this.cmi != null) {
1594
            this.cmi.execute();
1594
            this.cmi.execute();
1595
        }
1595
        }
1596

1596

1597
        WebContainer webContainer = null;
1597
        WebContainer webContainer = null;
1598
        try {
1598
        try {
1599
            if (this.webContainer == null) {
1599
            if (this.webContainer == null) {
1600
                // If not set, get the webContainer from jonas.properties
1600
                // If not set, get the webContainer from jonas.properties
1601
                //
1601
                //
1602
                // jonas.service.web.class is for example org.ow2.jonas.web.tomcat7.Tomcat7Service,
1602
                // jonas.service.web.class is for example org.ow2.jonas.web.tomcat7.Tomcat7Service,
1603
                // we therefore split it at each for and get the length - 2 (in our example, tomcat7).
1603
                // we therefore split it at each for and get the length - 2 (in our example, tomcat7).
1604
                Properties jonasProperties = new Properties();
1604
                Properties jonasProperties = new Properties();
1605
                InputStream fis = new FileInputStream(new File(this.jonasFileBase, "conf/jonas.properties"));
1605
                InputStream fis = new FileInputStream(new File(this.jonasFileBase, "conf/jonas.properties"));
1606
                try {
1606
                try {
1607
                    jonasProperties.load(fis);
1607
                    jonasProperties.load(fis);
1608
                } finally {
1608
                } finally {
1609
                    fis.close();
1609
                    fis.close();
1610
                    fis = null;
1610
                    fis = null;
1611
                    System.gc();
1611
                    System.gc();
1612
                }
1612
                }
1613
                final String webToken = jonasProperties.getProperty("jonas.service.web.class");
1613
                final String webToken = jonasProperties.getProperty("jonas.service.web.class");
1614
                if (webToken != null) {
1614
                if (webToken != null) {
1615
                    String[] defaultWebcontainerClass = webToken.split("\\.");
1615
                    String[] defaultWebcontainerClass = webToken.split("\\.");
1616
                    this.webContainer = defaultWebcontainerClass[defaultWebcontainerClass.length - 2];
1616
                    this.webContainer = defaultWebcontainerClass[defaultWebcontainerClass.length - 2];
1617
                }
1617
                }
1618
            }
1618
            }
1619

1619

1620
            if (this.webContainer != null) {
1620
            if (this.webContainer != null) {
1621
                for (String webContainerClassName : getAllClasses((URLClassLoader) this.getClass().getClassLoader(),
1621
                for (String webContainerClassName : getAllClasses((URLClassLoader) this.getClass().getClassLoader(),
1622
                        WebContainer.class.getName())) {
1622
                        WebContainer.class.getName())) {
1623

1623

1624
                    if (webContainerClassName.contains(this.webContainer)) {
1624
                    if (webContainerClassName.contains(this.webContainer)) {
1625
                        webContainer = (WebContainer)
1625
                        webContainer = (WebContainer)
1626
                                this.getClass().getClassLoader().loadClass(webContainerClassName).newInstance();
1626
                                this.getClass().getClassLoader().loadClass(webContainerClassName).newInstance();
1627
                        webContainer.setProject(this.project);
1627
                        webContainer.setProject(this.project);
1628
                    }
1628
                    }
1629
                }
1629
                }
1630
            }
1630
            }
1631
        } catch (Exception e) {
1631
        } catch (Exception e) {
1632
            throw new IllegalStateException("Cannot create Web container", e);
1632
            throw new IllegalStateException("Cannot create Web container", e);
1633
        }
1633
        }
1634

1634

1635
        if (webContainer != null) {
1635
        if (webContainer != null) {
1636
            //jvm route
1636
            //jvm route
1637
            if (this.jvmRoute != null) {
1637
            if (this.jvmRoute != null) {
1638
                invokeMethod(webContainer, "setJvmRoute", this.jvmRoute, "Web.jvmRoute",
1638
                invokeMethod(webContainer, "setJvmRoute", this.jvmRoute, "Web.jvmRoute",
1639
                        "[Web configuration] cannot set jvm route : " + jvmRoute);
1639
                        "[Web configuration] cannot set jvm route : " + jvmRoute);
1640
            }
1640
            }
1641

1641

1642
            //web ondemand
1642
            //web ondemand
1643
            invokeMethod(webContainer, "setOndemandenabled", String.valueOf(this.isWebOnDemandActivated),
1643
            invokeMethod(webContainer, "setOndemandenabled", String.valueOf(this.isWebOnDemandActivated),
1644
                    "webContainer.ondemandenabled", "[Web configuration] cannot set ondemandenable : " + this.isWebOnDemandActivated);
1644
                    "webContainer.ondemandenabled", "[Web configuration] cannot set ondemandenable : " + this.isWebOnDemandActivated);
1645

1645

1646
            if (this.isWebOnDemandActivated && this.webOnDemandRedirectPort != null) {
1646
            if (this.isWebOnDemandActivated && this.webOnDemandRedirectPort != null) {
1647
                invokeMethod(webContainer, "setOndemandredirectPort", this.webOnDemandRedirectPort, "webContainer.ondemandRedirectPort",
1647
                invokeMethod(webContainer, "setOndemandredirectPort", this.webOnDemandRedirectPort, "webContainer.ondemandRedirectPort",
1648
                        "[Web configuration] cannot set ondemand redirect port : " + this.webOnDemandRedirectPort);
1648
                        "[Web configuration] cannot set ondemand redirect port : " + this.webOnDemandRedirectPort);
1649
            }
1649
            }
1650

1650

1651
            //create AJP connector
1651
            //create AJP connector
1652
            Ajp ajp = null;
1652
            Ajp ajp = null;
1653
            if (this.isAjpActivated) {
1653
            if (this.isAjpActivated) {
1654
                ajp = (Ajp) instanciateConnector(Ajp.class.getName(), this.webContainer);
1654
                ajp = (Ajp) instanciateConnector(Ajp.class.getName(), this.webContainer);
1655
                if (ajp != null) {
1655
                if (ajp != null) {
1656
                    if (this.ajpEnableLookups != null) {
1656
                    if (this.ajpEnableLookups != null) {
1657
                        invokeMethod(ajp, "setEnableLookups", String.valueOf(this.ajpEnableLookups), "ajp.enableLookups",
1657
                        invokeMethod(ajp, "setEnableLookups", String.valueOf(this.ajpEnableLookups), "ajp.enableLookups",
1658
                                "[AJP configuration] cannot set enableLookups property : " + this.ajpEnableLookups);
1658
                                "[AJP configuration] cannot set enableLookups property : " + this.ajpEnableLookups);
1659
                    }
1659
                    }
1660
                    if (this.ajpAcceptCount != null) {
1660
                    if (this.ajpAcceptCount != null) {
1661
                        invokeMethod(ajp, "setAcceptCount", this.ajpAcceptCount, "ajp.acceptCount",
1661
                        invokeMethod(ajp, "setAcceptCount", this.ajpAcceptCount, "ajp.acceptCount",
1662
                                "[AJP configuration] cannot set accept count : " + this.ajpAcceptCount);
1662
                                "[AJP configuration] cannot set accept count : " + this.ajpAcceptCount);
1663
                    }
1663
                    }
1664
                    if (this.ajpConnectionTimeout != null) {
1664
                    if (this.ajpConnectionTimeout != null) {
1665
                        invokeMethod(ajp, "setConnectionTimeout", this.ajpConnectionTimeout, "ajp.connectionTimeout",
1665
                        invokeMethod(ajp, "setConnectionTimeout", this.ajpConnectionTimeout, "ajp.connectionTimeout",
1666
                                "[AJP configuration] cannot set connection timeout to: " + this.ajpConnectionTimeout);
1666
                                "[AJP configuration] cannot set connection timeout to: " + this.ajpConnectionTimeout);
1667
                    }
1667
                    }
1668
                    if (this.ajpMaxThreads != null) {
1668
                    if (this.ajpMaxThreads != null) {
1669
                        invokeMethod(ajp, "setMaxThreads", this.ajpMaxThreads, "ajp.maxThreads",
1669
                        invokeMethod(ajp, "setMaxThreads", this.ajpMaxThreads, "ajp.maxThreads",
1670
                                "[AJP configuration] cannot set max threads ; " + this.ajpMaxThreads);
1670
                                "[AJP configuration] cannot set max threads ; " + this.ajpMaxThreads);
1671
                    }
1671
                    }
1672
                    if (this.ajpMinSpareThreads != null) {
1672
                    if (this.ajpMinSpareThreads != null) {
1673
                        invokeMethod(ajp, "setMinSpareThreads", this.ajpMinSpareThreads, "ajp.minSpareThreads",
1673
                        invokeMethod(ajp, "setMinSpareThreads", this.ajpMinSpareThreads, "ajp.minSpareThreads",
1674
                                "[AJP configuration] cannot set min spare threads : " + this.ajpMinSpareThreads);
1674
                                "[AJP configuration] cannot set min spare threads : " + this.ajpMinSpareThreads);
1675
                    }
1675
                    }
1676
                    if (this.ajpPort != null) {
1676
                    if (this.ajpPort != null) {
1677
                        invokeMethod(ajp, "setPort", this.ajpPort, "ajp.port", "[AJP configuration] cannot set port : " +
1677
                        invokeMethod(ajp, "setPort", this.ajpPort, "ajp.port", "[AJP configuration] cannot set port : " +
1678
                                this.ajpPort);
1678
                                this.ajpPort);
1679
                    }
1679
                    }
1680
                    if (this.ajpRedirectPort != null) {
1680
                    if (this.ajpRedirectPort != null) {
1681
                        invokeMethod(ajp, "setRedirectPort", this.ajpRedirectPort, "ajp.redirectPort",
1681
                        invokeMethod(ajp, "setRedirectPort", this.ajpRedirectPort, "ajp.redirectPort",
1682
                                "[AJP configuration] cannot set redirect port : " + this.ajpRedirectPort);
1682
                                "[AJP configuration] cannot set redirect port : " + this.ajpRedirectPort);
1683
                    }
1683
                    }
1684
                }
1684
                }
1685
            }
1685
            }
1686

1686

1687
            //create HTTP connector
1687
            //create HTTP connector
1688
            Http http = null;
1688
            Http http = null;
1689
            if (this.isHttpActivated) {
1689
            if (this.isHttpActivated) {
1690
                http = (Http) instanciateConnector(Http.class.getName(), this.webContainer);
1690
                http = (Http) instanciateConnector(Http.class.getName(), this.webContainer);
1691
                if (http != null) {
1691
                if (http != null) {
1692
                    if (this.httpEnableLookups != null) {
1692
                    if (this.httpEnableLookups != null) {
1693
                        invokeMethod(http, "setEnableLookups", String.valueOf(this.httpEnableLookups), "http.enableLookups",
1693
                        invokeMethod(http, "setEnableLookups", String.valueOf(this.httpEnableLookups), "http.enableLookups",
1694
                                "[HTTP configuration] cannot set enableLookups property : " + this.httpEnableLookups);
1694
                                "[HTTP configuration] cannot set enableLookups property : " + this.httpEnableLookups);
1695
                    }
1695
                    }
1696
                    if (this.httpAcceptCount != null) {
1696
                    if (this.httpAcceptCount != null) {
1697
                        invokeMethod(http, "setAcceptCount", this.httpAcceptCount, "http.acceptCount",
1697
                        invokeMethod(http, "setAcceptCount", this.httpAcceptCount, "http.acceptCount",
1698
                                "[HTTP configuration] cannot set accept count : " + this.httpAcceptCount);
1698
                                "[HTTP configuration] cannot set accept count : " + this.httpAcceptCount);
1699
                    }
1699
                    }
1700
                    if (this.httpConnectionTimeout != null) {
1700
                    if (this.httpConnectionTimeout != null) {
1701
                        invokeMethod(http, "setConnectionTimeout", this.httpConnectionTimeout, "http.connectionTimeout",
1701
                        invokeMethod(http, "setConnectionTimeout", this.httpConnectionTimeout, "http.connectionTimeout",
1702
                                "[HTTP configuration] cannot set connection timeout to: " + this.httpConnectionTimeout);
1702
                                "[HTTP configuration] cannot set connection timeout to: " + this.httpConnectionTimeout);
1703
                    }
1703
                    }
1704
                    if (this.httpMaxThreads != null) {
1704
                    if (this.httpMaxThreads != null) {
1705
                        invokeMethod(http, "setMaxThreads", this.httpMaxThreads, "http.maxThreads",
1705
                        invokeMethod(http, "setMaxThreads", this.httpMaxThreads, "http.maxThreads",
1706
                                "[HTTP configuration] cannot set max threads ; " + this.httpMaxThreads);
1706
                                "[HTTP configuration] cannot set max threads ; " + this.httpMaxThreads);
1707
                    }
1707
                    }
1708
                    if (this.httpMinSpareThreads != null) {
1708
                    if (this.httpMinSpareThreads != null) {
1709
                        invokeMethod(http, "setMinSpareThreads", this.httpMinSpareThreads, "http.minSpareThreads",
1709
                        invokeMethod(http, "setMinSpareThreads", this.httpMinSpareThreads, "http.minSpareThreads",
1710
                                "[HTTP configuration] cannot set min spare threads : " + this.httpMinSpareThreads);
1710
                                "[HTTP configuration] cannot set min spare threads : " + this.httpMinSpareThreads);
1711
                    }
1711
                    }
1712
                    if (this.httpPort != null) {
1712
                    if (this.httpPort != null) {
1713
                        invokeMethod(http, "setPort", this.httpPort, "http.port", "[HTTP configuration] cannot set port : " +
1713
                        invokeMethod(http, "setPort", this.httpPort, "http.port", "[HTTP configuration] cannot set port : " +
1714
                                this.httpPort);
1714
                                this.httpPort);
1715
                    }
1715
                    }
1716
                    if (this.httpRedirectPort != null) {
1716
                    if (this.httpRedirectPort != null) {
1717
                        invokeMethod(http, "setRedirectPort", this.httpRedirectPort, "http.redirectPort",
1717
                        invokeMethod(http, "setRedirectPort", this.httpRedirectPort, "http.redirectPort",
1718
                                "[HTTP configuration] cannot set redirect port : " + this.httpRedirectPort);
1718
                                "[HTTP configuration] cannot set redirect port : " + this.httpRedirectPort);
1719
                    }
1719
                    }
1720
                    if (this.httpCompression != null) {
1720
                    if (this.httpCompression != null) {
1721
                        invokeMethod(http, "setCompression", this.httpCompression, "http.compression",
1721
                        invokeMethod(http, "setCompression", this.httpCompression, "http.compression",
1722
                                "[HTTP configuration] cannot set compression : " + this.httpCompression);
1722
                                "[HTTP configuration] cannot set compression : " + this.httpCompression);
1723
                    }
1723
                    }
1724
                    if (this.httpMaxKeepAliveRequest != null) {
1724
                    if (this.httpMaxKeepAliveRequest != null) {
1725
                        invokeMethod(http, "setMaxKeepAliveRequest", this.httpMaxKeepAliveRequest, "http.maxKeepAliveRequest",
1725
                        invokeMethod(http, "setMaxKeepAliveRequest", this.httpMaxKeepAliveRequest, "http.maxKeepAliveRequest",
1726
                                "[HTTP configuration] cannot set max keep alive request : " + this.httpMaxKeepAliveRequest);
1726
                                "[HTTP configuration] cannot set max keep alive request : " + this.httpMaxKeepAliveRequest);
1727
                    }
1727
                    }
1728
                }
1728
                }
1729
            }
1729
            }
1730

1730

1731
            //create HTTPS connector
1731
            //create HTTPS connector
1732
            Https https = null;
1732
            Https https = null;
1733
            if (this.isHttpsActivated) {
1733
            if (this.isHttpsActivated) {
1734
                https = (Https) instanciateConnector(Https.class.getName(), this.webContainer);
1734
                https = (Https) instanciateConnector(Https.class.getName(), this.webContainer);
1735
                if (https != null) {
1735
                if (https != null) {
1736
                    if (this.httpsEnableLookups != null) {
1736
                    if (this.httpsEnableLookups != null) {
1737
                        invokeMethod(https, "setEnableLookups", String.valueOf(this.httpsEnableLookups), "https.enableLookups",
1737
                        invokeMethod(https, "setEnableLookups", String.valueOf(this.httpsEnableLookups), "https.enableLookups",
1738
                                "[HTTPS configuration] cannot set enableLookups property : " + this.httpsEnableLookups);
1738
                                "[HTTPS configuration] cannot set enableLookups property : " + this.httpsEnableLookups);
1739
                    }
1739
                    }
1740
                    if (this.httpsAcceptCount != null) {
1740
                    if (this.httpsAcceptCount != null) {
1741
                        invokeMethod(https, "setAcceptCount", this.httpsAcceptCount, "https.acceptCount",
1741
                        invokeMethod(https, "setAcceptCount", this.httpsAcceptCount, "https.acceptCount",
1742
                                "[HTTPS configuration] cannot set accept count : " + this.httpsAcceptCount);
1742
                                "[HTTPS configuration] cannot set accept count : " + this.httpsAcceptCount);
1743
                    }
1743
                    }
1744
                    if (this.httpsConnectionTimeout != null) {
1744
                    if (this.httpsConnectionTimeout != null) {
1745
                        invokeMethod(https, "setConnectionTimeout", this.httpsConnectionTimeout, "https.connectionTimeout",
1745
                        invokeMethod(https, "setConnectionTimeout", this.httpsConnectionTimeout, "https.connectionTimeout",
1746
                                "[HTTPS configuration] cannot set connection timeout to: " + this.httpsConnectionTimeout);
1746
                                "[HTTPS configuration] cannot set connection timeout to: " + this.httpsConnectionTimeout);
1747
                    }
1747
                    }
1748
                    if (this.httpsMaxThreads != null) {
1748
                    if (this.httpsMaxThreads != null) {
1749
                        invokeMethod(https, "setMaxThreads", this.httpsMaxThreads, "https.maxThreads",
1749
                        invokeMethod(https, "setMaxThreads", this.httpsMaxThreads, "https.maxThreads",
1750
                                "[HTTPS configuration] cannot set max threads ; " + this.httpsMaxThreads);
1750
                                "[HTTPS configuration] cannot set max threads ; " + this.httpsMaxThreads);
1751
                    }
1751
                    }
1752
                    if (this.httpsMinSpareThreads != null) {
1752
                    if (this.httpsMinSpareThreads != null) {
1753
                        invokeMethod(https, "setMinSpareThreads", this.httpsMinSpareThreads, "https.minSpareThreads",
1753
                        invokeMethod(https, "setMinSpareThreads", this.httpsMinSpareThreads, "https.minSpareThreads",
1754
                                "[HTTPS configuration] cannot set min spare threads : " + this.httpsMinSpareThreads);
1754
                                "[HTTPS configuration] cannot set min spare threads : " + this.httpsMinSpareThreads);
1755
                    }
1755
                    }
1756
                    if (this.httpsPort != null) {
1756
                    if (this.httpsPort != null) {
1757
                        invokeMethod(https, "setPort", this.httpsPort, "https.port", "[HTTPS configuration] cannot set port : " +
1757
                        invokeMethod(https, "setPort", this.httpsPort, "https.port", "[HTTPS configuration] cannot set port : " +
1758
                                this.httpsPort);
1758
                                this.httpsPort);
1759
                    }
1759
                    }
1760
                    if (this.httpsRedirectPort != null) {
1760
                    if (this.httpsRedirectPort != null) {
1761
                        invokeMethod(https, "setRedirectPort", this.httpsRedirectPort, "https.redirectPort",
1761
                        invokeMethod(https, "setRedirectPort", this.httpsRedirectPort, "https.redirectPort",
1762
                                "[HTTPS configuration] cannot set redirect port : " + this.httpsRedirectPort);
1762
                                "[HTTPS configuration] cannot set redirect port : " + this.httpsRedirectPort);
1763
                    }
1763
                    }
1764
                    if (this.httpsCompression != null) {
1764
                    if (this.httpsCompression != null) {
1765
                        invokeMethod(https, "setCompression", this.httpsCompression, "https.compression",
1765
                        invokeMethod(https, "setCompression", this.httpsCompression, "https.compression",
1766
                                "[HTTPS configuration] cannot set compression : " + this.httpsCompression);
1766
                                "[HTTPS configuration] cannot set compression : " + this.httpsCompression);
1767
                    }
1767
                    }
1768
                    if (this.httpsMaxKeepAliveRequest != null) {
1768
                    if (this.httpsMaxKeepAliveRequest != null) {
1769
                        invokeMethod(https, "setMaxKeepAliveRequest", this.httpsMaxKeepAliveRequest, "https.maxKeepAliveRequest",
1769
                        invokeMethod(https, "setMaxKeepAliveRequest", this.httpsMaxKeepAliveRequest, "https.maxKeepAliveRequest",
1770
                                "[HTTPS configuration] cannot set max keep alive request : " + this.httpsMaxKeepAliveRequest);
1770
                                "[HTTPS configuration] cannot set max keep alive request : " + this.httpsMaxKeepAliveRequest);
1771
                    }
1771
                    }
1772
                    if (this.httpsKeystoreFile != null) {
1772
                    if (this.httpsKeystoreFile != null) {
1773
                        invokeMethod(https, "setKeystoreFile", this.httpsKeystoreFile, "https.keyStoreFile",
1773
                        invokeMethod(https, "setKeystoreFile", this.httpsKeystoreFile, "https.keyStoreFile",
1774
                                "[HTTPS configuration] cannot set keystore file : " + this.httpsKeystoreFile);
1774
                                "[HTTPS configuration] cannot set keystore file : " + this.httpsKeystoreFile);
1775
                    }
1775
                    }
1776
                    if (this.httpsKeystorePass != null) {
1776
                    if (this.httpsKeystorePass != null) {
1777
                        invokeMethod(https, "setKeystorePass", this.httpsKeystorePass, "https.keyStorePass",
1777
                        invokeMethod(https, "setKeystorePass", this.httpsKeystorePass, "https.keyStorePass",
1778
                                "[HTTPS configuration] cannot set keystore pass : " + this.httpsKeystorePass);
1778
                                "[HTTPS configuration] cannot set keystore pass : " + this.httpsKeystorePass);
1779
                    }
1779
                    }
1780
                }
1780
                }
1781
            }
1781
            }
1782

1782

1783
            SessionReplication sessionReplication = null;
1783
            SessionReplication sessionReplication = null;
1784
            if (this.isHttpReplicationActivated) {
1784
            if (this.isHttpReplicationActivated) {
1785
                sessionReplication = new SessionReplication();
1785
                sessionReplication = new SessionReplication();
1786
                if (this.sessionReplicationAlgorithm != null) {
1786
                if (this.sessionReplicationAlgorithm != null) {
1787
                    sessionReplication.setAlgorithm(this.sessionReplicationAlgorithm);
1787
                    sessionReplication.setAlgorithm(this.sessionReplicationAlgorithm);
1788
                }
1788
                }
1789
                if (this.sessionReplicationClusterName != null) {
1789
                if (this.sessionReplicationClusterName != null) {
1790
                    sessionReplication.setName(this.sessionReplicationClusterName);
1790
                    sessionReplication.setName(this.sessionReplicationClusterName);
1791
                }
1791
                }
1792
                if (this.sessionReplicationMulticastAddress != null) {
1792
                if (this.sessionReplicationMulticastAddress != null) {
1793
                    sessionReplication.setMcastAddr(this.sessionReplicationMulticastAddress);
1793
                    sessionReplication.setMcastAddr(this.sessionReplicationMulticastAddress);
1794
                }
1794
                }
1795
                if (this.sessionReplicationMulticastPort != null) {
1795
                if (this.sessionReplicationMulticastPort != null) {
1796
                    sessionReplication.setMcastPort(this.sessionReplicationMulticastPort);
1796
                    sessionReplication.setMcastPort(this.sessionReplicationMulticastPort);
1797
                }
1797
                }
1798
                if (this.sessionReplicationListenPort != null) {
1798
                if (this.sessionReplicationListenPort != null) {
1799
                    sessionReplication.setListenPort(this.sessionReplicationListenPort);
1799
                    sessionReplication.setListenPort(this.sessionReplicationListenPort);
1800
                }
1800
                }
1801
            }
1801
            }
1802

1802

1803
            TomcatSessionManager tomcatSessionManager = null;
1803
            TomcatSessionManager tomcatSessionManager = null;
1804
            if (this.isHttpSessionManagerActivated) {
1804
            if (this.isHttpSessionManagerActivated) {
1805
                tomcatSessionManager = new TomcatSessionManager();
1805
                tomcatSessionManager = new TomcatSessionManager();
1806
                if (this.maxActiveSession != null) {
1806
                if (this.maxActiveSession != null) {
1807
                    tomcatSessionManager.setMaxActiveSessions(this.maxActiveSession);
1807
                    tomcatSessionManager.setMaxActiveSessions(this.maxActiveSession);
1808
                }
1808
                }
1809
            }
1809
            }
1810

1810

1811
            //instanciate webcontainer Connectors object
1811
            //instanciate webcontainer Connectors object
1812
            Connectors connectors = null;
1812
            Connectors connectors = null;
1813
            Method connectorsMethod = null;
1813
            Method connectorsMethod = null;
1814
            for (Method method : webContainer.getClass().getMethods()) {
1814
            for (Method method : webContainer.getClass().getMethods()) {
1815
                if (method.getName().equals("addConfiguredConnectors") && method.getParameterTypes().length == 1) {
1815
                if (method.getName().equals("addConfiguredConnectors") && method.getParameterTypes().length == 1) {
1816
                    try {
1816
                    try {
1817
                        connectors = (Connectors) method.getParameterTypes()[0].newInstance();
1817
                        connectors = (Connectors) method.getParameterTypes()[0].newInstance();
1818
                        connectors.setProject(this.project);
1818
                        connectors.setProject(this.project);
-
 
1819
                        connectors.setSkipOptionalDeployablesCopy(true);
1819
                    } catch (Exception e) {
1820
                    } catch (Exception e) {
1820
                        throw new IllegalStateException("Cannot generate Web connector to configure", e);
1821
                        throw new IllegalStateException("Cannot generate Web connector to configure", e);
1821
                    }
1822
                    }
1822
                    connectorsMethod = method;
1823
                    connectorsMethod = method;
1823
                    break;
1824
                    break;
1824
                }
1825
                }
1825
            }
1826
            }
1826
            if (connectors == null) {
1827
            if (connectors == null) {
1827
                throw new IllegalStateException("Cannot find method for adding configured Web connector");
1828
                throw new IllegalStateException("Cannot find method for adding configured Web connector");
1828
            }
1829
            }
1829

1830

1830
            //addition of all connector to the Connectors object
1831
            //addition of all connector to the Connectors object
1831
            if (http != null) {
1832
            if (http != null) {
1832
                invokeMethod(connectors, "addConfiguredHttp", http, "web.connectors.http",
1833
                invokeMethod(connectors, "addConfiguredHttp", http, "web.connectors.http",
1833
                        "[Web container] cannot add configured Web HTTP connector");
1834
                        "[Web container] cannot add configured Web HTTP connector");
1834
            }
1835
            }
1835
            if (https != null) {
1836
            if (https != null) {
1836
                invokeMethod(connectors, "addConfiguredHttps", https, "web.connectors.https",
1837
                invokeMethod(connectors, "addConfiguredHttps", https, "web.connectors.https",
1837
                        "[Web container] cannot add configured Web HTTPS connector");
1838
                        "[Web container] cannot add configured Web HTTPS connector");
1838
            }
1839
            }
1839
            if (ajp != null) {
1840
            if (ajp != null) {
1840
                invokeMethod(connectors, "addConfiguredAjp", ajp, "web.connectors.ajp",
1841
                invokeMethod(connectors, "addConfiguredAjp", ajp, "web.connectors.ajp",
1841
                        "[Web container] cannot add configured Web AJP connector");
1842
                        "[Web container] cannot add configured Web AJP connector");
1842
            }
1843
            }
1843

1844

1844
            //addition of Connectors object to the WebContainer
1845
            //addition of Connectors object to the WebContainer
1845
            try {
1846
            try {
1846
                connectorsMethod.invoke(webContainer, connectors);
1847
                connectorsMethod.invoke(webContainer, connectors);
1847
            } catch (Exception e) {
1848
            } catch (Exception e) {
1848
                throw new IllegalStateException("Cannot add configured Web connector", e);
1849
                throw new IllegalStateException("Cannot add configured Web connector", e);
1849
            }
1850
            }
1850

1851

1851
            //addition of session manager to the webcontainer
1852
            //addition of session manager to the webcontainer
1852
            if (tomcatSessionManager != null) {
1853
            if (tomcatSessionManager != null) {
1853
                invokeMethod(webContainer, "addConfiguredSessionManager", tomcatSessionManager, "web.sessionManager",
1854
                invokeMethod(webContainer, "addConfiguredSessionManager", tomcatSessionManager, "web.sessionManager",
1854
                        "[Web container] cannot add configured Web session manager");
1855
                        "[Web container] cannot add configured Web session manager");
1855
            }
1856
            }
1856

1857

1857
            //addition of session replication object to the webContainer
1858
            //addition of session replication object to the webContainer
1858
            if (sessionReplication != null) {
1859
            if (sessionReplication != null) {
1859
                invokeMethod(webContainer, "addConfiguredSessionReplication", sessionReplication, "web.sessionReplication",
1860
                invokeMethod(webContainer, "addConfiguredSessionReplication", sessionReplication, "web.sessionReplication",
1860
                        "[Web container] cannot add configured Web session replication");
1861
                        "[Web container] cannot add configured Web session replication");
1861
            }
1862
            }
1862

1863

1863
            //execute the webcontainer task
1864
            //execute the webcontainer task
1864
            webContainer.execute();
1865
            webContainer.execute();
1865
        }
1866
        }
1866

1867

1867
        if (!this.isProtocolsListSet) {
1868
        if (!this.isProtocolsListSet) {
1868
            this.carol.setProtocols("jrmp");
1869
            this.carol.setProtocols("jrmp");
1869
        }
1870
        }
1870
        this.carol.execute();
1871
        this.carol.execute();
1871

1872

1872
        if (this.db != null) {
1873
        if (this.db != null) {
1873
            this.db.execute();
1874
            this.db.execute();
1874
        }
1875
        }
1875

1876

1876
        //TODO to be able to configure each discovery service
1877
        //TODO to be able to configure each discovery service
1877
        if (this.discovery != null) {
1878
        if (this.discovery != null) {
1878
            this.discovery.execute();
1879
            this.discovery.execute();
1879
        }
1880
        }
1880

1881

1881
        if (this.smartClient != null) {
1882
        if (this.smartClient != null) {
1882
            this.smartClient.execute();
1883
            this.smartClient.execute();
1883
        } 
1884
        } 
1884

1885

1885
        boolean first = true;
1886
        boolean first = true;
1886
        for (JdbcXml jdbcXml : this.jdbcXmlList) {
1887
        for (JdbcXml jdbcXml : this.jdbcXmlList) {
1887
            
1888
            
1888
            // The JdbcXml task will write all DS definitions to a single file
1889
            // The JdbcXml task will write all DS definitions to a single file
1889
            // called JONAS_BASE/deploy/jdbc-ds.xml
1890
            // called JONAS_BASE/deploy/jdbc-ds.xml
1890
            //
1891
            //
1891
            // Since the file does not exist at the first call, we need to set
1892
            // Since the file does not exist at the first call, we need to set
1892
            // it as "new file"; after we tell JdbcXml to merge
1893
            // it as "new file"; after we tell JdbcXml to merge
1893
            jdbcXml.setNewFile(Boolean.toString(first));
1894
            jdbcXml.setNewFile(Boolean.toString(first));
1894
            jdbcXml.execute();
1895
            jdbcXml.execute();
1895
            first = false;
1896
            first = false;
1896
        }
1897
        }
1897

1898

1898
        if (this.jms != null) {
1899
        if (this.jms != null) {
1899
            this.jms.execute();
1900
            this.jms.execute();
1900
        }
1901
        }
1901

1902

1902
        for (User admin: admins) {
1903
        for (User admin: admins) {
1903
            this.security.addConfiguredAdmin(admin);
1904
            this.security.addConfiguredAdmin(admin);
1904
        }
1905
        }
1905
        for (User user: users) {
1906
        for (User user: users) {
1906
            this.security.addConfiguredUser(user);
1907
            this.security.addConfiguredUser(user);
1907
        }
1908
        }
1908
        this.security.execute();
1909
        this.security.execute();
1909

1910

1910
        for (Mail mail: this.mails) {
1911
        for (Mail mail: this.mails) {
1911
            mail.execute();
1912
            mail.execute();
1912
        }
1913
        }
1913

1914

1914
        if (this.wsdlPublisherFile != null) {
1915
        if (this.wsdlPublisherFile != null) {
1915
            this.wsdlPublish = new WsdlPublish();
1916
            this.wsdlPublish = new WsdlPublish();
1916
            this.wsdlPublish.setProject(this.project);
1917
            this.wsdlPublish.setProject(this.project);
1917
            this.wsdlPublish.addConfiguredFile(this.wsdlPublisherFile);
1918
            this.wsdlPublish.addConfiguredFile(this.wsdlPublisherFile);
1918
            this.wsdlPublish.execute();
1919
            this.wsdlPublish.execute();
1919
        }
1920
        }
1920

1921

1921
        if (this.wrapper != null) {
1922
        if (this.wrapper != null) {
1922
            this.wrapper.execute();
1923
            this.wrapper.execute();
1923
        }
1924
        }
1924
    }
1925
    }
1925

1926

1926
    /* --------------------------------- */
1927
    /* --------------------------------- */
1927
    /* Cluster daemon configuration part */
1928
    /* Cluster daemon configuration part */
1928

1929

1929
    /**
1930
    /**
1930
     * Initialize ClusterDaemon if not set
1931
     * Initialize ClusterDaemon if not set
1931
     */
1932
     */
1932
    private void initClusterDaemon() {
1933
    private void initClusterDaemon() {
1933
        if (this.clusterDaemon == null) {
1934
        if (this.clusterDaemon == null) {
1934
            this.clusterDaemon = new ClusterDaemon();
1935
            this.clusterDaemon = new ClusterDaemon();
1935
            this.clusterDaemon.setProject(this.project);
1936
            this.clusterDaemon.setProject(this.project);
1936
        }
1937
        }
1937
    }
1938
    }
1938

1939

1939
    /**
1940
    /**
1940
     * {@inheritDoc}
1941
     * {@inheritDoc}
1941
     */
1942
     */
1942
    public void setCDClusterName(final String clusterName) {
1943
    public void setCDClusterName(final String clusterName) {
1943
        Jonas53.logger.finest("[Cluster daemon configuration] setting cluster name : " + clusterName);
1944
        Jonas53.logger.finest("[Cluster daemon configuration] setting cluster name : " + clusterName);
1944
        initClusterDaemon();
1945
        initClusterDaemon();
1945
        this.clusterDaemon.setName(clusterName);
1946
        this.clusterDaemon.setName(clusterName);
1946
    }
1947
    }
1947

1948

1948
    /**
1949
    /**
1949
     * {@inheritDoc}
1950
     * {@inheritDoc}
1950
     */
1951
     */
1951
    public void setCDClusterDomain(final String clusterDomain) {
1952
    public void setCDClusterDomain(final String clusterDomain) {
1952
        Jonas53.logger.finest("[Cluster daemon configuration] setting cluster domain name : " + clusterDomain);
1953
        Jonas53.logger.finest("[Cluster daemon configuration] setting cluster domain name : " + clusterDomain);
1953
        initClusterDaemon();
1954
        initClusterDaemon();
1954
        this.clusterDaemon.setDomainName(clusterDomain);
1955
        this.clusterDaemon.setDomainName(clusterDomain);
1955
    }
1956
    }
1956

1957

1957
    /**
1958
    /**
1958
     * {@inheritDoc}
1959
     * {@inheritDoc}
1959
     */
1960
     */
1960
    public void setCDProtocol(final String protocol) {
1961
    public void setCDProtocol(final String protocol) {
1961
        Jonas53.logger.finest("[Cluster daemon configuration] setting protocol : " + protocol);
1962
        Jonas53.logger.finest("[Cluster daemon configuration] setting protocol : " + protocol);
1962
        NotApplicableHelper.notApplicable("clusterdaemon.protocol");
1963
        NotApplicableHelper.notApplicable("clusterdaemon.protocol");
1963
    }
1964
    }
1964

1965

1965
    /**
1966
    /**
1966
     * {@inheritDoc}
1967
     * {@inheritDoc}
1967
     */
1968
     */
1968
    public void setCDPort(final String port) {
1969
    public void setCDPort(final String port) {
1969
        Jonas53.logger.finest("[Cluster daemon configuration] setting port : " + port);
1970
        Jonas53.logger.finest("[Cluster daemon configuration] setting port : " + port);
1970
        NotApplicableHelper.notApplicable("clusterdaemon.port");
1971
        NotApplicableHelper.notApplicable("clusterdaemon.port");
1971
    }
1972
    }
1972

1973

1973
    /**
1974
    /**
1974
     * {@inheritDoc}
1975
     * {@inheritDoc}
1975
     */
1976
     */
1976
    public void setCDDestDirPrefix(final String destDirPrefix) {
1977
    public void setCDDestDirPrefix(final String destDirPrefix) {
1977
        Jonas53.logger.finest("[Cluster daemon configuration] setting dest dir prefix : " + destDirPrefix);
1978
        Jonas53.logger.finest("[Cluster daemon configuration] setting dest dir prefix : " + destDirPrefix);
1978
        initClusterDaemon();
1979
        initClusterDaemon();
1979
        this.clusterDaemon.setDestDirPrefix(destDirPrefix);
1980
        this.clusterDaemon.setDestDirPrefix(destDirPrefix);
1980
        this.clusterDaemon.setCdDir(destDirPrefix);
1981
        this.clusterDaemon.setCdDir(destDirPrefix);
1981
        this.project.setProperty("jonas.base", destDirPrefix);
1982
        this.project.setProperty("jonas.base", destDirPrefix);
1982
    }
1983
    }
1983

1984

1984
    /**
1985
    /**
1985
     * {@inheritDoc}
1986
     * {@inheritDoc}
1986
     */
1987
     */
1987
    public void setCDInteractionMode(final String interactionMode) {
1988
    public void setCDInteractionMode(final String interactionMode) {
1988
        Jonas53.logger.finest("[Cluster daemon configuration] setting interaction mode : " + interactionMode);
1989
        Jonas53.logger.finest("[Cluster daemon configuration] setting interaction mode : " + interactionMode);
1989
        initClusterDaemon();
1990
        initClusterDaemon();
1990
        this.clusterDaemon.setInteractionMode(interactionMode);
1991
        this.clusterDaemon.setInteractionMode(interactionMode);
1991
    }
1992
    }
1992

1993

1993
    /**
1994
    /**
1994
     * {@inheritDoc}
1995
     * {@inheritDoc}
1995
     */
1996
     */
1996
    public void setCDJavaHome(final String javaHome) {
1997
    public void setCDJavaHome(final String javaHome) {
1997
        Jonas53.logger.finest("[Cluster daemon configuration] setting java home : " + javaHome);
1998
        Jonas53.logger.finest("[Cluster daemon configuration] setting java home : " + javaHome);
1998
        initClusterDaemon();
1999
        initClusterDaemon();
1999
        this.clusterDaemon.setJdk(javaHome);
2000
        this.clusterDaemon.setJdk(javaHome);
2000
    }
2001
    }
2001

2002

2002
    /**
2003
    /**
2003
     * {@inheritDoc}
2004
     * {@inheritDoc}
2004
     */
2005
     */
2005
    public void setCDJonasRoot(final String jonasRoot) {
2006
    public void setCDJonasRoot(final String jonasRoot) {
2006
        Jonas53.logger.finest("[Cluster daemon configuration] setting jonas root : " + jonasRoot);
2007
        Jonas53.logger.finest("[Cluster daemon configuration] setting jonas root : " + jonasRoot);
2007
        NotApplicableHelper.notApplicable("jonas.root");
2008
        NotApplicableHelper.notApplicable("jonas.root");
2008
    }
2009
    }
2009

2010

2010
    /**
2011
    /**
2011
     * {@inheritDoc}
2012
     * {@inheritDoc}
2012
     */
2013
     */
2013
    public void setCDServerNamePrefix(final String serverNamePrefix) {
2014
    public void setCDServerNamePrefix(final String serverNamePrefix) {
2014
        Jonas53.logger.finest("[Cluster daemon configuration] setting server name prefix : " + serverNamePrefix);
2015
        Jonas53.logger.finest("[Cluster daemon configuration] setting server name prefix : " + serverNamePrefix);
2015
        initClusterDaemon();
2016
        initClusterDaemon();
2016
        this.clusterDaemon.setClusterNodesName(serverNamePrefix);
2017
        this.clusterDaemon.setClusterNodesName(serverNamePrefix);
2017
    }
2018
    }
2018

2019

2019
    /**
2020
    /**
2020
     * {@inheritDoc}
2021
     * {@inheritDoc}
2021
     */
2022
     */
2022
    public void setCDXparam(final String xparam) {
2023
    public void setCDXparam(final String xparam) {
2023
        Jonas53.logger.finest("[Cluster daemon configuration] setting xparam : " + xparam);
2024
        Jonas53.logger.finest("[Cluster daemon configuration] setting xparam : " + xparam);
2024
        initClusterDaemon();
2025
        initClusterDaemon();
2025
        this.clusterDaemon.setXprm(xparam);
2026
        this.clusterDaemon.setXprm(xparam);
2026
    }
2027
    }
2027

2028

2028
    /**
2029
    /**
2029
     * {@inheritDoc}
2030
     * {@inheritDoc}
2030
     */
2031
     */
2031
    public void setCDAutoBoot(final boolean autoBoot) {
2032
    public void setCDAutoBoot(final boolean autoBoot) {
2032
        Jonas53.logger.finest("[Cluster daemon configuration] setting auto boot : " + autoBoot);
2033
        Jonas53.logger.finest("[Cluster daemon configuration] setting auto boot : " + autoBoot);
2033
        initClusterDaemon();
2034
        initClusterDaemon();
2034
        this.clusterDaemon.setAutoBoot(new Boolean(autoBoot).toString());
2035
        this.clusterDaemon.setAutoBoot(new Boolean(autoBoot).toString());
2035
    }
2036
    }
2036

2037

2037
    /**
2038
    /**
2038
     * {@inheritDoc}
2039
     * {@inheritDoc}
2039
     */
2040
     */
2040
    public void setCDNbInstances(final int nbInsts) {
2041
    public void setCDNbInstances(final int nbInsts) {
2041
        Jonas53.logger.finest("[Cluster daemon configuration] setting nb instance : " + nbInsts);
2042
        Jonas53.logger.finest("[Cluster daemon configuration] setting nb instance : " + nbInsts);
2042
        initClusterDaemon();
2043
        initClusterDaemon();
2043
        this.clusterDaemon.setInstNb(nbInsts);
2044
        this.clusterDaemon.setInstNb(nbInsts);
2044
    }
2045
    }
2045

2046

2046
    /**
2047
    /**
2047
     * {@inheritDoc}
2048
     * {@inheritDoc}
2048
     */
2049
     */
2049
    public void setCDJOnASScript(final String jonasScript) {
2050
    public void setCDJOnASScript(final String jonasScript) {
2050
        Jonas53.logger.finest("[Cluster daemon configuration] setting jonas script : " + jonasScript);
2051
        Jonas53.logger.finest("[Cluster daemon configuration] setting jonas script : " + jonasScript);
2051
        initClusterDaemon();
2052
        initClusterDaemon();
2052
        this.clusterDaemon.setJonasScript(jonasScript);
2053
        this.clusterDaemon.setJonasScript(jonasScript);
2053
    }
2054
    }
2054

2055

2055
    /**
2056
    /**
2056
     * {@inheritDoc}
2057
     * {@inheritDoc}
2057
     */
2058
     */
2058
    public void executeCDConf() {
2059
    public void executeCDConf() {
2059
        if (this.clusterDaemon != null) {
2060
        if (this.clusterDaemon != null) {
2060
            this.clusterDaemon.execute();
2061
            this.clusterDaemon.execute();
2061
        }
2062
        }
2062
    }
2063
    }
2063
    /* --------------------------------- */
2064
    /* --------------------------------- */
2064

2065

2065
    /**
2066
    /**
2066
     * {@inheritDoc}
2067
     * {@inheritDoc}
2067
     */
2068
     */
2068
    public void setWrapperConfiguration(final String javaHome, final String wrapperHome, final String serviceName,
2069
    public void setWrapperConfiguration(final String javaHome, final String wrapperHome, final String serviceName,
2069
                                        final String serviceDescription, final Boolean verbosity, final String logfile,
2070
                                        final String serviceDescription, final Boolean verbosity, final String logfile,
2070
                                        final String logfileRollmode) {
2071
                                        final String logfileRollmode) {
2071
        File wrapperDir = null;
2072
        File wrapperDir = null;
2072
        if (wrapperHome != null) {
2073
        if (wrapperHome != null) {
2073
            wrapperDir = new File(wrapperHome);
2074
            wrapperDir = new File(wrapperHome);
2074
        }
2075
        }
2075
        if (wrapperDir == null || !wrapperDir.exists()) {
2076
        if (wrapperDir == null || !wrapperDir.exists()) {
2076
            wrapperDir = new File(this.project.getProperty("jonas.root") + File.separator + "wrapper");
2077
            wrapperDir = new File(this.project.getProperty("jonas.root") + File.separator + "wrapper");
2077
        }
2078
        }
2078

2079

2079
        //locate wrapper ANT task
2080
        //locate wrapper ANT task
2080
        File wrapperAntTaskFile = new File(wrapperDir + File.separator + "lib" + File.separator + "ant" + File.separator
2081
        File wrapperAntTaskFile = new File(wrapperDir + File.separator + "lib" + File.separator + "ant" + File.separator
2081
                + "ow2_jonas_wrapper_ant.jar");
2082
                + "ow2_jonas_wrapper_ant.jar");
2082
        if (!wrapperAntTaskFile.exists()) {
2083
        if (!wrapperAntTaskFile.exists()) {
2083
            Jonas53.logger.finest("Wrapper home is incorrect. Cannot find Wrapper ANT task");
2084
            Jonas53.logger.finest("Wrapper home is incorrect. Cannot find Wrapper ANT task");
2084
            NotApplicableHelper.notApplicable("wrapper.home");
2085
            NotApplicableHelper.notApplicable("wrapper.home");
2085
        } else {
2086
        } else {
2086
            URL wrapperAntTask = null;
2087
            URL wrapperAntTask = null;
2087
            try {
2088
            try {
2088
                wrapperAntTask = wrapperAntTaskFile.toURI().toURL();
2089
                wrapperAntTask = wrapperAntTaskFile.toURI().toURL();
2089
            } catch (MalformedURLException e) {
2090
            } catch (MalformedURLException e) {
2090
                Jonas53.logger.severe("Cannot get the URL of the file " + wrapperAntTaskFile.getAbsolutePath());
2091
                Jonas53.logger.severe("Cannot get the URL of the file " + wrapperAntTaskFile.getAbsolutePath());
2091
            }
2092
            }
2092

2093

2093
            if (wrapperAntTask != null) {
2094
            if (wrapperAntTask != null) {
2094
                ClassLoader classLoader = new URLClassLoader(new URL[] {wrapperAntTask}, this.getClass().getClassLoader());
2095
                ClassLoader classLoader = new URLClassLoader(new URL[] {wrapperAntTask}, this.getClass().getClassLoader());
2095
                Class<? extends JOnASWrapper> clazz = null;
2096
                Class<? extends JOnASWrapper> clazz = null;
2096
                try {
2097
                try {
2097
                    clazz = classLoader.loadClass(JOnASWrapper.class.getName()).asSubclass(JOnASWrapper.class);
2098
                    clazz = classLoader.loadClass(JOnASWrapper.class.getName()).asSubclass(JOnASWrapper.class);
2098
                } catch (ClassNotFoundException e) {
2099
                } catch (ClassNotFoundException e) {
2099
                    Jonas53.logger.severe("Cannot found class " + JOnASWrapper.class.getName());
2100
                    Jonas53.logger.severe("Cannot found class " + JOnASWrapper.class.getName());
2100
                }
2101
                }
2101
                try {
2102
                try {
2102
                    this.wrapper = clazz.newInstance();
2103
                    this.wrapper = clazz.newInstance();
2103
                } catch (InstantiationException e) {
2104
                } catch (InstantiationException e) {
2104
                    Jonas53.logger.severe("Cannot instanciate " + Jonas53.class.getName());
2105
                    Jonas53.logger.severe("Cannot instanciate " + Jonas53.class.getName());
2105
                } catch (IllegalAccessException e) {
2106
                } catch (IllegalAccessException e) {
2106
                    Jonas53.logger.severe("Cannot instanciate " + Jonas53.class.getName());
2107
                    Jonas53.logger.severe("Cannot instanciate " + Jonas53.class.getName());
2107
                }
2108
                }
2108
                if (this.wrapper != null) {
2109
                if (this.wrapper != null) {
2109
                    this.wrapper.setProject(this.project);
2110
                    this.wrapper.setProject(this.project);
2110
                    if (javaHome != null) {
2111
                    if (javaHome != null) {
2111
                        this.wrapper.setJavaHome(javaHome);
2112
                        this.wrapper.setJavaHome(javaHome);
2112
                    }
2113
                    }
2113
                    if (wrapperHome != null) {
2114
                    if (wrapperHome != null) {
2114
                        this.wrapper.setWrapperHome(wrapperHome);
2115
                        this.wrapper.setWrapperHome(wrapperHome);
2115
                    }
2116
                    }
2116
                    if (serviceName != null) {
2117
                    if (serviceName != null) {
2117
                        this.wrapper.setServiceName(serviceName);
2118
                        this.wrapper.setServiceName(serviceName);
2118
                    }
2119
                    }
2119
                    if (serviceDescription != null) {
2120
                    if (serviceDescription != null) {
2120
                        this.wrapper.setServiceDescription(serviceDescription);
2121
                        this.wrapper.setServiceDescription(serviceDescription);
2121
                    }
2122
                    }
2122
                    if (verbosity != null) {
2123
                    if (verbosity != null) {
2123
                        this.wrapper.setVerbosity(verbosity);
2124
                        this.wrapper.setVerbosity(verbosity);
2124
                    }
2125
                    }
2125
                    if (logfile != null) {
2126
                    if (logfile != null) {
2126
                        this.wrapper.setLogfile(logfile);
2127
                        this.wrapper.setLogfile(logfile);
2127
                    }
2128
                    }
2128
                    if (logfileRollmode != null) {
2129
                    if (logfileRollmode != null) {
2129
                        this.wrapper.setLogfileRollmode(logfileRollmode);
2130
                        this.wrapper.setLogfileRollmode(logfileRollmode);
2130
                    }
2131
                    }
2131
                }
2132
                }
2132
            }
2133
            }
2133
        }
2134
        }
2134
    }
2135
    }
2135

2136

2136

2137

2137
    /**
2138
    /**
2138
     * Gets all classes in a given URLClassLoader that are children of a given class or interface.
2139
     * Gets all classes in a given URLClassLoader that are children of a given class or interface.
2139
     * @param urlCL URLClassLoader to scan.
2140
     * @param urlCL URLClassLoader to scan.
2140
     * @param parent Parent class or interface that returned classes should implement.
2141
     * @param parent Parent class or interface that returned classes should implement.
2141
     * @return All classes in <code>urlCl</code> that are children of class or interface <code>parent</code>.
2142
     * @return All classes in <code>urlCl</code> that are children of class or interface <code>parent</code>.
2142
     * @throws IOException If the URLClassLoader cannot be read.
2143
     * @throws IOException If the URLClassLoader cannot be read.
2143
     * @throws URISyntaxException If the URLClassLoader cannot be read.
2144
     * @throws URISyntaxException If the URLClassLoader cannot be read.
2144
     * @throws ClassNotFoundException If class or interface <code>parent</code> cannot be loaded.
2145
     * @throws ClassNotFoundException If class or interface <code>parent</code> cannot be loaded.
2145
     */
2146
     */
2146
    private SortedSet<String> getAllClasses(URLClassLoader urlCL, String parent)
2147
    private SortedSet<String> getAllClasses(URLClassLoader urlCL, String parent)
2147
        throws IOException, URISyntaxException, ClassNotFoundException {
2148
        throws IOException, URISyntaxException, ClassNotFoundException {
2148

2149

2149
        SortedSet<String> classes = new TreeSet<String>();
2150
        SortedSet<String> classes = new TreeSet<String>();
2150

2151

2151
        Class<?> parentClass;
2152
        Class<?> parentClass;
2152
        try {
2153
        try {
2153
            parentClass = urlCL.loadClass(parent);
2154
            parentClass = urlCL.loadClass(parent);
2154
        } catch (ClassNotFoundException e) {
2155
        } catch (ClassNotFoundException e) {
2155
            throw new IllegalArgumentException("Class " + parent + " not found in " + urlCL);
2156
            throw new IllegalArgumentException("Class " + parent + " not found in " + urlCL);
2156
        }
2157
        }
2157

2158

2158
        for (URL url : urlCL.getURLs()) {
2159
        for (URL url : urlCL.getURLs()) {
2159
            classes.addAll(getAllClasses(url, urlCL, parentClass));
2160
            classes.addAll(getAllClasses(url, urlCL, parentClass));
2160
        }
2161
        }
2161

2162

2162
        return classes;
2163
        return classes;
2163
    }
2164
    }
2164

2165

2165
    /**
2166
    /**
2166
     * Gets all classes in a given JAR file or a URLClassLoader that are children of a given class or interface.
2167
     * Gets all classes in a given JAR file or a URLClassLoader that are children of a given class or interface.
2167
     * @param jarUrl JAR file's URL.
2168
     * @param jarUrl JAR file's URL.
2168
     * @param urlCL URLClassLoader to scan.
2169
     * @param urlCL URLClassLoader to scan.
2169
     * @param parentClass Parent class or interface that returned classes should implement.
2170
     * @param parentClass Parent class or interface that returned classes should implement.
2170
     * @return All classes in <code>jar</code> that are member of <code>urlCl</code> that are children of class or interface
2171
     * @return All classes in <code>jar</code> that are member of <code>urlCl</code> that are children of class or interface
2171
     * <code>parent</code>.
2172
     * <code>parent</code>.
2172
     * @throws IOException If the JAR file cannot be read.
2173
     * @throws IOException If the JAR file cannot be read.
2173
     * @throws URISyntaxException If the JAR file cannot be read.
2174
     * @throws URISyntaxException If the JAR file cannot be read.
2174
     * @throws ClassNotFoundException If class or interface <code>parent</code> cannot be loaded.
2175
     * @throws ClassNotFoundException If class or interface <code>parent</code> cannot be loaded.
2175
     */
2176
     */
2176
    private SortedSet<String> getAllClasses(URL jarUrl, URLClassLoader urlCL, Class<?> parentClass)
2177
    private SortedSet<String> getAllClasses(URL jarUrl, URLClassLoader urlCL, Class<?> parentClass)
2177
        throws IOException, URISyntaxException, ClassNotFoundException {
2178
        throws IOException, URISyntaxException, ClassNotFoundException {
2178

2179

2179
        SortedSet<String> classes = new TreeSet<String>();
2180
        SortedSet<String> classes = new TreeSet<String>();
2180

2181

2181
        File jarFile = new File(jarUrl.toURI());
2182
        File jarFile = new File(jarUrl.toURI());
2182
        if (!jarFile.isFile()) {
2183
        if (!jarFile.isFile()) {
2183
            return classes;
2184
            return classes;
2184
        }
2185
        }
2185

2186

2186
        JarFile jar = new JarFile(jarFile);
2187
        JarFile jar = new JarFile(jarFile);
2187
        Enumeration<JarEntry> entries = jar.entries();
2188
        Enumeration<JarEntry> entries = jar.entries();
2188
        while (entries.hasMoreElements()) {
2189
        while (entries.hasMoreElements()) {
2189
            JarEntry entry = entries.nextElement();
2190
            JarEntry entry = entries.nextElement();
2190
            String entryName = entry.getName();
2191
            String entryName = entry.getName();
2191
            if (entryName.endsWith(".class") && !entryName.contains("$")) {
2192
            if (entryName.endsWith(".class") && !entryName.contains("$")) {
2192
                entryName = entryName.substring(0, entryName.length() - 6);
2193
                entryName = entryName.substring(0, entryName.length() - 6);
2193
                entryName = entryName.replace('/', '.');
2194
                entryName = entryName.replace('/', '.');
2194
                entryName = entryName.replace('\\', '.');
2195
                entryName = entryName.replace('\\', '.');
2195

2196

2196
                Class<?> entryClass;
2197
                Class<?> entryClass;
2197
                try {
2198
                try {
2198
                    entryClass = urlCL.loadClass(entryName);
2199
                    entryClass = urlCL.loadClass(entryName);
2199
                } catch (NoClassDefFoundError ignored) {
2200
                } catch (NoClassDefFoundError ignored) {
2200
                    continue;
2201
                    continue;
2201
                }
2202
                }
2202
                if (!entryClass.isInterface() && ! Modifier.isAbstract(entryClass.getModifiers())
2203
                if (!entryClass.isInterface() && ! Modifier.isAbstract(entryClass.getModifiers())
2203
                    && parentClass.isAssignableFrom(entryClass)) {
2204
                    && parentClass.isAssignableFrom(entryClass)) {
2204

2205

2205
                    classes.add(entryName);
2206
                    classes.add(entryName);
2206
                }
2207
                }
2207
            }
2208
            }
2208
        }
2209
        }
2209

2210

2210
        return classes;
2211
        return classes;
2211
    }
2212
    }
2212

2213

2213
    /**
2214
    /**
2214
     * Generic method in order to invoke a method
2215
     * Generic method in order to invoke a method
2215
     * @param object The object which contains the method to invoke
2216
     * @param object The object which contains the method to invoke
2216
     * @param methodToInvoke Name of the method to invoke
2217
     * @param methodToInvoke Name of the method to invoke
2217
     * @param parameter The parameter of the method to invoke.
2218
     * @param parameter The parameter of the method to invoke.
2218
     * @param notApplicableLog Log if no such method is defined in the given object class
2219
     * @param notApplicableLog Log if no such method is defined in the given object class
2219
     * @param invocationExceptionLog Log if the method invocation failed
2220
     * @param invocationExceptionLog Log if the method invocation failed
2220
     */
2221
     */
2221
    private void invokeMethod(final Object object, final String methodToInvoke,
2222
    private void invokeMethod(final Object object, final String methodToInvoke,
2222
                              final Object parameter, final String notApplicableLog,
2223
                              final Object parameter, final String notApplicableLog,
2223
                              final String invocationExceptionLog) {
2224
                              final String invocationExceptionLog) {
2224
        List<Object> parameters = new ArrayList<Object>();
2225
        List<Object> parameters = new ArrayList<Object>();
2225
        parameters.add(parameter);
2226
        parameters.add(parameter);
2226
        invokeMethod(object, methodToInvoke, parameters, notApplicableLog, invocationExceptionLog);
2227
        invokeMethod(object, methodToInvoke, parameters, notApplicableLog, invocationExceptionLog);
2227
    }
2228
    }
2228

2229

2229
    /**
2230
    /**
2230
     * Generic method in order to invoke a method
2231
     * Generic method in order to invoke a method
2231
     * @param object The object which contains the method to invoke
2232
     * @param object The object which contains the method to invoke
2232
     * @param methodToInvoke Name of the method to invoke
2233
     * @param methodToInvoke Name of the method to invoke
2233
     * @param parameters  List of parameters of the method to invoke.
2234
     * @param parameters  List of parameters of the method to invoke.
2234
     * @param notApplicableLog Log if no such method is defined in the given object class
2235
     * @param notApplicableLog Log if no such method is defined in the given object class
2235
     * @param invocationExceptionLog Log if the method invocation failed
2236
     * @param invocationExceptionLog Log if the method invocation failed
2236
     */
2237
     */
2237
    private void invokeMethod(final Object object, final String methodToInvoke,
2238
    private void invokeMethod(final Object object, final String methodToInvoke,
2238
                              final List<Object> parameters, final String notApplicableLog,
2239
                              final List<Object> parameters, final String notApplicableLog,
2239
                              final String invocationExceptionLog) {
2240
                              final String invocationExceptionLog) {
2240
        if (object == null) {
2241
        if (object == null) {
2241
            throw new IllegalArgumentException("'object' parameter shouldn't be null");
2242
            throw new IllegalArgumentException("'object' parameter shouldn't be null");
2242
        }
2243
        }
2243
        if (parameters == null) {
2244
        if (parameters == null) {
2244
            throw new IllegalArgumentException("'parameters' parameter shouldn't be null");
2245
            throw new IllegalArgumentException("'parameters' parameter shouldn't be null");
2245
        }
2246
        }
2246

2247

2247
        List<Class<?>> parametersClass = new ArrayList<Class<?>>();
2248
        List<Class<?>> parametersClass = new ArrayList<Class<?>>();
2248
        for (Object parameter: parameters) {
2249
        for (Object parameter: parameters) {
2249
            parametersClass.add(parameter.getClass());
2250
            parametersClass.add(parameter.getClass());
2250
        } 
2251
        } 
2251
        Method method = null;
2252
        Method method = null;
2252
        try {
2253
        try {
2253
            method = object.getClass().getMethod(methodToInvoke, parametersClass.toArray(new Class<?>[parametersClass.size()]));
2254
            method = object.getClass().getMethod(methodToInvoke, parametersClass.toArray(new Class<?>[parametersClass.size()]));
2254
        } catch (NoSuchMethodException e) {
2255
        } catch (NoSuchMethodException e) {
2255
            NotApplicableHelper.notApplicable(notApplicableLog);
2256
            NotApplicableHelper.notApplicable(notApplicableLog);
2256
        }
2257
        }
2257
        if (method != null) {
2258
        if (method != null) {
2258
            try {
2259
            try {
2259
                method.invoke(object, parameters.toArray(new Object[parameters.size()]));
2260
                method.invoke(object, parameters.toArray(new Object[parameters.size()]));
2260
            } catch (Exception e) {
2261
            } catch (Exception e) {
2261
                throw new IllegalArgumentException(invocationExceptionLog, e);
2262
                throw new IllegalArgumentException(invocationExceptionLog, e);
2262
            }
2263
            }
2263
        }
2264
        }
2264
    }
2265
    }
2265

2266

2266
    /**
2267
    /**
2267
     * Instanciate a connector (HTTP, HTTPS, AJP) according to the webcontainer implementation
2268
     * Instanciate a connector (HTTP, HTTPS, AJP) according to the webcontainer implementation
2268
     * @param connectorClassName Name of the generic connector class 
2269
     * @param connectorClassName Name of the generic connector class 
2269
     * @param webContainer Name of the webcontainer implementation
2270
     * @param webContainer Name of the webcontainer implementation
2270
     * @return the instance of a connector
2271
     * @return the instance of a connector
2271
     */
2272
     */
2272
    private Object instanciateConnector(final String connectorClassName, final String webContainer) {
2273
    private Object instanciateConnector(final String connectorClassName, final String webContainer) {
2273
        try {
2274
        try {
2274
            //try to find a connector classname with a name equals to ${connector.name} + ${webcontainer.name}
2275
            //try to find a connector classname with a name equals to ${connector.name} + ${webcontainer.name}
2275
            SortedSet<String> classesName = getAllClasses((URLClassLoader) this.getClass().getClassLoader(), connectorClassName);
2276
            SortedSet<String> classesName = getAllClasses((URLClassLoader) this.getClass().getClassLoader(), connectorClassName);
2276
            for (String className: classesName) {
2277
            for (String className: classesName) {
2277
                if (className.contains(webContainer)) {
2278
                if (className.contains(webContainer)) {
2278
                    return this.getClass().getClassLoader().loadClass(className).newInstance();
2279
                    return this.getClass().getClassLoader().loadClass(className).newInstance();
2279
                }
2280
                }
2280
            }
2281
            }
2281

2282

2282
            //try to find a connector classname with a name equals to ${connector.name} + ${webcontainer.nameWithoutVersions}
2283
            //try to find a connector classname with a name equals to ${connector.name} + ${webcontainer.nameWithoutVersions}
2283
            String webContainerWitoutVersion =  webContainer.trim(); 
2284
            String webContainerWitoutVersion =  webContainer.trim(); 
2284
            while (Character.isDigit(webContainerWitoutVersion.charAt(webContainerWitoutVersion.length() - 1))) {
2285
            while (Character.isDigit(webContainerWitoutVersion.charAt(webContainerWitoutVersion.length() - 1))) {
2285
                webContainerWitoutVersion = webContainerWitoutVersion.substring(0, webContainerWitoutVersion.length() - 1);
2286
                webContainerWitoutVersion = webContainerWitoutVersion.substring(0, webContainerWitoutVersion.length() - 1);
2286
            }
2287
            }
2287
            for (String className: classesName) {
2288
            for (String className: classesName) {
2288
                if (className.contains(webContainerWitoutVersion)) {
2289
                if (className.contains(webContainerWitoutVersion)) {
2289
                    return this.getClass().getClassLoader().loadClass(className).newInstance();
2290
                    return this.getClass().getClassLoader().loadClass(className).newInstance();
2290
                }
2291
                }
2291
            }
2292
            }
2292

2293

2293
            //nothing found...so just return a super instance of the connector
2294
            //nothing found...so just return a super instance of the connector
2294
            return this.getClass().getClassLoader().loadClass(connectorClassName).newInstance();
2295
            return this.getClass().getClassLoader().loadClass(connectorClassName).newInstance();
2295

2296

2296
        } catch (Exception e) {
2297
        } catch (Exception e) {
2297
            throw new IllegalStateException("Cannot create an AJP connector", e);
2298
            throw new IllegalStateException("Cannot create an AJP connector", e);
2298
        }
2299
        }
2299
    }
2300
    }
2300
}
2301
}