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