KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > configuration > CmsSystemConfiguration


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/configuration/CmsSystemConfiguration.java,v $
3  * Date : $Date: 2006/05/12 16:05:48 $
4  * Version: $Revision: 1.38 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.configuration;
33
34 import org.opencms.db.CmsCacheSettings;
35 import org.opencms.db.CmsDefaultUsers;
36 import org.opencms.db.CmsLoginManager;
37 import org.opencms.db.CmsLoginMessage;
38 import org.opencms.db.I_CmsDbContextFactory;
39 import org.opencms.flex.CmsFlexCacheConfiguration;
40 import org.opencms.i18n.CmsLocaleManager;
41 import org.opencms.mail.CmsMailHost;
42 import org.opencms.mail.CmsMailSettings;
43 import org.opencms.main.CmsContextInfo;
44 import org.opencms.main.CmsEventManager;
45 import org.opencms.main.CmsHttpAuthenticationSettings;
46 import org.opencms.main.CmsLog;
47 import org.opencms.main.I_CmsRequestHandler;
48 import org.opencms.main.I_CmsResourceInit;
49 import org.opencms.main.OpenCms;
50 import org.opencms.monitor.CmsMemoryMonitorConfiguration;
51 import org.opencms.scheduler.CmsScheduleManager;
52 import org.opencms.scheduler.CmsScheduledJobInfo;
53 import org.opencms.security.CmsDefaultValidationHandler;
54 import org.opencms.security.CmsRoleViolationException;
55 import org.opencms.security.I_CmsPasswordHandler;
56 import org.opencms.security.I_CmsValidationHandler;
57 import org.opencms.site.CmsSite;
58 import org.opencms.site.CmsSiteManager;
59 import org.opencms.site.CmsSiteMatcher;
60
61 import java.util.ArrayList JavaDoc;
62 import java.util.Collections JavaDoc;
63 import java.util.HashMap JavaDoc;
64 import java.util.HashSet JavaDoc;
65 import java.util.Iterator JavaDoc;
66 import java.util.List JavaDoc;
67 import java.util.Locale JavaDoc;
68 import java.util.Map JavaDoc;
69
70 import org.apache.commons.digester.Digester;
71 import org.apache.commons.logging.Log;
72
73 import org.dom4j.Element;
74
75 /**
76  * VFS master configuration class.<p>
77  *
78  * @author Alexander Kandzior
79  *
80  * @version $Revision: 1.38 $
81  *
82  * @since 6.0.0
83  */

84 public class CmsSystemConfiguration extends A_CmsXmlConfiguration implements I_CmsXmlConfiguration {
85
86     /** The "error" attribute. */
87     public static final String JavaDoc A_ERROR = "error";
88
89     /** The "exclusive" attribute. */
90     public static final String JavaDoc A_EXCLUSIVE = "exclusive";
91
92     /** The "server" attribute. */
93     public static final String JavaDoc A_SERVER = "server";
94
95     /** The name of the DTD for this configuration. */
96     public static final String JavaDoc CONFIGURATION_DTD_NAME = "opencms-system.dtd";
97
98     /** The name of the default XML file for this configuration. */
99     public static final String JavaDoc DEFAULT_XML_FILE_NAME = "opencms-system.xml";
100
101     /** The node name for the job "active" value. */
102     public static final String JavaDoc N_ACTIVE = "active";
103
104     /** The node name for the alias node. */
105     public static final String JavaDoc N_ALIAS = "alias";
106
107     /** The node name for the avgcachebytes node. */
108     public static final String JavaDoc N_AVGCACHEBYTES = "avgcachebytes";
109
110     /** The node name for the browser-based node. */
111     public static final String JavaDoc N_BROWSER_BASED = "browser-based";
112
113     /** the result cache node. */
114     public static final String JavaDoc N_CACHE = "resultcache";
115
116     /** The node name for the cache-enabled node. */
117     public static final String JavaDoc N_CACHE_ENABLED = "cache-enabled";
118
119     /** The node name for the cache-offline node. */
120     public static final String JavaDoc N_CACHE_OFFLINE = "cache-offline";
121
122     /** The node name for a job class. */
123     public static final String JavaDoc N_CLASS = "class";
124
125     /** The duration after which responsibles will be notified about out-dated content. */
126     public static final String JavaDoc N_CONTENT_NOTIFICATION = "content-notification";
127
128     /** The node name for the job context. */
129     public static final String JavaDoc N_CONTEXT = "context";
130
131     /** The node name for the job cron expression. */
132     public static final String JavaDoc N_CRONEXPRESSION = "cronexpression";
133
134     /** The node name for the defaultcontentencoding node. */
135     public static final String JavaDoc N_DEFAULT_CONTENT_ENCODING = "defaultcontentencoding";
136
137     /** The node name for the default-uri node. */
138     public static final String JavaDoc N_DEFAULT_URI = "default-uri";
139
140     /** The node name for the defaultusers expression. */
141     public static final String JavaDoc N_DEFAULTUSERS = "defaultusers";
142
143     /** The node name for the digest type. */
144     public static final String JavaDoc N_DIGESTTYPE = "digest-type";
145
146     /** The node name for the login account lock minutes. */
147     public static final String JavaDoc N_DISABLEMINUTES = "disableMinutes";
148
149     /** The node name for the email-interval node. */
150     public static final String JavaDoc N_EMAIL_INTERVAL = "email-interval";
151
152     /** The node name for the email-receiver node. */
153     public static final String JavaDoc N_EMAIL_RECEIVER = "email-receiver";
154
155     /** The node name for the email-sender node. */
156     public static final String JavaDoc N_EMAIL_SENDER = "email-sender";
157
158     /** The node name for the login message enabled flag. */
159     public static final String JavaDoc N_ENABLED = "enabled";
160
161     /** The node name for the context encoding. */
162     public static final String JavaDoc N_ENCODING = "encoding";
163
164     /** The node name for the request handler classes. */
165     public static final String JavaDoc N_EVENTMANAGER = "eventmanager";
166
167     /** The node name for the events node. */
168     public static final String JavaDoc N_EVENTS = "events";
169
170     /** The node name for the flexcache node. */
171     public static final String JavaDoc N_FLEXCACHE = "flexcache";
172
173     /** The node name for the form-based node. */
174     public static final String JavaDoc N_FORM_BASED = "form-based";
175
176     /** The node name for the group-administrators node. */
177     public static final String JavaDoc N_GROUP_ADMINISTRATORS = "group-administrators";
178
179     /** The node name for the group-guests node. */
180     public static final String JavaDoc N_GROUP_GUESTS = "group-guests";
181
182     /** The node name for the group-projectmanagers node. */
183     public static final String JavaDoc N_GROUP_PROJECTMANAGERS = "group-projectmanagers";
184
185     /** The node name for the group-users node. */
186     public static final String JavaDoc N_GROUP_USERS = "group-users";
187
188     /** The node name for the http-authentication node. */
189     public static final String JavaDoc N_HTTP_AUTHENTICATION = "http-authentication";
190
191     /** The node name for the internationalization node. */
192     public static final String JavaDoc N_I18N = "internationalization";
193
194     /** The node name for a job. */
195     public static final String JavaDoc N_JOB = "job";
196
197     /** The name of the class to generate cache keys. */
198     public static final String JavaDoc N_KEYGENERATOR = "keygenerator";
199
200     /** The node name for individual locales. */
201     public static final String JavaDoc N_LOCALE = "locale";
202
203     /** The node name for the locale handler. */
204     public static final String JavaDoc N_LOCALEHANDLER = "localehandler";
205
206     /** The node name for the configured locales. */
207     public static final String JavaDoc N_LOCALESCONFIGURED = "localesconfigured";
208
209     /** The node name for the default locale(s). */
210     public static final String JavaDoc N_LOCALESDEFAULT = "localesdefault";
211
212     /** The node name for the log-interval node. */
213     public static final String JavaDoc N_LOG_INTERVAL = "log-interval";
214
215     /** The node name for the login message login forbidden flag. */
216     public static final String JavaDoc N_LOGINFORBIDDEN = "loginForbidden";
217
218     /** The node name for the login manager. */
219     public static final String JavaDoc N_LOGINMANAGER = "loginmanager";
220
221     /** The node name for the login message. */
222     public static final String JavaDoc N_LOGINMESSAGE = "loginmessage";
223
224     /** The node name for the mail configuration. */
225     public static final String JavaDoc N_MAIL = "mail";
226
227     /** The node name for the "mail from" node. */
228     public static final String JavaDoc N_MAILFROM = "mailfrom";
229
230     /** The node name for the "mail host" node. */
231     public static final String JavaDoc N_MAILHOST = "mailhost";
232
233     /** The node name for the login manager bad attempt count. */
234     public static final String JavaDoc N_MAXBADATTEMPTS = "maxBadAttempts";
235
236     /** The node name for the maxcachebytes node. */
237     public static final String JavaDoc N_MAXCACHEBYTES = "maxcachebytes";
238
239     /** The node name for the maxentrybytes node. */
240     public static final String JavaDoc N_MAXENTRYBYTES = "maxentrybytes";
241
242     /** The node name for the maxkeys node. */
243     public static final String JavaDoc N_MAXKEYS = "maxkeys";
244
245     /** The node name for the maxusagepercent node. */
246     public static final String JavaDoc N_MAXUSAGE_PERCENT = "maxusagepercent";
247
248     /** The node name for the memorymonitor node. */
249     public static final String JavaDoc N_MEMORYMONITOR = "memorymonitor";
250
251     /** The node name for the login message text. */
252     public static final String JavaDoc N_MESSAGE = "message";
253
254     /** The duration after which responsibles will be notified about out-dated content. */
255     public static final String JavaDoc N_NOTIFICATION_PROJECT = "notification-project";
256
257     /** The duration after which responsibles will be notified about out-dated content. */
258     public static final String JavaDoc N_NOTIFICATION_TIME = "notification-time";
259
260     /** The node name for the job parameters. */
261     public static final String JavaDoc N_PARAMETERS = "parameters";
262
263     /** The node name for the password encoding. */
264     public static final String JavaDoc N_PASSWORDENCODING = "encoding";
265
266     /** The node name for the password handler. */
267     public static final String JavaDoc N_PASSWORDHANDLER = "passwordhandler";
268
269     /** The node name for the context project name. */
270     public static final String JavaDoc N_PROJECT = "project";
271
272     /** The node name for the memory email receiver. */
273     public static final String JavaDoc N_RECEIVER = "receiver";
274
275     /** The node name for the context remote addr. */
276     public static final String JavaDoc N_REMOTEADDR = "remoteaddr";
277
278     /** The node name for the context requested uri. */
279     public static final String JavaDoc N_REQUESTEDURI = "requesteduri";
280
281     /** The node name for the request handler classes. */
282     public static final String JavaDoc N_REQUESTHANDLER = "requesthandler";
283
284     /** The node name for the request handlers. */
285     public static final String JavaDoc N_REQUESTHANDLERS = "requesthandlers";
286
287     /** The node name for the resource init classes. */
288     public static final String JavaDoc N_RESOURCEINIT = "resourceinit";
289
290     /** The node name for the resource init classes. */
291     public static final String JavaDoc N_RESOURCEINITHANDLER = "resourceinithandler";
292
293     /** The node name for the job "reuseinstance" value. */
294     public static final String JavaDoc N_REUSEINSTANCE = "reuseinstance";
295
296     /** The node name for the runtime info. */
297     public static final String JavaDoc N_RUNTIMECLASSES = "runtimeclasses";
298
299     /** The node name for the runtime info factory. */
300     public static final String JavaDoc N_RUNTIMEINFO = "runtimeinfo";
301
302     /** The node name for the runtime properties node. */
303     public static final String JavaDoc N_RUNTIMEPROPERTIES = "runtimeproperties";
304
305     /** The node name for the scheduler. */
306     public static final String JavaDoc N_SCHEDULER = "scheduler";
307
308     /** The node name for the secure site. */
309     public static final String JavaDoc N_SECURE = "secure";
310
311     /** The node name for the context site root. */
312     public static final String JavaDoc N_SITEROOT = "siteroot";
313
314     /** The node name for the sites node. */
315     public static final String JavaDoc N_SITES = "sites";
316
317     /** The size of the driver manager's cache for ACLS. */
318     public static final String JavaDoc N_SIZE_ACLS = "size-accesscontrollists";
319
320     /** The size of the driver manager's cache for groups. */
321     public static final String JavaDoc N_SIZE_GROUPS = "size-groups";
322
323     /** The size of the security manager's cache for permission checks. */
324     public static final String JavaDoc N_SIZE_PERMISSIONS = "size-permissions";
325
326     /** The size of the driver manager's cache for projects. */
327     public static final String JavaDoc N_SIZE_PROJECTS = "size-projects";
328
329     /** The size of the driver manager's cache for properties. */
330     public static final String JavaDoc N_SIZE_PROPERTIES = "size-properties";
331
332     /** The size of the driver manager's cache for lists of resources. */
333     public static final String JavaDoc N_SIZE_RESOURCELISTS = "size-resourcelists";
334
335     /** The size of the driver manager's cache for resources. */
336     public static final String JavaDoc N_SIZE_RESOURCES = "size-resources";
337
338     /** The size of the driver manager's cache for user/group relations. */
339     public static final String JavaDoc N_SIZE_USERGROUPS = "size-usergroups";
340
341     /** The size of the driver manager's cache for users. */
342     public static final String JavaDoc N_SIZE_USERS = "size-users";
343
344     /** The main system configuration node name. */
345     public static final String JavaDoc N_SYSTEM = "system";
346
347     /** The node name for the login message end time. */
348     public static final String JavaDoc N_TIMEEND = "timeEnd";
349
350     /** The node name for the login message start time. */
351     public static final String JavaDoc N_TIMESTART = "timeStart";
352
353     /** The node name for the user-admin node. */
354     public static final String JavaDoc N_USER_ADMIN = "user-admin";
355
356     /** The node name for the user-deletedresource node. */
357     public static final String JavaDoc N_USER_DELETEDRESOURCE = "user-deletedresource";
358
359     /** The node name for the user-export node. */
360     public static final String JavaDoc N_USER_EXPORT = "user-export";
361
362     /** The node name for the user-guest node. */
363     public static final String JavaDoc N_USER_GUEST = "user-guest";
364
365     /** The node name for the context user name. */
366     public static final String JavaDoc N_USERNAME = "user";
367
368     /** The node name for the validation handler. */
369     public static final String JavaDoc N_VALIDATIONHANDLER = "validationhandler";
370
371     /** The node name for the version history. */
372     public static final String JavaDoc N_VERSIONHISTORY = "versionhistory";
373
374     /** The node name for the warning-interval node. */
375     public static final String JavaDoc N_WARNING_INTERVAL = "warning-interval";
376
377     /** The node name for the workplace-server node. */
378     public static final String JavaDoc N_WORKPLACE_SERVER = "workplace-server";
379
380     /** The log object for this class. */
381     private static final Log LOG = CmsLog.getLog(CmsSystemConfiguration.class);
382
383     /** The settings of the driver manager. */
384     private CmsCacheSettings m_cacheSettings;
385
386     /** The configured OpenCms default users and groups. */
387     private CmsDefaultUsers m_cmsDefaultUsers;
388
389     /** The flex cache configuration object. */
390     private CmsFlexCacheConfiguration m_cmsFlexCacheConfiguration;
391
392     /** The memory monitor configuration. */
393     private CmsMemoryMonitorConfiguration m_cmsMemoryMonitorConfiguration;
394
395     /** The list of jobs for the scheduler. */
396     private List JavaDoc m_configuredJobs;
397
398     /** The default content encoding. */
399     private String JavaDoc m_defaultContentEncoding;
400
401     /** The configured OpenCms event manager. */
402     private CmsEventManager m_eventManager;
403
404     /** The HTTP basic authentication settings. */
405     private CmsHttpAuthenticationSettings m_httpAuthenticationSettings;
406
407     /** The configured locale manager for multi language support. */
408     private CmsLocaleManager m_localeManager;
409
410     /** The configured login manager. */
411     private CmsLoginManager m_loginManager;
412
413     /** The configured login message. */
414     private CmsLoginMessage m_loginMessage;
415
416     /** The mail settings. */
417     private CmsMailSettings m_mailSettings;
418
419     /** Notification project. */
420     private String JavaDoc m_notificationProject;
421
422     /** The duration after which responsibles will be notified about out-dated content (in days). */
423     // It is an Integer object so that it can be distinguished if this optional element was set or not
424
private Integer JavaDoc m_notificationTime;
425
426     /** The password handler. */
427     private I_CmsPasswordHandler m_passwordHandler;
428
429     /** A list of instanciated request handler classes. */
430     private List JavaDoc m_requestHandlers;
431
432     /** A list of instanciated resource init handler classes. */
433     private List JavaDoc m_resourceInitHandlers;
434
435     /** The runtime info factory. */
436     private I_CmsDbContextFactory m_runtimeInfoFactory;
437
438     /** The runtime properties. */
439     private Map JavaDoc m_runtimeProperties;
440
441     /** The configured schedule manager. */
442     private CmsScheduleManager m_scheduleManager;
443
444     /** The configured site manager. */
445     private CmsSiteManager m_siteManager;
446
447     /** The temporary file project id. */
448     private int m_tempFileProjectId;
449
450     /** The configured validation handler. */
451     private I_CmsValidationHandler m_validationHandler;
452
453     /** Indicates if the version history is enabled. */
454     private boolean m_versionHistoryEnabled;
455
456     /** The maximum number of entries in the version history (per resource). */
457     private int m_versionHistoryMaxCount;
458
459     /**
460      * Public constructor, will be called by configuration manager.<p>
461      */

462     public CmsSystemConfiguration() {
463
464         setXmlFileName(DEFAULT_XML_FILE_NAME);
465         m_versionHistoryEnabled = true;
466         m_versionHistoryMaxCount = 10;
467         m_resourceInitHandlers = new ArrayList JavaDoc();
468         m_requestHandlers = new ArrayList JavaDoc();
469         m_configuredJobs = new ArrayList JavaDoc();
470         m_runtimeProperties = new HashMap JavaDoc();
471         m_eventManager = new CmsEventManager();
472         m_validationHandler = new CmsDefaultValidationHandler();
473         if (CmsLog.INIT.isInfoEnabled()) {
474             CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_SYSTEM_CONFIG_INIT_0));
475         }
476     }
477
478     /**
479      * @see org.opencms.configuration.I_CmsConfigurationParameterHandler#addConfigurationParameter(java.lang.String, java.lang.String)
480      */

481     public void addConfigurationParameter(String JavaDoc paramName, String JavaDoc paramValue) {
482
483         m_runtimeProperties.put(paramName, paramValue);
484     }
485
486     /**
487      * Adds the event manager class.<p>
488      *
489      * @param clazz the class name of event manager class to instanciate and add
490      */

491     public void addEventManager(String JavaDoc clazz) {
492
493         Object JavaDoc initClass;
494         try {
495             initClass = Class.forName(clazz).newInstance();
496         } catch (Throwable JavaDoc t) {
497             LOG.error(Messages.get().getBundle().key(
498                 Messages.INIT_EVENTMANAGER_CLASS_INVALID_2,
499                 clazz,
500                 m_resourceInitHandlers.getClass().getName()), t);
501             return;
502         }
503         if (initClass instanceof CmsEventManager) {
504             m_eventManager = (CmsEventManager)initClass;
505             if (CmsLog.INIT.isInfoEnabled()) {
506                 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_EVENTMANAGER_CLASS_SUCCESS_1, initClass));
507             }
508         } else {
509             if (CmsLog.INIT.isErrorEnabled()) {
510                 CmsLog.INIT.error(Messages.get().getBundle().key(
511                     Messages.INIT_EVENTMANAGER_CLASS_INVALID_2,
512                     initClass,
513                     m_resourceInitHandlers.getClass().getName()));
514             }
515         }
516     }
517
518     /**
519      * Adds a new job description for the scheduler.<p>
520      *
521      * @param jobInfo the job description to add
522      */

523     public void addJobFromConfiguration(CmsScheduledJobInfo jobInfo) {
524
525         m_configuredJobs.add(jobInfo);
526
527         if (CmsLog.INIT.isInfoEnabled()) {
528             CmsLog.INIT.info(Messages.get().getBundle().key(
529                 Messages.INIT_SCHEDULER_CONFIG_JOB_3,
530                 jobInfo.getJobName(),
531                 jobInfo.getClassName(),
532                 jobInfo.getContextInfo().getUserName()));
533         }
534     }
535
536     /**
537      * Adds a new instance of a request handler class.<p>
538      *
539      * @param clazz the class name of the request handler to instanciate and add
540      */

541     public void addRequestHandler(String JavaDoc clazz) {
542
543         Object JavaDoc initClass;
544         try {
545             initClass = Class.forName(clazz).newInstance();
546         } catch (Throwable JavaDoc t) {
547             LOG.error(Messages.get().getBundle().key(Messages.LOG_INIT_REQUEST_HANDLER_FAILURE_1, clazz), t);
548             return;
549         }
550         if (initClass instanceof I_CmsRequestHandler) {
551             m_requestHandlers.add(initClass);
552             if (CmsLog.INIT.isInfoEnabled()) {
553                 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_REQUEST_HANDLER_SUCCESS_1, clazz));
554             }
555         } else {
556             if (CmsLog.INIT.isErrorEnabled()) {
557                 CmsLog.INIT.error(Messages.get().getBundle().key(Messages.INIT_REQUEST_HANDLER_INVALID_1, clazz));
558             }
559         }
560     }
561
562     /**
563      * Adds a new instance of a resource init handler class.<p>
564      *
565      * @param clazz the class name of the resource init handler to instanciate and add
566      */

567     public void addResourceInitHandler(String JavaDoc clazz) {
568
569         Object JavaDoc initClass;
570         try {
571             initClass = Class.forName(clazz).newInstance();
572         } catch (Throwable JavaDoc t) {
573             LOG.error(Messages.get().getBundle().key(Messages.LOG_RESOURCE_INIT_CLASS_INVALID_1, clazz), t);
574             return;
575         }
576         if (initClass instanceof I_CmsResourceInit) {
577             m_resourceInitHandlers.add(initClass);
578             if (CmsLog.INIT.isInfoEnabled()) {
579                 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_RESOURCE_INIT_SUCCESS_1, initClass));
580             }
581         } else {
582             if (CmsLog.INIT.isErrorEnabled()) {
583                 CmsLog.INIT.error(Messages.get().getBundle().key(Messages.INIT_RESOURCE_INIT_INVALID_CLASS_1, initClass));
584             }
585         }
586     }
587
588     /**
589      * Generates the schedule manager.<p>
590      */

591     public void addScheduleManager() {
592
593         m_scheduleManager = new CmsScheduleManager(m_configuredJobs);
594     }
595
596     /**
597      * @see org.opencms.configuration.I_CmsXmlConfiguration#addXmlDigesterRules(org.apache.commons.digester.Digester)
598      */

599     public void addXmlDigesterRules(Digester digester) {
600
601         // add finish rule
602
digester.addCallMethod("*/" + N_SYSTEM, "initializeFinished");
603
604         // add rule for internationalization
605
digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_I18N, CmsLocaleManager.class);
606         digester.addSetNext("*/" + N_SYSTEM + "/" + N_I18N, "setLocaleManager");
607
608         // add locale handler creation rule
609
digester.addObjectCreate(
610             "*/" + N_SYSTEM + "/" + N_I18N + "/" + N_LOCALEHANDLER,
611             A_CLASS,
612             CmsConfigurationException.class);
613         digester.addSetNext("*/" + N_SYSTEM + "/" + N_I18N + "/" + N_LOCALEHANDLER, "setLocaleHandler");
614
615         // add locale rules
616
digester.addCallMethod(
617             "*/" + N_SYSTEM + "/" + N_I18N + "/" + N_LOCALESCONFIGURED + "/" + N_LOCALE,
618             "addAvailableLocale",
619             0);
620         digester.addCallMethod(
621             "*/" + N_SYSTEM + "/" + N_I18N + "/" + N_LOCALESDEFAULT + "/" + N_LOCALE,
622             "addDefaultLocale",
623             0);
624
625         // add version history rules
626
digester.addCallMethod("*/" + N_SYSTEM + "/" + N_VERSIONHISTORY, "setVersionHistorySettings", 2);
627         digester.addCallParam("*/" + N_SYSTEM + "/" + N_VERSIONHISTORY, 0, A_ENABLED);
628         digester.addCallParam("*/" + N_SYSTEM + "/" + N_VERSIONHISTORY, 1, A_COUNT);
629
630         // add mail configuration rule
631
digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_MAIL, CmsMailSettings.class);
632         digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILFROM, "setMailFromDefault", 0);
633         digester.addSetNext("*/" + N_SYSTEM + "/" + N_MAIL, "setMailSettings");
634
635         // add mail host configuration rule
636
digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, "addMailHost", 5);
637         digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 0, A_NAME);
638         digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 1, A_ORDER);
639         digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 2, A_PROTOCOL);
640         digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 3, A_USER);
641         digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 4, A_PASSWORD);
642
643         // add scheduler creation rule
644
digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SCHEDULER, "addScheduleManager");
645
646         // add scheduler job creation rule
647
digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB, CmsScheduledJobInfo.class);
648         digester.addBeanPropertySetter("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_NAME, "jobName");
649         digester.addBeanPropertySetter("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CLASS, "className");
650         digester.addBeanPropertySetter(
651             "*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CRONEXPRESSION,
652             "cronExpression");
653         digester.addBeanPropertySetter(
654             "*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_REUSEINSTANCE,
655             "reuseInstance");
656         digester.addBeanPropertySetter("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_ACTIVE, "active");
657         digester.addSetNext("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB, "addJobFromConfiguration");
658
659         // add job context creation rule
660
digester.addObjectCreate(
661             "*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT,
662             CmsContextInfo.class);
663         digester.addBeanPropertySetter("*/"
664             + N_SYSTEM
665             + "/"
666             + N_SCHEDULER
667             + "/"
668             + N_JOB
669             + "/"
670             + N_CONTEXT
671             + "/"
672             + N_USERNAME, "userName");
673         digester.addBeanPropertySetter("*/"
674             + N_SYSTEM
675             + "/"
676             + N_SCHEDULER
677             + "/"
678             + N_JOB
679             + "/"
680             + N_CONTEXT
681             + "/"
682             + N_PROJECT, "projectName");
683         digester.addBeanPropertySetter("*/"
684             + N_SYSTEM
685             + "/"
686             + N_SCHEDULER
687             + "/"
688             + N_JOB
689             + "/"
690             + N_CONTEXT
691             + "/"
692             + N_SITEROOT, "siteRoot");
693         digester.addBeanPropertySetter("*/"
694             + N_SYSTEM
695             + "/"
696             + N_SCHEDULER
697             + "/"
698             + N_JOB
699             + "/"
700             + N_CONTEXT
701             + "/"
702             + N_REQUESTEDURI, "requestedUri");
703         digester.addBeanPropertySetter("*/"
704             + N_SYSTEM
705             + "/"
706             + N_SCHEDULER
707             + "/"
708             + N_JOB
709             + "/"
710             + N_CONTEXT
711             + "/"
712             + N_LOCALE, "localeName");
713         digester.addBeanPropertySetter("*/"
714             + N_SYSTEM
715             + "/"
716             + N_SCHEDULER
717             + "/"
718             + N_JOB
719             + "/"
720             + N_CONTEXT
721             + "/"
722             + N_ENCODING);
723         digester.addBeanPropertySetter("*/"
724             + N_SYSTEM
725             + "/"
726             + N_SCHEDULER
727             + "/"
728             + N_JOB
729             + "/"
730             + N_CONTEXT
731             + "/"
732             + N_REMOTEADDR, "remoteAddr");
733         digester.addSetNext("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT, "setContextInfo");
734
735         // add generic parameter rules (used for jobs, password handler)
736
digester.addCallMethod(
737             "*/" + I_CmsXmlConfiguration.N_PARAM,
738             I_CmsConfigurationParameterHandler.ADD_PARAMETER_METHOD,
739             2);
740         digester.addCallParam("*/" + I_CmsXmlConfiguration.N_PARAM, 0, I_CmsXmlConfiguration.A_NAME);
741         digester.addCallParam("*/" + I_CmsXmlConfiguration.N_PARAM, 1);
742
743         // add event classes
744
digester.addCallMethod("*/" + N_SYSTEM + "/" + N_EVENTS + "/" + N_EVENTMANAGER, "addEventManager", 1);
745         digester.addCallParam("*/" + N_SYSTEM + "/" + N_EVENTS + "/" + N_EVENTMANAGER, 0, A_CLASS);
746
747         // add resource init classes
748
digester.addCallMethod(
749             "*/" + N_SYSTEM + "/" + N_RESOURCEINIT + "/" + N_RESOURCEINITHANDLER,
750             "addResourceInitHandler",
751             1);
752         digester.addCallParam("*/" + N_SYSTEM + "/" + N_RESOURCEINIT + "/" + N_RESOURCEINITHANDLER, 0, A_CLASS);
753
754         // add request handler classes
755
digester.addCallMethod(
756             "*/" + N_SYSTEM + "/" + N_REQUESTHANDLERS + "/" + N_REQUESTHANDLER,
757             "addRequestHandler",
758             1);
759         digester.addCallParam("*/" + N_SYSTEM + "/" + N_REQUESTHANDLERS + "/" + N_REQUESTHANDLER, 0, A_CLASS);
760
761         // add password handler creation rule
762
digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER, A_CLASS, CmsConfigurationException.class);
763         digester.addCallMethod(
764             "*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER,
765             I_CmsConfigurationParameterHandler.INIT_CONFIGURATION_METHOD);
766         digester.addBeanPropertySetter(
767             "*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER + "/" + N_PASSWORDENCODING,
768             "inputEncoding");
769         digester.addBeanPropertySetter("*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER + "/" + N_DIGESTTYPE, "digestType");
770         digester.addSetNext("*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER, "setPasswordHandler");
771
772         // add validation handler creation rules
773
digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_VALIDATIONHANDLER, A_CLASS, CmsDefaultValidationHandler.class);
774         digester.addSetNext("*/" + N_SYSTEM + "/" + N_VALIDATIONHANDLER, "setValidationHandler");
775
776         // add login manager creation rules
777
digester.addCallMethod("*/" + N_LOGINMANAGER, "setLoginManager", 2);
778         digester.addCallParam("*/" + N_LOGINMANAGER + "/" + N_DISABLEMINUTES, 0);
779         digester.addCallParam("*/" + N_LOGINMANAGER + "/" + N_MAXBADATTEMPTS, 1);
780
781         // add login message creation rules
782
digester.addObjectCreate("*/" + N_LOGINMESSAGE, CmsLoginMessage.class);
783         digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/" + N_ENABLED);
784         digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/" + N_MESSAGE);
785         digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/" + N_LOGINFORBIDDEN);
786         digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/" + N_TIMESTART);
787         digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/" + N_TIMEEND);
788         digester.addSetNext("*/" + N_LOGINMESSAGE, "setLoginMessage");
789
790         // add site configuration rule
791
digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_SITES, CmsSiteManager.class);
792         digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_WORKPLACE_SERVER, "setWorkplaceServer", 0);
793         digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_DEFAULT_URI, "setDefaultUri", 0);
794         digester.addSetNext("*/" + N_SYSTEM + "/" + N_SITES, "setSiteManager");
795
796         // add site configuration rule
797
digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE, "addSite", 5);
798         digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE, 0, A_SERVER);
799         digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE, 1, A_URI);
800         digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_SECURE, 2, A_SERVER);
801         digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_SECURE, 3, A_EXCLUSIVE);
802         digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_SECURE, 4, A_ERROR);
803
804         // add an alias to the currently configured site
805
digester.addCallMethod(
806             "*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_ALIAS,
807             "addAliasToConfigSite",
808             1);
809         digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_ALIAS, 0, A_SERVER);
810
811         // add compatibility parameter rules
812
digester.addCallMethod(
813             "*/" + N_SYSTEM + "/" + N_RUNTIMEPROPERTIES + "/" + N_PARAM,
814             I_CmsConfigurationParameterHandler.ADD_PARAMETER_METHOD,
815             2);
816         digester.addCallParam(
817             "*/" + N_SYSTEM + "/" + N_RUNTIMEPROPERTIES + "/" + N_PARAM,
818             0,
819             I_CmsXmlConfiguration.A_NAME);
820         digester.addCallParam("*/" + N_SYSTEM + "/" + N_RUNTIMEPROPERTIES + "/" + N_PARAM, 1);
821
822         // add runtime classes configuration rules
823
digester.addCallMethod(
824             "*/" + N_SYSTEM + "/" + N_RUNTIMECLASSES + "/" + N_RUNTIMEINFO,
825             "setRuntimeInfoFactory",
826             1);
827         digester.addCallParam("*/" + N_SYSTEM + "/" + N_RUNTIMECLASSES + "/" + N_RUNTIMEINFO, 0, A_CLASS);
828
829         // add default users rule
830
digester.addCallMethod("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS, "setCmsDefaultUsers", 8);
831         digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_USER_ADMIN, 0);
832         digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_USER_GUEST, 1);
833         digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_USER_EXPORT, 2);
834         digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_USER_DELETEDRESOURCE, 3);
835         digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_ADMINISTRATORS, 4);
836         digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_PROJECTMANAGERS, 5);
837         digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_USERS, 6);
838         digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_GUESTS, 7);
839
840         // add defaultContentEncoding rule
841
digester.addCallMethod("*/" + N_SYSTEM + "/" + N_DEFAULT_CONTENT_ENCODING, "setDefaultContentEncoding", 1);
842         digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULT_CONTENT_ENCODING, 0);
843
844         // add memorymonitor configuration rule
845
digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR, CmsMemoryMonitorConfiguration.class);
846         digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR, "initialize", 4);
847         digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_MAXUSAGE_PERCENT, 0);
848         digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_LOG_INTERVAL, 1);
849         digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_EMAIL_INTERVAL, 2);
850         digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_WARNING_INTERVAL, 3);
851         digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_EMAIL_SENDER, "setEmailSender", 0);
852         digester.addCallMethod(
853             "*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_EMAIL_RECEIVER + "/" + N_RECEIVER,
854             "addEmailReceiver",
855             0);
856
857         // set the MemoryMonitorConfiguration initialized once before
858
digester.addSetNext("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR, "setCmsMemoryMonitorConfiguration");
859
860         // add flexcache configuration rule
861
digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_FLEXCACHE, CmsFlexCacheConfiguration.class);
862         digester.addCallMethod("*/" + N_SYSTEM + "/" + N_FLEXCACHE, "initialize", 6);
863         digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_CACHE_ENABLED, 0);
864         digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_CACHE_OFFLINE, 1);
865         digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_MAXCACHEBYTES, 2);
866         digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_AVGCACHEBYTES, 3);
867         digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_MAXENTRYBYTES, 4);
868         digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_MAXKEYS, 5);
869
870         // set the FlexCacheConfiguration initialized once before
871
digester.addSetNext("*/" + N_SYSTEM + "/" + N_FLEXCACHE, "setCmsFlexCacheConfiguration");
872
873         // add http basic authentication rules
874
digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_HTTP_AUTHENTICATION, CmsHttpAuthenticationSettings.class);
875         digester.addCallMethod(
876             "*/" + N_SYSTEM + "/" + N_HTTP_AUTHENTICATION + "/" + N_BROWSER_BASED,
877             "setUseBrowserBasedHttpAuthentication",
878             0);
879         digester.addCallMethod(
880             "*/" + N_SYSTEM + "/" + N_HTTP_AUTHENTICATION + "/" + N_FORM_BASED,
881             "setFormBasedHttpAuthenticationUri",
882             0);
883         digester.addSetNext("*/" + N_SYSTEM + "/" + N_HTTP_AUTHENTICATION, "setHttpAuthenticationSettings");
884
885         // cache rules
886
digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_CACHE, CmsCacheSettings.class);
887         digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_KEYGENERATOR, "setCacheKeyGenerator", 0);
888         digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_USERS, "setUserCacheSize", 0);
889         digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_GROUPS, "setGroupCacheSize", 0);
890         digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_USERGROUPS, "setUserGroupsCacheSize", 0);
891         digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_PROJECTS, "setProjectCacheSize", 0);
892         digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_RESOURCES, "setResourceCacheSize", 0);
893         digester.addCallMethod(
894             "*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_RESOURCELISTS,
895             "setResourcelistCacheSize",
896             0);
897         digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_PROPERTIES, "setPropertyCacheSize", 0);
898         digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_ACLS, "setAclCacheSize", 0);
899         digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_PERMISSIONS, "setPermissionCacheSize", 0);
900         digester.addSetNext("*/" + N_SYSTEM + "/" + N_CACHE, "setCacheSettings");
901
902         // set the notification time
903
digester.addCallMethod(
904             "*/" + N_SYSTEM + "/" + N_CONTENT_NOTIFICATION + "/" + N_NOTIFICATION_TIME,
905             "setNotificationTime",
906             1);
907         digester.addCallParam("*/" + N_SYSTEM + "/" + N_CONTENT_NOTIFICATION + "/" + N_NOTIFICATION_TIME, 0);
908
909         // set the notification project
910
digester.addCallMethod(
911             "*/" + N_SYSTEM + "/" + N_CONTENT_NOTIFICATION + "/" + N_NOTIFICATION_PROJECT,
912             "setNotificationProject",
913             1);
914         digester.addCallParam("*/" + N_SYSTEM + "/" + N_CONTENT_NOTIFICATION + "/" + N_NOTIFICATION_PROJECT, 0);
915     }
916
917     /**
918      * @see org.opencms.configuration.I_CmsXmlConfiguration#generateXml(org.dom4j.Element)
919      */

920     public Element generateXml(Element parent) {
921
922         // generate vfs node and subnodes
923
Element systemElement = parent.addElement(N_SYSTEM);
924
925         if (OpenCms.getRunLevel() >= OpenCms.RUNLEVEL_3_SHELL_ACCESS) {
926             // initialized OpenCms instance is available, use latest values
927
m_localeManager = OpenCms.getLocaleManager();
928             m_mailSettings = OpenCms.getSystemInfo().getMailSettings();
929             m_configuredJobs = OpenCms.getScheduleManager().getJobs();
930             m_versionHistoryEnabled = OpenCms.getSystemInfo().isVersionHistoryEnabled();
931             m_versionHistoryMaxCount = OpenCms.getSystemInfo().getVersionHistoryMaxCount();
932             // m_resourceInitHandlers instance must be the one from configuration
933
// m_requestHandlers instance must be the one from configuration
934
m_siteManager = OpenCms.getSiteManager();
935             m_loginManager = OpenCms.getLoginManager();
936             m_loginMessage = OpenCms.getLoginManager().getLoginMessage();
937         }
938
939         // i18n nodes
940
Element i18nElement = systemElement.addElement(N_I18N);
941         i18nElement.addElement(N_LOCALEHANDLER).addAttribute(
942             A_CLASS,
943             m_localeManager.getLocaleHandler().getClass().getName());
944         Iterator JavaDoc i;
945         Element localesElement;
946         localesElement = i18nElement.addElement(N_LOCALESCONFIGURED);
947         i = m_localeManager.getAvailableLocales().iterator();
948         while (i.hasNext()) {
949             Locale JavaDoc locale = (Locale JavaDoc)i.next();
950             localesElement.addElement(N_LOCALE).addText(locale.toString());
951         }
952         localesElement = i18nElement.addElement(N_LOCALESDEFAULT);
953         i = m_localeManager.getDefaultLocales().iterator();
954         while (i.hasNext()) {
955             Locale JavaDoc locale = (Locale JavaDoc)i.next();
956             localesElement.addElement(N_LOCALE).setText(locale.toString());
957         }
958
959         // mail nodes
960
Element mailElement = systemElement.addElement(N_MAIL);
961         mailElement.addElement(N_MAILFROM).setText(m_mailSettings.getMailFromDefault());
962         i = m_mailSettings.getMailHosts().iterator();
963         while (i.hasNext()) {
964             CmsMailHost host = (CmsMailHost)i.next();
965             Element hostElement = mailElement.addElement(N_MAILHOST).addAttribute(A_NAME, host.getHostname()).addAttribute(
966                 A_ORDER,
967                 host.getOrder().toString()).addAttribute(A_PROTOCOL, host.getProtocol());
968             if (host.isAuthenticating()) {
969                 hostElement.addAttribute(A_USER, host.getUsername()).addAttribute(A_PASSWORD, host.getPassword());
970             }
971         }
972
973         // scheduler node
974
Element schedulerElement = systemElement.addElement(N_SCHEDULER);
975         i = m_configuredJobs.iterator();
976         while (i.hasNext()) {
977             CmsScheduledJobInfo jobInfo = (CmsScheduledJobInfo)i.next();
978             Element jobElement = schedulerElement.addElement(N_JOB);
979             jobElement.addElement(N_NAME).addText(jobInfo.getJobName());
980             jobElement.addElement(N_CLASS).addText(jobInfo.getClassName());
981             jobElement.addElement(N_REUSEINSTANCE).addText(String.valueOf(jobInfo.isReuseInstance()));
982             jobElement.addElement(N_ACTIVE).addText(String.valueOf(jobInfo.isActive()));
983             jobElement.addElement(N_CRONEXPRESSION).addCDATA(jobInfo.getCronExpression());
984             Element contextElement = jobElement.addElement(N_CONTEXT);
985             contextElement.addElement(N_USERNAME).setText(jobInfo.getContextInfo().getUserName());
986             contextElement.addElement(N_PROJECT).setText(jobInfo.getContextInfo().getProjectName());
987             contextElement.addElement(N_SITEROOT).setText(jobInfo.getContextInfo().getSiteRoot());
988             contextElement.addElement(N_REQUESTEDURI).setText(jobInfo.getContextInfo().getRequestedUri());
989             contextElement.addElement(N_LOCALE).setText(jobInfo.getContextInfo().getLocaleName());
990             contextElement.addElement(N_ENCODING).setText(jobInfo.getContextInfo().getEncoding());
991             contextElement.addElement(N_REMOTEADDR).setText(jobInfo.getContextInfo().getRemoteAddr());
992             Map JavaDoc jobParameters = jobInfo.getConfiguration();
993             if ((jobParameters != null) && (jobParameters.size() > 0)) {
994                 Element parameterElement = jobElement.addElement(N_PARAMETERS);
995                 Iterator JavaDoc it = jobParameters.keySet().iterator();
996                 while (it.hasNext()) {
997                     String JavaDoc name = (String JavaDoc)it.next();
998                     String JavaDoc value = jobParameters.get(name).toString();
999                     Element paramNode = parameterElement.addElement(N_PARAM);
1000                    paramNode.addAttribute(A_NAME, name);
1001                    paramNode.addText(value);
1002                }
1003            }
1004        }
1005
1006        // <events> node
1007
Element eventsElement = systemElement.addElement(N_EVENTS);
1008        Element eventManagerElement = eventsElement.addElement(N_EVENTMANAGER);
1009        eventManagerElement.addAttribute(A_CLASS, m_eventManager.getClass().getName());
1010
1011        // version history
1012
systemElement.addElement(N_VERSIONHISTORY).addAttribute(
1013            A_ENABLED,
1014            new Boolean JavaDoc(m_versionHistoryEnabled).toString()).addAttribute(
1015            A_COUNT,
1016            new Integer JavaDoc(m_versionHistoryMaxCount).toString());
1017
1018        // resourceinit
1019
Element resourceinitElement = systemElement.addElement(N_RESOURCEINIT);
1020        i = m_resourceInitHandlers.iterator();
1021        while (i.hasNext()) {
1022            I_CmsResourceInit clazz = (I_CmsResourceInit)i.next();
1023            Element handlerElement = resourceinitElement.addElement(N_RESOURCEINITHANDLER);
1024            handlerElement.addAttribute(A_CLASS, clazz.getClass().getName());
1025        }
1026
1027        // request handlers
1028
Element requesthandlersElement = systemElement.addElement(N_REQUESTHANDLERS);
1029        i = m_requestHandlers.iterator();
1030        while (i.hasNext()) {
1031            I_CmsRequestHandler clazz = (I_CmsRequestHandler)i.next();
1032            Element handlerElement = requesthandlersElement.addElement(N_REQUESTHANDLER);
1033            handlerElement.addAttribute(A_CLASS, clazz.getClass().getName());
1034        }
1035
1036        // password handler
1037
Element passwordhandlerElement = systemElement.addElement(N_PASSWORDHANDLER).addAttribute(
1038            A_CLASS,
1039            m_passwordHandler.getClass().getName());
1040        passwordhandlerElement.addElement(N_PASSWORDENCODING).addText(m_passwordHandler.getInputEncoding());
1041        passwordhandlerElement.addElement(N_DIGESTTYPE).addText(m_passwordHandler.getDigestType());
1042        Map JavaDoc handlerParameters = m_passwordHandler.getConfiguration();
1043        if (handlerParameters != null) {
1044            Iterator JavaDoc it = handlerParameters.keySet().iterator();
1045            while (it.hasNext()) {
1046                String JavaDoc name = (String JavaDoc)it.next();
1047                String JavaDoc value = handlerParameters.get(name).toString();
1048                Element paramNode = passwordhandlerElement.addElement(N_PARAM);
1049                paramNode.addAttribute(A_NAME, name);
1050                paramNode.addText(value);
1051            }
1052        }
1053
1054        // validation handler
1055
if (m_validationHandler != null) {
1056            Element valHandlerElem = systemElement.addElement(N_VALIDATIONHANDLER);
1057            valHandlerElem.addAttribute(A_CLASS, m_validationHandler.getClass().getName());
1058        }
1059
1060        // login manager
1061
if (m_loginManager != null) {
1062            Element managerElement = systemElement.addElement(N_LOGINMANAGER);
1063            managerElement.addElement(N_DISABLEMINUTES).addText(String.valueOf(m_loginManager.getDisableMinutes()));
1064            managerElement.addElement(N_MAXBADATTEMPTS).addText(String.valueOf(m_loginManager.getMaxBadAttempts()));
1065        }
1066
1067        // login message
1068
if (m_loginMessage != null) {
1069            Element messageElement = systemElement.addElement(N_LOGINMESSAGE);
1070            messageElement.addElement(N_ENABLED).addText(String.valueOf(m_loginMessage.isEnabled()));
1071            messageElement.addElement(N_MESSAGE).addCDATA(m_loginMessage.getMessage());
1072            messageElement.addElement(N_LOGINFORBIDDEN).addText(String.valueOf(m_loginMessage.isLoginForbidden()));
1073            if (m_loginMessage.getTimeStart() != CmsLoginMessage.DEFAULT_TIME_START) {
1074                messageElement.addElement(N_TIMESTART).addText(String.valueOf(m_loginMessage.getTimeStart()));
1075            }
1076            if (m_loginMessage.getTimeEnd() != CmsLoginMessage.DEFAULT_TIME_END) {
1077                messageElement.addElement(N_TIMEEND).addText(String.valueOf(m_loginMessage.getTimeEnd()));
1078            }
1079        }
1080
1081        // create <sites> node
1082
Element sitesElement = systemElement.addElement(N_SITES);
1083        sitesElement.addElement(N_WORKPLACE_SERVER).addText(m_siteManager.getWorkplaceServer());
1084        sitesElement.addElement(N_DEFAULT_URI).addText(m_siteManager.getDefaultUri());
1085        Iterator JavaDoc siteIterator = new HashSet JavaDoc(m_siteManager.getSites().values()).iterator();
1086        while (siteIterator.hasNext()) {
1087            CmsSite site = (CmsSite)siteIterator.next();
1088            // create <site server="" uri=""/> subnode(s)
1089
Element siteElement = sitesElement.addElement(N_SITE);
1090
1091            siteElement.addAttribute(A_SERVER, site.getSiteMatcher().toString());
1092            siteElement.addAttribute(A_URI, site.getSiteRoot().concat("/"));
1093            // create <secure server=""/> subnode
1094
if (site.hasSecureServer()) {
1095                Element secureElem = siteElement.addElement(N_SECURE);
1096                secureElem.addAttribute(A_SERVER, site.getSecureUrl());
1097                secureElem.addAttribute(A_EXCLUSIVE, "" + site.isExclusiveUrl());
1098                secureElem.addAttribute(A_ERROR, "" + site.isExclusiveError());
1099            }
1100            // create <alias server=""/> subnode(s)
1101
Iterator JavaDoc aliasIterator = site.getAliases().iterator();
1102            while (aliasIterator.hasNext()) {
1103                String JavaDoc aliasServerName = ((CmsSiteMatcher)aliasIterator.next()).getUrl();
1104                siteElement.addElement(N_ALIAS).addAttribute(A_SERVER, aliasServerName);
1105            }
1106
1107        }
1108
1109        // create <runtimeproperties> node
1110
Element runtimepropertiesElement = systemElement.addElement(N_RUNTIMEPROPERTIES);
1111        if (m_runtimeProperties != null) {
1112            List JavaDoc sortedRuntimeProperties = new ArrayList JavaDoc(m_runtimeProperties.keySet());
1113            Collections.sort(sortedRuntimeProperties);
1114            Iterator JavaDoc it = sortedRuntimeProperties.iterator();
1115            while (it.hasNext()) {
1116                String JavaDoc key = (String JavaDoc)it.next();
1117                // create <param name="">value</param> subnodes
1118
runtimepropertiesElement.addElement(N_PARAM).addAttribute(A_NAME, key).addText(
1119                    (String JavaDoc)m_runtimeProperties.get(key));
1120            }
1121        }
1122
1123        // create <runtimeinfo> node
1124
Element runtimeinfoElement = systemElement.addElement(N_RUNTIMECLASSES);
1125        Element runtimeinfofactoryElement = runtimeinfoElement.addElement(N_RUNTIMEINFO);
1126        runtimeinfofactoryElement.addAttribute(A_CLASS, getRuntimeInfoFactory().getClass().getName());
1127
1128        // create <defaultusers> node
1129
Element defaultusersElement = systemElement.addElement(N_DEFAULTUSERS);
1130        // create <user-admin> subnode
1131
defaultusersElement.addElement(N_USER_ADMIN).addText(m_cmsDefaultUsers.getUserAdmin());
1132        // create <user-guest> subnode
1133
defaultusersElement.addElement(N_USER_GUEST).addText(m_cmsDefaultUsers.getUserGuest());
1134        // create <user-export> subnode
1135
defaultusersElement.addElement(N_USER_EXPORT).addText(m_cmsDefaultUsers.getUserExport());
1136        if (!m_cmsDefaultUsers.getUserDeletedResource().equals(m_cmsDefaultUsers.getUserAdmin())) {
1137            // create <user-deletedresource> subnode
1138
defaultusersElement.addElement(N_USER_DELETEDRESOURCE).addText(m_cmsDefaultUsers.getUserDeletedResource());
1139        }
1140        // create <group-administrators> subnode
1141
defaultusersElement.addElement(N_GROUP_ADMINISTRATORS).addText(m_cmsDefaultUsers.getGroupAdministrators());
1142        // create <group-projectmanagers> subnode
1143
defaultusersElement.addElement(N_GROUP_PROJECTMANAGERS).addText(m_cmsDefaultUsers.getGroupProjectmanagers());
1144        // create <group-users> subnode
1145
defaultusersElement.addElement(N_GROUP_USERS).addText(m_cmsDefaultUsers.getGroupUsers());
1146        // create <group-guests> subnode
1147
defaultusersElement.addElement(N_GROUP_GUESTS).addText(m_cmsDefaultUsers.getGroupGuests());
1148
1149        // create <defaultcontentencoding> node
1150
systemElement.addElement(N_DEFAULT_CONTENT_ENCODING).addText(getDefaultContentEncoding());
1151
1152        // create <memorymonitor> node
1153
if (m_cmsMemoryMonitorConfiguration != null) {
1154            Element memorymonitorElement = systemElement.addElement(N_MEMORYMONITOR);
1155            if (m_cmsMemoryMonitorConfiguration.getMaxUsagePercent() > 0) {
1156                memorymonitorElement.addElement(N_MAXUSAGE_PERCENT).addText(
1157                    String.valueOf(m_cmsMemoryMonitorConfiguration.getMaxUsagePercent()));
1158            }
1159            if (m_cmsMemoryMonitorConfiguration.getLogInterval() > 0) {
1160                memorymonitorElement.addElement(N_LOG_INTERVAL).addText(
1161                    String.valueOf(m_cmsMemoryMonitorConfiguration.getLogInterval()));
1162            }
1163            if (m_cmsMemoryMonitorConfiguration.getEmailInterval() > 0) {
1164                memorymonitorElement.addElement(N_EMAIL_INTERVAL).addText(
1165                    String.valueOf(m_cmsMemoryMonitorConfiguration.getEmailInterval()));
1166            }
1167            if (m_cmsMemoryMonitorConfiguration.getWarningInterval() > 0) {
1168                memorymonitorElement.addElement(N_WARNING_INTERVAL).addText(
1169                    String.valueOf(m_cmsMemoryMonitorConfiguration.getWarningInterval()));
1170            }
1171            if (m_cmsMemoryMonitorConfiguration.getEmailSender() != null) {
1172                memorymonitorElement.addElement(N_EMAIL_SENDER).addText(
1173                    m_cmsMemoryMonitorConfiguration.getEmailSender());
1174            }
1175            List JavaDoc emailReceiver = m_cmsMemoryMonitorConfiguration.getEmailReceiver();
1176            if (!emailReceiver.isEmpty()) {
1177                Element emailreceiverElement = memorymonitorElement.addElement(N_EMAIL_RECEIVER);
1178                Iterator JavaDoc iter = emailReceiver.iterator();
1179                while (iter.hasNext()) {
1180                    emailreceiverElement.addElement(N_RECEIVER).addText((String JavaDoc)iter.next());
1181                }
1182            }
1183        }
1184
1185        // create <flexcache> node
1186
Element flexcacheElement = systemElement.addElement(N_FLEXCACHE);
1187        flexcacheElement.addElement(N_CACHE_ENABLED).addText(
1188            String.valueOf(m_cmsFlexCacheConfiguration.isCacheEnabled()).toString());
1189        flexcacheElement.addElement(N_CACHE_OFFLINE).addText(
1190            String.valueOf(m_cmsFlexCacheConfiguration.isCacheOffline()).toString());
1191        flexcacheElement.addElement(N_MAXCACHEBYTES).addText(
1192            String.valueOf(m_cmsFlexCacheConfiguration.getMaxCacheBytes()).toString());
1193        flexcacheElement.addElement(N_AVGCACHEBYTES).addText(
1194            String.valueOf(m_cmsFlexCacheConfiguration.getAvgCacheBytes()).toString());
1195        flexcacheElement.addElement(N_MAXENTRYBYTES).addText(
1196            String.valueOf(m_cmsFlexCacheConfiguration.getMaxEntryBytes()).toString());
1197        flexcacheElement.addElement(N_MAXKEYS).addText(
1198            String.valueOf(m_cmsFlexCacheConfiguration.getMaxKeys()).toString());
1199
1200        // create <http-authentication> node
1201
Element httpAuthenticationElement = systemElement.addElement(N_HTTP_AUTHENTICATION);
1202        httpAuthenticationElement.addElement(N_BROWSER_BASED).setText(
1203            Boolean.toString(m_httpAuthenticationSettings.useBrowserBasedHttpAuthentication()));
1204        if (m_httpAuthenticationSettings.getFormBasedHttpAuthenticationUri() != null) {
1205            httpAuthenticationElement.addElement(N_FORM_BASED).setText(
1206                m_httpAuthenticationSettings.getFormBasedHttpAuthenticationUri());
1207        }
1208
1209        // cache settings
1210
Element cacheElement = systemElement.addElement(N_CACHE);
1211        cacheElement.addElement(N_KEYGENERATOR).setText(m_cacheSettings.getCacheKeyGenerator());
1212        cacheElement.addElement(N_SIZE_USERS).setText(Integer.toString(m_cacheSettings.getUserCacheSize()));
1213        cacheElement.addElement(N_SIZE_GROUPS).setText(Integer.toString(m_cacheSettings.getGroupCacheSize()));
1214        cacheElement.addElement(N_SIZE_USERGROUPS).setText(Integer.toString(m_cacheSettings.getUserGroupsCacheSize()));
1215        cacheElement.addElement(N_SIZE_PROJECTS).setText(Integer.toString(m_cacheSettings.getProjectCacheSize()));
1216        cacheElement.addElement(N_SIZE_RESOURCES).setText(Integer.toString(m_cacheSettings.getResourceCacheSize()));
1217        cacheElement.addElement(N_SIZE_RESOURCELISTS).setText(
1218            Integer.toString(m_cacheSettings.getResourcelistCacheSize()));
1219        cacheElement.addElement(N_SIZE_PROPERTIES).setText(Integer.toString(m_cacheSettings.getPropertyCacheSize()));
1220        cacheElement.addElement(N_SIZE_ACLS).setText(Integer.toString(m_cacheSettings.getAclCacheSize()));
1221        cacheElement.addElement(N_SIZE_PERMISSIONS).setText(Integer.toString(m_cacheSettings.getPermissionCacheSize()));
1222
1223        // content notification settings
1224
if (m_notificationTime != null || m_notificationProject != null) {
1225            Element notificationElement = systemElement.addElement(N_CONTENT_NOTIFICATION);
1226            if (m_notificationTime != null) {
1227                notificationElement.addElement(N_NOTIFICATION_TIME).setText(m_notificationTime.toString());
1228            }
1229            if (m_notificationProject != null) {
1230                notificationElement.addElement(N_NOTIFICATION_PROJECT).setText(m_notificationProject.toString());
1231            }
1232        }
1233
1234        // return the vfs node
1235
return systemElement;
1236    }
1237
1238    /**
1239     * Returns the settings of the driver manager.<p>
1240     *
1241     * @return the settings of the driver manager
1242     */

1243    public CmsCacheSettings getCacheSettings() {
1244
1245        return m_cacheSettings;
1246    }
1247
1248    /**
1249     * Returns the default users.<p>
1250     *
1251     * @return the default users
1252     */

1253    public CmsDefaultUsers getCmsDefaultUsers() {
1254
1255        return m_cmsDefaultUsers;
1256    }
1257
1258    /**
1259     * Returns the flexCacheConfiguration.<p>
1260     *
1261     * @return the flexCacheConfiguration
1262     */

1263    public CmsFlexCacheConfiguration getCmsFlexCacheConfiguration() {
1264
1265        return m_cmsFlexCacheConfiguration;
1266    }
1267
1268    /**
1269     * Returns the memory monitor configuration.<p>
1270     *
1271     * @return the memory monitor configuration
1272     */

1273    public CmsMemoryMonitorConfiguration getCmsMemoryMonitorConfiguration() {
1274
1275        return m_cmsMemoryMonitorConfiguration;
1276    }
1277
1278    /**
1279     * Returns the defaultContentEncoding.<p>
1280     *
1281     * @return the defaultContentEncoding
1282     */

1283    public String JavaDoc getDefaultContentEncoding() {
1284
1285        return m_defaultContentEncoding;
1286    }
1287
1288    /**
1289     * @see org.opencms.configuration.I_CmsXmlConfiguration#getDtdFilename()
1290     */

1291    public String JavaDoc getDtdFilename() {
1292
1293        return CONFIGURATION_DTD_NAME;
1294    }
1295
1296    /**
1297     * Returns the configured OpenCms event manager instance.<p>
1298     *
1299     * @return the configured OpenCms event manager instance
1300     */

1301    public CmsEventManager getEventManager() {
1302
1303        return m_eventManager;
1304    }
1305
1306    /**
1307     * Returns the HTTP authentication settings.<p>
1308     *
1309     * @return the HTTP authentication settings
1310     */

1311    public CmsHttpAuthenticationSettings getHttpAuthenticationSettings() {
1312
1313        return m_httpAuthenticationSettings;
1314    }
1315
1316    /**
1317     * Returns the configured locale manager for multi language support.<p>
1318     *
1319     * @return the configured locale manager for multi language support
1320     */

1321    public CmsLocaleManager getLocaleManager() {
1322
1323        return m_localeManager;
1324    }
1325
1326    /**
1327     * Returns the configured login manager.<p>
1328     *
1329     * @return the configured login manager
1330     */

1331    public CmsLoginManager getLoginManager() {
1332
1333        if (m_loginManager == null) {
1334            // no login manager configured, create default
1335
m_loginManager = new CmsLoginManager(
1336                CmsLoginManager.DISABLE_MINUTES_DEFAULT,
1337                CmsLoginManager.MAX_BAD_ATTEMPTS_DEFAULT);
1338        }
1339        if (m_loginMessage != null) {
1340            // null OpenCms object is ok during configuration
1341
try {
1342                m_loginManager.setLoginMessage(null, m_loginMessage);
1343            } catch (CmsRoleViolationException e) {
1344                // this should never happen
1345
}
1346        }
1347        return m_loginManager;
1348    }
1349
1350    /**
1351     * Returns the configured mail settings.<p>
1352     *
1353     * @return the configured mail settings
1354     */

1355    public CmsMailSettings getMailSettings() {
1356
1357        return m_mailSettings;
1358    }
1359
1360    /**
1361     * Returns the project in which timestamps for the content notification are read.<p>
1362     *
1363     * @return the project in which timestamps for the content notification are read
1364     */

1365    public String JavaDoc getNotificationProject() {
1366
1367        return m_notificationProject;
1368    }
1369
1370    /**
1371     * Returns the duration after which responsibles will be notified about out-dated content (in days).<p>
1372     *
1373     * @return the duration after which responsibles will be notified about out-dated content
1374     */

1375    public int getNotificationTime() {
1376
1377        if (m_notificationTime != null) {
1378            return m_notificationTime.intValue();
1379        } else {
1380            return -1;
1381        }
1382    }
1383
1384    /**
1385     * Returns the configured password handler.<p>
1386     *
1387     * @return the configured password handler
1388     */

1389    public I_CmsPasswordHandler getPasswordHandler() {
1390
1391        return m_passwordHandler;
1392    }
1393
1394    /**
1395     * Returns the list of instanciated request handler classes.<p>
1396     *
1397     * @return the list of instanciated request handler classes
1398     */

1399    public List JavaDoc getRequestHandlers() {
1400
1401        return m_requestHandlers;
1402    }
1403
1404    /**
1405     * Returns the list of instanciated resource init handler classes.<p>
1406     *
1407     * @return the list of instanciated resource init handler classes
1408     */

1409    public List JavaDoc getResourceInitHandlers() {
1410
1411        return m_resourceInitHandlers;
1412    }
1413
1414    /**
1415     * Returns the runtime info factory instance.<p>
1416     *
1417     * @return the runtime info factory instance
1418     */

1419    public I_CmsDbContextFactory getRuntimeInfoFactory() {
1420
1421        return m_runtimeInfoFactory;
1422    }
1423
1424    /**
1425     * Returns the runtime Properties.<p>
1426     *
1427     * @return the runtime Properties
1428     */

1429    public Map JavaDoc getRuntimeProperties() {
1430
1431        return m_runtimeProperties;
1432    }
1433
1434    /**
1435     * Returns the configured schedule manager.<p>
1436     *
1437     * @return the configured schedule manager
1438     */

1439    public CmsScheduleManager getScheduleManager() {
1440
1441        return m_scheduleManager;
1442    }
1443
1444    /**
1445     * Returns the site manager.<p>
1446     *
1447     * @return the site manager
1448     */

1449    public CmsSiteManager getSiteManager() {
1450
1451        return m_siteManager;
1452    }
1453
1454    /**
1455     * Returns temporary file project id.<p>
1456     *
1457     * @return temporary file project id
1458     */

1459    public int getTempFileProjectId() {
1460
1461        return m_tempFileProjectId;
1462    }
1463
1464    /**
1465     * Returns an instance of the configured validation handler.<p>
1466     *
1467     * @return an instance of the configured validation handler
1468     */

1469    public I_CmsValidationHandler getValidationHandler() {
1470
1471        return m_validationHandler;
1472    }
1473
1474    /**
1475     * Returns the maximum number of versions that are kept per file in the VFS version history.<p>
1476     *
1477     * If the versin history is disabled, this setting has no effect.<p>
1478     *
1479     * @return the maximum number of versions that are kept per file
1480     * @see #isVersionHistoryEnabled()
1481     */

1482    public int getVersionHistoryMaxCount() {
1483
1484        return m_versionHistoryMaxCount;
1485    }
1486
1487    /**
1488     * Will be called when configuration of this object is finished.<p>
1489     */

1490    public void initializeFinished() {
1491
1492        if (CmsLog.INIT.isInfoEnabled()) {
1493            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_SYSTEM_CONFIG_FINISHED_0));
1494        }
1495    }
1496
1497    /**
1498     * Returns if the VFS version history is enabled.<p>
1499     *
1500     * @return if the VFS version history is enabled
1501     */

1502    public boolean isVersionHistoryEnabled() {
1503
1504        return m_versionHistoryEnabled;
1505    }
1506
1507    /**
1508     * Sets the settings of the driver manager.<p>
1509     *
1510     * @param settings the settings of the driver manager
1511     */

1512    public void setCacheSettings(CmsCacheSettings settings) {
1513
1514        m_cacheSettings = settings;
1515    }
1516
1517    /**
1518     * Sets the CmsDefaultUsers.<p>
1519     *
1520     * @param userAdmin the name of the default admin user
1521     * @param userGuest the name of the guest user
1522     * @param userExport the name of the export user
1523     * @param userDeletedResource the name of the deleted resource user, can be <code>null</code>
1524     * @param groupAdministrators the name of the administrators group
1525     * @param groupProjectmanagers the name of the project managers group
1526     * @param groupUsers the name of the users group
1527     * @param groupGuests the name of the guests group
1528     */

1529    public void setCmsDefaultUsers(
1530
1531        String JavaDoc userAdmin,
1532        String JavaDoc userGuest,
1533        String JavaDoc userExport,
1534        String JavaDoc userDeletedResource,
1535        String JavaDoc groupAdministrators,
1536        String JavaDoc groupProjectmanagers,
1537        String JavaDoc groupUsers,
1538        String JavaDoc groupGuests) {
1539
1540        m_cmsDefaultUsers = new CmsDefaultUsers(
1541            userAdmin,
1542            userGuest,
1543            userExport,
1544            userDeletedResource,
1545            groupAdministrators,
1546            groupProjectmanagers,
1547            groupUsers,
1548            groupGuests);
1549    }
1550
1551    /**
1552     * Sets the flexCacheConfiguration.<p>
1553     *
1554     * @param flexCacheConfiguration the flexCacheConfiguration to set
1555     */

1556    public void setCmsFlexCacheConfiguration(CmsFlexCacheConfiguration flexCacheConfiguration) {
1557
1558        m_cmsFlexCacheConfiguration = flexCacheConfiguration;
1559    }
1560
1561    /**
1562     * Sets the cmsMemoryMonitorConfiguration.<p>
1563     *
1564     * @param cmsMemoryMonitorConfiguration the cmsMemoryMonitorConfiguration to set
1565     */

1566    public void setCmsMemoryMonitorConfiguration(CmsMemoryMonitorConfiguration cmsMemoryMonitorConfiguration) {
1567
1568        m_cmsMemoryMonitorConfiguration = cmsMemoryMonitorConfiguration;
1569    }
1570
1571    /**
1572     * Sets the defaultContentEncoding.<p>
1573     *
1574     * @param defaultContentEncoding the defaultContentEncoding to set
1575     */

1576    public void setDefaultContentEncoding(String JavaDoc defaultContentEncoding) {
1577
1578        m_defaultContentEncoding = defaultContentEncoding;
1579    }
1580
1581    /**
1582     * Sets the HTTP authentication settings.<p>
1583     *
1584     * @param httpAuthenticationSettings the HTTP authentication settings to set
1585     */

1586    public void setHttpAuthenticationSettings(CmsHttpAuthenticationSettings httpAuthenticationSettings) {
1587
1588        m_httpAuthenticationSettings = httpAuthenticationSettings;
1589    }
1590
1591    /**
1592     * Sets the locale manager for multi language support.<p>
1593     *
1594     * @param localeManager the locale manager to set
1595     */

1596    public void setLocaleManager(CmsLocaleManager localeManager) {
1597
1598        m_localeManager = localeManager;
1599        if (CmsLog.INIT.isInfoEnabled()) {
1600            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_CONFIG_I18N_FINISHED_0));
1601        }
1602    }
1603
1604    /**
1605     * Sets the configured login manager.<p>
1606     *
1607     * @param maxBadAttemptsStr the number of allowed bad login attempts
1608     * @param disableMinutesStr the time an account gets locked if to many bad logins are attempted
1609     */

1610    public void setLoginManager(String JavaDoc disableMinutesStr, String JavaDoc maxBadAttemptsStr) {
1611
1612        int disableMinutes;
1613        try {
1614            disableMinutes = Integer.valueOf(disableMinutesStr).intValue();
1615        } catch (NumberFormatException JavaDoc e) {
1616            disableMinutes = CmsLoginManager.DISABLE_MINUTES_DEFAULT;
1617        }
1618        int maxBadAttempts;
1619        try {
1620            maxBadAttempts = Integer.valueOf(maxBadAttemptsStr).intValue();
1621        } catch (NumberFormatException JavaDoc e) {
1622            maxBadAttempts = CmsLoginManager.MAX_BAD_ATTEMPTS_DEFAULT;
1623        }
1624        m_loginManager = new CmsLoginManager(disableMinutes, maxBadAttempts);
1625        if (CmsLog.INIT.isInfoEnabled()) {
1626            CmsLog.INIT.info(Messages.get().getBundle().key(
1627                Messages.INIT_LOGINMANAGER_2,
1628                new Integer JavaDoc(disableMinutes),
1629                new Integer JavaDoc(maxBadAttempts)));
1630        }
1631    }
1632
1633    /**
1634     * Adds the login message from the configuration.<p>
1635     *
1636     * @param message the login message to add
1637     */

1638    public void setLoginMessage(CmsLoginMessage message) {
1639
1640        m_loginMessage = message;
1641        if (CmsLog.INIT.isInfoEnabled()) {
1642            CmsLog.INIT.info(Messages.get().getBundle().key(
1643                Messages.INIT_LOGINMESSAGE_3,
1644                new Boolean JavaDoc(message.isEnabled()),
1645                new Boolean JavaDoc(message.isLoginForbidden()),
1646                message.getMessage()));
1647        }
1648    }
1649
1650    /**
1651     * Sets the mail settings.<p>
1652     *
1653     * @param mailSettings the mail settings to set.
1654     */

1655    public void setMailSettings(CmsMailSettings mailSettings) {
1656
1657        m_mailSettings = mailSettings;
1658        if (LOG.isDebugEnabled()) {
1659            LOG.debug(Messages.get().getBundle().key(Messages.LOG_MAIL_SETTINGS_1, mailSettings));
1660        }
1661    }
1662
1663    /**
1664     * Sets the project in which timestamps for the content notification are read.<p>
1665     *
1666     * @param notificationProject the project in which timestamps for the content notification are read
1667     */

1668    public void setNotificationProject(String JavaDoc notificationProject) {
1669
1670        m_notificationProject = notificationProject;
1671        if (CmsLog.INIT.isInfoEnabled()) {
1672            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_NOTIFICATION_PROJECT_1, m_notificationProject));
1673        }
1674    }
1675
1676    /**
1677     * Sets the duration after which responsibles will be notified about out-dated content (in days).<p>
1678     *
1679     * @param notificationTime the duration after which responsibles will be notified about out-dated content
1680     */

1681    public void setNotificationTime(String JavaDoc notificationTime) {
1682
1683        try {
1684            m_notificationTime = new Integer JavaDoc(notificationTime);
1685        } catch (Throwable JavaDoc t) {
1686            m_notificationTime = new Integer JavaDoc(-1);
1687        }
1688        if (CmsLog.INIT.isInfoEnabled()) {
1689            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_NOTIFICATION_TIME_1, m_notificationTime));
1690        }
1691    }
1692
1693    /**
1694     * Sets the password handler class.<p>
1695     *
1696     * @param passwordHandler the password handler to set
1697     */

1698    public void setPasswordHandler(I_CmsPasswordHandler passwordHandler) {
1699
1700        m_passwordHandler = passwordHandler;
1701        if (CmsLog.INIT.isInfoEnabled()) {
1702            CmsLog.INIT.info(Messages.get().getBundle().key(
1703                Messages.INIT_PWD_HANDLER_SUCCESS_1,
1704                passwordHandler.getClass().getName()));
1705        }
1706    }
1707
1708    /**
1709     * Sets the runtime info factory.<p>
1710     *
1711     * @param className the class name of the configured runtime info factory
1712     */

1713    public void setRuntimeInfoFactory(String JavaDoc className) {
1714
1715        Object JavaDoc objectInstance;
1716
1717        try {
1718            objectInstance = Class.forName(className).newInstance();
1719        } catch (Throwable JavaDoc t) {
1720            LOG.error(Messages.get().getBundle().key(Messages.LOG_RESOURCE_INIT_FAILURE_1, className), t);
1721            return;
1722        }
1723
1724        if (objectInstance instanceof I_CmsDbContextFactory) {
1725            m_runtimeInfoFactory = (I_CmsDbContextFactory)objectInstance;
1726            if (CmsLog.INIT.isInfoEnabled()) {
1727                CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_RUNTIME_INFO_FACTORY_SUCCESS_1, className));
1728            }
1729        } else {
1730            if (CmsLog.INIT.isFatalEnabled()) {
1731                CmsLog.INIT.fatal(Messages.get().getBundle().key(
1732                    Messages.INIT_RUNTIME_INFO_FACTORY_FAILURE_1,
1733                    className));
1734            }
1735        }
1736
1737    }
1738
1739    /**
1740     * Sets the site manager.<p>
1741     *
1742     * @param siteManager the site manager to set
1743     */

1744    public void setSiteManager(CmsSiteManager siteManager) {
1745
1746        m_siteManager = siteManager;
1747        if (CmsLog.INIT.isInfoEnabled()) {
1748            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_SITE_CONFIG_FINISHED_0));
1749        }
1750    }
1751
1752    /**
1753     * Sets the temporary file project id.<p>
1754     *
1755     * @param tempFileProjectId the temporary file project id to set
1756     */

1757    public void setTempFileProjectId(String JavaDoc tempFileProjectId) {
1758
1759        try {
1760            m_tempFileProjectId = Integer.valueOf(tempFileProjectId).intValue();
1761        } catch (Throwable JavaDoc t) {
1762            m_tempFileProjectId = -1;
1763        }
1764        if (CmsLog.INIT.isInfoEnabled()) {
1765            CmsLog.INIT.info(Messages.get().getBundle().key(
1766                Messages.INIT_TEMPFILE_PROJECT_ID_1,
1767                new Integer JavaDoc(m_tempFileProjectId)));
1768        }
1769    }
1770
1771    /**
1772     * Sets the validation handler.<p>
1773     *
1774     * @param validationHandler the validation handler to set.
1775     */

1776    public void setValidationHandler(I_CmsValidationHandler validationHandler) {
1777
1778        m_validationHandler = validationHandler;
1779        if (LOG.isDebugEnabled()) {
1780            LOG.debug(Messages.get().getBundle().key(Messages.LOG_VALIDATION_HANDLER_1, validationHandler));
1781        }
1782    }
1783
1784    /**
1785     * VFS version history settings are set here.<p>
1786     *
1787     * @param historyEnabled if true the history is enabled
1788     * @param historyMaxCount the maximum number of versions that are kept per VFS resource
1789     */

1790    public void setVersionHistorySettings(String JavaDoc historyEnabled, String JavaDoc historyMaxCount) {
1791
1792        m_versionHistoryEnabled = Boolean.valueOf(historyEnabled).booleanValue();
1793        m_versionHistoryMaxCount = Integer.valueOf(historyMaxCount).intValue();
1794        if (CmsLog.INIT.isInfoEnabled()) {
1795            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_HISTORY_SETTINGS_2,
1796            // is Boolean type localized by underlying java.text.MessageFormat?
1797
new Boolean JavaDoc(m_versionHistoryEnabled), new Integer JavaDoc(m_versionHistoryMaxCount)));
1798        }
1799    }
1800}
Popular Tags