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