001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software GmbH & Co. KG, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.configuration;
029
030import org.opencms.db.CmsCacheSettings;
031import org.opencms.db.CmsDefaultUsers;
032import org.opencms.db.CmsLoginManager;
033import org.opencms.db.CmsLoginMessage;
034import org.opencms.db.CmsSubscriptionManager;
035import org.opencms.db.I_CmsDbContextFactory;
036import org.opencms.flex.CmsFlexCacheConfiguration;
037import org.opencms.i18n.CmsLocaleManager;
038import org.opencms.mail.CmsMailHost;
039import org.opencms.mail.CmsMailSettings;
040import org.opencms.main.CmsContextInfo;
041import org.opencms.main.CmsDefaultSessionStorageProvider;
042import org.opencms.main.CmsEventManager;
043import org.opencms.main.CmsHttpAuthenticationSettings;
044import org.opencms.main.CmsLog;
045import org.opencms.main.CmsServletContainerSettings;
046import org.opencms.main.I_CmsRequestHandler;
047import org.opencms.main.I_CmsResourceInit;
048import org.opencms.main.I_CmsSessionStorageProvider;
049import org.opencms.main.OpenCms;
050import org.opencms.monitor.CmsMemoryMonitorConfiguration;
051import org.opencms.publish.CmsPublishManager;
052import org.opencms.scheduler.CmsScheduleManager;
053import org.opencms.scheduler.CmsScheduledJobInfo;
054import org.opencms.security.CmsDefaultAuthorizationHandler;
055import org.opencms.security.CmsDefaultCredentialsResolver;
056import org.opencms.security.CmsDefaultValidationHandler;
057import org.opencms.security.CmsRoleViolationException;
058import org.opencms.security.I_CmsAuthorizationHandler;
059import org.opencms.security.I_CmsCredentialsResolver;
060import org.opencms.security.I_CmsPasswordHandler;
061import org.opencms.security.I_CmsValidationHandler;
062import org.opencms.site.CmsSite;
063import org.opencms.site.CmsSiteManagerImpl;
064import org.opencms.site.CmsSiteMatcher;
065import org.opencms.util.CmsStringUtil;
066import org.opencms.workflow.CmsDefaultWorkflowManager;
067import org.opencms.workflow.I_CmsWorkflowManager;
068import org.opencms.xml.containerpage.CmsADECacheSettings;
069
070import java.util.ArrayList;
071import java.util.Collections;
072import java.util.HashMap;
073import java.util.HashSet;
074import java.util.Iterator;
075import java.util.LinkedHashMap;
076import java.util.List;
077import java.util.Locale;
078import java.util.Map;
079
080import org.apache.commons.digester.Digester;
081import org.apache.commons.lang.StringUtils;
082import org.apache.commons.logging.Log;
083
084import org.dom4j.Element;
085
086/**
087 * System master configuration class.<p>
088 *
089 * @since 6.0.0
090 */
091public class CmsSystemConfiguration extends A_CmsXmlConfiguration {
092
093    /** Enum for the user session mode. */
094    public enum UserSessionMode {
095        /** Only a single session per user is allowed. */
096        single,
097        /** Any number of sessions for a user are allowed. */
098        standard
099    }
100
101    /** The attribute name for the deleted node. */
102    public static final String A_DELETED = "deleted";
103
104    /** The "error" attribute. */
105    public static final String A_ERROR = "error";
106
107    /** The "errorPage" attribute. */
108    public static final String A_ERROR_PAGE = "errorPage";
109
110    /** The "exclusive" attribute. */
111    public static final String A_EXCLUSIVE = "exclusive";
112
113    /** The attribute name for the localization mode. */
114    public static final String A_LOCALIZATION_MODE = "localizationMode";
115
116    /** The "maxvisited" attribute. */
117    public static final String A_MAXVISITED = "maxvisited";
118
119    /** The "offline" attribute. */
120    public static final String A_OFFLINE = "offline";
121
122    /** The attribute name for the alias offset. */
123    public static final String A_OFFSET = "offset";
124
125    /** The "online" attribute. */
126    public static final String A_ONLINE = "online";
127
128    /** The "poolname" attribute. */
129    public static final String A_POOLNAME = "poolname";
130
131    /** The "position" attribute. */
132    public static final String A_POSITION = "position";
133
134    /** The "security" attribute. */
135    public static final String A_SECURITY = "security";
136
137    /** The "server" attribute. */
138    public static final String A_SERVER = "server";
139
140    /** The "title" attribute. */
141    public static final String A_TITLE = "title";
142
143    /** The "usePermanentRedirects" attribute. */
144    public static final String A_USE_PERMANENT_REDIRECTS = "usePermanentRedirects";
145
146    /** The "webserver" attribute. */
147    public static final String A_WEBSERVER = "webserver";
148
149    /** The name of the DTD for this configuration. */
150    public static final String CONFIGURATION_DTD_NAME = "opencms-system.dtd";
151
152    /** The default user session mode. */
153    public static final UserSessionMode DEFAULT_USER_SESSION_MODE = UserSessionMode.standard;
154
155    /** The name of the default XML file for this configuration. */
156    public static final String DEFAULT_XML_FILE_NAME = "opencms-system.xml";
157
158    /** The node name for the job "active" value. */
159    public static final String N_ACTIVE = "active";
160
161    /** The ade node name. */
162    public static final String N_ADE = "ade";
163
164    /** The ade-cache node name. */
165    public static final String N_ADE_CACHE = "ade-cache";
166
167    /** The node name for the alias node. */
168    public static final String N_ALIAS = "alias";
169
170    /** The node name for the authorization handler. */
171    public static final String N_AUTHORIZATIONHANDLER = "authorizationhandler";
172
173    /** The node name for the avgcachebytes node. */
174    public static final String N_AVGCACHEBYTES = "avgcachebytes";
175
176    /** The node name for the browser-based node. */
177    public static final String N_BROWSER_BASED = "browser-based";
178
179    /** The node name for the cache-enabled node. */
180    public static final String N_CACHE_ENABLED = "cache-enabled";
181
182    /** The node name for the cache-offline node. */
183    public static final String N_CACHE_OFFLINE = "cache-offline";
184
185    /** The node name for a job class. */
186    public static final String N_CLASS = "class";
187
188    /** The configuration node name. */
189    public static final String N_CONFIGURATION = "configuration";
190
191    /** The containerpages node name. */
192    public static final String N_CONTAINERPAGES = "containerpages";
193
194    /** The duration after which responsible resource owners will be notified about out-dated content. */
195    public static final String N_CONTENT_NOTIFICATION = "content-notification";
196
197    /** The node name for the job context. */
198    public static final String N_CONTEXT = "context";
199
200    /** The node name for the job cron expression. */
201    public static final String N_CRONEXPRESSION = "cronexpression";
202
203    /** The node name for the defaultcontentencoding node. */
204    public static final String N_DEFAULT_CONTENT_ENCODING = "defaultcontentencoding";
205
206    /** The node name for the default-uri node. */
207    public static final String N_DEFAULT_URI = "default-uri";
208
209    /** The node name for the defaultusers expression. */
210    public static final String N_DEFAULTUSERS = "defaultusers";
211
212    /** The node name for the device selector node. */
213    public static final String N_DEVICESELECTOR = "device-selector";
214
215    /** The node name for the digest type. */
216    public static final String N_DIGESTTYPE = "digest-type";
217
218    /** The node name for the login account lock minutes.  */
219    public static final String N_DISABLEMINUTES = "disableMinutes";
220
221    /** The node name for the sitemap cache for documents. */
222    public static final String N_DOCUMENTS = "documents";
223
224    /** The node name for the email-interval node. */
225    public static final String N_EMAIL_INTERVAL = "email-interval";
226
227    /** The node name for the email-receiver node. */
228    public static final String N_EMAIL_RECEIVER = "email-receiver";
229
230    /** The node name for the email-sender node. */
231    public static final String N_EMAIL_SENDER = "email-sender";
232
233    /** The node name for the login message enabled flag. */
234    public static final String N_ENABLED = "enabled";
235
236    /** The node name for the login security option enabled flag. */
237    public static final String N_ENABLESCURITY = "enableSecurity";
238
239    /** The node name for the context encoding. */
240    public static final String N_ENCODING = "encoding";
241
242    /** The node name for the request handler classes. */
243    public static final String N_EVENTMANAGER = "eventmanager";
244
245    /** The node name for the events node. */
246    public static final String N_EVENTS = "events";
247
248    /** The node name for the flexcache node. */
249    public static final String N_FLEXCACHE = "flexcache";
250
251    /** The node name for the form-based node. */
252    public static final String N_FORM_BASED = "form-based";
253
254    /** The node name for the group-administrators node. */
255    public static final String N_GROUP_ADMINISTRATORS = "group-administrators";
256
257    /** The node name for the group-guests node. */
258    public static final String N_GROUP_GUESTS = "group-guests";
259
260    /** The node name for the group-projectmanagers node. */
261    public static final String N_GROUP_PROJECTMANAGERS = "group-projectmanagers";
262
263    /** The node name for the group-users node. */
264    public static final String N_GROUP_USERS = "group-users";
265
266    /** The groupcontainers node name. */
267    public static final String N_GROUPCONTAINERS = "groupcontainers";
268
269    /** The node name for the publish "history-size" value. */
270    public static final String N_HISTORYSIZE = "history-size";
271
272    /** The node name for the http-authentication node. */
273    public static final String N_HTTP_AUTHENTICATION = "http-authentication";
274
275    /** The node name for the internationalization node. */
276    public static final String N_I18N = "internationalization";
277
278    /** The node name for a job. */
279    public static final String N_JOB = "job";
280
281    /** The name of the class to generate cache keys. */
282    public static final String N_KEYGENERATOR = "keygenerator";
283
284    /** The node name for individual locales. */
285    public static final String N_LOCALE = "locale";
286
287    /** The node name for the locale handler. */
288    public static final String N_LOCALEHANDLER = "localehandler";
289
290    /** The node name for the configured locales. */
291    public static final String N_LOCALESCONFIGURED = "localesconfigured";
292
293    /** The node name for the default locale(s). */
294    public static final String N_LOCALESDEFAULT = "localesdefault";
295
296    /** The node name for the log-interval node. */
297    public static final String N_LOG_INTERVAL = "log-interval";
298
299    /** The node name for the login message login forbidden flag. */
300    public static final String N_LOGINFORBIDDEN = "loginForbidden";
301
302    /** The node name for the login manager. */
303    public static final String N_LOGINMANAGER = "loginmanager";
304
305    /** The node name for the login message. */
306    public static final String N_LOGINMESSAGE = "loginmessage";
307
308    /** The node name for the mail configuration. */
309    public static final String N_MAIL = "mail";
310
311    /** The node name for the "mail from" node. */
312    public static final String N_MAILFROM = "mailfrom";
313
314    /** The node name for the "mail host" node. */
315    public static final String N_MAILHOST = "mailhost";
316
317    /** The node name for the login manager bad attempt count. */
318    public static final String N_MAXBADATTEMPTS = "maxBadAttempts";
319
320    /** The node name for the maxcachebytes node. */
321    public static final String N_MAXCACHEBYTES = "maxcachebytes";
322
323    /** The node name for the maxentrybytes node. */
324    public static final String N_MAXENTRYBYTES = "maxentrybytes";
325
326    /** The node name for the maxkeys node. */
327    public static final String N_MAXKEYS = "maxkeys";
328
329    /** The node name for the maxusagepercent node. */
330    public static final String N_MAXUSAGE_PERCENT = "maxusagepercent";
331
332    /** The node name for the memorymonitor node. */
333    public static final String N_MEMORYMONITOR = "memorymonitor";
334
335    /** The node name for the login message text. */
336    public static final String N_MESSAGE = "message";
337
338    /** The duration after which responsibles will be notified about out-dated content. */
339    public static final String N_NOTIFICATION_PROJECT = "notification-project";
340
341    /** The duration after which responsibles will be notified about out-dated content. */
342    public static final String N_NOTIFICATION_TIME = "notification-time";
343
344    /** The node name for the job parameters. */
345    public static final String N_PARAMETERS = "parameters";
346
347    /** Node name for the password change interval. */
348    public static final String N_PASSWORD_CHANGE_INTERVAL = "passwordChangeInterval";
349
350    /** The node name for the password encoding. */
351    public static final String N_PASSWORDENCODING = "encoding";
352
353    /** The node name for the password handler. */
354    public static final String N_PASSWORDHANDLER = "passwordhandler";
355
356    /** The node name for the permission handler. */
357    public static final String N_PERMISSIONHANDLER = "permissionhandler";
358
359    /** The node name for the prevent-response-flush node. */
360    public static final String N_PREVENTRESPONSEFLUSH = "prevent-response-flush";
361
362    /** The node name for the context project name. */
363    public static final String N_PROJECT = "project";
364
365    /** The node name for the publish list remove mode. */
366    public static final String N_PUBLISH_LIST_REMOVE_MODE = "publish-list-remove-mode";
367
368    /** The node name for the "publishhistory" section. */
369    public static final String N_PUBLISHMANAGER = "publishmanager";
370
371    /** The node name for the "publishhistory" section. */
372    public static final String N_QUEUEPERSISTANCE = "queue-persistance";
373
374    /** The node name for the "publishhistory" section. */
375    public static final String N_QUEUESHUTDOWNTIME = "queue-shutdowntime";
376
377    /** The node name for the memory email receiver. */
378    public static final String N_RECEIVER = "receiver";
379
380    /** The node name for the release-tags-after-end node. */
381    public static final String N_RELEASETAGSAFTEREND = "release-tags-after-end";
382
383    /** The node name for the context remote addr. */
384    public static final String N_REMOTEADDR = "remoteaddr";
385
386    /** The node name for the context requested uri. */
387    public static final String N_REQUESTEDURI = "requesteduri";
388
389    /** The node name for the request-error-page-attribute node. */
390    public static final String N_REQUESTERRORPAGEATTRIBUTE = "request-error-page-attribute";
391
392    /** The node name for the request handler classes. */
393    public static final String N_REQUESTHANDLER = "requesthandler";
394
395    /** The node name for the request handlers. */
396    public static final String N_REQUESTHANDLERS = "requesthandlers";
397
398    /** The node name for the resource init classes. */
399    public static final String N_RESOURCEINIT = "resourceinit";
400
401    /** The node name for the resource init classes. */
402    public static final String N_RESOURCEINITHANDLER = "resourceinithandler";
403
404    /** Node name for the restrict-detail-contents option. */
405    public static final String N_RESTRICT_DETAIL_CONTENTS = "restrict-detail-contents";
406
407    /** the result cache node. */
408    public static final String N_RESULTCACHE = "resultcache";
409
410    /** The node name for the job "reuseinstance" value. */
411    public static final String N_REUSEINSTANCE = "reuseinstance";
412
413    /** The node name for the runtime info. */
414    public static final String N_RUNTIMECLASSES = "runtimeclasses";
415
416    /** The node name for the runtime info factory. */
417    public static final String N_RUNTIMEINFO = "runtimeinfo";
418
419    /** The node name for the runtime properties node. */
420    public static final String N_RUNTIMEPROPERTIES = "runtimeproperties";
421
422    /** The node name for the sax-impl-system-properties node. */
423    public static final String N_SAX_IMPL_SYSTEM_PROPERTIES = "sax-impl-system-properties";
424
425    /** The node name for the scheduler. */
426    public static final String N_SCHEDULER = "scheduler";
427
428    /** The node name for the secure site. */
429    public static final String N_SECURE = "secure";
430
431    /** The node name for the servlet container settings. */
432    public static final String N_SERVLETCONTAINERSETTINGS = "servletcontainer-settings";
433
434    /** The node name for the session-storageprovider node. */
435    public static final String N_SESSION_STORAGEPROVIDER = "session-storageprovider";
436
437    /** Shared folder node name. */
438    public static final String N_SHARED_FOLDER = "shared-folder";
439
440    /** The sitemap node name. */
441    public static final String N_SITEMAP = "sitemap";
442
443    /** The sitemap-cache node name. */
444    public static final String N_SITEMAP_CACHE = "sitemap-cache";
445
446    /** The node name for the context site root. */
447    public static final String N_SITEROOT = "siteroot";
448
449    /** The node name for the sites node. */
450    public static final String N_SITES = "sites";
451
452    /** The size of the memory monitor's cache for ACLS. */
453    public static final String N_SIZE_ACLS = "size-accesscontrollists";
454
455    /** The size of the memory monitor's cache for offline container pages. */
456    public static final String N_SIZE_CONTAINERPAGE_OFFLINE = "size-containerpage-offline";
457
458    /** The size of the memory monitor's cache for online container pages. */
459    public static final String N_SIZE_CONTAINERPAGE_ONLINE = "size-containerpage-online";
460
461    /** The size of the memory monitor's cache for groups. */
462    public static final String N_SIZE_GROUPS = "size-groups";
463
464    /** The size of the memory monitor's cache for organizational units. */
465    public static final String N_SIZE_ORGUNITS = "size-orgunits";
466
467    /** The size of the memory monitor's cache for permission checks. */
468    public static final String N_SIZE_PERMISSIONS = "size-permissions";
469
470    /** The size of the memory monitor's cache for project resources. */
471    public static final String N_SIZE_PROJECTRESOURCES = "size-projectresources";
472
473    /** The size of the memory monitor's cache for projects. */
474    public static final String N_SIZE_PROJECTS = "size-projects";
475
476    /** The size of the memory monitor's cache for properties. */
477    public static final String N_SIZE_PROPERTIES = "size-properties";
478
479    /** The size of the memory monitor's cache for property lists. */
480    public static final String N_SIZE_PROPERTYLISTS = "size-propertylists";
481
482    /** The size of the memory monitor's cache for lists of resources. */
483    public static final String N_SIZE_RESOURCELISTS = "size-resourcelists";
484
485    /** The size of the memory monitor's cache for resources. */
486    public static final String N_SIZE_RESOURCES = "size-resources";
487
488    /** The size of the memory monitor's cache for roles. */
489    public static final String N_SIZE_ROLES = "size-roles";
490
491    /** The size of the memory monitor's cache for user/group relations. */
492    public static final String N_SIZE_USERGROUPS = "size-usergroups";
493
494    /** The size of the memory monitor's cache for users. */
495    public static final String N_SIZE_USERS = "size-users";
496
497    /** The subscriptionmanager node name. */
498    public static final String N_SUBSCRIPTIONMANAGER = "subscriptionmanager";
499
500    /** The main system configuration node name. */
501    public static final String N_SYSTEM = "system";
502
503    /** The node name for the login message end time. */
504    public static final String N_TIMEEND = "timeEnd";
505
506    /** The node name for the login message start time. */
507    public static final String N_TIMESTART = "timeStart";
508
509    /** The node name for the time zone configuration. */
510    public static final String N_TIMEZONE = "timezone";
511
512    /** Node name for the authorization token lifetime. */
513    public static final String N_TOKEN_LIFETIME = "tokenLifetime";
514
515    /** The node name for the user-admin node. */
516    public static final String N_USER_ADMIN = "user-admin";
517
518    /** Node name for the user data check interval. */
519    public static final String N_USER_DATA_CHECK_INTERVAL = "userDataCheckInterval";
520
521    /** The node name for the user-deletedresource node. */
522    public static final String N_USER_DELETEDRESOURCE = "user-deletedresource";
523
524    /** The node name for the user-export node. */
525    public static final String N_USER_EXPORT = "user-export";
526
527    /** The node name for the user-guest node. */
528    public static final String N_USER_GUEST = "user-guest";
529
530    /** The node name for the context user name. */
531    public static final String N_USERNAME = "user";
532
533    /** The node name for the validation handler. */
534    public static final String N_VALIDATIONHANDLER = "validationhandler";
535
536    /** The node name for the version history. */
537    public static final String N_VERSIONHISTORY = "versionhistory";
538
539    /** The node name for the warning-interval node. */
540    public static final String N_WARNING_INTERVAL = "warning-interval";
541
542    /** The node name for the workflow configuration. */
543    public static final String N_WORKFLOW = "workflow";
544
545    /** The node name for the workplace-server node. */
546    public static final String N_WORKPLACE_SERVER = "workplace-server";
547
548    /** The log object for this class. */
549    private static final Log LOG = CmsLog.getLog(CmsSystemConfiguration.class);
550
551    /** Node name for the credentials resolver setting. */
552    private static final String N_CREDENTIALS_RESOLVER = "credentials-resolver";
553
554    /** Node name for the user max inactive time. */
555    private static final String N_MAX_INACTIVE_TIME = "maxInactiveTime";
556
557    /** Node name for the element reuse mode. */
558    private static final String N_REUSE_ELEMENTS = "reuse-elements";
559
560    /** Node name for the user session mode. */
561    private static final String N_USER_SESSION_MODE = "user-session-mode";
562
563    /** The ADE cache settings. */
564    private CmsADECacheSettings m_adeCacheSettings;
565
566    /** The ADE configuration. */
567    private String m_adeConfiguration;
568
569    /** The ADE configuration parameters. */
570    private Map<String, String> m_adeParameters = new LinkedHashMap<String, String>();
571
572    /** The authorization handler. */
573    private String m_authorizationHandler;
574
575    /** The settings of the memory monitor. */
576    private CmsCacheSettings m_cacheSettings;
577
578    /** The configured OpenCms default users and groups. */
579    private CmsDefaultUsers m_cmsDefaultUsers;
580
581    /** The flex cache configuration object. */
582    private CmsFlexCacheConfiguration m_cmsFlexCacheConfiguration;
583
584    /** The memory monitor configuration. */
585    private CmsMemoryMonitorConfiguration m_cmsMemoryMonitorConfiguration;
586
587    /** The list of jobs for the scheduler. */
588    private List<CmsScheduledJobInfo> m_configuredJobs;
589
590    /** The credentials resolver instance. */
591    private I_CmsCredentialsResolver m_credentialsResolver;
592
593    /** The configured credentials resolver class name. */
594    private String m_credentialsResolverClass;
595
596    /** The default content encoding. */
597    private String m_defaultContentEncoding;
598
599    /** The configured OpenCms event manager. */
600    private CmsEventManager m_eventManager;
601
602    /** Indicates if the version history is enabled. */
603    private boolean m_historyEnabled;
604
605    /** The maximum number of historical versions per resource. */
606    private int m_historyVersions;
607
608    /** The maximum number of historical versions for deleted resources. */
609    private int m_historyVersionsAfterDeletion;
610
611    /** The HTTP basic authentication settings. */
612    private CmsHttpAuthenticationSettings m_httpAuthenticationSettings;
613
614    /** The configured locale manager for multi language support. */
615    private CmsLocaleManager m_localeManager;
616
617    /** The configured login manager. */
618    private CmsLoginManager m_loginManager;
619
620    /** The configured login message. */
621    private CmsLoginMessage m_loginMessage;
622
623    /** The mail settings. */
624    private CmsMailSettings m_mailSettings;
625
626    /** Notification project. */
627    private String m_notificationProject;
628
629    /** The duration after which responsibles will be notified about out-dated content (in days). */
630    // It is an Integer object so that it can be distinguished if this optional element was set or not
631    private Integer m_notificationTime;
632
633    /** The password handler. */
634    private I_CmsPasswordHandler m_passwordHandler;
635
636    /** The permission handler. */
637    private String m_permissionHandler;
638
639    /** The configured publish list remove mode. */
640    private String m_publishListRemoveMode;
641
642    /** The configured publish manager. */
643    private CmsPublishManager m_publishManager;
644
645    /** A list of instantiated request handler classes. */
646    private List<I_CmsRequestHandler> m_requestHandlers;
647
648    /** A list of instantiated resource init handler classes. */
649    private List<I_CmsResourceInit> m_resourceInitHandlers;
650
651    /** Value of the restrict-detail-contents option. */
652    private String m_restrictDetailContents;
653
654    /** The runtime info factory. */
655    private I_CmsDbContextFactory m_runtimeInfoFactory;
656
657    /** The runtime properties. */
658    private Map<String, String> m_runtimeProperties;
659
660    /** Flag indicating if the SAX parser implementation classes should be stored in system properties
661     *  to improve the unmarshalling performance. */
662    private boolean m_saxImplProperties;
663
664    /** The configured schedule manager. */
665    private CmsScheduleManager m_scheduleManager;
666
667    /** The configured session storage provider class name. */
668    private String m_sessionStorageProvider;
669
670    /** The configured site manager. */
671    private CmsSiteManagerImpl m_siteManager;
672
673    /** The subscription manager. */
674    private CmsSubscriptionManager m_subscriptionManager;
675
676    /** The temporary file project id. */
677    private int m_tempFileProjectId;
678
679    /** The user session mode. */
680    private UserSessionMode m_userSessionMode;
681
682    /** The configured validation handler. */
683    private String m_validationHandler;
684
685    /** The configured workflow manager. */
686    private I_CmsWorkflowManager m_workflowManager;
687
688    /**
689     * Adds an ADE configuration parameter.<p>
690     *
691     * @param name the parameter name
692     * @param value the parameter value
693     */
694    public void addAdeParameter(String name, String value) {
695
696        m_adeParameters.put(name, value);
697    }
698
699    /**
700     * @see org.opencms.configuration.I_CmsConfigurationParameterHandler#addConfigurationParameter(java.lang.String, java.lang.String)
701     */
702    @Override
703    public void addConfigurationParameter(String paramName, String paramValue) {
704
705        m_runtimeProperties.put(paramName, paramValue);
706    }
707
708    /**
709     * Adds the event manager class.<p>
710     *
711     * @param clazz the class name of event manager class  to instantiate and add
712     */
713    public void addEventManager(String clazz) {
714
715        try {
716            m_eventManager = (CmsEventManager)Class.forName(clazz).newInstance();
717            if (CmsLog.INIT.isInfoEnabled()) {
718                CmsLog.INIT.info(
719                    Messages.get().getBundle().key(Messages.INIT_EVENTMANAGER_CLASS_SUCCESS_1, m_eventManager));
720            }
721        } catch (Throwable t) {
722            LOG.error(Messages.get().getBundle().key(Messages.INIT_EVENTMANAGER_CLASS_INVALID_1, clazz), t);
723            return;
724        }
725    }
726
727    /**
728     * Adds a new job description for the scheduler.<p>
729     *
730     * @param jobInfo the job description to add
731     */
732    public void addJobFromConfiguration(CmsScheduledJobInfo jobInfo) {
733
734        m_configuredJobs.add(jobInfo);
735
736        if (CmsLog.INIT.isInfoEnabled()) {
737            CmsLog.INIT.info(
738                Messages.get().getBundle().key(
739                    Messages.INIT_SCHEDULER_CONFIG_JOB_3,
740                    jobInfo.getJobName(),
741                    jobInfo.getClassName(),
742                    jobInfo.getContextInfo().getUserName()));
743        }
744    }
745
746    /**
747     * Adds a new instance of a request handler class.<p>
748     *
749     * @param clazz the class name of the request handler to instantiate and add
750     */
751    public void addRequestHandler(String clazz) {
752
753        Object initClass;
754        try {
755            initClass = Class.forName(clazz).newInstance();
756        } catch (Throwable t) {
757            LOG.error(Messages.get().getBundle().key(Messages.LOG_INIT_REQUEST_HANDLER_FAILURE_1, clazz), t);
758            return;
759        }
760        if (initClass instanceof I_CmsRequestHandler) {
761            m_requestHandlers.add((I_CmsRequestHandler)initClass);
762            if (CmsLog.INIT.isInfoEnabled()) {
763                CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_REQUEST_HANDLER_SUCCESS_1, clazz));
764            }
765        } else {
766            if (CmsLog.INIT.isErrorEnabled()) {
767                CmsLog.INIT.error(Messages.get().getBundle().key(Messages.INIT_REQUEST_HANDLER_INVALID_1, clazz));
768            }
769        }
770    }
771
772    /**
773     * Adds a new instance of a resource init handler class.<p>
774     *
775     * @param clazz the class name of the resource init handler to instantiate and add
776     */
777    public void addResourceInitHandler(String clazz) {
778
779        Object initClass;
780        try {
781            initClass = Class.forName(clazz).newInstance();
782        } catch (Throwable t) {
783            LOG.error(Messages.get().getBundle().key(Messages.LOG_RESOURCE_INIT_CLASS_INVALID_1, clazz), t);
784            return;
785        }
786        if (initClass instanceof I_CmsResourceInit) {
787            m_resourceInitHandlers.add((I_CmsResourceInit)initClass);
788            if (CmsLog.INIT.isInfoEnabled()) {
789                CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_RESOURCE_INIT_SUCCESS_1, clazz));
790            }
791        } else {
792            if (CmsLog.INIT.isErrorEnabled()) {
793                CmsLog.INIT.error(Messages.get().getBundle().key(Messages.INIT_RESOURCE_INIT_INVALID_CLASS_1, clazz));
794            }
795        }
796    }
797
798    /**
799     * Generates the schedule manager.<p>
800     */
801    public void addScheduleManager() {
802
803        m_scheduleManager = new CmsScheduleManager(m_configuredJobs);
804    }
805
806    /**
807     * @see org.opencms.configuration.I_CmsXmlConfiguration#addXmlDigesterRules(org.apache.commons.digester.Digester)
808     */
809    public void addXmlDigesterRules(Digester digester) {
810
811        // add finish rule
812        digester.addCallMethod("*/" + N_SYSTEM, "initializeFinished");
813
814        // add rule for internationalization
815        digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_I18N, CmsLocaleManager.class);
816        digester.addSetNext("*/" + N_SYSTEM + "/" + N_I18N, "setLocaleManager");
817
818        // add locale handler creation rule
819        digester.addObjectCreate(
820            "*/" + N_SYSTEM + "/" + N_I18N + "/" + N_LOCALEHANDLER,
821            A_CLASS,
822            CmsConfigurationException.class);
823        digester.addSetNext("*/" + N_SYSTEM + "/" + N_I18N + "/" + N_LOCALEHANDLER, "setLocaleHandler");
824
825        // add locale rules
826        digester.addCallMethod(
827            "*/" + N_SYSTEM + "/" + N_I18N + "/" + N_LOCALESCONFIGURED + "/" + N_LOCALE,
828            "addAvailableLocale",
829            0);
830        digester.addCallMethod(
831            "*/" + N_SYSTEM + "/" + N_I18N + "/" + N_LOCALESDEFAULT + "/" + N_LOCALE,
832            "addDefaultLocale",
833            0);
834        // add time zone rule
835        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_I18N + "/" + N_TIMEZONE, "setTimeZone", 0);
836        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_I18N + "/" + N_REUSE_ELEMENTS, "setReuseElements", 0);
837
838        // add version history rules
839        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_VERSIONHISTORY, "setHistorySettings", 3);
840        digester.addCallParam("*/" + N_SYSTEM + "/" + N_VERSIONHISTORY, 0, A_ENABLED);
841        digester.addCallParam("*/" + N_SYSTEM + "/" + N_VERSIONHISTORY, 1, A_COUNT);
842        digester.addCallParam("*/" + N_SYSTEM + "/" + N_VERSIONHISTORY, 2, A_DELETED);
843
844        // add mail configuration rule
845        digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_MAIL, CmsMailSettings.class);
846        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILFROM, "setMailFromDefault", 0);
847        digester.addSetNext("*/" + N_SYSTEM + "/" + N_MAIL, "setMailSettings");
848
849        // add mail host configuration rule
850        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, "addMailHost", 7);
851        digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 0, A_NAME);
852        digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 1, A_PORT);
853        digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 2, A_ORDER);
854        digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 3, A_PROTOCOL);
855        digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 4, A_SECURITY);
856        digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 5, A_USER);
857        digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 6, A_PASSWORD);
858
859        // add scheduler creation rule
860        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SCHEDULER, "addScheduleManager");
861
862        // add scheduler job creation rule
863        digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB, CmsScheduledJobInfo.class);
864        digester.addBeanPropertySetter("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_NAME, "jobName");
865        digester.addBeanPropertySetter("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CLASS, "className");
866        digester.addBeanPropertySetter(
867            "*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CRONEXPRESSION,
868            "cronExpression");
869        digester.addBeanPropertySetter(
870            "*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_REUSEINSTANCE,
871            "reuseInstance");
872        digester.addBeanPropertySetter("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_ACTIVE, "active");
873        digester.addSetNext("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB, "addJobFromConfiguration");
874
875        // add job context creation rule
876        digester.addObjectCreate(
877            "*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT,
878            CmsContextInfo.class);
879        digester.addBeanPropertySetter(
880            "*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT + "/" + N_USERNAME,
881            "userName");
882        digester.addBeanPropertySetter(
883            "*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT + "/" + N_PROJECT,
884            "projectName");
885        digester.addBeanPropertySetter(
886            "*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT + "/" + N_SITEROOT,
887            "siteRoot");
888        digester.addBeanPropertySetter(
889            "*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT + "/" + N_REQUESTEDURI,
890            "requestedUri");
891        digester.addBeanPropertySetter(
892            "*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT + "/" + N_LOCALE,
893            "localeName");
894        digester.addBeanPropertySetter(
895            "*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT + "/" + N_ENCODING);
896        digester.addBeanPropertySetter(
897            "*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT + "/" + N_REMOTEADDR,
898            "remoteAddr");
899        digester.addSetNext("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT, "setContextInfo");
900
901        // add generic parameter rules (used for jobs, password handler)
902        digester.addCallMethod(
903            "*/" + I_CmsXmlConfiguration.N_PARAM,
904            I_CmsConfigurationParameterHandler.ADD_PARAMETER_METHOD,
905            2);
906        digester.addCallParam("*/" + I_CmsXmlConfiguration.N_PARAM, 0, I_CmsXmlConfiguration.A_NAME);
907        digester.addCallParam("*/" + I_CmsXmlConfiguration.N_PARAM, 1);
908
909        // add event classes
910        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_EVENTS + "/" + N_EVENTMANAGER, "addEventManager", 1);
911        digester.addCallParam("*/" + N_SYSTEM + "/" + N_EVENTS + "/" + N_EVENTMANAGER, 0, A_CLASS);
912
913        // add resource init classes
914        digester.addCallMethod(
915            "*/" + N_SYSTEM + "/" + N_RESOURCEINIT + "/" + N_RESOURCEINITHANDLER,
916            "addResourceInitHandler",
917            1);
918        digester.addCallParam("*/" + N_SYSTEM + "/" + N_RESOURCEINIT + "/" + N_RESOURCEINITHANDLER, 0, A_CLASS);
919
920        // add request handler classes
921        digester.addCallMethod(
922            "*/" + N_SYSTEM + "/" + N_REQUESTHANDLERS + "/" + N_REQUESTHANDLER,
923            "addRequestHandler",
924            1);
925        digester.addCallParam("*/" + N_SYSTEM + "/" + N_REQUESTHANDLERS + "/" + N_REQUESTHANDLER, 0, A_CLASS);
926
927        // add password handler creation rule
928        digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER, A_CLASS, CmsConfigurationException.class);
929        digester.addCallMethod(
930            "*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER,
931            I_CmsConfigurationParameterHandler.INIT_CONFIGURATION_METHOD);
932        digester.addBeanPropertySetter(
933            "*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER + "/" + N_PASSWORDENCODING,
934            "inputEncoding");
935        digester.addBeanPropertySetter("*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER + "/" + N_DIGESTTYPE, "digestType");
936        digester.addSetNext("*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER, "setPasswordHandler");
937
938        // add validation handler creation rules
939        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_VALIDATIONHANDLER, "setValidationHandler", 1);
940        digester.addCallParam("*/" + N_SYSTEM + "/" + N_VALIDATIONHANDLER, 0, A_CLASS);
941
942        // add login manager creation rules
943        digester.addCallMethod("*/" + N_LOGINMANAGER, "setLoginManager", 7);
944        digester.addCallParam("*/" + N_LOGINMANAGER + "/" + N_DISABLEMINUTES, 0);
945        digester.addCallParam("*/" + N_LOGINMANAGER + "/" + N_MAXBADATTEMPTS, 1);
946        digester.addCallParam("*/" + N_LOGINMANAGER + "/" + N_ENABLESCURITY, 2);
947        digester.addCallParam("*/" + N_LOGINMANAGER + "/" + N_TOKEN_LIFETIME, 3);
948        digester.addCallParam("*/" + N_LOGINMANAGER + "/" + N_MAX_INACTIVE_TIME, 4);
949        digester.addCallParam("*/" + N_LOGINMANAGER + "/" + N_PASSWORD_CHANGE_INTERVAL, 5);
950        digester.addCallParam("*/" + N_LOGINMANAGER + "/" + N_USER_DATA_CHECK_INTERVAL, 6);
951
952        // add login message creation rules
953        digester.addObjectCreate("*/" + N_LOGINMESSAGE, CmsLoginMessage.class);
954        digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/" + N_ENABLED);
955        digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/" + N_MESSAGE);
956        digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/" + N_LOGINFORBIDDEN);
957        digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/" + N_TIMESTART);
958        digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/" + N_TIMEEND);
959        digester.addSetNext("*/" + N_LOGINMESSAGE, "setLoginMessage");
960
961        // add site configuration rule
962        digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_SITES, CmsSiteManagerImpl.class);
963        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_WORKPLACE_SERVER, "addWorkplaceServer", 0);
964        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_DEFAULT_URI, "setDefaultUri", 0);
965        digester.addSetNext("*/" + N_SYSTEM + "/" + N_SITES, "setSiteManager");
966
967        // add site configuration rule
968        String siteXpath = "*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE;
969
970        digester.addCallMethod(siteXpath, "addSite", 10);
971        digester.addCallParam(siteXpath, 0, A_SERVER);
972        digester.addCallParam(siteXpath, 1, A_URI);
973        digester.addCallParam(siteXpath, 2, A_TITLE);
974        digester.addCallParam(siteXpath, 3, A_POSITION);
975        digester.addCallParam(siteXpath, 4, A_ERROR_PAGE);
976        digester.addCallParam(siteXpath, 5, A_WEBSERVER);
977        digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_SECURE, 6, A_SERVER);
978        digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_SECURE, 7, A_EXCLUSIVE);
979        digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_SECURE, 8, A_ERROR);
980        digester.addCallParam(
981            "*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_SECURE,
982            9,
983            A_USE_PERMANENT_REDIRECTS);
984        digester.addCallMethod(siteXpath + "/" + N_PARAMETERS + "/" + N_PARAM, "addParamToConfigSite", 2);
985        digester.addCallParam(siteXpath + "/" + N_PARAMETERS + "/" + N_PARAM, 0, A_NAME);
986        digester.addCallParam(siteXpath + "/" + N_PARAMETERS + "/" + N_PARAM, 1);
987        // add an alias to the currently configured site
988        digester.addCallMethod(
989            "*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_ALIAS,
990            "addAliasToConfigSite",
991            2);
992        digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_ALIAS, 0, A_SERVER);
993        digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_ALIAS, 1, A_OFFSET);
994
995        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SHARED_FOLDER, "setSharedFolder", 0);
996
997        digester.addCallMethod(
998            "*/" + N_SYSTEM + "/" + N_SAX_IMPL_SYSTEM_PROPERTIES,
999            "setUseSaxImplSystemProperties",
1000            1);
1001        digester.addCallParam("*/" + N_SYSTEM + "/" + N_SAX_IMPL_SYSTEM_PROPERTIES, 0);
1002
1003        // add compatibility parameter rules
1004        digester.addCallMethod(
1005            "*/" + N_SYSTEM + "/" + N_RUNTIMEPROPERTIES + "/" + N_PARAM,
1006            I_CmsConfigurationParameterHandler.ADD_PARAMETER_METHOD,
1007            2);
1008        digester.addCallParam(
1009            "*/" + N_SYSTEM + "/" + N_RUNTIMEPROPERTIES + "/" + N_PARAM,
1010            0,
1011            I_CmsXmlConfiguration.A_NAME);
1012        digester.addCallParam("*/" + N_SYSTEM + "/" + N_RUNTIMEPROPERTIES + "/" + N_PARAM, 1);
1013
1014        // add runtime classes configuration rules
1015        digester.addCallMethod(
1016            "*/" + N_SYSTEM + "/" + N_RUNTIMECLASSES + "/" + N_RUNTIMEINFO,
1017            "setRuntimeInfoFactory",
1018            1);
1019        digester.addCallParam("*/" + N_SYSTEM + "/" + N_RUNTIMECLASSES + "/" + N_RUNTIMEINFO, 0, A_CLASS);
1020
1021        // add default users rule
1022        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS, "setCmsDefaultUsers", 7);
1023        digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_USER_ADMIN, 0);
1024        digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_USER_GUEST, 1);
1025        digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_USER_EXPORT, 2);
1026        digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_USER_DELETEDRESOURCE, 3);
1027        digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_ADMINISTRATORS, 4);
1028        digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_USERS, 5);
1029        digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_GUESTS, 6);
1030
1031        // add defaultContentEncoding rule
1032        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_DEFAULT_CONTENT_ENCODING, "setDefaultContentEncoding", 1);
1033        digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULT_CONTENT_ENCODING, 0);
1034
1035        // add memorymonitor configuration rule
1036        digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR, CmsMemoryMonitorConfiguration.class);
1037        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR, "initialize", 5);
1038        digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR, 0, A_CLASS);
1039        digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_MAXUSAGE_PERCENT, 1);
1040        digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_LOG_INTERVAL, 2);
1041        digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_EMAIL_INTERVAL, 3);
1042        digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_WARNING_INTERVAL, 4);
1043        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_EMAIL_SENDER, "setEmailSender", 0);
1044        digester.addCallMethod(
1045            "*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_EMAIL_RECEIVER + "/" + N_RECEIVER,
1046            "addEmailReceiver",
1047            0);
1048
1049        // set the MemoryMonitorConfiguration initialized once before
1050        digester.addSetNext("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR, "setCmsMemoryMonitorConfiguration");
1051
1052        // add flexcache configuration rule
1053        digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_FLEXCACHE, CmsFlexCacheConfiguration.class);
1054        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_FLEXCACHE, "initialize", 6);
1055        digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_CACHE_ENABLED, 0);
1056        digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_CACHE_OFFLINE, 1);
1057        digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_MAXCACHEBYTES, 2);
1058        digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_AVGCACHEBYTES, 3);
1059        digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_MAXENTRYBYTES, 4);
1060        digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_MAXKEYS, 5);
1061        // add flexcache device selector
1062        digester.addCallMethod(
1063            "*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_DEVICESELECTOR,
1064            "setDeviceSelectorConfiguration",
1065            1);
1066        digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_DEVICESELECTOR, 0, A_CLASS);
1067
1068        // set the FlexCacheConfiguration initialized once before
1069        digester.addSetNext("*/" + N_SYSTEM + "/" + N_FLEXCACHE, "setCmsFlexCacheConfiguration");
1070
1071        // add http basic authentication rules
1072        digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_HTTP_AUTHENTICATION, CmsHttpAuthenticationSettings.class);
1073        digester.addCallMethod(
1074            "*/" + N_SYSTEM + "/" + N_HTTP_AUTHENTICATION + "/" + N_BROWSER_BASED,
1075            "setUseBrowserBasedHttpAuthentication",
1076            0);
1077        digester.addCallMethod(
1078            "*/" + N_SYSTEM + "/" + N_HTTP_AUTHENTICATION + "/" + N_FORM_BASED,
1079            "setFormBasedHttpAuthenticationUri",
1080            0);
1081        digester.addSetNext("*/" + N_SYSTEM + "/" + N_HTTP_AUTHENTICATION, "setHttpAuthenticationSettings");
1082
1083        // cache rules
1084        digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_RESULTCACHE, CmsCacheSettings.class);
1085        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_RESULTCACHE + "/" + N_KEYGENERATOR, "setCacheKeyGenerator", 0);
1086        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_RESULTCACHE + "/" + N_SIZE_USERS, "setUserCacheSize", 0);
1087        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_RESULTCACHE + "/" + N_SIZE_GROUPS, "setGroupCacheSize", 0);
1088        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_RESULTCACHE + "/" + N_SIZE_ORGUNITS, "setOrgUnitCacheSize", 0);
1089        digester.addCallMethod(
1090            "*/" + N_SYSTEM + "/" + N_RESULTCACHE + "/" + N_SIZE_USERGROUPS,
1091            "setUserGroupsCacheSize",
1092            0);
1093        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_RESULTCACHE + "/" + N_SIZE_PROJECTS, "setProjectCacheSize", 0);
1094        digester.addCallMethod(
1095            "*/" + N_SYSTEM + "/" + N_RESULTCACHE + "/" + N_SIZE_PROJECTRESOURCES,
1096            "setProjectResourcesCacheSize",
1097            0);
1098        digester.addCallMethod(
1099            "*/" + N_SYSTEM + "/" + N_RESULTCACHE + "/" + N_SIZE_RESOURCES,
1100            "setResourceCacheSize",
1101            0);
1102        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_RESULTCACHE + "/" + N_SIZE_ROLES, "setRolesCacheSize", 0);
1103        digester.addCallMethod(
1104            "*/" + N_SYSTEM + "/" + N_RESULTCACHE + "/" + N_SIZE_RESOURCELISTS,
1105            "setResourcelistCacheSize",
1106            0);
1107        digester.addCallMethod(
1108            "*/" + N_SYSTEM + "/" + N_RESULTCACHE + "/" + N_SIZE_PROPERTIES,
1109            "setPropertyCacheSize",
1110            0);
1111        digester.addCallMethod(
1112            "*/" + N_SYSTEM + "/" + N_RESULTCACHE + "/" + N_SIZE_PROPERTYLISTS,
1113            "setPropertyListsCacheSize",
1114            0);
1115        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_RESULTCACHE + "/" + N_SIZE_ACLS, "setAclCacheSize", 0);
1116        digester.addCallMethod(
1117            "*/" + N_SYSTEM + "/" + N_RESULTCACHE + "/" + N_SIZE_PERMISSIONS,
1118            "setPermissionCacheSize",
1119            0);
1120        digester.addCallMethod(
1121            "*/" + N_SYSTEM + "/" + N_RESULTCACHE + "/" + N_SIZE_CONTAINERPAGE_OFFLINE,
1122            "setContainerPageOfflineSize",
1123            0);
1124        digester.addCallMethod(
1125            "*/" + N_SYSTEM + "/" + N_RESULTCACHE + "/" + N_SIZE_CONTAINERPAGE_ONLINE,
1126            "setContainerPageOnlineSize",
1127            0);
1128        digester.addSetNext("*/" + N_SYSTEM + "/" + N_RESULTCACHE, "setCacheSettings");
1129
1130        // set the notification time
1131        digester.addCallMethod(
1132            "*/" + N_SYSTEM + "/" + N_CONTENT_NOTIFICATION + "/" + N_NOTIFICATION_TIME,
1133            "setNotificationTime",
1134            1);
1135        digester.addCallParam("*/" + N_SYSTEM + "/" + N_CONTENT_NOTIFICATION + "/" + N_NOTIFICATION_TIME, 0);
1136
1137        // set the notification project
1138        digester.addCallMethod(
1139            "*/" + N_SYSTEM + "/" + N_CONTENT_NOTIFICATION + "/" + N_NOTIFICATION_PROJECT,
1140            "setNotificationProject",
1141            1);
1142        digester.addCallParam("*/" + N_SYSTEM + "/" + N_CONTENT_NOTIFICATION + "/" + N_NOTIFICATION_PROJECT, 0);
1143
1144        // add authorization handler creation rules
1145        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_AUTHORIZATIONHANDLER, "setAuthorizationHandler", 1);
1146        digester.addCallParam("*/" + N_SYSTEM + "/" + N_AUTHORIZATIONHANDLER, 0, A_CLASS);
1147
1148        // add publish manager configuration rule
1149        digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_PUBLISHMANAGER, CmsPublishManager.class);
1150        digester.addCallMethod(
1151            "*/" + N_SYSTEM + "/" + N_PUBLISHMANAGER + "/" + N_HISTORYSIZE,
1152            "setPublishHistorySize",
1153            0);
1154        digester.addCallMethod(
1155            "*/" + N_SYSTEM + "/" + N_PUBLISHMANAGER + "/" + N_QUEUEPERSISTANCE,
1156            "setPublishQueuePersistance",
1157            0);
1158        digester.addCallMethod(
1159            "*/" + N_SYSTEM + "/" + N_PUBLISHMANAGER + "/" + N_QUEUESHUTDOWNTIME,
1160            "setPublishQueueShutdowntime",
1161            0);
1162        digester.addSetNext("*/" + N_SYSTEM + "/" + N_PUBLISHMANAGER, "setPublishManager");
1163
1164        // add rule for session storage provider
1165        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SESSION_STORAGEPROVIDER, "setSessionStorageProvider", 1);
1166        digester.addCallParam("*/" + N_SYSTEM + "/" + N_SESSION_STORAGEPROVIDER, 0, A_CLASS);
1167
1168        // add rule for permission handler
1169        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_PERMISSIONHANDLER, "setPermissionHandler", 1);
1170        digester.addCallParam("*/" + N_SYSTEM + "/" + N_PERMISSIONHANDLER, 0, A_CLASS);
1171
1172        // add rules for servlet container settings
1173        digester.addCallMethod(
1174            "*/" + N_SYSTEM + "/" + N_SERVLETCONTAINERSETTINGS + "/" + N_PREVENTRESPONSEFLUSH,
1175            "setPreventResponseFlush",
1176            0);
1177        digester.addCallMethod(
1178            "*/" + N_SYSTEM + "/" + N_SERVLETCONTAINERSETTINGS + "/" + N_RELEASETAGSAFTEREND,
1179            "setReleaseTagsAfterEnd",
1180            0);
1181        digester.addCallMethod(
1182            "*/" + N_SYSTEM + "/" + N_SERVLETCONTAINERSETTINGS + "/" + N_REQUESTERRORPAGEATTRIBUTE,
1183            "setRequestErrorPageAttribute",
1184            0);
1185        digester.addCallMethod(
1186            "*/" + N_SYSTEM + "/" + N_SERVLETCONTAINERSETTINGS,
1187            "setServletContainerSettingsMode",
1188            1);
1189        digester.addCallParam("*/" + N_SYSTEM + "/" + N_SERVLETCONTAINERSETTINGS, 0, A_MODE);
1190
1191        // add rule for ADE cache settings
1192        String adeCachePath = "*/" + N_SYSTEM + "/" + N_ADE + "/" + N_ADE_CACHE;
1193        digester.addObjectCreate(adeCachePath, CmsADECacheSettings.class);
1194        // container page cache
1195        digester.addCallMethod(adeCachePath + "/" + N_CONTAINERPAGES, "setContainerPageOfflineSize", 1);
1196        digester.addCallParam(adeCachePath + "/" + N_CONTAINERPAGES, 0, A_OFFLINE);
1197        digester.addCallMethod(adeCachePath + "/" + N_CONTAINERPAGES, "setContainerPageOnlineSize", 1);
1198        digester.addCallParam(adeCachePath + "/" + N_CONTAINERPAGES, 0, A_ONLINE);
1199        // groupcontainer cache
1200        digester.addCallMethod(adeCachePath + "/" + N_GROUPCONTAINERS, "setGroupContainerOfflineSize", 1);
1201        digester.addCallParam(adeCachePath + "/" + N_GROUPCONTAINERS, 0, A_OFFLINE);
1202        digester.addCallMethod(adeCachePath + "/" + N_GROUPCONTAINERS, "setGroupContainerOnlineSize", 1);
1203        digester.addCallParam(adeCachePath + "/" + N_GROUPCONTAINERS, 0, A_ONLINE);
1204        // set the settings
1205        digester.addSetNext(adeCachePath, "setAdeCacheSettings");
1206
1207        String adeParamPath = "*/" + N_SYSTEM + "/" + N_ADE + "/" + N_PARAMETERS + "/" + N_PARAM;
1208        digester.addCallMethod(adeParamPath, "addAdeParameter", 2);
1209        digester.addCallParam(adeParamPath, 0, I_CmsXmlConfiguration.A_NAME);
1210        digester.addCallParam(adeParamPath, 1);
1211
1212        // add rule for subscription manager settings
1213        digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_SUBSCRIPTIONMANAGER, CmsSubscriptionManager.class);
1214        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SUBSCRIPTIONMANAGER, "setEnabled", 1);
1215        digester.addCallParam("*/" + N_SYSTEM + "/" + N_SUBSCRIPTIONMANAGER, 0, A_ENABLED);
1216        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SUBSCRIPTIONMANAGER, "setPoolName", 1);
1217        digester.addCallParam("*/" + N_SYSTEM + "/" + N_SUBSCRIPTIONMANAGER, 0, A_POOLNAME);
1218        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SUBSCRIPTIONMANAGER, "setMaxVisitedCount", 1);
1219        digester.addCallParam("*/" + N_SYSTEM + "/" + N_SUBSCRIPTIONMANAGER, 0, A_MAXVISITED);
1220        digester.addSetNext("*/" + N_SYSTEM + "/" + N_SUBSCRIPTIONMANAGER, "setSubscriptionManager");
1221
1222        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_PUBLISH_LIST_REMOVE_MODE, "setPublishListRemoveMode", 1);
1223        digester.addCallParam("*/" + N_SYSTEM + "/" + N_PUBLISH_LIST_REMOVE_MODE, 0, A_MODE);
1224
1225        String workflowXpath = "*/" + N_SYSTEM + "/" + N_WORKFLOW;
1226        digester.addObjectCreate(workflowXpath, CmsDefaultWorkflowManager.class.getName(), A_CLASS);
1227        digester.addObjectCreate(workflowXpath + "/" + N_PARAMETERS, LinkedHashMap.class);
1228        digester.addCallMethod(workflowXpath + "/" + N_PARAMETERS + "/" + N_PARAM, "put", 2);
1229        digester.addCallParam(workflowXpath + "/" + N_PARAMETERS + "/" + N_PARAM, 0, A_NAME);
1230        digester.addCallParam(workflowXpath + "/" + N_PARAMETERS + "/" + N_PARAM, 1);
1231        digester.addSetNext(workflowXpath + "/" + N_PARAMETERS, "setParameters");
1232        digester.addSetNext(workflowXpath, "setWorkflowManager");
1233
1234        String userSessionPath = "*/" + N_SYSTEM + "/" + N_USER_SESSION_MODE;
1235        digester.addCallMethod(userSessionPath, "setUserSessionMode", 0);
1236
1237        String credentialsResolverPath = "*/" + N_SYSTEM + "/" + N_CREDENTIALS_RESOLVER;
1238        digester.addCallMethod(credentialsResolverPath, "setCredentialsResolver", 0);
1239
1240        digester.addCallMethod("*/" + N_SYSTEM + "/" + N_RESTRICT_DETAIL_CONTENTS, "setRestrictDetailContents", 1);
1241        digester.addCallParam("*/" + N_SYSTEM + "/" + N_RESTRICT_DETAIL_CONTENTS, 0);
1242
1243    }
1244
1245    /**
1246     * @see org.opencms.configuration.I_CmsXmlConfiguration#generateXml(org.dom4j.Element)
1247     */
1248    public Element generateXml(Element parent) {
1249
1250        // generate vfs node and subnodes
1251        Element systemElement = parent.addElement(N_SYSTEM);
1252
1253        if (OpenCms.getRunLevel() >= OpenCms.RUNLEVEL_3_SHELL_ACCESS) {
1254            // initialized OpenCms instance is available, use latest values
1255            m_localeManager = OpenCms.getLocaleManager();
1256            m_mailSettings = OpenCms.getSystemInfo().getMailSettings();
1257            m_configuredJobs = OpenCms.getScheduleManager().getJobs();
1258            m_historyEnabled = OpenCms.getSystemInfo().isHistoryEnabled();
1259            m_historyVersions = OpenCms.getSystemInfo().getHistoryVersions();
1260            m_historyVersionsAfterDeletion = OpenCms.getSystemInfo().getHistoryVersionsAfterDeletion();
1261            // m_resourceInitHandlers instance must be the one from configuration
1262            // m_requestHandlers instance must be the one from configuration
1263            m_siteManager = OpenCms.getSiteManager();
1264            m_loginManager = OpenCms.getLoginManager();
1265            m_loginMessage = OpenCms.getLoginManager().getLoginMessage();
1266        }
1267
1268        // i18n nodes
1269        Element i18nElement = systemElement.addElement(N_I18N);
1270        i18nElement.addElement(N_LOCALEHANDLER).addAttribute(
1271            A_CLASS,
1272            m_localeManager.getLocaleHandler().getClass().getName());
1273        Iterator<Locale> loc;
1274        Element localesElement;
1275        localesElement = i18nElement.addElement(N_LOCALESCONFIGURED);
1276        loc = m_localeManager.getAvailableLocales().iterator();
1277        while (loc.hasNext()) {
1278            localesElement.addElement(N_LOCALE).addText(loc.next().toString());
1279        }
1280        localesElement = i18nElement.addElement(N_LOCALESDEFAULT);
1281        loc = m_localeManager.getDefaultLocales().iterator();
1282        while (loc.hasNext()) {
1283            localesElement.addElement(N_LOCALE).setText(loc.next().toString());
1284        }
1285        i18nElement.addElement(N_TIMEZONE).setText(m_localeManager.getTimeZone().getID());
1286        if (null != m_localeManager.getReuseElementsStr()) {
1287            i18nElement.addElement(N_REUSE_ELEMENTS).setText(m_localeManager.getReuseElementsStr());
1288        }
1289
1290        // mail nodes
1291        Element mailElement = systemElement.addElement(N_MAIL);
1292        mailElement.addElement(N_MAILFROM).setText(m_mailSettings.getMailFromDefault());
1293        Iterator<CmsMailHost> hosts = m_mailSettings.getMailHosts().iterator();
1294        while (hosts.hasNext()) {
1295            CmsMailHost host = hosts.next();
1296            Element hostElement = mailElement.addElement(N_MAILHOST).addAttribute(
1297                A_NAME,
1298                host.getHostname()).addAttribute(A_PORT, Integer.toString(host.getPort())).addAttribute(
1299                    A_ORDER,
1300                    host.getOrder().toString()).addAttribute(A_PROTOCOL, host.getProtocol()).addAttribute(
1301                        A_SECURITY,
1302                        host.getSecurity());
1303            if (host.isAuthenticating()) {
1304                hostElement.addAttribute(A_USER, host.getUsername()).addAttribute(A_PASSWORD, host.getPassword());
1305            }
1306        }
1307
1308        // scheduler node
1309        Element schedulerElement = systemElement.addElement(N_SCHEDULER);
1310        Iterator<CmsScheduledJobInfo> jobs = m_configuredJobs.iterator();
1311        while (jobs.hasNext()) {
1312            CmsScheduledJobInfo jobInfo = jobs.next();
1313            Element jobElement = schedulerElement.addElement(N_JOB);
1314            jobElement.addElement(N_NAME).addText(jobInfo.getJobName());
1315            jobElement.addElement(N_CLASS).addText(jobInfo.getClassName());
1316            jobElement.addElement(N_REUSEINSTANCE).addText(String.valueOf(jobInfo.isReuseInstance()));
1317            jobElement.addElement(N_ACTIVE).addText(String.valueOf(jobInfo.isActive()));
1318            jobElement.addElement(N_CRONEXPRESSION).addCDATA(jobInfo.getCronExpression());
1319            Element contextElement = jobElement.addElement(N_CONTEXT);
1320            contextElement.addElement(N_USERNAME).setText(jobInfo.getContextInfo().getUserName());
1321            contextElement.addElement(N_PROJECT).setText(jobInfo.getContextInfo().getProjectName());
1322            contextElement.addElement(N_SITEROOT).setText(jobInfo.getContextInfo().getSiteRoot());
1323            contextElement.addElement(N_REQUESTEDURI).setText(jobInfo.getContextInfo().getRequestedUri());
1324            contextElement.addElement(N_LOCALE).setText(jobInfo.getContextInfo().getLocaleName());
1325            contextElement.addElement(N_ENCODING).setText(jobInfo.getContextInfo().getEncoding());
1326            contextElement.addElement(N_REMOTEADDR).setText(jobInfo.getContextInfo().getRemoteAddr());
1327            CmsParameterConfiguration jobParameters = jobInfo.getConfiguration();
1328            if ((jobParameters != null) && (jobParameters.size() > 0)) {
1329                Element parameterElement = jobElement.addElement(N_PARAMETERS);
1330                jobParameters.appendToXml(parameterElement);
1331            }
1332        }
1333
1334        // <events> node
1335        Element eventsElement = systemElement.addElement(N_EVENTS);
1336        Element eventManagerElement = eventsElement.addElement(N_EVENTMANAGER);
1337        eventManagerElement.addAttribute(A_CLASS, m_eventManager.getClass().getName());
1338
1339        // version history
1340        Element historyElement = systemElement.addElement(N_VERSIONHISTORY);
1341        historyElement.addAttribute(A_ENABLED, String.valueOf(m_historyEnabled));
1342        historyElement.addAttribute(A_COUNT, new Integer(m_historyVersions).toString());
1343        historyElement.addAttribute(A_DELETED, new Integer(m_historyVersionsAfterDeletion).toString());
1344
1345        // resourceinit
1346        Element resourceinitElement = systemElement.addElement(N_RESOURCEINIT);
1347        Iterator<I_CmsResourceInit> resHandlers = m_resourceInitHandlers.iterator();
1348        while (resHandlers.hasNext()) {
1349            I_CmsResourceInit clazz = resHandlers.next();
1350            Element handlerElement = resourceinitElement.addElement(N_RESOURCEINITHANDLER);
1351            handlerElement.addAttribute(A_CLASS, clazz.getClass().getName());
1352        }
1353
1354        // request handlers
1355        Element requesthandlersElement = systemElement.addElement(N_REQUESTHANDLERS);
1356        Iterator<I_CmsRequestHandler> reqHandlers = m_requestHandlers.iterator();
1357        while (reqHandlers.hasNext()) {
1358            I_CmsRequestHandler clazz = reqHandlers.next();
1359            Element handlerElement = requesthandlersElement.addElement(N_REQUESTHANDLER);
1360            handlerElement.addAttribute(A_CLASS, clazz.getClass().getName());
1361        }
1362
1363        // password handler
1364        Element passwordhandlerElement = systemElement.addElement(N_PASSWORDHANDLER).addAttribute(
1365            A_CLASS,
1366            m_passwordHandler.getClass().getName());
1367        passwordhandlerElement.addElement(N_PASSWORDENCODING).addText(m_passwordHandler.getInputEncoding());
1368        passwordhandlerElement.addElement(N_DIGESTTYPE).addText(m_passwordHandler.getDigestType());
1369        CmsParameterConfiguration handlerParameters = m_passwordHandler.getConfiguration();
1370        if (handlerParameters != null) {
1371            handlerParameters.appendToXml(passwordhandlerElement);
1372        }
1373
1374        // validation handler
1375        if (m_validationHandler != null) {
1376            Element valHandlerElem = systemElement.addElement(N_VALIDATIONHANDLER);
1377            valHandlerElem.addAttribute(A_CLASS, m_validationHandler);
1378        }
1379
1380        // login manager
1381        if (m_loginManager != null) {
1382            Element managerElement = systemElement.addElement(N_LOGINMANAGER);
1383            managerElement.addElement(N_DISABLEMINUTES).addText(String.valueOf(m_loginManager.getDisableMinutes()));
1384            managerElement.addElement(N_MAXBADATTEMPTS).addText(String.valueOf(m_loginManager.getMaxBadAttempts()));
1385            managerElement.addElement(N_ENABLESCURITY).addText(String.valueOf(m_loginManager.isEnableSecurity()));
1386            String tokenLifetimeStr = m_loginManager.getTokenLifetimeStr();
1387            if (tokenLifetimeStr != null) {
1388                managerElement.addElement(N_TOKEN_LIFETIME).addText(tokenLifetimeStr);
1389            }
1390            if (m_loginManager.getMaxInactive() != null) {
1391                managerElement.addElement(N_MAX_INACTIVE_TIME).addText(m_loginManager.getMaxInactive());
1392            }
1393
1394            if (m_loginManager.getPasswordChangeIntervalStr() != null) {
1395                managerElement.addElement(N_PASSWORD_CHANGE_INTERVAL).addText(
1396                    m_loginManager.getPasswordChangeIntervalStr());
1397            }
1398
1399            if (m_loginManager.getUserDataCheckIntervalStr() != null) {
1400                managerElement.addElement(N_USER_DATA_CHECK_INTERVAL).addText(
1401                    m_loginManager.getUserDataCheckIntervalStr());
1402            }
1403        }
1404
1405        // login message
1406        if (m_loginMessage != null) {
1407            Element messageElement = systemElement.addElement(N_LOGINMESSAGE);
1408            messageElement.addElement(N_ENABLED).addText(String.valueOf(m_loginMessage.isEnabled()));
1409            messageElement.addElement(N_MESSAGE).addCDATA(m_loginMessage.getMessage());
1410            messageElement.addElement(N_LOGINFORBIDDEN).addText(String.valueOf(m_loginMessage.isLoginForbidden()));
1411            if (m_loginMessage.getTimeStart() != CmsLoginMessage.DEFAULT_TIME_START) {
1412                messageElement.addElement(N_TIMESTART).addText(String.valueOf(m_loginMessage.getTimeStart()));
1413            }
1414            if (m_loginMessage.getTimeEnd() != CmsLoginMessage.DEFAULT_TIME_END) {
1415                messageElement.addElement(N_TIMEEND).addText(String.valueOf(m_loginMessage.getTimeEnd()));
1416            }
1417        }
1418
1419        // create <sites> node
1420        Element sitesElement = systemElement.addElement(N_SITES);
1421        for (String server : m_siteManager.getWorkplaceServers()) {
1422            sitesElement.addElement(N_WORKPLACE_SERVER).addText(server);
1423        }
1424        sitesElement.addElement(N_DEFAULT_URI).addText(m_siteManager.getDefaultUri());
1425        String sharedFolder = m_siteManager.getSharedFolder();
1426        if (sharedFolder != null) {
1427            sitesElement.addElement(N_SHARED_FOLDER).addText(sharedFolder);
1428        }
1429        Iterator<CmsSite> siteIterator = new HashSet<CmsSite>(m_siteManager.getSites().values()).iterator();
1430        while (siteIterator.hasNext()) {
1431            CmsSite site = siteIterator.next();
1432            // create <site server="" uri=""/> subnode(s)
1433            Element siteElement = sitesElement.addElement(N_SITE);
1434
1435            siteElement.addAttribute(A_SERVER, site.getSiteMatcher().toString());
1436            siteElement.addAttribute(A_URI, site.getSiteRoot().concat("/"));
1437            siteElement.addAttribute(A_TITLE, site.getTitle());
1438            siteElement.addAttribute(A_POSITION, Float.toString(site.getPosition()));
1439            siteElement.addAttribute(A_ERROR_PAGE, site.getErrorPage());
1440            siteElement.addAttribute(A_WEBSERVER, String.valueOf(site.isWebserver()));
1441
1442            // create <secure server=""/> subnode
1443            if (site.hasSecureServer()) {
1444                Element secureElem = siteElement.addElement(N_SECURE);
1445                secureElem.addAttribute(A_SERVER, site.getSecureUrl());
1446
1447                secureElem.addAttribute(A_EXCLUSIVE, String.valueOf(site.isExclusiveUrl()));
1448                secureElem.addAttribute(A_ERROR, String.valueOf(site.isExclusiveError()));
1449                if (site.usesPermanentRedirects()) {
1450                    secureElem.addAttribute(A_USE_PERMANENT_REDIRECTS, Boolean.TRUE.toString());
1451                }
1452            }
1453            if ((site.getParameters() != null) && !site.getParameters().isEmpty()) {
1454                Element parametersElem = siteElement.addElement(N_PARAMETERS);
1455                for (Map.Entry<String, String> entry : site.getParameters().entrySet()) {
1456                    Element paramElem = parametersElem.addElement(N_PARAM);
1457                    paramElem.addAttribute(A_NAME, entry.getKey());
1458                    paramElem.addText(entry.getValue());
1459                }
1460            }
1461            // create <alias server=""/> subnode(s)
1462            Iterator<CmsSiteMatcher> aliasIterator = site.getAliases().iterator();
1463            while (aliasIterator.hasNext()) {
1464                CmsSiteMatcher matcher = aliasIterator.next();
1465                Element aliasElement = siteElement.addElement(N_ALIAS);
1466                aliasElement.addAttribute(A_SERVER, matcher.getUrl());
1467                if (matcher.getTimeOffset() != 0) {
1468                    aliasElement.addAttribute(A_OFFSET, "" + matcher.getTimeOffset());
1469                }
1470            }
1471        }
1472
1473        Element saxImpl = systemElement.addElement(N_SAX_IMPL_SYSTEM_PROPERTIES);
1474        saxImpl.setText(String.valueOf(m_saxImplProperties));
1475
1476        // create <runtimeproperties> node
1477        Element runtimepropertiesElement = systemElement.addElement(N_RUNTIMEPROPERTIES);
1478        if (m_runtimeProperties != null) {
1479            List<String> sortedRuntimeProperties = new ArrayList<String>(m_runtimeProperties.keySet());
1480            Collections.sort(sortedRuntimeProperties);
1481            Iterator<String> it = sortedRuntimeProperties.iterator();
1482            while (it.hasNext()) {
1483                String key = it.next();
1484                // create <param name="">value</param> subnodes
1485                runtimepropertiesElement.addElement(N_PARAM).addAttribute(A_NAME, key).addText(
1486                    m_runtimeProperties.get(key));
1487            }
1488        }
1489
1490        // create <runtimeinfo> node
1491        Element runtimeinfoElement = systemElement.addElement(N_RUNTIMECLASSES);
1492        Element runtimeinfofactoryElement = runtimeinfoElement.addElement(N_RUNTIMEINFO);
1493        runtimeinfofactoryElement.addAttribute(A_CLASS, getRuntimeInfoFactory().getClass().getName());
1494
1495        // create <defaultusers> node
1496        Element defaultusersElement = systemElement.addElement(N_DEFAULTUSERS);
1497        // create <user-admin> subnode
1498        defaultusersElement.addElement(N_USER_ADMIN).addText(m_cmsDefaultUsers.getUserAdmin());
1499        // create <user-guest> subnode
1500        defaultusersElement.addElement(N_USER_GUEST).addText(m_cmsDefaultUsers.getUserGuest());
1501        // create <user-export> subnode
1502        defaultusersElement.addElement(N_USER_EXPORT).addText(m_cmsDefaultUsers.getUserExport());
1503        if (!m_cmsDefaultUsers.getUserDeletedResource().equals(m_cmsDefaultUsers.getUserAdmin())) {
1504            // create <user-deletedresource> subnode
1505            defaultusersElement.addElement(N_USER_DELETEDRESOURCE).addText(m_cmsDefaultUsers.getUserDeletedResource());
1506        }
1507        // create <group-administrators> subnode
1508        defaultusersElement.addElement(N_GROUP_ADMINISTRATORS).addText(m_cmsDefaultUsers.getGroupAdministrators());
1509        // create <group-users> subnode
1510        defaultusersElement.addElement(N_GROUP_USERS).addText(m_cmsDefaultUsers.getGroupUsers());
1511        // create <group-guests> subnode
1512        defaultusersElement.addElement(N_GROUP_GUESTS).addText(m_cmsDefaultUsers.getGroupGuests());
1513
1514        // create <defaultcontentencoding> node
1515        systemElement.addElement(N_DEFAULT_CONTENT_ENCODING).addText(getDefaultContentEncoding());
1516
1517        // create <memorymonitor> node
1518        if (m_cmsMemoryMonitorConfiguration != null) {
1519            Element memorymonitorElement = systemElement.addElement(N_MEMORYMONITOR);
1520            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_cmsMemoryMonitorConfiguration.getClassName())) {
1521                memorymonitorElement.addAttribute(A_CLASS, m_cmsMemoryMonitorConfiguration.getClassName());
1522            }
1523
1524            memorymonitorElement.addElement(N_MAXUSAGE_PERCENT).addText(
1525                String.valueOf(m_cmsMemoryMonitorConfiguration.getMaxUsagePercent()));
1526
1527            memorymonitorElement.addElement(N_LOG_INTERVAL).addText(
1528                String.valueOf(m_cmsMemoryMonitorConfiguration.getLogInterval()));
1529
1530            if (m_cmsMemoryMonitorConfiguration.getEmailInterval() >= 0) {
1531                memorymonitorElement.addElement(N_EMAIL_INTERVAL).addText(
1532                    String.valueOf(m_cmsMemoryMonitorConfiguration.getEmailInterval()));
1533            }
1534
1535            memorymonitorElement.addElement(N_WARNING_INTERVAL).addText(
1536                String.valueOf(m_cmsMemoryMonitorConfiguration.getWarningInterval()));
1537
1538            if (m_cmsMemoryMonitorConfiguration.getEmailSender() != null) {
1539                memorymonitorElement.addElement(N_EMAIL_SENDER).addText(
1540                    m_cmsMemoryMonitorConfiguration.getEmailSender());
1541            }
1542            List<String> emailReceiver = m_cmsMemoryMonitorConfiguration.getEmailReceiver();
1543            if (!emailReceiver.isEmpty()) {
1544                Element emailreceiverElement = memorymonitorElement.addElement(N_EMAIL_RECEIVER);
1545                Iterator<String> iter = emailReceiver.iterator();
1546                while (iter.hasNext()) {
1547                    emailreceiverElement.addElement(N_RECEIVER).addText(iter.next());
1548                }
1549            }
1550        }
1551
1552        // create <flexcache> node
1553        Element flexcacheElement = systemElement.addElement(N_FLEXCACHE);
1554        flexcacheElement.addElement(N_CACHE_ENABLED).addText(
1555            String.valueOf(m_cmsFlexCacheConfiguration.isCacheEnabled()));
1556        flexcacheElement.addElement(N_CACHE_OFFLINE).addText(
1557            String.valueOf(m_cmsFlexCacheConfiguration.isCacheOffline()));
1558        flexcacheElement.addElement(N_MAXCACHEBYTES).addText(
1559            String.valueOf(m_cmsFlexCacheConfiguration.getMaxCacheBytes()));
1560        flexcacheElement.addElement(N_AVGCACHEBYTES).addText(
1561            String.valueOf(m_cmsFlexCacheConfiguration.getAvgCacheBytes()));
1562        flexcacheElement.addElement(N_MAXENTRYBYTES).addText(
1563            String.valueOf(m_cmsFlexCacheConfiguration.getMaxEntryBytes()));
1564        flexcacheElement.addElement(N_MAXKEYS).addText(String.valueOf(m_cmsFlexCacheConfiguration.getMaxKeys()));
1565        if (m_cmsFlexCacheConfiguration.getDeviceSelectorConfiguration() != null) {
1566            Element flexcacheDeviceSelectorElement = flexcacheElement.addElement(N_DEVICESELECTOR);
1567            flexcacheDeviceSelectorElement.addAttribute(
1568                A_CLASS,
1569                m_cmsFlexCacheConfiguration.getDeviceSelectorConfiguration());
1570        }
1571
1572        // create <http-authentication> node
1573        Element httpAuthenticationElement = systemElement.addElement(N_HTTP_AUTHENTICATION);
1574        httpAuthenticationElement.addElement(N_BROWSER_BASED).setText(
1575            m_httpAuthenticationSettings.getConfigBrowserBasedAuthentication());
1576        if (m_httpAuthenticationSettings.getFormBasedHttpAuthenticationUri() != null) {
1577            httpAuthenticationElement.addElement(N_FORM_BASED).setText(
1578                m_httpAuthenticationSettings.getFormBasedHttpAuthenticationUri());
1579        }
1580
1581        // cache settings
1582        Element cacheElement = systemElement.addElement(N_RESULTCACHE);
1583        cacheElement.addElement(N_KEYGENERATOR).setText(m_cacheSettings.getCacheKeyGenerator());
1584        cacheElement.addElement(N_SIZE_USERS).setText(Integer.toString(m_cacheSettings.getUserCacheSize()));
1585        cacheElement.addElement(N_SIZE_GROUPS).setText(Integer.toString(m_cacheSettings.getGroupCacheSize()));
1586        if (m_cacheSettings.getConfiguredOrgUnitCacheSize() > -1) {
1587            cacheElement.addElement(N_SIZE_ORGUNITS).setText(
1588                Integer.toString(m_cacheSettings.getConfiguredOrgUnitCacheSize()));
1589        }
1590        cacheElement.addElement(N_SIZE_USERGROUPS).setText(Integer.toString(m_cacheSettings.getUserGroupsCacheSize()));
1591        cacheElement.addElement(N_SIZE_PROJECTS).setText(Integer.toString(m_cacheSettings.getProjectCacheSize()));
1592        if (m_cacheSettings.getConfiguredProjectResourcesCacheSize() > -1) {
1593            cacheElement.addElement(N_SIZE_PROJECTRESOURCES).setText(
1594                Integer.toString(m_cacheSettings.getConfiguredProjectResourcesCacheSize()));
1595        }
1596        cacheElement.addElement(N_SIZE_RESOURCES).setText(Integer.toString(m_cacheSettings.getResourceCacheSize()));
1597        if (m_cacheSettings.getConfiguredRolesCacheSize() > -1) {
1598            cacheElement.addElement(N_SIZE_ROLES).setText(
1599                Integer.toString(m_cacheSettings.getConfiguredRolesCacheSize()));
1600        }
1601        cacheElement.addElement(N_SIZE_RESOURCELISTS).setText(
1602            Integer.toString(m_cacheSettings.getResourcelistCacheSize()));
1603        cacheElement.addElement(N_SIZE_PROPERTIES).setText(Integer.toString(m_cacheSettings.getPropertyCacheSize()));
1604        if (m_cacheSettings.getConfiguredPropertyListsCacheSize() > -1) {
1605            cacheElement.addElement(N_SIZE_PROPERTYLISTS).setText(
1606                Integer.toString(m_cacheSettings.getConfiguredPropertyListsCacheSize()));
1607        }
1608        cacheElement.addElement(N_SIZE_ACLS).setText(Integer.toString(m_cacheSettings.getAclCacheSize()));
1609        cacheElement.addElement(N_SIZE_PERMISSIONS).setText(Integer.toString(m_cacheSettings.getPermissionCacheSize()));
1610
1611        // content notification settings
1612        if ((m_notificationTime != null) || (m_notificationProject != null)) {
1613            Element notificationElement = systemElement.addElement(N_CONTENT_NOTIFICATION);
1614            if (m_notificationTime != null) {
1615                notificationElement.addElement(N_NOTIFICATION_TIME).setText(m_notificationTime.toString());
1616            }
1617            if (m_notificationProject != null) {
1618                notificationElement.addElement(N_NOTIFICATION_PROJECT).setText(m_notificationProject);
1619            }
1620        }
1621
1622        // authorization handler
1623        if (m_authorizationHandler != null) {
1624            Element authorizationHandlerElem = systemElement.addElement(N_AUTHORIZATIONHANDLER);
1625            authorizationHandlerElem.addAttribute(A_CLASS, m_authorizationHandler);
1626        }
1627
1628        // optional publish manager nodes
1629        if (m_publishManager != null) {
1630            Element pubHistElement = systemElement.addElement(N_PUBLISHMANAGER);
1631            pubHistElement.addElement(N_HISTORYSIZE).setText(String.valueOf(m_publishManager.getPublishHistorySize()));
1632            // optional nodes for publish queue
1633            pubHistElement.addElement(N_QUEUEPERSISTANCE).setText(
1634                String.valueOf(m_publishManager.isPublishQueuePersistanceEnabled()));
1635            pubHistElement.addElement(N_QUEUESHUTDOWNTIME).setText(
1636                String.valueOf(m_publishManager.getPublishQueueShutdowntime()));
1637        }
1638
1639        // session storage provider
1640        if (m_sessionStorageProvider != null) {
1641            Element sessionStorageProviderElem = systemElement.addElement(N_SESSION_STORAGEPROVIDER);
1642            sessionStorageProviderElem.addAttribute(A_CLASS, m_sessionStorageProvider);
1643        }
1644
1645        // permission handler
1646        if (m_permissionHandler != null) {
1647            Element permissionHandlerElem = systemElement.addElement(N_PERMISSIONHANDLER);
1648            permissionHandlerElem.addAttribute(A_CLASS, m_permissionHandler);
1649        }
1650
1651        // servlet container settings
1652        CmsServletContainerSettings servletContainerSettings = OpenCms.getSystemInfo().getServletContainerSettings();
1653        if (!servletContainerSettings.getMode().isNone()) {
1654            Element servletContainerSettingsElem = systemElement.addElement(N_SERVLETCONTAINERSETTINGS);
1655            servletContainerSettingsElem.addAttribute(A_MODE, servletContainerSettings.getMode().getMode());
1656            if (!servletContainerSettings.getMode().isAuto()) {
1657                servletContainerSettingsElem.addElement(N_PREVENTRESPONSEFLUSH).addText(
1658                    "" + servletContainerSettings.isPreventResponseFlush());
1659                servletContainerSettingsElem.addElement(N_RELEASETAGSAFTEREND).addText(
1660                    "" + servletContainerSettings.isReleaseTagsAfterEnd());
1661            }
1662            // always write back the error page attribute
1663            if (servletContainerSettings.getRequestErrorPageAttribute() != null) {
1664                servletContainerSettingsElem.addElement(N_REQUESTERRORPAGEATTRIBUTE).addText(
1665                    servletContainerSettings.getRequestErrorPageAttribute());
1666            }
1667        }
1668
1669        // ADE settings
1670        if ((getAdeConfiguration() != null) || (getAdeCacheSettings() != null) || !m_adeParameters.isEmpty()) {
1671            Element adeElem = systemElement.addElement(N_ADE);
1672            if (getAdeConfiguration() != null) {
1673                adeElem.addElement(N_CONFIGURATION).addAttribute(A_CLASS, getAdeConfiguration());
1674            }
1675            if (!m_adeParameters.isEmpty()) {
1676                Element paramsElement = adeElem.addElement(N_PARAMETERS);
1677                for (Map.Entry<String, String> entry : m_adeParameters.entrySet()) {
1678                    String name = entry.getKey();
1679                    String value = entry.getValue();
1680                    Element paramElement = paramsElement.addElement(N_PARAM);
1681                    paramElement.addAttribute(N_NAME, name);
1682                    paramElement.setText(value);
1683                }
1684            }
1685            if (getAdeCacheSettings() != null) {
1686                Element cacheElem = adeElem.addElement(N_ADE_CACHE);
1687                // container page cache
1688                Element cntPageCacheElem = cacheElem.addElement(N_CONTAINERPAGES);
1689                cntPageCacheElem.addAttribute(A_OFFLINE, "" + getAdeCacheSettings().getContainerPageOfflineSize());
1690                cntPageCacheElem.addAttribute(A_ONLINE, "" + getAdeCacheSettings().getContainerPageOnlineSize());
1691                // group-container cache
1692                Element groupContainerCacheElem = cacheElem.addElement(N_GROUPCONTAINERS);
1693                groupContainerCacheElem.addAttribute(
1694                    A_OFFLINE,
1695                    "" + getAdeCacheSettings().getGroupContainerOfflineSize());
1696                groupContainerCacheElem.addAttribute(
1697                    A_ONLINE,
1698                    "" + getAdeCacheSettings().getGroupContainerOnlineSize());
1699            }
1700        }
1701
1702        // subscription manager settings
1703        if (getSubscriptionManager() != null) {
1704            Element subscrManElem = systemElement.addElement(N_SUBSCRIPTIONMANAGER);
1705            subscrManElem.addAttribute(A_ENABLED, Boolean.toString(getSubscriptionManager().isEnabled()));
1706            subscrManElem.addAttribute(A_POOLNAME, getSubscriptionManager().getPoolName());
1707            subscrManElem.addAttribute(A_MAXVISITED, String.valueOf(getSubscriptionManager().getMaxVisitedCount()));
1708        }
1709
1710        I_CmsWorkflowManager workflowMan = getWorkflowManager();
1711        if (workflowMan != null) {
1712            Element workflowElem = systemElement.addElement(N_WORKFLOW);
1713            workflowElem.addAttribute(A_CLASS, workflowMan.getClass().getName());
1714            Map<String, String> parameters = workflowMan.getParameters();
1715            Element parametersElem = workflowElem.addElement(N_PARAMETERS);
1716            for (Map.Entry<String, String> entry : parameters.entrySet()) {
1717                Element paramElem = parametersElem.addElement(N_PARAM);
1718                paramElem.addAttribute(A_NAME, entry.getKey());
1719                paramElem.addText(entry.getValue());
1720            }
1721        }
1722
1723        if (m_userSessionMode != null) {
1724            Element userSessionElem = systemElement.addElement(N_USER_SESSION_MODE);
1725            userSessionElem.setText(m_userSessionMode.toString());
1726        }
1727
1728        if (m_credentialsResolverClass != null) {
1729            systemElement.addElement(N_CREDENTIALS_RESOLVER).setText(m_credentialsResolverClass);
1730        }
1731
1732        if (m_publishListRemoveMode != null) {
1733            systemElement.addElement(N_PUBLISH_LIST_REMOVE_MODE).addAttribute(A_MODE, m_publishListRemoveMode);
1734        }
1735
1736        if (m_restrictDetailContents != null) {
1737            Element restrictDetailContentsElem = systemElement.addElement(N_RESTRICT_DETAIL_CONTENTS);
1738            restrictDetailContentsElem.addText(m_restrictDetailContents);
1739        }
1740
1741        // return the system node
1742        return systemElement;
1743    }
1744
1745    /**
1746     * Returns the settings of the ADE cache.<p>
1747     *
1748     * @return the settings of the ADE cache
1749     */
1750    public CmsADECacheSettings getAdeCacheSettings() {
1751
1752        return m_adeCacheSettings;
1753    }
1754
1755    /**
1756     * Returns the ade configuration class name.<p>
1757     *
1758     * @return the ade configuration class name
1759     */
1760    public String getAdeConfiguration() {
1761
1762        return m_adeConfiguration;
1763    }
1764
1765    /**
1766     * Gets the ADE configuration parameters.<p>
1767     *
1768     * @return the ADE configuration parameters
1769     */
1770    public Map<String, String> getAdeParameters() {
1771
1772        return m_adeParameters;
1773    }
1774
1775    /**
1776     * Returns an instance of the configured authorization handler.<p>
1777     *
1778     * @return an instance of the configured authorization handler
1779     */
1780    public I_CmsAuthorizationHandler getAuthorizationHandler() {
1781
1782        if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_authorizationHandler)) {
1783            return new CmsDefaultAuthorizationHandler();
1784        }
1785        try {
1786            I_CmsAuthorizationHandler authorizationHandler = (I_CmsAuthorizationHandler)Class.forName(
1787                m_authorizationHandler).newInstance();
1788            if (LOG.isInfoEnabled()) {
1789                LOG.info(
1790                    Messages.get().getBundle().key(
1791                        Messages.INIT_AUTHORIZATION_HANDLER_CLASS_SUCCESS_1,
1792                        m_authorizationHandler));
1793            }
1794            authorizationHandler.setParameters(m_runtimeProperties);
1795            return authorizationHandler;
1796        } catch (Throwable t) {
1797            LOG.error(
1798                Messages.get().getBundle().key(
1799                    Messages.INIT_AUTHORIZATION_HANDLER_CLASS_INVALID_1,
1800                    m_authorizationHandler),
1801                t);
1802            return new CmsDefaultAuthorizationHandler();
1803        }
1804    }
1805
1806    /**
1807     * Returns the settings of the memory monitor.<p>
1808     *
1809     * @return the settings of the memory monitor
1810     */
1811    public CmsCacheSettings getCacheSettings() {
1812
1813        return m_cacheSettings;
1814    }
1815
1816    /**
1817     * Returns the default users.<p>
1818     *
1819     * @return the default users
1820     */
1821    public CmsDefaultUsers getCmsDefaultUsers() {
1822
1823        return m_cmsDefaultUsers;
1824    }
1825
1826    /**
1827     * Returns the flexCacheConfiguration.<p>
1828     *
1829     * @return the flexCacheConfiguration
1830     */
1831    public CmsFlexCacheConfiguration getCmsFlexCacheConfiguration() {
1832
1833        return m_cmsFlexCacheConfiguration;
1834    }
1835
1836    /**
1837     * Returns the memory monitor configuration.<p>
1838     *
1839     * @return the memory monitor configuration
1840     */
1841    public CmsMemoryMonitorConfiguration getCmsMemoryMonitorConfiguration() {
1842
1843        return m_cmsMemoryMonitorConfiguration;
1844    }
1845
1846    /**
1847     * Gets the credentials resolver.<p>
1848     *
1849     * @return the credentials resolver
1850     */
1851    public I_CmsCredentialsResolver getCredentialsResolver() {
1852
1853        if (m_credentialsResolver == null) {
1854            m_credentialsResolver = new CmsDefaultCredentialsResolver();
1855        }
1856        return m_credentialsResolver;
1857    }
1858
1859    /**
1860     * Gets the configured credentials resolver class name (null if no class is explicity configured).<p>
1861     *
1862     * @return the name of the configured credentials resolver class
1863     */
1864    public String getCredentialsResolverClass() {
1865
1866        return m_credentialsResolverClass;
1867    }
1868
1869    /**
1870     * Returns the defaultContentEncoding.<p>
1871     *
1872     * @return the defaultContentEncoding
1873     */
1874    public String getDefaultContentEncoding() {
1875
1876        return m_defaultContentEncoding;
1877    }
1878
1879    /**
1880     * @see org.opencms.configuration.I_CmsXmlConfiguration#getDtdFilename()
1881     */
1882    public String getDtdFilename() {
1883
1884        return CONFIGURATION_DTD_NAME;
1885    }
1886
1887    /**
1888     * Returns the configured OpenCms event manager instance.<p>
1889     *
1890     * @return the configured OpenCms event manager instance
1891     */
1892    public CmsEventManager getEventManager() {
1893
1894        return m_eventManager;
1895    }
1896
1897    /**
1898     * Returns the maximum number of versions that are kept per resource in the VFS version history.<p>
1899     *
1900     * If the version history is disabled, this setting has no effect.<p>
1901     *
1902     * @return the maximum number of versions that are kept per resource
1903     *
1904     * @see #isHistoryEnabled()
1905     */
1906    public int getHistoryVersions() {
1907
1908        return m_historyVersions;
1909    }
1910
1911    /**
1912     * Returns the maximum number of versions that are kept in the VFS version history for deleted resources.<p>
1913     *
1914     * If the version history is disabled, this setting has no effect.<p>
1915     *
1916     * @return the maximum number of versions that are kept for deleted resources
1917     *
1918     * @see #isHistoryEnabled()
1919     */
1920    public int getHistoryVersionsAfterDeletion() {
1921
1922        return m_historyVersionsAfterDeletion;
1923    }
1924
1925    /**
1926     * Returns the HTTP authentication settings.<p>
1927     *
1928     * @return the HTTP authentication settings
1929     */
1930    public CmsHttpAuthenticationSettings getHttpAuthenticationSettings() {
1931
1932        return m_httpAuthenticationSettings;
1933    }
1934
1935    /**
1936     * Returns the configured locale manager for multi language support.<p>
1937     *
1938     * @return the configured locale manager for multi language support
1939     */
1940    public CmsLocaleManager getLocaleManager() {
1941
1942        return m_localeManager;
1943    }
1944
1945    /**
1946     * Returns the configured login manager.<p>
1947     *
1948     * @return the configured login manager
1949     */
1950    public CmsLoginManager getLoginManager() {
1951
1952        if (m_loginManager == null) {
1953            // no login manager configured, create default
1954            m_loginManager = new CmsLoginManager(
1955                CmsLoginManager.DISABLE_MINUTES_DEFAULT,
1956                CmsLoginManager.MAX_BAD_ATTEMPTS_DEFAULT,
1957                CmsLoginManager.ENABLE_SECURITY_DEFAULT,
1958                null,
1959                null,
1960                null,
1961                null);
1962        }
1963        if (m_loginMessage != null) {
1964            // null OpenCms object is ok during configuration
1965            try {
1966                m_loginManager.setLoginMessage(null, m_loginMessage);
1967            } catch (CmsRoleViolationException e) {
1968                // this should never happen
1969            }
1970        }
1971        return m_loginManager;
1972    }
1973
1974    /**
1975     * Returns the configured mail settings.<p>
1976     *
1977     * @return the configured mail settings
1978     */
1979    public CmsMailSettings getMailSettings() {
1980
1981        return m_mailSettings;
1982    }
1983
1984    /**
1985     * Returns the project in which timestamps for the content notification are read.<p>
1986     *
1987     * @return the project in which timestamps for the content notification are read
1988     */
1989    public String getNotificationProject() {
1990
1991        return m_notificationProject;
1992    }
1993
1994    /**
1995     * Returns the duration after which responsibles will be notified about out-dated content (in days).<p>
1996     *
1997     * @return the duration after which responsibles will be notified about out-dated content
1998     */
1999    public int getNotificationTime() {
2000
2001        if (m_notificationTime != null) {
2002            return m_notificationTime.intValue();
2003        } else {
2004            return -1;
2005        }
2006    }
2007
2008    /**
2009     * Returns the configured password handler.<p>
2010     *
2011     * @return the configured password handler
2012     */
2013    public I_CmsPasswordHandler getPasswordHandler() {
2014
2015        return m_passwordHandler;
2016    }
2017
2018    /**
2019     * Returns the permission Handler class name.<p>
2020     *
2021     * @return the permission Handler class name
2022     */
2023    public String getPermissionHandler() {
2024
2025        return m_permissionHandler;
2026    }
2027
2028    /**
2029     * Returns the configured publish list remove mode, or a default value if there is no configured value or an erroneous configured value.<p>
2030     *
2031     * @return the publish list remove mode
2032     */
2033    public CmsPublishManager.PublishListRemoveMode getPublishListRemoveMode() {
2034
2035        try {
2036            // trim preserves null
2037            return CmsPublishManager.PublishListRemoveMode.valueOf(StringUtils.trim(m_publishListRemoveMode));
2038        } catch (Exception e) {
2039            return CmsPublishManager.PublishListRemoveMode.allUsers;
2040        }
2041    }
2042
2043    /**
2044     * Returns the configured publish list remove mode as a string, or null if no publish list remove mode has been configured.<p>
2045     *
2046     * @return the publish list remove mode string from the configuration
2047     */
2048    public String getPublishListRemoveModeStr() {
2049
2050        return m_publishListRemoveMode;
2051    }
2052
2053    /**
2054     * Returns the configured publish manager.<p>
2055     *
2056     * @return the configured publish manager
2057     */
2058    public CmsPublishManager getPublishManager() {
2059
2060        if (m_publishManager == null) {
2061            // no publish manager configured, create default
2062            m_publishManager = new CmsPublishManager(
2063                CmsPublishManager.DEFAULT_HISTORY_SIZE,
2064                CmsPublishManager.DEFAULT_QUEUE_PERSISTANCE,
2065                CmsPublishManager.DEFAULT_QUEUE_SHUTDOWNTIME);
2066        }
2067        return m_publishManager;
2068    }
2069
2070    /**
2071     * Returns the list of instantiated request handler classes.<p>
2072     *
2073     * @return the list of instantiated request handler classes
2074     */
2075    public List<I_CmsRequestHandler> getRequestHandlers() {
2076
2077        return m_requestHandlers;
2078    }
2079
2080    /**
2081     * Returns the list of instantiated resource init handler classes.<p>
2082     *
2083     * @return the list of instantiated resource init handler classes
2084     */
2085    public List<I_CmsResourceInit> getResourceInitHandlers() {
2086
2087        return m_resourceInitHandlers;
2088    }
2089
2090    /**
2091     * Returns the runtime info factory instance.<p>
2092     *
2093     * @return the runtime info factory instance
2094     */
2095    public I_CmsDbContextFactory getRuntimeInfoFactory() {
2096
2097        return m_runtimeInfoFactory;
2098    }
2099
2100    /**
2101     * Returns the runtime Properties.<p>
2102     *
2103     * @return the runtime Properties
2104     */
2105    public Map<String, String> getRuntimeProperties() {
2106
2107        return m_runtimeProperties;
2108    }
2109
2110    /**
2111     * Returns the configured schedule manager.<p>
2112     *
2113     * @return the configured schedule manager
2114     */
2115    public CmsScheduleManager getScheduleManager() {
2116
2117        return m_scheduleManager;
2118    }
2119
2120    /**
2121     * Returns an instance of the configured session storage provider.<p>
2122     *
2123     * @return an instance of the configured session storage provider
2124     */
2125    public I_CmsSessionStorageProvider getSessionStorageProvider() {
2126
2127        if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_sessionStorageProvider)) {
2128            return new CmsDefaultSessionStorageProvider();
2129        }
2130        try {
2131            I_CmsSessionStorageProvider sessionCacheProvider = (I_CmsSessionStorageProvider)Class.forName(
2132                m_sessionStorageProvider).newInstance();
2133            if (CmsLog.INIT.isInfoEnabled()) {
2134                CmsLog.INIT.info(
2135                    Messages.get().getBundle().key(
2136                        Messages.INIT_SESSION_STORAGEPROVIDER_SUCCESS_1,
2137                        m_sessionStorageProvider));
2138            }
2139            return sessionCacheProvider;
2140        } catch (Throwable t) {
2141            LOG.error(
2142                Messages.get().getBundle().key(
2143                    Messages.LOG_INIT_SESSION_STORAGEPROVIDER_FAILURE_1,
2144                    m_sessionStorageProvider),
2145                t);
2146            return new CmsDefaultSessionStorageProvider();
2147        }
2148    }
2149
2150    /**
2151     * Returns the site manager.<p>
2152     *
2153     * @return the site manager
2154     */
2155    public CmsSiteManagerImpl getSiteManager() {
2156
2157        return m_siteManager;
2158    }
2159
2160    /**
2161     * Returns the configured subscription manager.<p>
2162     *
2163     * @return the configured subscription manager
2164     */
2165    public CmsSubscriptionManager getSubscriptionManager() {
2166
2167        if (m_subscriptionManager == null) {
2168            // no subscription manager configured, create default
2169            m_subscriptionManager = new CmsSubscriptionManager();
2170        }
2171        return m_subscriptionManager;
2172    }
2173
2174    /**
2175     * Returns temporary file project id.<p>
2176     *
2177     * @return temporary file project id
2178     */
2179    public int getTempFileProjectId() {
2180
2181        return m_tempFileProjectId;
2182    }
2183
2184    /**
2185     * Gets the user session mode.<p>
2186     *
2187     * @param useDefault if true, and no user session mode was configured, this will return the default value
2188     *
2189     * @return the user session mode
2190     */
2191    public UserSessionMode getUserSessionMode(boolean useDefault) {
2192
2193        if (m_userSessionMode != null) {
2194            return m_userSessionMode;
2195        } else if (useDefault) {
2196            return DEFAULT_USER_SESSION_MODE;
2197        } else {
2198            return null;
2199        }
2200    }
2201
2202    /**
2203     * Returns an instance of the configured validation handler.<p>
2204     *
2205     * @return an instance of the configured validation handler
2206     */
2207    public I_CmsValidationHandler getValidationHandler() {
2208
2209        if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_validationHandler)) {
2210            return new CmsDefaultValidationHandler();
2211        }
2212        try {
2213            I_CmsValidationHandler validationHandler = (I_CmsValidationHandler)Class.forName(
2214                m_validationHandler).newInstance();
2215            if (LOG.isInfoEnabled()) {
2216                LOG.info(
2217                    Messages.get().getBundle().key(
2218                        Messages.INIT_VALIDATION_HANDLER_CLASS_SUCCESS_1,
2219                        m_validationHandler));
2220            }
2221            return validationHandler;
2222        } catch (Throwable t) {
2223            LOG.error(
2224                Messages.get().getBundle().key(Messages.INIT_VALIDATION_HANDLER_CLASS_INVALID_1, m_validationHandler),
2225                t);
2226            return new CmsDefaultValidationHandler();
2227        }
2228    }
2229
2230    /**
2231     * Gets the configured workflow manager instance.<p>
2232     *
2233     * @return the configured workflow manager instance.
2234     */
2235    public I_CmsWorkflowManager getWorkflowManager() {
2236
2237        return m_workflowManager;
2238    }
2239
2240    /**
2241     * Will be called when configuration of this object is finished.<p>
2242     */
2243    public void initializeFinished() {
2244
2245        if (CmsLog.INIT.isInfoEnabled()) {
2246            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_SYSTEM_CONFIG_FINISHED_0));
2247        }
2248    }
2249
2250    /**
2251     * Returns if the VFS version history is enabled.<p>
2252     *
2253     * @return if the VFS version history is enabled
2254     */
2255    public boolean isHistoryEnabled() {
2256
2257        return m_historyEnabled;
2258    }
2259
2260    /**
2261     * Returns true if detail contents are restricted to detail pages from the same site.<p>
2262     *
2263     * @return true if detail contents are restricted to detail pages from the same site
2264     */
2265    public boolean isRestrictDetailContents() {
2266
2267        return (m_restrictDetailContents == null) || Boolean.parseBoolean(m_restrictDetailContents.trim());
2268
2269    }
2270
2271    /**
2272     * Sets the cache settings for ADE.<p>
2273     *
2274     * @param settings the cache settings for ADE
2275     */
2276    public void setAdeCacheSettings(CmsADECacheSettings settings) {
2277
2278        m_adeCacheSettings = settings;
2279    }
2280
2281    /**
2282     * Sets the ADE configuration class name.<p>
2283     *
2284     * @param className the class name to set
2285     */
2286    public void setAdeConfiguration(String className) {
2287
2288        m_adeConfiguration = className;
2289    }
2290
2291    /**
2292     * Sets the authorization handler.<p>
2293     *
2294     * @param authorizationHandlerClass the authorization handler class to set.
2295     */
2296    public void setAuthorizationHandler(String authorizationHandlerClass) {
2297
2298        m_authorizationHandler = authorizationHandlerClass;
2299    }
2300
2301    /**
2302     * Sets the settings of the memory monitor.<p>
2303     *
2304     * @param settings the settings of the memory monitor
2305     */
2306    public void setCacheSettings(CmsCacheSettings settings) {
2307
2308        m_cacheSettings = settings;
2309    }
2310
2311    /**
2312     * Sets the CmsDefaultUsers.<p>
2313     *
2314     * @param userAdmin the name of the default admin user
2315     * @param userGuest the name of the guest user
2316     * @param userExport the name of the export user
2317     * @param userDeletedResource the name of the deleted resource user, can be <code>null</code>
2318     * @param groupAdministrators the name of the administrators group
2319     * @param groupUsers the name of the users group
2320     * @param groupGuests the name of the guests group
2321     */
2322    public void setCmsDefaultUsers(
2323
2324        String userAdmin,
2325        String userGuest,
2326        String userExport,
2327        String userDeletedResource,
2328        String groupAdministrators,
2329        String groupUsers,
2330        String groupGuests) {
2331
2332        if (CmsLog.INIT.isInfoEnabled()) {
2333            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_CHECKING_DEFAULT_USER_NAMES_0));
2334        }
2335        m_cmsDefaultUsers = new CmsDefaultUsers(
2336            userAdmin,
2337            userGuest,
2338            userExport,
2339            userDeletedResource,
2340            groupAdministrators,
2341            groupUsers,
2342            groupGuests);
2343
2344        if (CmsLog.INIT.isInfoEnabled()) {
2345            CmsLog.INIT.info(
2346                Messages.get().getBundle().key(Messages.INIT_ADMIN_USER_1, m_cmsDefaultUsers.getUserAdmin()));
2347            CmsLog.INIT.info(
2348                Messages.get().getBundle().key(Messages.INIT_GUEST_USER_1, m_cmsDefaultUsers.getUserGuest()));
2349            CmsLog.INIT.info(
2350                Messages.get().getBundle().key(Messages.INIT_EXPORT_USER_1, m_cmsDefaultUsers.getUserExport()));
2351            CmsLog.INIT.info(
2352                Messages.get().getBundle().key(
2353                    Messages.INIT_DELETED_RESOURCE_USER_1,
2354                    m_cmsDefaultUsers.getUserDeletedResource()));
2355            CmsLog.INIT.info(
2356                Messages.get().getBundle().key(
2357                    Messages.INIT_ADMIN_GROUP_1,
2358                    m_cmsDefaultUsers.getGroupAdministrators()));
2359            CmsLog.INIT.info(
2360                Messages.get().getBundle().key(Messages.INIT_USERS_GROUP_1, m_cmsDefaultUsers.getGroupUsers()));
2361            CmsLog.INIT.info(
2362                Messages.get().getBundle().key(Messages.INIT_GUESTS_GROUP_1, m_cmsDefaultUsers.getGroupGuests()));
2363            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DEFAULT_USER_NAMES_INITIALIZED_0));
2364        }
2365    }
2366
2367    /**
2368     * Sets the flexCacheConfiguration.<p>
2369     *
2370     * @param flexCacheConfiguration the flexCacheConfiguration to set
2371     */
2372    public void setCmsFlexCacheConfiguration(CmsFlexCacheConfiguration flexCacheConfiguration) {
2373
2374        m_cmsFlexCacheConfiguration = flexCacheConfiguration;
2375    }
2376
2377    /**
2378     * Sets the cmsMemoryMonitorConfiguration.<p>
2379     *
2380     * @param cmsMemoryMonitorConfiguration the cmsMemoryMonitorConfiguration to set
2381     */
2382    public void setCmsMemoryMonitorConfiguration(CmsMemoryMonitorConfiguration cmsMemoryMonitorConfiguration) {
2383
2384        m_cmsMemoryMonitorConfiguration = cmsMemoryMonitorConfiguration;
2385    }
2386
2387    /**
2388     * Sets the credentials resolver class.<p>
2389     *
2390     * @param className the name of the credentials resolver class
2391     *
2392     * @throws Exception if something goes wrong
2393     */
2394    public void setCredentialsResolver(String className) throws Exception {
2395
2396        String originalClassName = className;
2397        className = className.trim();
2398        Class<?> resolverClass = Class.forName(className);
2399        m_credentialsResolver = (I_CmsCredentialsResolver)(resolverClass.newInstance());
2400        m_credentialsResolverClass = originalClassName;
2401    }
2402
2403    /**
2404     * Sets the defaultContentEncoding.<p>
2405     *
2406     * @param defaultContentEncoding the defaultContentEncoding to set
2407     */
2408    public void setDefaultContentEncoding(String defaultContentEncoding) {
2409
2410        m_defaultContentEncoding = defaultContentEncoding;
2411    }
2412
2413    /**
2414     * VFS version history settings are set here.<p>
2415     *
2416     * @param historyEnabled if true the history is enabled
2417     * @param historyVersions the maximum number of versions that are kept per VFS resource
2418     * @param historyVersionsAfterDeletion the maximum number of versions for deleted resources
2419     */
2420    public void setHistorySettings(String historyEnabled, String historyVersions, String historyVersionsAfterDeletion) {
2421
2422        m_historyEnabled = Boolean.valueOf(historyEnabled).booleanValue();
2423        m_historyVersions = Integer.valueOf(historyVersions).intValue();
2424        m_historyVersionsAfterDeletion = Integer.valueOf(historyVersionsAfterDeletion).intValue();
2425        if (CmsLog.INIT.isInfoEnabled()) {
2426            CmsLog.INIT.info(
2427                Messages.get().getBundle().key(
2428                    Messages.INIT_HISTORY_SETTINGS_3,
2429                    Boolean.valueOf(m_historyEnabled),
2430                    new Integer(m_historyVersions),
2431                    new Integer(m_historyVersionsAfterDeletion)));
2432        }
2433    }
2434
2435    /**
2436     * Sets the HTTP authentication settings.<p>
2437     *
2438     * @param httpAuthenticationSettings the HTTP authentication settings to set
2439     */
2440    public void setHttpAuthenticationSettings(CmsHttpAuthenticationSettings httpAuthenticationSettings) {
2441
2442        m_httpAuthenticationSettings = httpAuthenticationSettings;
2443    }
2444
2445    /**
2446     * Sets the locale manager for multi language support.<p>
2447     *
2448     * @param localeManager the locale manager to set
2449     */
2450    public void setLocaleManager(CmsLocaleManager localeManager) {
2451
2452        m_localeManager = localeManager;
2453        if (CmsLog.INIT.isInfoEnabled()) {
2454            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_CONFIG_I18N_FINISHED_0));
2455        }
2456    }
2457
2458    /**
2459     * Sets the configured login manager.<p>
2460     *
2461     * @param maxBadAttemptsStr the number of allowed bad login attempts
2462     * @param disableMinutesStr the time an account gets locked if to many bad logins are attempted
2463     * @param enableSecurityStr flag to determine if the security option should be enabled on the login dialog
2464     * @param tokenLifetime the token lifetime
2465     * @param maxInactive maximum time since last login before CmsLockInactiveAccountsJob locks an account
2466     * @param passwordChangeInterval the password change interval
2467     * @param userDataCheckInterval the user data check interval
2468     */
2469    public void setLoginManager(
2470        String disableMinutesStr,
2471        String maxBadAttemptsStr,
2472        String enableSecurityStr,
2473        String tokenLifetime,
2474        String maxInactive,
2475        String passwordChangeInterval,
2476        String userDataCheckInterval) {
2477
2478        int disableMinutes;
2479        try {
2480            disableMinutes = Integer.valueOf(disableMinutesStr).intValue();
2481        } catch (NumberFormatException e) {
2482            disableMinutes = CmsLoginManager.DISABLE_MINUTES_DEFAULT;
2483        }
2484        int maxBadAttempts;
2485        try {
2486            maxBadAttempts = Integer.valueOf(maxBadAttemptsStr).intValue();
2487        } catch (NumberFormatException e) {
2488            maxBadAttempts = CmsLoginManager.MAX_BAD_ATTEMPTS_DEFAULT;
2489        }
2490        boolean enableSecurity = Boolean.valueOf(enableSecurityStr).booleanValue();
2491        m_loginManager = new CmsLoginManager(
2492            disableMinutes,
2493            maxBadAttempts,
2494            enableSecurity,
2495            tokenLifetime,
2496            maxInactive,
2497            passwordChangeInterval,
2498            userDataCheckInterval);
2499        if (CmsLog.INIT.isInfoEnabled()) {
2500            CmsLog.INIT.info(
2501                Messages.get().getBundle().key(
2502                    Messages.INIT_LOGINMANAGER_3,
2503                    new Integer(disableMinutes),
2504                    new Integer(maxBadAttempts),
2505                    new Boolean(enableSecurity)));
2506        }
2507    }
2508
2509    /**
2510     * Adds the login message from the configuration.<p>
2511     *
2512     * @param message the login message to add
2513     */
2514    public void setLoginMessage(CmsLoginMessage message) {
2515
2516        m_loginMessage = message;
2517        if (CmsLog.INIT.isInfoEnabled()) {
2518            CmsLog.INIT.info(
2519                Messages.get().getBundle().key(
2520                    Messages.INIT_LOGINMESSAGE_3,
2521                    Boolean.valueOf(message.isEnabled()),
2522                    Boolean.valueOf(message.isLoginForbidden()),
2523                    message.getMessage()));
2524        }
2525    }
2526
2527    /**
2528     * Sets the mail settings.<p>
2529     *
2530     * @param mailSettings the mail settings to set.
2531     */
2532    public void setMailSettings(CmsMailSettings mailSettings) {
2533
2534        m_mailSettings = mailSettings;
2535        if (LOG.isDebugEnabled()) {
2536            LOG.debug(Messages.get().getBundle().key(Messages.LOG_MAIL_SETTINGS_1, mailSettings));
2537        }
2538    }
2539
2540    /**
2541     * Sets the project in which timestamps for the content notification are read.<p>
2542     *
2543     * @param notificationProject the project in which timestamps for the content notification are read
2544     */
2545    public void setNotificationProject(String notificationProject) {
2546
2547        m_notificationProject = notificationProject;
2548        if (CmsLog.INIT.isInfoEnabled()) {
2549            CmsLog.INIT.info(
2550                Messages.get().getBundle().key(Messages.INIT_NOTIFICATION_PROJECT_1, m_notificationProject));
2551        }
2552    }
2553
2554    /**
2555     * Sets the duration after which responsibles will be notified about out-dated content (in days).<p>
2556     *
2557     * @param notificationTime the duration after which responsibles will be notified about out-dated content
2558     */
2559    public void setNotificationTime(String notificationTime) {
2560
2561        try {
2562            m_notificationTime = new Integer(notificationTime);
2563        } catch (Throwable t) {
2564            m_notificationTime = new Integer(-1);
2565        }
2566        if (CmsLog.INIT.isInfoEnabled()) {
2567            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_NOTIFICATION_TIME_1, m_notificationTime));
2568        }
2569    }
2570
2571    /**
2572     * Sets the password handler class.<p>
2573     *
2574     * @param passwordHandler the password handler to set
2575     */
2576    public void setPasswordHandler(I_CmsPasswordHandler passwordHandler) {
2577
2578        m_passwordHandler = passwordHandler;
2579        if (CmsLog.INIT.isInfoEnabled()) {
2580            CmsLog.INIT.info(
2581                Messages.get().getBundle().key(
2582                    Messages.INIT_PWD_HANDLER_SUCCESS_1,
2583                    passwordHandler.getClass().getName()));
2584        }
2585    }
2586
2587    /**
2588     * Sets the permission Handler class name.<p>
2589     *
2590     * @param permissionHandler the class name to set
2591     */
2592    public void setPermissionHandler(String permissionHandler) {
2593
2594        m_permissionHandler = permissionHandler;
2595    }
2596
2597    /**
2598     * Sets the servlet container specific setting.<p>
2599     *
2600     * @param configValue the configuration value
2601     */
2602    public void setPreventResponseFlush(String configValue) {
2603
2604        OpenCms.getSystemInfo().getServletContainerSettings().setPreventResponseFlush(
2605            Boolean.valueOf(configValue).booleanValue());
2606    }
2607
2608    /**
2609     * Sets the publish list remove mode.<p>
2610     *
2611     * @param removeMode the publish list remove mode
2612     */
2613    public void setPublishListRemoveMode(String removeMode) {
2614
2615        m_publishListRemoveMode = removeMode;
2616    }
2617
2618    /**
2619     * Sets the publish manager.<p>
2620     *
2621     * @param publishManager the publish manager
2622     */
2623    public void setPublishManager(CmsPublishManager publishManager) {
2624
2625        m_publishManager = publishManager;
2626    }
2627
2628    /**
2629     * Sets the servlet container specific setting.<p>
2630     *
2631     * @param configValue the configuration value
2632     */
2633    public void setReleaseTagsAfterEnd(String configValue) {
2634
2635        OpenCms.getSystemInfo().getServletContainerSettings().setReleaseTagsAfterEnd(
2636            Boolean.valueOf(configValue).booleanValue());
2637    }
2638
2639    /**
2640     * Sets the servlet container specific setting.<p>
2641     *
2642     * @param configValue the configuration value
2643     */
2644    public void setRequestErrorPageAttribute(String configValue) {
2645
2646        OpenCms.getSystemInfo().getServletContainerSettings().setRequestErrorPageAttribute(configValue);
2647    }
2648
2649    /**
2650     * Sets the 'restrict detail contents' option.<p>
2651     *
2652     * @param restrictDetailContents the value of the option
2653     */
2654    public void setRestrictDetailContents(String restrictDetailContents) {
2655
2656        m_restrictDetailContents = restrictDetailContents;
2657    }
2658
2659    /**
2660     * Sets the runtime info factory.<p>
2661     *
2662     * @param className the class name of the configured runtime info factory
2663     */
2664    public void setRuntimeInfoFactory(String className) {
2665
2666        Object objectInstance;
2667
2668        try {
2669            objectInstance = Class.forName(className).newInstance();
2670        } catch (Throwable t) {
2671            LOG.error(Messages.get().getBundle().key(Messages.LOG_CLASS_INIT_FAILURE_1, className), t);
2672            return;
2673        }
2674
2675        if (objectInstance instanceof I_CmsDbContextFactory) {
2676            m_runtimeInfoFactory = (I_CmsDbContextFactory)objectInstance;
2677            if (CmsLog.INIT.isInfoEnabled()) {
2678                CmsLog.INIT.info(
2679                    Messages.get().getBundle().key(Messages.INIT_RUNTIME_INFO_FACTORY_SUCCESS_1, className));
2680            }
2681        } else {
2682            if (CmsLog.INIT.isFatalEnabled()) {
2683                CmsLog.INIT.fatal(
2684                    Messages.get().getBundle().key(Messages.INIT_RUNTIME_INFO_FACTORY_FAILURE_1, className));
2685            }
2686        }
2687
2688    }
2689
2690    /**
2691     * Sets the servlet container settings configuration mode.<p>
2692     *
2693     * @param configValue the value to set
2694     */
2695    public void setServletContainerSettingsMode(String configValue) {
2696
2697        OpenCms.getSystemInfo().getServletContainerSettings().setMode(configValue);
2698    }
2699
2700    /**
2701     * Sets the session storage provider.<p>
2702     *
2703     * @param sessionStorageProviderClass the session storage provider class to set.
2704     */
2705    public void setSessionStorageProvider(String sessionStorageProviderClass) {
2706
2707        m_sessionStorageProvider = sessionStorageProviderClass;
2708    }
2709
2710    /**
2711     * Sets the site manager.<p>
2712     *
2713     * @param siteManager the site manager to set
2714     */
2715    public void setSiteManager(CmsSiteManagerImpl siteManager) {
2716
2717        m_siteManager = siteManager;
2718        if (CmsLog.INIT.isInfoEnabled()) {
2719            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_SITE_CONFIG_FINISHED_0));
2720        }
2721    }
2722
2723    /**
2724     * Sets the subscription manager.<p>
2725     *
2726     * @param subscriptionManager the subscription manager
2727     */
2728    public void setSubscriptionManager(CmsSubscriptionManager subscriptionManager) {
2729
2730        m_subscriptionManager = subscriptionManager;
2731    }
2732
2733    /**
2734     * Sets the temporary file project id.<p>
2735     *
2736     * @param tempFileProjectId the temporary file project id to set
2737     */
2738    public void setTempFileProjectId(String tempFileProjectId) {
2739
2740        try {
2741            m_tempFileProjectId = Integer.valueOf(tempFileProjectId).intValue();
2742        } catch (Throwable t) {
2743            m_tempFileProjectId = -1;
2744        }
2745        if (CmsLog.INIT.isInfoEnabled()) {
2746            CmsLog.INIT.info(
2747                Messages.get().getBundle().key(Messages.INIT_TEMPFILE_PROJECT_ID_1, new Integer(m_tempFileProjectId)));
2748        }
2749    }
2750
2751    /**
2752     * Sets the user session mode.<p>
2753     *
2754     * @param userSessionMode the user session mode
2755     */
2756    public void setUserSessionMode(String userSessionMode) {
2757
2758        if ((userSessionMode == null) || (m_userSessionMode != null)) {
2759            throw new IllegalStateException("Can't set user session mode to " + userSessionMode);
2760        }
2761        m_userSessionMode = UserSessionMode.valueOf(userSessionMode);
2762    }
2763
2764    /**
2765     * Sets if the SAX parser implementation classes should be stored in system properties
2766     * to improve the unmarshalling performance.<p>
2767     *
2768     * @param enabled <code>true</code> to store SAX parser implementation classes in system properties
2769     */
2770    public void setUseSaxImplSystemProperties(String enabled) {
2771
2772        m_saxImplProperties = Boolean.parseBoolean(enabled);
2773    }
2774
2775    /**
2776     * Sets the validation handler.<p>
2777     *
2778     * @param validationHandlerClass the validation handler class to set.
2779     */
2780    public void setValidationHandler(String validationHandlerClass) {
2781
2782        m_validationHandler = validationHandlerClass;
2783    }
2784
2785    /**
2786     * Sets the configured workflow manager instance.<p>
2787     *
2788     * @param workflowManager the configured workflow manager
2789     */
2790    public void setWorkflowManager(I_CmsWorkflowManager workflowManager) {
2791
2792        m_workflowManager = workflowManager;
2793    }
2794
2795    /**
2796     * Returns whether the SAX parser implementation classes should be stored in system properties
2797     * to improve the unmarshalling performance.<p>
2798     *
2799     * @return <code>true</code> if the SAX parser implementation classes should be stored in system properties
2800     */
2801    public boolean useSaxImplSystemProperties() {
2802
2803        return m_saxImplProperties;
2804    }
2805
2806    /**
2807     * @see org.opencms.configuration.A_CmsXmlConfiguration#initMembers()
2808     */
2809    @Override
2810    protected void initMembers() {
2811
2812        setXmlFileName(DEFAULT_XML_FILE_NAME);
2813        m_historyEnabled = true;
2814        m_historyVersions = 10;
2815        m_historyVersionsAfterDeletion = -1; // use m_historyVersions instead
2816        m_resourceInitHandlers = new ArrayList<I_CmsResourceInit>();
2817        m_requestHandlers = new ArrayList<I_CmsRequestHandler>();
2818        m_configuredJobs = new ArrayList<CmsScheduledJobInfo>();
2819        m_runtimeProperties = new HashMap<String, String>();
2820        m_eventManager = new CmsEventManager();
2821        if (CmsLog.INIT.isInfoEnabled()) {
2822            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_SYSTEM_CONFIG_INIT_0));
2823        }
2824    }
2825}