1 31 32 package org.opencms.configuration; 33 34 import org.opencms.db.CmsCacheSettings; 35 import org.opencms.db.CmsDefaultUsers; 36 import org.opencms.db.CmsLoginManager; 37 import org.opencms.db.CmsLoginMessage; 38 import org.opencms.db.I_CmsDbContextFactory; 39 import org.opencms.flex.CmsFlexCacheConfiguration; 40 import org.opencms.i18n.CmsLocaleManager; 41 import org.opencms.mail.CmsMailHost; 42 import org.opencms.mail.CmsMailSettings; 43 import org.opencms.main.CmsContextInfo; 44 import org.opencms.main.CmsEventManager; 45 import org.opencms.main.CmsHttpAuthenticationSettings; 46 import org.opencms.main.CmsLog; 47 import org.opencms.main.I_CmsRequestHandler; 48 import org.opencms.main.I_CmsResourceInit; 49 import org.opencms.main.OpenCms; 50 import org.opencms.monitor.CmsMemoryMonitorConfiguration; 51 import org.opencms.scheduler.CmsScheduleManager; 52 import org.opencms.scheduler.CmsScheduledJobInfo; 53 import org.opencms.security.CmsDefaultValidationHandler; 54 import org.opencms.security.CmsRoleViolationException; 55 import org.opencms.security.I_CmsPasswordHandler; 56 import org.opencms.security.I_CmsValidationHandler; 57 import org.opencms.site.CmsSite; 58 import org.opencms.site.CmsSiteManager; 59 import org.opencms.site.CmsSiteMatcher; 60 61 import java.util.ArrayList ; 62 import java.util.Collections ; 63 import java.util.HashMap ; 64 import java.util.HashSet ; 65 import java.util.Iterator ; 66 import java.util.List ; 67 import java.util.Locale ; 68 import java.util.Map ; 69 70 import org.apache.commons.digester.Digester; 71 import org.apache.commons.logging.Log; 72 73 import org.dom4j.Element; 74 75 84 public class CmsSystemConfiguration extends A_CmsXmlConfiguration implements I_CmsXmlConfiguration { 85 86 87 public static final String A_ERROR = "error"; 88 89 90 public static final String A_EXCLUSIVE = "exclusive"; 91 92 93 public static final String A_SERVER = "server"; 94 95 96 public static final String CONFIGURATION_DTD_NAME = "opencms-system.dtd"; 97 98 99 public static final String DEFAULT_XML_FILE_NAME = "opencms-system.xml"; 100 101 102 public static final String N_ACTIVE = "active"; 103 104 105 public static final String N_ALIAS = "alias"; 106 107 108 public static final String N_AVGCACHEBYTES = "avgcachebytes"; 109 110 111 public static final String N_BROWSER_BASED = "browser-based"; 112 113 114 public static final String N_CACHE = "resultcache"; 115 116 117 public static final String N_CACHE_ENABLED = "cache-enabled"; 118 119 120 public static final String N_CACHE_OFFLINE = "cache-offline"; 121 122 123 public static final String N_CLASS = "class"; 124 125 126 public static final String N_CONTENT_NOTIFICATION = "content-notification"; 127 128 129 public static final String N_CONTEXT = "context"; 130 131 132 public static final String N_CRONEXPRESSION = "cronexpression"; 133 134 135 public static final String N_DEFAULT_CONTENT_ENCODING = "defaultcontentencoding"; 136 137 138 public static final String N_DEFAULT_URI = "default-uri"; 139 140 141 public static final String N_DEFAULTUSERS = "defaultusers"; 142 143 144 public static final String N_DIGESTTYPE = "digest-type"; 145 146 147 public static final String N_DISABLEMINUTES = "disableMinutes"; 148 149 150 public static final String N_EMAIL_INTERVAL = "email-interval"; 151 152 153 public static final String N_EMAIL_RECEIVER = "email-receiver"; 154 155 156 public static final String N_EMAIL_SENDER = "email-sender"; 157 158 159 public static final String N_ENABLED = "enabled"; 160 161 162 public static final String N_ENCODING = "encoding"; 163 164 165 public static final String N_EVENTMANAGER = "eventmanager"; 166 167 168 public static final String N_EVENTS = "events"; 169 170 171 public static final String N_FLEXCACHE = "flexcache"; 172 173 174 public static final String N_FORM_BASED = "form-based"; 175 176 177 public static final String N_GROUP_ADMINISTRATORS = "group-administrators"; 178 179 180 public static final String N_GROUP_GUESTS = "group-guests"; 181 182 183 public static final String N_GROUP_PROJECTMANAGERS = "group-projectmanagers"; 184 185 186 public static final String N_GROUP_USERS = "group-users"; 187 188 189 public static final String N_HTTP_AUTHENTICATION = "http-authentication"; 190 191 192 public static final String N_I18N = "internationalization"; 193 194 195 public static final String N_JOB = "job"; 196 197 198 public static final String N_KEYGENERATOR = "keygenerator"; 199 200 201 public static final String N_LOCALE = "locale"; 202 203 204 public static final String N_LOCALEHANDLER = "localehandler"; 205 206 207 public static final String N_LOCALESCONFIGURED = "localesconfigured"; 208 209 210 public static final String N_LOCALESDEFAULT = "localesdefault"; 211 212 213 public static final String N_LOG_INTERVAL = "log-interval"; 214 215 216 public static final String N_LOGINFORBIDDEN = "loginForbidden"; 217 218 219 public static final String N_LOGINMANAGER = "loginmanager"; 220 221 222 public static final String N_LOGINMESSAGE = "loginmessage"; 223 224 225 public static final String N_MAIL = "mail"; 226 227 228 public static final String N_MAILFROM = "mailfrom"; 229 230 231 public static final String N_MAILHOST = "mailhost"; 232 233 234 public static final String N_MAXBADATTEMPTS = "maxBadAttempts"; 235 236 237 public static final String N_MAXCACHEBYTES = "maxcachebytes"; 238 239 240 public static final String N_MAXENTRYBYTES = "maxentrybytes"; 241 242 243 public static final String N_MAXKEYS = "maxkeys"; 244 245 246 public static final String N_MAXUSAGE_PERCENT = "maxusagepercent"; 247 248 249 public static final String N_MEMORYMONITOR = "memorymonitor"; 250 251 252 public static final String N_MESSAGE = "message"; 253 254 255 public static final String N_NOTIFICATION_PROJECT = "notification-project"; 256 257 258 public static final String N_NOTIFICATION_TIME = "notification-time"; 259 260 261 public static final String N_PARAMETERS = "parameters"; 262 263 264 public static final String N_PASSWORDENCODING = "encoding"; 265 266 267 public static final String N_PASSWORDHANDLER = "passwordhandler"; 268 269 270 public static final String N_PROJECT = "project"; 271 272 273 public static final String N_RECEIVER = "receiver"; 274 275 276 public static final String N_REMOTEADDR = "remoteaddr"; 277 278 279 public static final String N_REQUESTEDURI = "requesteduri"; 280 281 282 public static final String N_REQUESTHANDLER = "requesthandler"; 283 284 285 public static final String N_REQUESTHANDLERS = "requesthandlers"; 286 287 288 public static final String N_RESOURCEINIT = "resourceinit"; 289 290 291 public static final String N_RESOURCEINITHANDLER = "resourceinithandler"; 292 293 294 public static final String N_REUSEINSTANCE = "reuseinstance"; 295 296 297 public static final String N_RUNTIMECLASSES = "runtimeclasses"; 298 299 300 public static final String N_RUNTIMEINFO = "runtimeinfo"; 301 302 303 public static final String N_RUNTIMEPROPERTIES = "runtimeproperties"; 304 305 306 public static final String N_SCHEDULER = "scheduler"; 307 308 309 public static final String N_SECURE = "secure"; 310 311 312 public static final String N_SITEROOT = "siteroot"; 313 314 315 public static final String N_SITES = "sites"; 316 317 318 public static final String N_SIZE_ACLS = "size-accesscontrollists"; 319 320 321 public static final String N_SIZE_GROUPS = "size-groups"; 322 323 324 public static final String N_SIZE_PERMISSIONS = "size-permissions"; 325 326 327 public static final String N_SIZE_PROJECTS = "size-projects"; 328 329 330 public static final String N_SIZE_PROPERTIES = "size-properties"; 331 332 333 public static final String N_SIZE_RESOURCELISTS = "size-resourcelists"; 334 335 336 public static final String N_SIZE_RESOURCES = "size-resources"; 337 338 339 public static final String N_SIZE_USERGROUPS = "size-usergroups"; 340 341 342 public static final String N_SIZE_USERS = "size-users"; 343 344 345 public static final String N_SYSTEM = "system"; 346 347 348 public static final String N_TIMEEND = "timeEnd"; 349 350 351 public static final String N_TIMESTART = "timeStart"; 352 353 354 public static final String N_USER_ADMIN = "user-admin"; 355 356 357 public static final String N_USER_DELETEDRESOURCE = "user-deletedresource"; 358 359 360 public static final String N_USER_EXPORT = "user-export"; 361 362 363 public static final String N_USER_GUEST = "user-guest"; 364 365 366 public static final String N_USERNAME = "user"; 367 368 369 public static final String N_VALIDATIONHANDLER = "validationhandler"; 370 371 372 public static final String N_VERSIONHISTORY = "versionhistory"; 373 374 375 public static final String N_WARNING_INTERVAL = "warning-interval"; 376 377 378 public static final String N_WORKPLACE_SERVER = "workplace-server"; 379 380 381 private static final Log LOG = CmsLog.getLog(CmsSystemConfiguration.class); 382 383 384 private CmsCacheSettings m_cacheSettings; 385 386 387 private CmsDefaultUsers m_cmsDefaultUsers; 388 389 390 private CmsFlexCacheConfiguration m_cmsFlexCacheConfiguration; 391 392 393 private CmsMemoryMonitorConfiguration m_cmsMemoryMonitorConfiguration; 394 395 396 private List m_configuredJobs; 397 398 399 private String m_defaultContentEncoding; 400 401 402 private CmsEventManager m_eventManager; 403 404 405 private CmsHttpAuthenticationSettings m_httpAuthenticationSettings; 406 407 408 private CmsLocaleManager m_localeManager; 409 410 411 private CmsLoginManager m_loginManager; 412 413 414 private CmsLoginMessage m_loginMessage; 415 416 417 private CmsMailSettings m_mailSettings; 418 419 420 private String m_notificationProject; 421 422 423 private Integer m_notificationTime; 425 426 427 private I_CmsPasswordHandler m_passwordHandler; 428 429 430 private List m_requestHandlers; 431 432 433 private List m_resourceInitHandlers; 434 435 436 private I_CmsDbContextFactory m_runtimeInfoFactory; 437 438 439 private Map m_runtimeProperties; 440 441 442 private CmsScheduleManager m_scheduleManager; 443 444 445 private CmsSiteManager m_siteManager; 446 447 448 private int m_tempFileProjectId; 449 450 451 private I_CmsValidationHandler m_validationHandler; 452 453 454 private boolean m_versionHistoryEnabled; 455 456 457 private int m_versionHistoryMaxCount; 458 459 462 public CmsSystemConfiguration() { 463 464 setXmlFileName(DEFAULT_XML_FILE_NAME); 465 m_versionHistoryEnabled = true; 466 m_versionHistoryMaxCount = 10; 467 m_resourceInitHandlers = new ArrayList (); 468 m_requestHandlers = new ArrayList (); 469 m_configuredJobs = new ArrayList (); 470 m_runtimeProperties = new HashMap (); 471 m_eventManager = new CmsEventManager(); 472 m_validationHandler = new CmsDefaultValidationHandler(); 473 if (CmsLog.INIT.isInfoEnabled()) { 474 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_SYSTEM_CONFIG_INIT_0)); 475 } 476 } 477 478 481 public void addConfigurationParameter(String paramName, String paramValue) { 482 483 m_runtimeProperties.put(paramName, paramValue); 484 } 485 486 491 public void addEventManager(String clazz) { 492 493 Object initClass; 494 try { 495 initClass = Class.forName(clazz).newInstance(); 496 } catch (Throwable t) { 497 LOG.error(Messages.get().getBundle().key( 498 Messages.INIT_EVENTMANAGER_CLASS_INVALID_2, 499 clazz, 500 m_resourceInitHandlers.getClass().getName()), t); 501 return; 502 } 503 if (initClass instanceof CmsEventManager) { 504 m_eventManager = (CmsEventManager)initClass; 505 if (CmsLog.INIT.isInfoEnabled()) { 506 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_EVENTMANAGER_CLASS_SUCCESS_1, initClass)); 507 } 508 } else { 509 if (CmsLog.INIT.isErrorEnabled()) { 510 CmsLog.INIT.error(Messages.get().getBundle().key( 511 Messages.INIT_EVENTMANAGER_CLASS_INVALID_2, 512 initClass, 513 m_resourceInitHandlers.getClass().getName())); 514 } 515 } 516 } 517 518 523 public void addJobFromConfiguration(CmsScheduledJobInfo jobInfo) { 524 525 m_configuredJobs.add(jobInfo); 526 527 if (CmsLog.INIT.isInfoEnabled()) { 528 CmsLog.INIT.info(Messages.get().getBundle().key( 529 Messages.INIT_SCHEDULER_CONFIG_JOB_3, 530 jobInfo.getJobName(), 531 jobInfo.getClassName(), 532 jobInfo.getContextInfo().getUserName())); 533 } 534 } 535 536 541 public void addRequestHandler(String clazz) { 542 543 Object initClass; 544 try { 545 initClass = Class.forName(clazz).newInstance(); 546 } catch (Throwable t) { 547 LOG.error(Messages.get().getBundle().key(Messages.LOG_INIT_REQUEST_HANDLER_FAILURE_1, clazz), t); 548 return; 549 } 550 if (initClass instanceof I_CmsRequestHandler) { 551 m_requestHandlers.add(initClass); 552 if (CmsLog.INIT.isInfoEnabled()) { 553 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_REQUEST_HANDLER_SUCCESS_1, clazz)); 554 } 555 } else { 556 if (CmsLog.INIT.isErrorEnabled()) { 557 CmsLog.INIT.error(Messages.get().getBundle().key(Messages.INIT_REQUEST_HANDLER_INVALID_1, clazz)); 558 } 559 } 560 } 561 562 567 public void addResourceInitHandler(String clazz) { 568 569 Object initClass; 570 try { 571 initClass = Class.forName(clazz).newInstance(); 572 } catch (Throwable t) { 573 LOG.error(Messages.get().getBundle().key(Messages.LOG_RESOURCE_INIT_CLASS_INVALID_1, clazz), t); 574 return; 575 } 576 if (initClass instanceof I_CmsResourceInit) { 577 m_resourceInitHandlers.add(initClass); 578 if (CmsLog.INIT.isInfoEnabled()) { 579 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_RESOURCE_INIT_SUCCESS_1, initClass)); 580 } 581 } else { 582 if (CmsLog.INIT.isErrorEnabled()) { 583 CmsLog.INIT.error(Messages.get().getBundle().key(Messages.INIT_RESOURCE_INIT_INVALID_CLASS_1, initClass)); 584 } 585 } 586 } 587 588 591 public void addScheduleManager() { 592 593 m_scheduleManager = new CmsScheduleManager(m_configuredJobs); 594 } 595 596 599 public void addXmlDigesterRules(Digester digester) { 600 601 digester.addCallMethod("*/" + N_SYSTEM, "initializeFinished"); 603 604 digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_I18N, CmsLocaleManager.class); 606 digester.addSetNext("*/" + N_SYSTEM + "/" + N_I18N, "setLocaleManager"); 607 608 digester.addObjectCreate( 610 "*/" + N_SYSTEM + "/" + N_I18N + "/" + N_LOCALEHANDLER, 611 A_CLASS, 612 CmsConfigurationException.class); 613 digester.addSetNext("*/" + N_SYSTEM + "/" + N_I18N + "/" + N_LOCALEHANDLER, "setLocaleHandler"); 614 615 digester.addCallMethod( 617 "*/" + N_SYSTEM + "/" + N_I18N + "/" + N_LOCALESCONFIGURED + "/" + N_LOCALE, 618 "addAvailableLocale", 619 0); 620 digester.addCallMethod( 621 "*/" + N_SYSTEM + "/" + N_I18N + "/" + N_LOCALESDEFAULT + "/" + N_LOCALE, 622 "addDefaultLocale", 623 0); 624 625 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_VERSIONHISTORY, "setVersionHistorySettings", 2); 627 digester.addCallParam("*/" + N_SYSTEM + "/" + N_VERSIONHISTORY, 0, A_ENABLED); 628 digester.addCallParam("*/" + N_SYSTEM + "/" + N_VERSIONHISTORY, 1, A_COUNT); 629 630 digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_MAIL, CmsMailSettings.class); 632 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILFROM, "setMailFromDefault", 0); 633 digester.addSetNext("*/" + N_SYSTEM + "/" + N_MAIL, "setMailSettings"); 634 635 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, "addMailHost", 5); 637 digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 0, A_NAME); 638 digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 1, A_ORDER); 639 digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 2, A_PROTOCOL); 640 digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 3, A_USER); 641 digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/" + N_MAILHOST, 4, A_PASSWORD); 642 643 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SCHEDULER, "addScheduleManager"); 645 646 digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB, CmsScheduledJobInfo.class); 648 digester.addBeanPropertySetter("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_NAME, "jobName"); 649 digester.addBeanPropertySetter("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CLASS, "className"); 650 digester.addBeanPropertySetter( 651 "*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CRONEXPRESSION, 652 "cronExpression"); 653 digester.addBeanPropertySetter( 654 "*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_REUSEINSTANCE, 655 "reuseInstance"); 656 digester.addBeanPropertySetter("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_ACTIVE, "active"); 657 digester.addSetNext("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB, "addJobFromConfiguration"); 658 659 digester.addObjectCreate( 661 "*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT, 662 CmsContextInfo.class); 663 digester.addBeanPropertySetter("*/" 664 + N_SYSTEM 665 + "/" 666 + N_SCHEDULER 667 + "/" 668 + N_JOB 669 + "/" 670 + N_CONTEXT 671 + "/" 672 + N_USERNAME, "userName"); 673 digester.addBeanPropertySetter("*/" 674 + N_SYSTEM 675 + "/" 676 + N_SCHEDULER 677 + "/" 678 + N_JOB 679 + "/" 680 + N_CONTEXT 681 + "/" 682 + N_PROJECT, "projectName"); 683 digester.addBeanPropertySetter("*/" 684 + N_SYSTEM 685 + "/" 686 + N_SCHEDULER 687 + "/" 688 + N_JOB 689 + "/" 690 + N_CONTEXT 691 + "/" 692 + N_SITEROOT, "siteRoot"); 693 digester.addBeanPropertySetter("*/" 694 + N_SYSTEM 695 + "/" 696 + N_SCHEDULER 697 + "/" 698 + N_JOB 699 + "/" 700 + N_CONTEXT 701 + "/" 702 + N_REQUESTEDURI, "requestedUri"); 703 digester.addBeanPropertySetter("*/" 704 + N_SYSTEM 705 + "/" 706 + N_SCHEDULER 707 + "/" 708 + N_JOB 709 + "/" 710 + N_CONTEXT 711 + "/" 712 + N_LOCALE, "localeName"); 713 digester.addBeanPropertySetter("*/" 714 + N_SYSTEM 715 + "/" 716 + N_SCHEDULER 717 + "/" 718 + N_JOB 719 + "/" 720 + N_CONTEXT 721 + "/" 722 + N_ENCODING); 723 digester.addBeanPropertySetter("*/" 724 + N_SYSTEM 725 + "/" 726 + N_SCHEDULER 727 + "/" 728 + N_JOB 729 + "/" 730 + N_CONTEXT 731 + "/" 732 + N_REMOTEADDR, "remoteAddr"); 733 digester.addSetNext("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT, "setContextInfo"); 734 735 digester.addCallMethod( 737 "*/" + I_CmsXmlConfiguration.N_PARAM, 738 I_CmsConfigurationParameterHandler.ADD_PARAMETER_METHOD, 739 2); 740 digester.addCallParam("*/" + I_CmsXmlConfiguration.N_PARAM, 0, I_CmsXmlConfiguration.A_NAME); 741 digester.addCallParam("*/" + I_CmsXmlConfiguration.N_PARAM, 1); 742 743 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_EVENTS + "/" + N_EVENTMANAGER, "addEventManager", 1); 745 digester.addCallParam("*/" + N_SYSTEM + "/" + N_EVENTS + "/" + N_EVENTMANAGER, 0, A_CLASS); 746 747 digester.addCallMethod( 749 "*/" + N_SYSTEM + "/" + N_RESOURCEINIT + "/" + N_RESOURCEINITHANDLER, 750 "addResourceInitHandler", 751 1); 752 digester.addCallParam("*/" + N_SYSTEM + "/" + N_RESOURCEINIT + "/" + N_RESOURCEINITHANDLER, 0, A_CLASS); 753 754 digester.addCallMethod( 756 "*/" + N_SYSTEM + "/" + N_REQUESTHANDLERS + "/" + N_REQUESTHANDLER, 757 "addRequestHandler", 758 1); 759 digester.addCallParam("*/" + N_SYSTEM + "/" + N_REQUESTHANDLERS + "/" + N_REQUESTHANDLER, 0, A_CLASS); 760 761 digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER, A_CLASS, CmsConfigurationException.class); 763 digester.addCallMethod( 764 "*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER, 765 I_CmsConfigurationParameterHandler.INIT_CONFIGURATION_METHOD); 766 digester.addBeanPropertySetter( 767 "*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER + "/" + N_PASSWORDENCODING, 768 "inputEncoding"); 769 digester.addBeanPropertySetter("*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER + "/" + N_DIGESTTYPE, "digestType"); 770 digester.addSetNext("*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER, "setPasswordHandler"); 771 772 digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_VALIDATIONHANDLER, A_CLASS, CmsDefaultValidationHandler.class); 774 digester.addSetNext("*/" + N_SYSTEM + "/" + N_VALIDATIONHANDLER, "setValidationHandler"); 775 776 digester.addCallMethod("*/" + N_LOGINMANAGER, "setLoginManager", 2); 778 digester.addCallParam("*/" + N_LOGINMANAGER + "/" + N_DISABLEMINUTES, 0); 779 digester.addCallParam("*/" + N_LOGINMANAGER + "/" + N_MAXBADATTEMPTS, 1); 780 781 digester.addObjectCreate("*/" + N_LOGINMESSAGE, CmsLoginMessage.class); 783 digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/" + N_ENABLED); 784 digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/" + N_MESSAGE); 785 digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/" + N_LOGINFORBIDDEN); 786 digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/" + N_TIMESTART); 787 digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/" + N_TIMEEND); 788 digester.addSetNext("*/" + N_LOGINMESSAGE, "setLoginMessage"); 789 790 digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_SITES, CmsSiteManager.class); 792 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_WORKPLACE_SERVER, "setWorkplaceServer", 0); 793 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_DEFAULT_URI, "setDefaultUri", 0); 794 digester.addSetNext("*/" + N_SYSTEM + "/" + N_SITES, "setSiteManager"); 795 796 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE, "addSite", 5); 798 digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE, 0, A_SERVER); 799 digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE, 1, A_URI); 800 digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_SECURE, 2, A_SERVER); 801 digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_SECURE, 3, A_EXCLUSIVE); 802 digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_SECURE, 4, A_ERROR); 803 804 digester.addCallMethod( 806 "*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_ALIAS, 807 "addAliasToConfigSite", 808 1); 809 digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/" + N_SITE + "/" + N_ALIAS, 0, A_SERVER); 810 811 digester.addCallMethod( 813 "*/" + N_SYSTEM + "/" + N_RUNTIMEPROPERTIES + "/" + N_PARAM, 814 I_CmsConfigurationParameterHandler.ADD_PARAMETER_METHOD, 815 2); 816 digester.addCallParam( 817 "*/" + N_SYSTEM + "/" + N_RUNTIMEPROPERTIES + "/" + N_PARAM, 818 0, 819 I_CmsXmlConfiguration.A_NAME); 820 digester.addCallParam("*/" + N_SYSTEM + "/" + N_RUNTIMEPROPERTIES + "/" + N_PARAM, 1); 821 822 digester.addCallMethod( 824 "*/" + N_SYSTEM + "/" + N_RUNTIMECLASSES + "/" + N_RUNTIMEINFO, 825 "setRuntimeInfoFactory", 826 1); 827 digester.addCallParam("*/" + N_SYSTEM + "/" + N_RUNTIMECLASSES + "/" + N_RUNTIMEINFO, 0, A_CLASS); 828 829 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS, "setCmsDefaultUsers", 8); 831 digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_USER_ADMIN, 0); 832 digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_USER_GUEST, 1); 833 digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_USER_EXPORT, 2); 834 digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_USER_DELETEDRESOURCE, 3); 835 digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_ADMINISTRATORS, 4); 836 digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_PROJECTMANAGERS, 5); 837 digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_USERS, 6); 838 digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_GUESTS, 7); 839 840 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_DEFAULT_CONTENT_ENCODING, "setDefaultContentEncoding", 1); 842 digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULT_CONTENT_ENCODING, 0); 843 844 digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR, CmsMemoryMonitorConfiguration.class); 846 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR, "initialize", 4); 847 digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_MAXUSAGE_PERCENT, 0); 848 digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_LOG_INTERVAL, 1); 849 digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_EMAIL_INTERVAL, 2); 850 digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_WARNING_INTERVAL, 3); 851 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_EMAIL_SENDER, "setEmailSender", 0); 852 digester.addCallMethod( 853 "*/" + N_SYSTEM + "/" + N_MEMORYMONITOR + "/" + N_EMAIL_RECEIVER + "/" + N_RECEIVER, 854 "addEmailReceiver", 855 0); 856 857 digester.addSetNext("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR, "setCmsMemoryMonitorConfiguration"); 859 860 digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_FLEXCACHE, CmsFlexCacheConfiguration.class); 862 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_FLEXCACHE, "initialize", 6); 863 digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_CACHE_ENABLED, 0); 864 digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_CACHE_OFFLINE, 1); 865 digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_MAXCACHEBYTES, 2); 866 digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_AVGCACHEBYTES, 3); 867 digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_MAXENTRYBYTES, 4); 868 digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/" + N_MAXKEYS, 5); 869 870 digester.addSetNext("*/" + N_SYSTEM + "/" + N_FLEXCACHE, "setCmsFlexCacheConfiguration"); 872 873 digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_HTTP_AUTHENTICATION, CmsHttpAuthenticationSettings.class); 875 digester.addCallMethod( 876 "*/" + N_SYSTEM + "/" + N_HTTP_AUTHENTICATION + "/" + N_BROWSER_BASED, 877 "setUseBrowserBasedHttpAuthentication", 878 0); 879 digester.addCallMethod( 880 "*/" + N_SYSTEM + "/" + N_HTTP_AUTHENTICATION + "/" + N_FORM_BASED, 881 "setFormBasedHttpAuthenticationUri", 882 0); 883 digester.addSetNext("*/" + N_SYSTEM + "/" + N_HTTP_AUTHENTICATION, "setHttpAuthenticationSettings"); 884 885 digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_CACHE, CmsCacheSettings.class); 887 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_KEYGENERATOR, "setCacheKeyGenerator", 0); 888 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_USERS, "setUserCacheSize", 0); 889 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_GROUPS, "setGroupCacheSize", 0); 890 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_USERGROUPS, "setUserGroupsCacheSize", 0); 891 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_PROJECTS, "setProjectCacheSize", 0); 892 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_RESOURCES, "setResourceCacheSize", 0); 893 digester.addCallMethod( 894 "*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_RESOURCELISTS, 895 "setResourcelistCacheSize", 896 0); 897 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_PROPERTIES, "setPropertyCacheSize", 0); 898 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_ACLS, "setAclCacheSize", 0); 899 digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/" + N_SIZE_PERMISSIONS, "setPermissionCacheSize", 0); 900 digester.addSetNext("*/" + N_SYSTEM + "/" + N_CACHE, "setCacheSettings"); 901 902 digester.addCallMethod( 904 "*/" + N_SYSTEM + "/" + N_CONTENT_NOTIFICATION + "/" + N_NOTIFICATION_TIME, 905 "setNotificationTime", 906 1); 907 digester.addCallParam("*/" + N_SYSTEM + "/" + N_CONTENT_NOTIFICATION + "/" + N_NOTIFICATION_TIME, 0); 908 909 digester.addCallMethod( 911 "*/" + N_SYSTEM + "/" + N_CONTENT_NOTIFICATION + "/" + N_NOTIFICATION_PROJECT, 912 "setNotificationProject", 913 1); 914 digester.addCallParam("*/" + N_SYSTEM + "/" + N_CONTENT_NOTIFICATION + "/" + N_NOTIFICATION_PROJECT, 0); 915 } 916 917 920 public Element generateXml(Element parent) { 921 922 Element systemElement = parent.addElement(N_SYSTEM); 924 925 if (OpenCms.getRunLevel() >= OpenCms.RUNLEVEL_3_SHELL_ACCESS) { 926 m_localeManager = OpenCms.getLocaleManager(); 928 m_mailSettings = OpenCms.getSystemInfo().getMailSettings(); 929 m_configuredJobs = OpenCms.getScheduleManager().getJobs(); 930 m_versionHistoryEnabled = OpenCms.getSystemInfo().isVersionHistoryEnabled(); 931 m_versionHistoryMaxCount = OpenCms.getSystemInfo().getVersionHistoryMaxCount(); 932 m_siteManager = OpenCms.getSiteManager(); 935 m_loginManager = OpenCms.getLoginManager(); 936 m_loginMessage = OpenCms.getLoginManager().getLoginMessage(); 937 } 938 939 Element i18nElement = systemElement.addElement(N_I18N); 941 i18nElement.addElement(N_LOCALEHANDLER).addAttribute( 942 A_CLASS, 943 m_localeManager.getLocaleHandler().getClass().getName()); 944 Iterator i; 945 Element localesElement; 946 localesElement = i18nElement.addElement(N_LOCALESCONFIGURED); 947 i = m_localeManager.getAvailableLocales().iterator(); 948 while (i.hasNext()) { 949 Locale locale = (Locale )i.next(); 950 localesElement.addElement(N_LOCALE).addText(locale.toString()); 951 } 952 localesElement = i18nElement.addElement(N_LOCALESDEFAULT); 953 i = m_localeManager.getDefaultLocales().iterator(); 954 while (i.hasNext()) { 955 Locale locale = (Locale )i.next(); 956 localesElement.addElement(N_LOCALE).setText(locale.toString()); 957 } 958 959 Element mailElement = systemElement.addElement(N_MAIL); 961 mailElement.addElement(N_MAILFROM).setText(m_mailSettings.getMailFromDefault()); 962 i = m_mailSettings.getMailHosts().iterator(); 963 while (i.hasNext()) { 964 CmsMailHost host = (CmsMailHost)i.next(); 965 Element hostElement = mailElement.addElement(N_MAILHOST).addAttribute(A_NAME, host.getHostname()).addAttribute( 966 A_ORDER, 967 host.getOrder().toString()).addAttribute(A_PROTOCOL, host.getProtocol()); 968 if (host.isAuthenticating()) { 969 hostElement.addAttribute(A_USER, host.getUsername()).addAttribute(A_PASSWORD, host.getPassword()); 970 } 971 } 972 973 Element schedulerElement = systemElement.addElement(N_SCHEDULER); 975 i = m_configuredJobs.iterator(); 976 while (i.hasNext()) { 977 CmsScheduledJobInfo jobInfo = (CmsScheduledJobInfo)i.next(); 978 Element jobElement = schedulerElement.addElement(N_JOB); 979 jobElement.addElement(N_NAME).addText(jobInfo.getJobName()); 980 jobElement.addElement(N_CLASS).addText(jobInfo.getClassName()); 981 jobElement.addElement(N_REUSEINSTANCE).addText(String.valueOf(jobInfo.isReuseInstance())); 982 jobElement.addElement(N_ACTIVE).addText(String.valueOf(jobInfo.isActive())); 983 jobElement.addElement(N_CRONEXPRESSION).addCDATA(jobInfo.getCronExpression()); 984 Element contextElement = jobElement.addElement(N_CONTEXT); 985 contextElement.addElement(N_USERNAME).setText(jobInfo.getContextInfo().getUserName()); 986 contextElement.addElement(N_PROJECT).setText(jobInfo.getContextInfo().getProjectName()); 987 contextElement.addElement(N_SITEROOT).setText(jobInfo.getContextInfo().getSiteRoot()); 988 contextElement.addElement(N_REQUESTEDURI).setText(jobInfo.getContextInfo().getRequestedUri()); 989 contextElement.addElement(N_LOCALE).setText(jobInfo.getContextInfo().getLocaleName()); 990 contextElement.addElement(N_ENCODING).setText(jobInfo.getContextInfo().getEncoding()); 991 contextElement.addElement(N_REMOTEADDR).setText(jobInfo.getContextInfo().getRemoteAddr()); 992 Map jobParameters = jobInfo.getConfiguration(); 993 if ((jobParameters != null) && (jobParameters.size() > 0)) { 994 Element parameterElement = jobElement.addElement(N_PARAMETERS); 995 Iterator it = jobParameters.keySet().iterator(); 996 while (it.hasNext()) { 997 String name = (String )it.next(); 998 String value = jobParameters.get(name).toString(); 999 Element paramNode = parameterElement.addElement(N_PARAM); 1000 paramNode.addAttribute(A_NAME, name); 1001 paramNode.addText(value); 1002 } 1003 } 1004 } 1005 1006 Element eventsElement = systemElement.addElement(N_EVENTS); 1008 Element eventManagerElement = eventsElement.addElement(N_EVENTMANAGER); 1009 eventManagerElement.addAttribute(A_CLASS, m_eventManager.getClass().getName()); 1010 1011 systemElement.addElement(N_VERSIONHISTORY).addAttribute( 1013 A_ENABLED, 1014 new Boolean (m_versionHistoryEnabled).toString()).addAttribute( 1015 A_COUNT, 1016 new Integer (m_versionHistoryMaxCount).toString()); 1017 1018 Element resourceinitElement = systemElement.addElement(N_RESOURCEINIT); 1020 i = m_resourceInitHandlers.iterator(); 1021 while (i.hasNext()) { 1022 I_CmsResourceInit clazz = (I_CmsResourceInit)i.next(); 1023 Element handlerElement = resourceinitElement.addElement(N_RESOURCEINITHANDLER); 1024 handlerElement.addAttribute(A_CLASS, clazz.getClass().getName()); 1025 } 1026 1027 Element requesthandlersElement = systemElement.addElement(N_REQUESTHANDLERS); 1029 i = m_requestHandlers.iterator(); 1030 while (i.hasNext()) { 1031 I_CmsRequestHandler clazz = (I_CmsRequestHandler)i.next(); 1032 Element handlerElement = requesthandlersElement.addElement(N_REQUESTHANDLER); 1033 handlerElement.addAttribute(A_CLASS, clazz.getClass().getName()); 1034 } 1035 1036 Element passwordhandlerElement = systemElement.addElement(N_PASSWORDHANDLER).addAttribute( 1038 A_CLASS, 1039 m_passwordHandler.getClass().getName()); 1040 passwordhandlerElement.addElement(N_PASSWORDENCODING).addText(m_passwordHandler.getInputEncoding()); 1041 passwordhandlerElement.addElement(N_DIGESTTYPE).addText(m_passwordHandler.getDigestType()); 1042 Map handlerParameters = m_passwordHandler.getConfiguration(); 1043 if (handlerParameters != null) { 1044 Iterator it = handlerParameters.keySet().iterator(); 1045 while (it.hasNext()) { 1046 String name = (String )it.next(); 1047 String value = handlerParameters.get(name).toString(); 1048 Element paramNode = passwordhandlerElement.addElement(N_PARAM); 1049 paramNode.addAttribute(A_NAME, name); 1050 paramNode.addText(value); 1051 } 1052 } 1053 1054 if (m_validationHandler != null) { 1056 Element valHandlerElem = systemElement.addElement(N_VALIDATIONHANDLER); 1057 valHandlerElem.addAttribute(A_CLASS, m_validationHandler.getClass().getName()); 1058 } 1059 1060 if (m_loginManager != null) { 1062 Element managerElement = systemElement.addElement(N_LOGINMANAGER); 1063 managerElement.addElement(N_DISABLEMINUTES).addText(String.valueOf(m_loginManager.getDisableMinutes())); 1064 managerElement.addElement(N_MAXBADATTEMPTS).addText(String.valueOf(m_loginManager.getMaxBadAttempts())); 1065 } 1066 1067 if (m_loginMessage != null) { 1069 Element messageElement = systemElement.addElement(N_LOGINMESSAGE); 1070 messageElement.addElement(N_ENABLED).addText(String.valueOf(m_loginMessage.isEnabled())); 1071 messageElement.addElement(N_MESSAGE).addCDATA(m_loginMessage.getMessage()); 1072 messageElement.addElement(N_LOGINFORBIDDEN).addText(String.valueOf(m_loginMessage.isLoginForbidden())); 1073 if (m_loginMessage.getTimeStart() != CmsLoginMessage.DEFAULT_TIME_START) { 1074 messageElement.addElement(N_TIMESTART).addText(String.valueOf(m_loginMessage.getTimeStart())); 1075 } 1076 if (m_loginMessage.getTimeEnd() != CmsLoginMessage.DEFAULT_TIME_END) { 1077 messageElement.addElement(N_TIMEEND).addText(String.valueOf(m_loginMessage.getTimeEnd())); 1078 } 1079 } 1080 1081 Element sitesElement = systemElement.addElement(N_SITES); 1083 sitesElement.addElement(N_WORKPLACE_SERVER).addText(m_siteManager.getWorkplaceServer()); 1084 sitesElement.addElement(N_DEFAULT_URI).addText(m_siteManager.getDefaultUri()); 1085 Iterator siteIterator = new HashSet (m_siteManager.getSites().values()).iterator(); 1086 while (siteIterator.hasNext()) { 1087 CmsSite site = (CmsSite)siteIterator.next(); 1088 Element siteElement = sitesElement.addElement(N_SITE); 1090 1091 siteElement.addAttribute(A_SERVER, site.getSiteMatcher().toString()); 1092 siteElement.addAttribute(A_URI, site.getSiteRoot().concat("/")); 1093 if (site.hasSecureServer()) { 1095 Element secureElem = siteElement.addElement(N_SECURE); 1096 secureElem.addAttribute(A_SERVER, site.getSecureUrl()); 1097 secureElem.addAttribute(A_EXCLUSIVE, "" + site.isExclusiveUrl()); 1098 secureElem.addAttribute(A_ERROR, "" + site.isExclusiveError()); 1099 } 1100 Iterator aliasIterator = site.getAliases().iterator(); 1102 while (aliasIterator.hasNext()) { 1103 String aliasServerName = ((CmsSiteMatcher)aliasIterator.next()).getUrl(); 1104 siteElement.addElement(N_ALIAS).addAttribute(A_SERVER, aliasServerName); 1105 } 1106 1107 } 1108 1109 Element runtimepropertiesElement = systemElement.addElement(N_RUNTIMEPROPERTIES); 1111 if (m_runtimeProperties != null) { 1112 List sortedRuntimeProperties = new ArrayList (m_runtimeProperties.keySet()); 1113 Collections.sort(sortedRuntimeProperties); 1114 Iterator it = sortedRuntimeProperties.iterator(); 1115 while (it.hasNext()) { 1116 String key = (String )it.next(); 1117 runtimepropertiesElement.addElement(N_PARAM).addAttribute(A_NAME, key).addText( 1119 (String )m_runtimeProperties.get(key)); 1120 } 1121 } 1122 1123 Element runtimeinfoElement = systemElement.addElement(N_RUNTIMECLASSES); 1125 Element runtimeinfofactoryElement = runtimeinfoElement.addElement(N_RUNTIMEINFO); 1126 runtimeinfofactoryElement.addAttribute(A_CLASS, getRuntimeInfoFactory().getClass().getName()); 1127 1128 Element defaultusersElement = systemElement.addElement(N_DEFAULTUSERS); 1130 defaultusersElement.addElement(N_USER_ADMIN).addText(m_cmsDefaultUsers.getUserAdmin()); 1132 defaultusersElement.addElement(N_USER_GUEST).addText(m_cmsDefaultUsers.getUserGuest()); 1134 defaultusersElement.addElement(N_USER_EXPORT).addText(m_cmsDefaultUsers.getUserExport()); 1136 if (!m_cmsDefaultUsers.getUserDeletedResource().equals(m_cmsDefaultUsers.getUserAdmin())) { 1137 defaultusersElement.addElement(N_USER_DELETEDRESOURCE).addText(m_cmsDefaultUsers.getUserDeletedResource()); 1139 } 1140 defaultusersElement.addElement(N_GROUP_ADMINISTRATORS).addText(m_cmsDefaultUsers.getGroupAdministrators()); 1142 defaultusersElement.addElement(N_GROUP_PROJECTMANAGERS).addText(m_cmsDefaultUsers.getGroupProjectmanagers()); 1144 defaultusersElement.addElement(N_GROUP_USERS).addText(m_cmsDefaultUsers.getGroupUsers()); 1146 defaultusersElement.addElement(N_GROUP_GUESTS).addText(m_cmsDefaultUsers.getGroupGuests()); 1148 1149 systemElement.addElement(N_DEFAULT_CONTENT_ENCODING).addText(getDefaultContentEncoding()); 1151 1152 if (m_cmsMemoryMonitorConfiguration != null) { 1154 Element memorymonitorElement = systemElement.addElement(N_MEMORYMONITOR); 1155 if (m_cmsMemoryMonitorConfiguration.getMaxUsagePercent() > 0) { 1156 memorymonitorElement.addElement(N_MAXUSAGE_PERCENT).addText( 1157 String.valueOf(m_cmsMemoryMonitorConfiguration.getMaxUsagePercent())); 1158 } 1159 if (m_cmsMemoryMonitorConfiguration.getLogInterval() > 0) { 1160 memorymonitorElement.addElement(N_LOG_INTERVAL).addText( 1161 String.valueOf(m_cmsMemoryMonitorConfiguration.getLogInterval())); 1162 } 1163 if (m_cmsMemoryMonitorConfiguration.getEmailInterval() > 0) { 1164 memorymonitorElement.addElement(N_EMAIL_INTERVAL).addText( 1165 String.valueOf(m_cmsMemoryMonitorConfiguration.getEmailInterval())); 1166 } 1167 if (m_cmsMemoryMonitorConfiguration.getWarningInterval() > 0) { 1168 memorymonitorElement.addElement(N_WARNING_INTERVAL).addText( 1169 String.valueOf(m_cmsMemoryMonitorConfiguration.getWarningInterval())); 1170 } 1171 if (m_cmsMemoryMonitorConfiguration.getEmailSender() != null) { 1172 memorymonitorElement.addElement(N_EMAIL_SENDER).addText( 1173 m_cmsMemoryMonitorConfiguration.getEmailSender()); 1174 } 1175 List emailReceiver = m_cmsMemoryMonitorConfiguration.getEmailReceiver(); 1176 if (!emailReceiver.isEmpty()) { 1177 Element emailreceiverElement = memorymonitorElement.addElement(N_EMAIL_RECEIVER); 1178 Iterator iter = emailReceiver.iterator(); 1179 while (iter.hasNext()) { 1180 emailreceiverElement.addElement(N_RECEIVER).addText((String )iter.next()); 1181 } 1182 } 1183 } 1184 1185 Element flexcacheElement = systemElement.addElement(N_FLEXCACHE); 1187 flexcacheElement.addElement(N_CACHE_ENABLED).addText( 1188 String.valueOf(m_cmsFlexCacheConfiguration.isCacheEnabled()).toString()); 1189 flexcacheElement.addElement(N_CACHE_OFFLINE).addText( 1190 String.valueOf(m_cmsFlexCacheConfiguration.isCacheOffline()).toString()); 1191 flexcacheElement.addElement(N_MAXCACHEBYTES).addText( 1192 String.valueOf(m_cmsFlexCacheConfiguration.getMaxCacheBytes()).toString()); 1193 flexcacheElement.addElement(N_AVGCACHEBYTES).addText( 1194 String.valueOf(m_cmsFlexCacheConfiguration.getAvgCacheBytes()).toString()); 1195 flexcacheElement.addElement(N_MAXENTRYBYTES).addText( 1196 String.valueOf(m_cmsFlexCacheConfiguration.getMaxEntryBytes()).toString()); 1197 flexcacheElement.addElement(N_MAXKEYS).addText( 1198 String.valueOf(m_cmsFlexCacheConfiguration.getMaxKeys()).toString()); 1199 1200 Element httpAuthenticationElement = systemElement.addElement(N_HTTP_AUTHENTICATION); 1202 httpAuthenticationElement.addElement(N_BROWSER_BASED).setText( 1203 Boolean.toString(m_httpAuthenticationSettings.useBrowserBasedHttpAuthentication())); 1204 if (m_httpAuthenticationSettings.getFormBasedHttpAuthenticationUri() != null) { 1205 httpAuthenticationElement.addElement(N_FORM_BASED).setText( 1206 m_httpAuthenticationSettings.getFormBasedHttpAuthenticationUri()); 1207 } 1208 1209 Element cacheElement = systemElement.addElement(N_CACHE); 1211 cacheElement.addElement(N_KEYGENERATOR).setText(m_cacheSettings.getCacheKeyGenerator()); 1212 cacheElement.addElement(N_SIZE_USERS).setText(Integer.toString(m_cacheSettings.getUserCacheSize())); 1213 cacheElement.addElement(N_SIZE_GROUPS).setText(Integer.toString(m_cacheSettings.getGroupCacheSize())); 1214 cacheElement.addElement(N_SIZE_USERGROUPS).setText(Integer.toString(m_cacheSettings.getUserGroupsCacheSize())); 1215 cacheElement.addElement(N_SIZE_PROJECTS).setText(Integer.toString(m_cacheSettings.getProjectCacheSize())); 1216 cacheElement.addElement(N_SIZE_RESOURCES).setText(Integer.toString(m_cacheSettings.getResourceCacheSize())); 1217 cacheElement.addElement(N_SIZE_RESOURCELISTS).setText( 1218 Integer.toString(m_cacheSettings.getResourcelistCacheSize())); 1219 cacheElement.addElement(N_SIZE_PROPERTIES).setText(Integer.toString(m_cacheSettings.getPropertyCacheSize())); 1220 cacheElement.addElement(N_SIZE_ACLS).setText(Integer.toString(m_cacheSettings.getAclCacheSize())); 1221 cacheElement.addElement(N_SIZE_PERMISSIONS).setText(Integer.toString(m_cacheSettings.getPermissionCacheSize())); 1222 1223 if (m_notificationTime != null || m_notificationProject != null) { 1225 Element notificationElement = systemElement.addElement(N_CONTENT_NOTIFICATION); 1226 if (m_notificationTime != null) { 1227 notificationElement.addElement(N_NOTIFICATION_TIME).setText(m_notificationTime.toString()); 1228 } 1229 if (m_notificationProject != null) { 1230 notificationElement.addElement(N_NOTIFICATION_PROJECT).setText(m_notificationProject.toString()); 1231 } 1232 } 1233 1234 return systemElement; 1236 } 1237 1238 1243 public CmsCacheSettings getCacheSettings() { 1244 1245 return m_cacheSettings; 1246 } 1247 1248 1253 public CmsDefaultUsers getCmsDefaultUsers() { 1254 1255 return m_cmsDefaultUsers; 1256 } 1257 1258 1263 public CmsFlexCacheConfiguration getCmsFlexCacheConfiguration() { 1264 1265 return m_cmsFlexCacheConfiguration; 1266 } 1267 1268 1273 public CmsMemoryMonitorConfiguration getCmsMemoryMonitorConfiguration() { 1274 1275 return m_cmsMemoryMonitorConfiguration; 1276 } 1277 1278 1283 public String getDefaultContentEncoding() { 1284 1285 return m_defaultContentEncoding; 1286 } 1287 1288 1291 public String getDtdFilename() { 1292 1293 return CONFIGURATION_DTD_NAME; 1294 } 1295 1296 1301 public CmsEventManager getEventManager() { 1302 1303 return m_eventManager; 1304 } 1305 1306 1311 public CmsHttpAuthenticationSettings getHttpAuthenticationSettings() { 1312 1313 return m_httpAuthenticationSettings; 1314 } 1315 1316 1321 public CmsLocaleManager getLocaleManager() { 1322 1323 return m_localeManager; 1324 } 1325 1326 1331 public CmsLoginManager getLoginManager() { 1332 1333 if (m_loginManager == null) { 1334 m_loginManager = new CmsLoginManager( 1336 CmsLoginManager.DISABLE_MINUTES_DEFAULT, 1337 CmsLoginManager.MAX_BAD_ATTEMPTS_DEFAULT); 1338 } 1339 if (m_loginMessage != null) { 1340 try { 1342 m_loginManager.setLoginMessage(null, m_loginMessage); 1343 } catch (CmsRoleViolationException e) { 1344 } 1346 } 1347 return m_loginManager; 1348 } 1349 1350 1355 public CmsMailSettings getMailSettings() { 1356 1357 return m_mailSettings; 1358 } 1359 1360 1365 public String getNotificationProject() { 1366 1367 return m_notificationProject; 1368 } 1369 1370 1375 public int getNotificationTime() { 1376 1377 if (m_notificationTime != null) { 1378 return m_notificationTime.intValue(); 1379 } else { 1380 return -1; 1381 } 1382 } 1383 1384 1389 public I_CmsPasswordHandler getPasswordHandler() { 1390 1391 return m_passwordHandler; 1392 } 1393 1394 1399 public List getRequestHandlers() { 1400 1401 return m_requestHandlers; 1402 } 1403 1404 1409 public List getResourceInitHandlers() { 1410 1411 return m_resourceInitHandlers; 1412 } 1413 1414 1419 public I_CmsDbContextFactory getRuntimeInfoFactory() { 1420 1421 return m_runtimeInfoFactory; 1422 } 1423 1424 1429 public Map getRuntimeProperties() { 1430 1431 return m_runtimeProperties; 1432 } 1433 1434 1439 public CmsScheduleManager getScheduleManager() { 1440 1441 return m_scheduleManager; 1442 } 1443 1444 1449 public CmsSiteManager getSiteManager() { 1450 1451 return m_siteManager; 1452 } 1453 1454 1459 public int getTempFileProjectId() { 1460 1461 return m_tempFileProjectId; 1462 } 1463 1464 1469 public I_CmsValidationHandler getValidationHandler() { 1470 1471 return m_validationHandler; 1472 } 1473 1474 1482 public int getVersionHistoryMaxCount() { 1483 1484 return m_versionHistoryMaxCount; 1485 } 1486 1487 1490 public void initializeFinished() { 1491 1492 if (CmsLog.INIT.isInfoEnabled()) { 1493 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_SYSTEM_CONFIG_FINISHED_0)); 1494 } 1495 } 1496 1497 1502 public boolean isVersionHistoryEnabled() { 1503 1504 return m_versionHistoryEnabled; 1505 } 1506 1507 1512 public void setCacheSettings(CmsCacheSettings settings) { 1513 1514 m_cacheSettings = settings; 1515 } 1516 1517 1529 public void setCmsDefaultUsers( 1530 1531 String userAdmin, 1532 String userGuest, 1533 String userExport, 1534 String userDeletedResource, 1535 String groupAdministrators, 1536 String groupProjectmanagers, 1537 String groupUsers, 1538 String groupGuests) { 1539 1540 m_cmsDefaultUsers = new CmsDefaultUsers( 1541 userAdmin, 1542 userGuest, 1543 userExport, 1544 userDeletedResource, 1545 groupAdministrators, 1546 groupProjectmanagers, 1547 groupUsers, 1548 groupGuests); 1549 } 1550 1551 1556 public void setCmsFlexCacheConfiguration(CmsFlexCacheConfiguration flexCacheConfiguration) { 1557 1558 m_cmsFlexCacheConfiguration = flexCacheConfiguration; 1559 } 1560 1561 1566 public void setCmsMemoryMonitorConfiguration(CmsMemoryMonitorConfiguration cmsMemoryMonitorConfiguration) { 1567 1568 m_cmsMemoryMonitorConfiguration = cmsMemoryMonitorConfiguration; 1569 } 1570 1571 1576 public void setDefaultContentEncoding(String defaultContentEncoding) { 1577 1578 m_defaultContentEncoding = defaultContentEncoding; 1579 } 1580 1581 1586 public void setHttpAuthenticationSettings(CmsHttpAuthenticationSettings httpAuthenticationSettings) { 1587 1588 m_httpAuthenticationSettings = httpAuthenticationSettings; 1589 } 1590 1591 1596 public void setLocaleManager(CmsLocaleManager localeManager) { 1597 1598 m_localeManager = localeManager; 1599 if (CmsLog.INIT.isInfoEnabled()) { 1600 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_CONFIG_I18N_FINISHED_0)); 1601 } 1602 } 1603 1604 1610 public void setLoginManager(String disableMinutesStr, String maxBadAttemptsStr) { 1611 1612 int disableMinutes; 1613 try { 1614 disableMinutes = Integer.valueOf(disableMinutesStr).intValue(); 1615 } catch (NumberFormatException e) { 1616 disableMinutes = CmsLoginManager.DISABLE_MINUTES_DEFAULT; 1617 } 1618 int maxBadAttempts; 1619 try { 1620 maxBadAttempts = Integer.valueOf(maxBadAttemptsStr).intValue(); 1621 } catch (NumberFormatException e) { 1622 maxBadAttempts = CmsLoginManager.MAX_BAD_ATTEMPTS_DEFAULT; 1623 } 1624 m_loginManager = new CmsLoginManager(disableMinutes, maxBadAttempts); 1625 if (CmsLog.INIT.isInfoEnabled()) { 1626 CmsLog.INIT.info(Messages.get().getBundle().key( 1627 Messages.INIT_LOGINMANAGER_2, 1628 new Integer (disableMinutes), 1629 new Integer (maxBadAttempts))); 1630 } 1631 } 1632 1633 1638 public void setLoginMessage(CmsLoginMessage message) { 1639 1640 m_loginMessage = message; 1641 if (CmsLog.INIT.isInfoEnabled()) { 1642 CmsLog.INIT.info(Messages.get().getBundle().key( 1643 Messages.INIT_LOGINMESSAGE_3, 1644 new Boolean (message.isEnabled()), 1645 new Boolean (message.isLoginForbidden()), 1646 message.getMessage())); 1647 } 1648 } 1649 1650 1655 public void setMailSettings(CmsMailSettings mailSettings) { 1656 1657 m_mailSettings = mailSettings; 1658 if (LOG.isDebugEnabled()) { 1659 LOG.debug(Messages.get().getBundle().key(Messages.LOG_MAIL_SETTINGS_1, mailSettings)); 1660 } 1661 } 1662 1663 1668 public void setNotificationProject(String notificationProject) { 1669 1670 m_notificationProject = notificationProject; 1671 if (CmsLog.INIT.isInfoEnabled()) { 1672 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_NOTIFICATION_PROJECT_1, m_notificationProject)); 1673 } 1674 } 1675 1676 1681 public void setNotificationTime(String notificationTime) { 1682 1683 try { 1684 m_notificationTime = new Integer (notificationTime); 1685 } catch (Throwable t) { 1686 m_notificationTime = new Integer (-1); 1687 } 1688 if (CmsLog.INIT.isInfoEnabled()) { 1689 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_NOTIFICATION_TIME_1, m_notificationTime)); 1690 } 1691 } 1692 1693 1698 public void setPasswordHandler(I_CmsPasswordHandler passwordHandler) { 1699 1700 m_passwordHandler = passwordHandler; 1701 if (CmsLog.INIT.isInfoEnabled()) { 1702 CmsLog.INIT.info(Messages.get().getBundle().key( 1703 Messages.INIT_PWD_HANDLER_SUCCESS_1, 1704 passwordHandler.getClass().getName())); 1705 } 1706 } 1707 1708 1713 public void setRuntimeInfoFactory(String className) { 1714 1715 Object objectInstance; 1716 1717 try { 1718 objectInstance = Class.forName(className).newInstance(); 1719 } catch (Throwable t) { 1720 LOG.error(Messages.get().getBundle().key(Messages.LOG_RESOURCE_INIT_FAILURE_1, className), t); 1721 return; 1722 } 1723 1724 if (objectInstance instanceof I_CmsDbContextFactory) { 1725 m_runtimeInfoFactory = (I_CmsDbContextFactory)objectInstance; 1726 if (CmsLog.INIT.isInfoEnabled()) { 1727 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_RUNTIME_INFO_FACTORY_SUCCESS_1, className)); 1728 } 1729 } else { 1730 if (CmsLog.INIT.isFatalEnabled()) { 1731 CmsLog.INIT.fatal(Messages.get().getBundle().key( 1732 Messages.INIT_RUNTIME_INFO_FACTORY_FAILURE_1, 1733 className)); 1734 } 1735 } 1736 1737 } 1738 1739 1744 public void setSiteManager(CmsSiteManager siteManager) { 1745 1746 m_siteManager = siteManager; 1747 if (CmsLog.INIT.isInfoEnabled()) { 1748 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_SITE_CONFIG_FINISHED_0)); 1749 } 1750 } 1751 1752 1757 public void setTempFileProjectId(String tempFileProjectId) { 1758 1759 try { 1760 m_tempFileProjectId = Integer.valueOf(tempFileProjectId).intValue(); 1761 } catch (Throwable t) { 1762 m_tempFileProjectId = -1; 1763 } 1764 if (CmsLog.INIT.isInfoEnabled()) { 1765 CmsLog.INIT.info(Messages.get().getBundle().key( 1766 Messages.INIT_TEMPFILE_PROJECT_ID_1, 1767 new Integer (m_tempFileProjectId))); 1768 } 1769 } 1770 1771 1776 public void setValidationHandler(I_CmsValidationHandler validationHandler) { 1777 1778 m_validationHandler = validationHandler; 1779 if (LOG.isDebugEnabled()) { 1780 LOG.debug(Messages.get().getBundle().key(Messages.LOG_VALIDATION_HANDLER_1, validationHandler)); 1781 } 1782 } 1783 1784 1790 public void setVersionHistorySettings(String historyEnabled, String historyMaxCount) { 1791 1792 m_versionHistoryEnabled = Boolean.valueOf(historyEnabled).booleanValue(); 1793 m_versionHistoryMaxCount = Integer.valueOf(historyMaxCount).intValue(); 1794 if (CmsLog.INIT.isInfoEnabled()) { 1795 CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_HISTORY_SETTINGS_2, 1796 new Boolean (m_versionHistoryEnabled), new Integer (m_versionHistoryMaxCount))); 1798 } 1799 } 1800} | Popular Tags |