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