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