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