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