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