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