0001: /*
0002: * File : $Source: /usr/local/cvs/opencms/src/org/opencms/configuration/CmsSystemConfiguration.java,v $
0003: * Date : $Date: 2008-02-27 12:05:48 $
0004: * Version: $Revision: 1.44 $
0005: *
0006: * This library is part of OpenCms -
0007: * the Open Source Content Management System
0008: *
0009: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
0010: *
0011: * This library is free software; you can redistribute it and/or
0012: * modify it under the terms of the GNU Lesser General Public
0013: * License as published by the Free Software Foundation; either
0014: * version 2.1 of the License, or (at your option) any later version.
0015: *
0016: * This library is distributed in the hope that it will be useful,
0017: * but WITHOUT ANY WARRANTY; without even the implied warranty of
0018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0019: * Lesser General Public License for more details.
0020: *
0021: * For further information about Alkacon Software GmbH, please see the
0022: * company website: http://www.alkacon.com
0023: *
0024: * For further information about OpenCms, please see the
0025: * project website: http://www.opencms.org
0026: *
0027: * You should have received a copy of the GNU Lesser General Public
0028: * License along with this library; if not, write to the Free Software
0029: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0030: */
0031:
0032: package org.opencms.configuration;
0033:
0034: import org.opencms.db.CmsCacheSettings;
0035: import org.opencms.db.CmsDefaultUsers;
0036: import org.opencms.db.CmsLoginManager;
0037: import org.opencms.db.CmsLoginMessage;
0038: import org.opencms.db.I_CmsDbContextFactory;
0039: import org.opencms.flex.CmsFlexCacheConfiguration;
0040: import org.opencms.i18n.CmsLocaleManager;
0041: import org.opencms.mail.CmsMailHost;
0042: import org.opencms.mail.CmsMailSettings;
0043: import org.opencms.main.CmsContextInfo;
0044: import org.opencms.main.CmsDefaultSessionStorageProvider;
0045: import org.opencms.main.CmsEventManager;
0046: import org.opencms.main.CmsHttpAuthenticationSettings;
0047: import org.opencms.main.CmsLog;
0048: import org.opencms.main.I_CmsSessionStorageProvider;
0049: import org.opencms.main.I_CmsRequestHandler;
0050: import org.opencms.main.I_CmsResourceInit;
0051: import org.opencms.main.OpenCms;
0052: import org.opencms.monitor.CmsMemoryMonitorConfiguration;
0053: import org.opencms.publish.CmsPublishManager;
0054: import org.opencms.scheduler.CmsScheduleManager;
0055: import org.opencms.scheduler.CmsScheduledJobInfo;
0056: import org.opencms.security.CmsDefaultAuthorizationHandler;
0057: import org.opencms.security.CmsDefaultValidationHandler;
0058: import org.opencms.security.CmsRoleViolationException;
0059: import org.opencms.security.I_CmsAuthorizationHandler;
0060: import org.opencms.security.I_CmsPasswordHandler;
0061: import org.opencms.security.I_CmsValidationHandler;
0062: import org.opencms.site.CmsSite;
0063: import org.opencms.site.CmsSiteManagerImpl;
0064: import org.opencms.site.CmsSiteMatcher;
0065: import org.opencms.util.CmsStringUtil;
0066:
0067: import java.util.ArrayList;
0068: import java.util.Collections;
0069: import java.util.HashMap;
0070: import java.util.HashSet;
0071: import java.util.Iterator;
0072: import java.util.List;
0073: import java.util.Locale;
0074: import java.util.Map;
0075:
0076: import org.apache.commons.digester.Digester;
0077: import org.apache.commons.logging.Log;
0078:
0079: import org.dom4j.Element;
0080:
0081: /**
0082: * System master configuration class.<p>
0083: *
0084: * @author Alexander Kandzior
0085: *
0086: * @version $Revision: 1.44 $
0087: *
0088: * @since 6.0.0
0089: */
0090: public class CmsSystemConfiguration extends A_CmsXmlConfiguration
0091: implements I_CmsXmlConfiguration {
0092:
0093: /** The "error" attribute. */
0094: public static final String A_ERROR = "error";
0095:
0096: /** The "exclusive" attribute. */
0097: public static final String A_EXCLUSIVE = "exclusive";
0098:
0099: /** The "server" attribute. */
0100: public static final String A_SERVER = "server";
0101:
0102: /** The name of the DTD for this configuration. */
0103: public static final String CONFIGURATION_DTD_NAME = "opencms-system.dtd";
0104:
0105: /** The name of the default XML file for this configuration. */
0106: public static final String DEFAULT_XML_FILE_NAME = "opencms-system.xml";
0107:
0108: /** The node name for the job "active" value. */
0109: public static final String N_ACTIVE = "active";
0110:
0111: /** The node name for the alias node. */
0112: public static final String N_ALIAS = "alias";
0113:
0114: /** The node name for the authorization handler. */
0115: public static final String N_AUTHORIZATIONHANDLER = "authorizationhandler";
0116:
0117: /** The node name for the avgcachebytes node. */
0118: public static final String N_AVGCACHEBYTES = "avgcachebytes";
0119:
0120: /** The node name for the browser-based node. */
0121: public static final String N_BROWSER_BASED = "browser-based";
0122:
0123: /** the result cache node. */
0124: public static final String N_CACHE = "resultcache";
0125:
0126: /** The node name for the cache-enabled node. */
0127: public static final String N_CACHE_ENABLED = "cache-enabled";
0128:
0129: /** The node name for the cache-offline node. */
0130: public static final String N_CACHE_OFFLINE = "cache-offline";
0131:
0132: /** The node name for a job class. */
0133: public static final String N_CLASS = "class";
0134:
0135: /** The duration after which responsibles will be notified about out-dated content. */
0136: public static final String N_CONTENT_NOTIFICATION = "content-notification";
0137:
0138: /** The node name for the job context. */
0139: public static final String N_CONTEXT = "context";
0140:
0141: /** The node name for the job cron expression. */
0142: public static final String N_CRONEXPRESSION = "cronexpression";
0143:
0144: /** The node name for the defaultcontentencoding node. */
0145: public static final String N_DEFAULT_CONTENT_ENCODING = "defaultcontentencoding";
0146:
0147: /** The node name for the default-uri node. */
0148: public static final String N_DEFAULT_URI = "default-uri";
0149:
0150: /** The node name for the defaultusers expression. */
0151: public static final String N_DEFAULTUSERS = "defaultusers";
0152:
0153: /** The node name for the digest type. */
0154: public static final String N_DIGESTTYPE = "digest-type";
0155:
0156: /** The node name for the login account lock minutes. */
0157: public static final String N_DISABLEMINUTES = "disableMinutes";
0158:
0159: /** The node name for the email-interval node. */
0160: public static final String N_EMAIL_INTERVAL = "email-interval";
0161:
0162: /** The node name for the email-receiver node. */
0163: public static final String N_EMAIL_RECEIVER = "email-receiver";
0164:
0165: /** The node name for the email-sender node. */
0166: public static final String N_EMAIL_SENDER = "email-sender";
0167:
0168: /** The node name for the login message enabled flag. */
0169: public static final String N_ENABLED = "enabled";
0170:
0171: /** The node name for the context encoding. */
0172: public static final String N_ENCODING = "encoding";
0173:
0174: /** The node name for the request handler classes. */
0175: public static final String N_EVENTMANAGER = "eventmanager";
0176:
0177: /** The node name for the events node. */
0178: public static final String N_EVENTS = "events";
0179:
0180: /** The node name for the flexcache node. */
0181: public static final String N_FLEXCACHE = "flexcache";
0182:
0183: /** The node name for the form-based node. */
0184: public static final String N_FORM_BASED = "form-based";
0185:
0186: /** The node name for the group-administrators node. */
0187: public static final String N_GROUP_ADMINISTRATORS = "group-administrators";
0188:
0189: /** The node name for the group-guests node. */
0190: public static final String N_GROUP_GUESTS = "group-guests";
0191:
0192: /** The node name for the group-projectmanagers node. */
0193: public static final String N_GROUP_PROJECTMANAGERS = "group-projectmanagers";
0194:
0195: /** The node name for the group-users node. */
0196: public static final String N_GROUP_USERS = "group-users";
0197:
0198: /** The node name for the publish "history-size" value. */
0199: public static final String N_HISTORYSIZE = "history-size";
0200:
0201: /** The node name for the http-authentication node. */
0202: public static final String N_HTTP_AUTHENTICATION = "http-authentication";
0203:
0204: /** The node name for the internationalization node. */
0205: public static final String N_I18N = "internationalization";
0206:
0207: /** The node name for a job. */
0208: public static final String N_JOB = "job";
0209:
0210: /** The name of the class to generate cache keys. */
0211: public static final String N_KEYGENERATOR = "keygenerator";
0212:
0213: /** The node name for individual locales. */
0214: public static final String N_LOCALE = "locale";
0215:
0216: /** The node name for the locale handler. */
0217: public static final String N_LOCALEHANDLER = "localehandler";
0218:
0219: /** The node name for the configured locales. */
0220: public static final String N_LOCALESCONFIGURED = "localesconfigured";
0221:
0222: /** The node name for the default locale(s). */
0223: public static final String N_LOCALESDEFAULT = "localesdefault";
0224:
0225: /** The node name for the log-interval node. */
0226: public static final String N_LOG_INTERVAL = "log-interval";
0227:
0228: /** The node name for the login message login forbidden flag. */
0229: public static final String N_LOGINFORBIDDEN = "loginForbidden";
0230:
0231: /** The node name for the login manager. */
0232: public static final String N_LOGINMANAGER = "loginmanager";
0233:
0234: /** The node name for the login message. */
0235: public static final String N_LOGINMESSAGE = "loginmessage";
0236:
0237: /** The node name for the mail configuration. */
0238: public static final String N_MAIL = "mail";
0239:
0240: /** The node name for the "mail from" node. */
0241: public static final String N_MAILFROM = "mailfrom";
0242:
0243: /** The node name for the "mail host" node. */
0244: public static final String N_MAILHOST = "mailhost";
0245:
0246: /** The node name for the login manager bad attempt count. */
0247: public static final String N_MAXBADATTEMPTS = "maxBadAttempts";
0248:
0249: /** The node name for the maxcachebytes node. */
0250: public static final String N_MAXCACHEBYTES = "maxcachebytes";
0251:
0252: /** The node name for the maxentrybytes node. */
0253: public static final String N_MAXENTRYBYTES = "maxentrybytes";
0254:
0255: /** The node name for the maxkeys node. */
0256: public static final String N_MAXKEYS = "maxkeys";
0257:
0258: /** The node name for the maxusagepercent node. */
0259: public static final String N_MAXUSAGE_PERCENT = "maxusagepercent";
0260:
0261: /** The node name for the memorymonitor node. */
0262: public static final String N_MEMORYMONITOR = "memorymonitor";
0263:
0264: /** The node name for the login message text. */
0265: public static final String N_MESSAGE = "message";
0266:
0267: /** The duration after which responsibles will be notified about out-dated content. */
0268: public static final String N_NOTIFICATION_PROJECT = "notification-project";
0269:
0270: /** The duration after which responsibles will be notified about out-dated content. */
0271: public static final String N_NOTIFICATION_TIME = "notification-time";
0272:
0273: /** The node name for the job parameters. */
0274: public static final String N_PARAMETERS = "parameters";
0275:
0276: /** The node name for the password encoding. */
0277: public static final String N_PASSWORDENCODING = "encoding";
0278:
0279: /** The node name for the password handler. */
0280: public static final String N_PASSWORDHANDLER = "passwordhandler";
0281:
0282: /** The node name for the permission handler. */
0283: public static final String N_PERMISSIONHANDLER = "permissionhandler";
0284:
0285: /** The node name for the context project name. */
0286: public static final String N_PROJECT = "project";
0287:
0288: /** The node name for the "publishhistory" section. */
0289: public static final String N_PUBLISHMANAGER = "publishmanager";
0290:
0291: /** The node name for the "publishhistory" section. */
0292: public static final String N_QUEUEPERSISTANCE = "queue-persistance";
0293:
0294: /** The node name for the "publishhistory" section. */
0295: public static final String N_QUEUESHUTDOWNTIME = "queue-shutdowntime";
0296:
0297: /** The node name for the memory email receiver. */
0298: public static final String N_RECEIVER = "receiver";
0299:
0300: /** The node name for the context remote addr. */
0301: public static final String N_REMOTEADDR = "remoteaddr";
0302:
0303: /** The node name for the context requested uri. */
0304: public static final String N_REQUESTEDURI = "requesteduri";
0305:
0306: /** The node name for the request handler classes. */
0307: public static final String N_REQUESTHANDLER = "requesthandler";
0308:
0309: /** The node name for the request handlers. */
0310: public static final String N_REQUESTHANDLERS = "requesthandlers";
0311:
0312: /** The node name for the resource init classes. */
0313: public static final String N_RESOURCEINIT = "resourceinit";
0314:
0315: /** The node name for the resource init classes. */
0316: public static final String N_RESOURCEINITHANDLER = "resourceinithandler";
0317:
0318: /** The node name for the job "reuseinstance" value. */
0319: public static final String N_REUSEINSTANCE = "reuseinstance";
0320:
0321: /** The node name for the runtime info. */
0322: public static final String N_RUNTIMECLASSES = "runtimeclasses";
0323:
0324: /** The node name for the runtime info factory. */
0325: public static final String N_RUNTIMEINFO = "runtimeinfo";
0326:
0327: /** The node name for the runtime properties node. */
0328: public static final String N_RUNTIMEPROPERTIES = "runtimeproperties";
0329:
0330: /** The node name for the scheduler. */
0331: public static final String N_SCHEDULER = "scheduler";
0332:
0333: /** The node name for the secure site. */
0334: public static final String N_SECURE = "secure";
0335:
0336: /** The node name for the session-storageprovider node. */
0337: public static final String N_SESSION_STORAGEPROVIDER = "session-storageprovider";
0338:
0339: /** The node name for the context site root. */
0340: public static final String N_SITEROOT = "siteroot";
0341:
0342: /** The node name for the sites node. */
0343: public static final String N_SITES = "sites";
0344:
0345: /** The size of the driver manager's cache for ACLS. */
0346: public static final String N_SIZE_ACLS = "size-accesscontrollists";
0347:
0348: /** The size of the driver manager's cache for groups. */
0349: public static final String N_SIZE_GROUPS = "size-groups";
0350:
0351: /** The size of the driver manager's cache for organizational units. */
0352: public static final String N_SIZE_ORGUNITS = "size-orgunits";
0353:
0354: /** The size of the security manager's cache for permission checks. */
0355: public static final String N_SIZE_PERMISSIONS = "size-permissions";
0356:
0357: /** The size of the driver manager's cache for project resources. */
0358: public static final String N_SIZE_PROJECTRESOURCES = "size-projectresources";
0359:
0360: /** The size of the driver manager's cache for projects. */
0361: public static final String N_SIZE_PROJECTS = "size-projects";
0362:
0363: /** The size of the driver manager's cache for properties. */
0364: public static final String N_SIZE_PROPERTIES = "size-properties";
0365:
0366: /** The size of the driver manager's cache for property lists. */
0367: public static final String N_SIZE_PROPERTYLISTS = "size-propertylists";
0368:
0369: /** The size of the driver manager's cache for lists of resources. */
0370: public static final String N_SIZE_RESOURCELISTS = "size-resourcelists";
0371:
0372: /** The size of the driver manager's cache for resources. */
0373: public static final String N_SIZE_RESOURCES = "size-resources";
0374:
0375: /** The size of the driver manager's cache for roles. */
0376: public static final String N_SIZE_ROLES = "size-roles";
0377:
0378: /** The size of the driver manager's cache for user/group relations. */
0379: public static final String N_SIZE_USERGROUPS = "size-usergroups";
0380:
0381: /** The size of the driver manager's cache for users. */
0382: public static final String N_SIZE_USERS = "size-users";
0383:
0384: /** The main system configuration node name. */
0385: public static final String N_SYSTEM = "system";
0386:
0387: /** The node name for the login message end time. */
0388: public static final String N_TIMEEND = "timeEnd";
0389:
0390: /** The node name for the login message start time. */
0391: public static final String N_TIMESTART = "timeStart";
0392:
0393: /** The node name for the user-admin node. */
0394: public static final String N_USER_ADMIN = "user-admin";
0395:
0396: /** The node name for the user-deletedresource node. */
0397: public static final String N_USER_DELETEDRESOURCE = "user-deletedresource";
0398:
0399: /** The node name for the user-export node. */
0400: public static final String N_USER_EXPORT = "user-export";
0401:
0402: /** The node name for the user-guest node. */
0403: public static final String N_USER_GUEST = "user-guest";
0404:
0405: /** The node name for the context user name. */
0406: public static final String N_USERNAME = "user";
0407:
0408: /** The node name for the validation handler. */
0409: public static final String N_VALIDATIONHANDLER = "validationhandler";
0410:
0411: /** The node name for the version history. */
0412: public static final String N_VERSIONHISTORY = "versionhistory";
0413:
0414: /** The node name for the warning-interval node. */
0415: public static final String N_WARNING_INTERVAL = "warning-interval";
0416:
0417: /** The node name for the workplace-server node. */
0418: public static final String N_WORKPLACE_SERVER = "workplace-server";
0419:
0420: /** The attribute name for the deleted node. */
0421: private static final String A_DELETED = "deleted";
0422:
0423: /** The log object for this class. */
0424: private static final Log LOG = CmsLog
0425: .getLog(CmsSystemConfiguration.class);
0426:
0427: /** The authorization handler. */
0428: private String m_authorizationHandler;
0429:
0430: /** The settings of the driver manager. */
0431: private CmsCacheSettings m_cacheSettings;
0432:
0433: /** The configured OpenCms default users and groups. */
0434: private CmsDefaultUsers m_cmsDefaultUsers;
0435:
0436: /** The flex cache configuration object. */
0437: private CmsFlexCacheConfiguration m_cmsFlexCacheConfiguration;
0438:
0439: /** The memory monitor configuration. */
0440: private CmsMemoryMonitorConfiguration m_cmsMemoryMonitorConfiguration;
0441:
0442: /** The list of jobs for the scheduler. */
0443: private List m_configuredJobs;
0444:
0445: /** The default content encoding. */
0446: private String m_defaultContentEncoding;
0447:
0448: /** The configured OpenCms event manager. */
0449: private CmsEventManager m_eventManager;
0450:
0451: /** Indicates if the version history is enabled. */
0452: private boolean m_historyEnabled;
0453:
0454: /** The maximum number of historical versions per resource. */
0455: private int m_historyVersions;
0456:
0457: /** The maximum number of historical versions for deleted resources. */
0458: private int m_historyVersionsAfterDeletion;
0459:
0460: /** The HTTP basic authentication settings. */
0461: private CmsHttpAuthenticationSettings m_httpAuthenticationSettings;
0462:
0463: /** The configured locale manager for multi language support. */
0464: private CmsLocaleManager m_localeManager;
0465:
0466: /** The configured login manager. */
0467: private CmsLoginManager m_loginManager;
0468:
0469: /** The configured login message. */
0470: private CmsLoginMessage m_loginMessage;
0471:
0472: /** The mail settings. */
0473: private CmsMailSettings m_mailSettings;
0474:
0475: /** Notification project. */
0476: private String m_notificationProject;
0477:
0478: /** The duration after which responsibles will be notified about out-dated content (in days). */
0479: // It is an Integer object so that it can be distinguished if this optional element was set or not
0480: private Integer m_notificationTime;
0481:
0482: /** The password handler. */
0483: private I_CmsPasswordHandler m_passwordHandler;
0484:
0485: /** The permission handler. */
0486: private String m_permissionHandler;
0487:
0488: /** The configured publish manager. */
0489: private CmsPublishManager m_publishManager;
0490:
0491: /** A list of instanciated request handler classes. */
0492: private List m_requestHandlers;
0493:
0494: /** A list of instanciated resource init handler classes. */
0495: private List m_resourceInitHandlers;
0496:
0497: /** The runtime info factory. */
0498: private I_CmsDbContextFactory m_runtimeInfoFactory;
0499:
0500: /** The runtime properties. */
0501: private Map m_runtimeProperties;
0502:
0503: /** The configured schedule manager. */
0504: private CmsScheduleManager m_scheduleManager;
0505:
0506: /** The configured session storage provider class name. */
0507: private String m_sessionStorageProvider;
0508:
0509: /** The configured site manager. */
0510: private CmsSiteManagerImpl m_siteManager;
0511:
0512: /** The temporary file project id. */
0513: private int m_tempFileProjectId;
0514:
0515: /** The configured validation handler. */
0516: private String m_validationHandler;
0517:
0518: /**
0519: * Public constructor, will be called by configuration manager.<p>
0520: */
0521: public CmsSystemConfiguration() {
0522:
0523: setXmlFileName(DEFAULT_XML_FILE_NAME);
0524: m_historyEnabled = true;
0525: m_historyVersions = 10;
0526: m_historyVersionsAfterDeletion = -1; // use m_historyVersions instead
0527: m_resourceInitHandlers = new ArrayList();
0528: m_requestHandlers = new ArrayList();
0529: m_configuredJobs = new ArrayList();
0530: m_runtimeProperties = new HashMap();
0531: m_eventManager = new CmsEventManager();
0532: if (CmsLog.INIT.isInfoEnabled()) {
0533: CmsLog.INIT.info(Messages.get().getBundle().key(
0534: Messages.INIT_SYSTEM_CONFIG_INIT_0));
0535: }
0536: }
0537:
0538: /**
0539: * @see org.opencms.configuration.I_CmsConfigurationParameterHandler#addConfigurationParameter(java.lang.String, java.lang.String)
0540: */
0541: public void addConfigurationParameter(String paramName,
0542: String paramValue) {
0543:
0544: m_runtimeProperties.put(paramName, paramValue);
0545: }
0546:
0547: /**
0548: * Adds the event manager class.<p>
0549: *
0550: * @param clazz the class name of event manager class to instanciate and add
0551: */
0552: public void addEventManager(String clazz) {
0553:
0554: try {
0555: m_eventManager = (CmsEventManager) Class.forName(clazz)
0556: .newInstance();
0557: if (CmsLog.INIT.isInfoEnabled()) {
0558: CmsLog.INIT.info(Messages.get().getBundle().key(
0559: Messages.INIT_EVENTMANAGER_CLASS_SUCCESS_1,
0560: m_eventManager));
0561: }
0562: } catch (Throwable t) {
0563: LOG.error(Messages.get().getBundle().key(
0564: Messages.INIT_EVENTMANAGER_CLASS_INVALID_1, clazz),
0565: t);
0566: return;
0567: }
0568: }
0569:
0570: /**
0571: * Adds a new job description for the scheduler.<p>
0572: *
0573: * @param jobInfo the job description to add
0574: */
0575: public void addJobFromConfiguration(CmsScheduledJobInfo jobInfo) {
0576:
0577: m_configuredJobs.add(jobInfo);
0578:
0579: if (CmsLog.INIT.isInfoEnabled()) {
0580: CmsLog.INIT.info(Messages.get().getBundle().key(
0581: Messages.INIT_SCHEDULER_CONFIG_JOB_3,
0582: jobInfo.getJobName(), jobInfo.getClassName(),
0583: jobInfo.getContextInfo().getUserName()));
0584: }
0585: }
0586:
0587: /**
0588: * Adds a new instance of a request handler class.<p>
0589: *
0590: * @param clazz the class name of the request handler to instanciate and add
0591: */
0592: public void addRequestHandler(String clazz) {
0593:
0594: Object initClass;
0595: try {
0596: initClass = Class.forName(clazz).newInstance();
0597: } catch (Throwable t) {
0598: LOG
0599: .error(
0600: Messages
0601: .get()
0602: .getBundle()
0603: .key(
0604: Messages.LOG_INIT_REQUEST_HANDLER_FAILURE_1,
0605: clazz), t);
0606: return;
0607: }
0608: if (initClass instanceof I_CmsRequestHandler) {
0609: m_requestHandlers.add(initClass);
0610: if (CmsLog.INIT.isInfoEnabled()) {
0611: CmsLog.INIT
0612: .info(Messages
0613: .get()
0614: .getBundle()
0615: .key(
0616: Messages.INIT_REQUEST_HANDLER_SUCCESS_1,
0617: clazz));
0618: }
0619: } else {
0620: if (CmsLog.INIT.isErrorEnabled()) {
0621: CmsLog.INIT
0622: .error(Messages
0623: .get()
0624: .getBundle()
0625: .key(
0626: Messages.INIT_REQUEST_HANDLER_INVALID_1,
0627: clazz));
0628: }
0629: }
0630: }
0631:
0632: /**
0633: * Adds a new instance of a resource init handler class.<p>
0634: *
0635: * @param clazz the class name of the resource init handler to instantiate and add
0636: */
0637: public void addResourceInitHandler(String clazz) {
0638:
0639: Object initClass;
0640: try {
0641: initClass = Class.forName(clazz).newInstance();
0642: } catch (Throwable t) {
0643: LOG.error(Messages.get().getBundle().key(
0644: Messages.LOG_RESOURCE_INIT_CLASS_INVALID_1, clazz),
0645: t);
0646: return;
0647: }
0648: if (initClass instanceof I_CmsResourceInit) {
0649: m_resourceInitHandlers.add(initClass);
0650: if (CmsLog.INIT.isInfoEnabled()) {
0651: CmsLog.INIT.info(Messages.get().getBundle().key(
0652: Messages.INIT_RESOURCE_INIT_SUCCESS_1, clazz));
0653: }
0654: } else {
0655: if (CmsLog.INIT.isErrorEnabled()) {
0656: CmsLog.INIT.error(Messages.get().getBundle().key(
0657: Messages.INIT_RESOURCE_INIT_INVALID_CLASS_1,
0658: clazz));
0659: }
0660: }
0661: }
0662:
0663: /**
0664: * Generates the schedule manager.<p>
0665: */
0666: public void addScheduleManager() {
0667:
0668: m_scheduleManager = new CmsScheduleManager(m_configuredJobs);
0669: }
0670:
0671: /**
0672: * @see org.opencms.configuration.I_CmsXmlConfiguration#addXmlDigesterRules(org.apache.commons.digester.Digester)
0673: */
0674: public void addXmlDigesterRules(Digester digester) {
0675:
0676: // add finish rule
0677: digester.addCallMethod("*/" + N_SYSTEM, "initializeFinished");
0678:
0679: // add rule for internationalization
0680: digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_I18N,
0681: CmsLocaleManager.class);
0682: digester.addSetNext("*/" + N_SYSTEM + "/" + N_I18N,
0683: "setLocaleManager");
0684:
0685: // add locale handler creation rule
0686: digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_I18N + "/"
0687: + N_LOCALEHANDLER, A_CLASS,
0688: CmsConfigurationException.class);
0689: digester.addSetNext("*/" + N_SYSTEM + "/" + N_I18N + "/"
0690: + N_LOCALEHANDLER, "setLocaleHandler");
0691:
0692: // add locale rules
0693: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_I18N + "/"
0694: + N_LOCALESCONFIGURED + "/" + N_LOCALE,
0695: "addAvailableLocale", 0);
0696: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_I18N + "/"
0697: + N_LOCALESDEFAULT + "/" + N_LOCALE,
0698: "addDefaultLocale", 0);
0699:
0700: // add version history rules
0701: digester.addCallMethod(
0702: "*/" + N_SYSTEM + "/" + N_VERSIONHISTORY,
0703: "setHistorySettings", 3);
0704: digester.addCallParam("*/" + N_SYSTEM + "/" + N_VERSIONHISTORY,
0705: 0, A_ENABLED);
0706: digester.addCallParam("*/" + N_SYSTEM + "/" + N_VERSIONHISTORY,
0707: 1, A_COUNT);
0708: digester.addCallParam("*/" + N_SYSTEM + "/" + N_VERSIONHISTORY,
0709: 2, A_DELETED);
0710:
0711: // add mail configuration rule
0712: digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_MAIL,
0713: CmsMailSettings.class);
0714: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MAIL + "/"
0715: + N_MAILFROM, "setMailFromDefault", 0);
0716: digester.addSetNext("*/" + N_SYSTEM + "/" + N_MAIL,
0717: "setMailSettings");
0718:
0719: // add mail host configuration rule
0720: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MAIL + "/"
0721: + N_MAILHOST, "addMailHost", 5);
0722: digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/"
0723: + N_MAILHOST, 0, A_NAME);
0724: digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/"
0725: + N_MAILHOST, 1, A_ORDER);
0726: digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/"
0727: + N_MAILHOST, 2, A_PROTOCOL);
0728: digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/"
0729: + N_MAILHOST, 3, A_USER);
0730: digester.addCallParam("*/" + N_SYSTEM + "/" + N_MAIL + "/"
0731: + N_MAILHOST, 4, A_PASSWORD);
0732:
0733: // add scheduler creation rule
0734: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SCHEDULER,
0735: "addScheduleManager");
0736:
0737: // add scheduler job creation rule
0738: digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_SCHEDULER
0739: + "/" + N_JOB, CmsScheduledJobInfo.class);
0740: digester.addBeanPropertySetter("*/" + N_SYSTEM + "/"
0741: + N_SCHEDULER + "/" + N_JOB + "/" + N_NAME, "jobName");
0742: digester.addBeanPropertySetter("*/" + N_SYSTEM + "/"
0743: + N_SCHEDULER + "/" + N_JOB + "/" + N_CLASS,
0744: "className");
0745: digester.addBeanPropertySetter("*/" + N_SYSTEM + "/"
0746: + N_SCHEDULER + "/" + N_JOB + "/" + N_CRONEXPRESSION,
0747: "cronExpression");
0748: digester.addBeanPropertySetter("*/" + N_SYSTEM + "/"
0749: + N_SCHEDULER + "/" + N_JOB + "/" + N_REUSEINSTANCE,
0750: "reuseInstance");
0751: digester.addBeanPropertySetter("*/" + N_SYSTEM + "/"
0752: + N_SCHEDULER + "/" + N_JOB + "/" + N_ACTIVE, "active");
0753: digester.addSetNext("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/"
0754: + N_JOB, "addJobFromConfiguration");
0755:
0756: // add job context creation rule
0757: digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_SCHEDULER
0758: + "/" + N_JOB + "/" + N_CONTEXT, CmsContextInfo.class);
0759: digester.addBeanPropertySetter("*/" + N_SYSTEM + "/"
0760: + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT + "/"
0761: + N_USERNAME, "userName");
0762: digester.addBeanPropertySetter("*/" + N_SYSTEM + "/"
0763: + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT + "/"
0764: + N_PROJECT, "projectName");
0765: digester.addBeanPropertySetter("*/" + N_SYSTEM + "/"
0766: + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT + "/"
0767: + N_SITEROOT, "siteRoot");
0768: digester.addBeanPropertySetter("*/" + N_SYSTEM + "/"
0769: + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT + "/"
0770: + N_REQUESTEDURI, "requestedUri");
0771: digester.addBeanPropertySetter("*/" + N_SYSTEM + "/"
0772: + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT + "/"
0773: + N_LOCALE, "localeName");
0774: digester.addBeanPropertySetter("*/" + N_SYSTEM + "/"
0775: + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT + "/"
0776: + N_ENCODING);
0777: digester.addBeanPropertySetter("*/" + N_SYSTEM + "/"
0778: + N_SCHEDULER + "/" + N_JOB + "/" + N_CONTEXT + "/"
0779: + N_REMOTEADDR, "remoteAddr");
0780: digester.addSetNext("*/" + N_SYSTEM + "/" + N_SCHEDULER + "/"
0781: + N_JOB + "/" + N_CONTEXT, "setContextInfo");
0782:
0783: // add generic parameter rules (used for jobs, password handler)
0784: digester
0785: .addCallMethod(
0786: "*/" + I_CmsXmlConfiguration.N_PARAM,
0787: I_CmsConfigurationParameterHandler.ADD_PARAMETER_METHOD,
0788: 2);
0789: digester.addCallParam("*/" + I_CmsXmlConfiguration.N_PARAM, 0,
0790: I_CmsXmlConfiguration.A_NAME);
0791: digester.addCallParam("*/" + I_CmsXmlConfiguration.N_PARAM, 1);
0792:
0793: // add event classes
0794: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_EVENTS + "/"
0795: + N_EVENTMANAGER, "addEventManager", 1);
0796: digester.addCallParam("*/" + N_SYSTEM + "/" + N_EVENTS + "/"
0797: + N_EVENTMANAGER, 0, A_CLASS);
0798:
0799: // add resource init classes
0800: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_RESOURCEINIT
0801: + "/" + N_RESOURCEINITHANDLER,
0802: "addResourceInitHandler", 1);
0803: digester.addCallParam("*/" + N_SYSTEM + "/" + N_RESOURCEINIT
0804: + "/" + N_RESOURCEINITHANDLER, 0, A_CLASS);
0805:
0806: // add request handler classes
0807: digester.addCallMethod("*/" + N_SYSTEM + "/"
0808: + N_REQUESTHANDLERS + "/" + N_REQUESTHANDLER,
0809: "addRequestHandler", 1);
0810: digester.addCallParam("*/" + N_SYSTEM + "/" + N_REQUESTHANDLERS
0811: + "/" + N_REQUESTHANDLER, 0, A_CLASS);
0812:
0813: // add password handler creation rule
0814: digester.addObjectCreate("*/" + N_SYSTEM + "/"
0815: + N_PASSWORDHANDLER, A_CLASS,
0816: CmsConfigurationException.class);
0817: digester
0818: .addCallMethod(
0819: "*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER,
0820: I_CmsConfigurationParameterHandler.INIT_CONFIGURATION_METHOD);
0821: digester.addBeanPropertySetter("*/" + N_SYSTEM + "/"
0822: + N_PASSWORDHANDLER + "/" + N_PASSWORDENCODING,
0823: "inputEncoding");
0824: digester.addBeanPropertySetter("*/" + N_SYSTEM + "/"
0825: + N_PASSWORDHANDLER + "/" + N_DIGESTTYPE, "digestType");
0826: digester.addSetNext("*/" + N_SYSTEM + "/" + N_PASSWORDHANDLER,
0827: "setPasswordHandler");
0828:
0829: // add validation handler creation rules
0830: digester.addCallMethod("*/" + N_SYSTEM + "/"
0831: + N_VALIDATIONHANDLER, "setValidationHandler", 1);
0832: digester.addCallParam("*/" + N_SYSTEM + "/"
0833: + N_VALIDATIONHANDLER, 0, A_CLASS);
0834:
0835: // add login manager creation rules
0836: digester.addCallMethod("*/" + N_LOGINMANAGER,
0837: "setLoginManager", 2);
0838: digester.addCallParam("*/" + N_LOGINMANAGER + "/"
0839: + N_DISABLEMINUTES, 0);
0840: digester.addCallParam("*/" + N_LOGINMANAGER + "/"
0841: + N_MAXBADATTEMPTS, 1);
0842:
0843: // add login message creation rules
0844: digester.addObjectCreate("*/" + N_LOGINMESSAGE,
0845: CmsLoginMessage.class);
0846: digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/"
0847: + N_ENABLED);
0848: digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/"
0849: + N_MESSAGE);
0850: digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/"
0851: + N_LOGINFORBIDDEN);
0852: digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/"
0853: + N_TIMESTART);
0854: digester.addBeanPropertySetter("*/" + N_LOGINMESSAGE + "/"
0855: + N_TIMEEND);
0856: digester.addSetNext("*/" + N_LOGINMESSAGE, "setLoginMessage");
0857:
0858: // add site configuration rule
0859: digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_SITES,
0860: CmsSiteManagerImpl.class);
0861: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SITES + "/"
0862: + N_WORKPLACE_SERVER, "setWorkplaceServer", 0);
0863: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SITES + "/"
0864: + N_DEFAULT_URI, "setDefaultUri", 0);
0865: digester.addSetNext("*/" + N_SYSTEM + "/" + N_SITES,
0866: "setSiteManager");
0867:
0868: // add site configuration rule
0869: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SITES + "/"
0870: + N_SITE, "addSite", 5);
0871: digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/"
0872: + N_SITE, 0, A_SERVER);
0873: digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/"
0874: + N_SITE, 1, A_URI);
0875: digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/"
0876: + N_SITE + "/" + N_SECURE, 2, A_SERVER);
0877: digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/"
0878: + N_SITE + "/" + N_SECURE, 3, A_EXCLUSIVE);
0879: digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/"
0880: + N_SITE + "/" + N_SECURE, 4, A_ERROR);
0881:
0882: // add an alias to the currently configured site
0883: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_SITES + "/"
0884: + N_SITE + "/" + N_ALIAS, "addAliasToConfigSite", 1);
0885: digester.addCallParam("*/" + N_SYSTEM + "/" + N_SITES + "/"
0886: + N_SITE + "/" + N_ALIAS, 0, A_SERVER);
0887:
0888: // add compatibility parameter rules
0889: digester
0890: .addCallMethod(
0891: "*/" + N_SYSTEM + "/" + N_RUNTIMEPROPERTIES
0892: + "/" + N_PARAM,
0893: I_CmsConfigurationParameterHandler.ADD_PARAMETER_METHOD,
0894: 2);
0895: digester.addCallParam("*/" + N_SYSTEM + "/"
0896: + N_RUNTIMEPROPERTIES + "/" + N_PARAM, 0,
0897: I_CmsXmlConfiguration.A_NAME);
0898: digester.addCallParam("*/" + N_SYSTEM + "/"
0899: + N_RUNTIMEPROPERTIES + "/" + N_PARAM, 1);
0900:
0901: // add runtime classes configuration rules
0902: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_RUNTIMECLASSES
0903: + "/" + N_RUNTIMEINFO, "setRuntimeInfoFactory", 1);
0904: digester.addCallParam("*/" + N_SYSTEM + "/" + N_RUNTIMECLASSES
0905: + "/" + N_RUNTIMEINFO, 0, A_CLASS);
0906:
0907: // add default users rule
0908: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS,
0909: "setCmsDefaultUsers", 8);
0910: digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS
0911: + "/" + N_USER_ADMIN, 0);
0912: digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS
0913: + "/" + N_USER_GUEST, 1);
0914: digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS
0915: + "/" + N_USER_EXPORT, 2);
0916: digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS
0917: + "/" + N_USER_DELETEDRESOURCE, 3);
0918: digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS
0919: + "/" + N_GROUP_ADMINISTRATORS, 4);
0920: digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS
0921: + "/" + N_GROUP_PROJECTMANAGERS, 5);
0922: digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS
0923: + "/" + N_GROUP_USERS, 6);
0924: digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS
0925: + "/" + N_GROUP_GUESTS, 7);
0926:
0927: // add defaultContentEncoding rule
0928: digester.addCallMethod("*/" + N_SYSTEM + "/"
0929: + N_DEFAULT_CONTENT_ENCODING,
0930: "setDefaultContentEncoding", 1);
0931: digester.addCallParam("*/" + N_SYSTEM + "/"
0932: + N_DEFAULT_CONTENT_ENCODING, 0);
0933:
0934: // add memorymonitor configuration rule
0935: digester.addObjectCreate("*/" + N_SYSTEM + "/"
0936: + N_MEMORYMONITOR, CmsMemoryMonitorConfiguration.class);
0937: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR,
0938: "initialize", 5);
0939: digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR,
0940: 0, A_CLASS);
0941: digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR
0942: + "/" + N_MAXUSAGE_PERCENT, 1);
0943: digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR
0944: + "/" + N_LOG_INTERVAL, 2);
0945: digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR
0946: + "/" + N_EMAIL_INTERVAL, 3);
0947: digester.addCallParam("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR
0948: + "/" + N_WARNING_INTERVAL, 4);
0949: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR
0950: + "/" + N_EMAIL_SENDER, "setEmailSender", 0);
0951: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR
0952: + "/" + N_EMAIL_RECEIVER + "/" + N_RECEIVER,
0953: "addEmailReceiver", 0);
0954:
0955: // set the MemoryMonitorConfiguration initialized once before
0956: digester.addSetNext("*/" + N_SYSTEM + "/" + N_MEMORYMONITOR,
0957: "setCmsMemoryMonitorConfiguration");
0958:
0959: // add flexcache configuration rule
0960: digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_FLEXCACHE,
0961: CmsFlexCacheConfiguration.class);
0962: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_FLEXCACHE,
0963: "initialize", 6);
0964: digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/"
0965: + N_CACHE_ENABLED, 0);
0966: digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/"
0967: + N_CACHE_OFFLINE, 1);
0968: digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/"
0969: + N_MAXCACHEBYTES, 2);
0970: digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/"
0971: + N_AVGCACHEBYTES, 3);
0972: digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/"
0973: + N_MAXENTRYBYTES, 4);
0974: digester.addCallParam("*/" + N_SYSTEM + "/" + N_FLEXCACHE + "/"
0975: + N_MAXKEYS, 5);
0976:
0977: // set the FlexCacheConfiguration initialized once before
0978: digester.addSetNext("*/" + N_SYSTEM + "/" + N_FLEXCACHE,
0979: "setCmsFlexCacheConfiguration");
0980:
0981: // add http basic authentication rules
0982: digester.addObjectCreate("*/" + N_SYSTEM + "/"
0983: + N_HTTP_AUTHENTICATION,
0984: CmsHttpAuthenticationSettings.class);
0985: digester.addCallMethod("*/" + N_SYSTEM + "/"
0986: + N_HTTP_AUTHENTICATION + "/" + N_BROWSER_BASED,
0987: "setUseBrowserBasedHttpAuthentication", 0);
0988: digester.addCallMethod("*/" + N_SYSTEM + "/"
0989: + N_HTTP_AUTHENTICATION + "/" + N_FORM_BASED,
0990: "setFormBasedHttpAuthenticationUri", 0);
0991: digester.addSetNext("*/" + N_SYSTEM + "/"
0992: + N_HTTP_AUTHENTICATION,
0993: "setHttpAuthenticationSettings");
0994:
0995: // cache rules
0996: digester.addObjectCreate("*/" + N_SYSTEM + "/" + N_CACHE,
0997: CmsCacheSettings.class);
0998: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/"
0999: + N_KEYGENERATOR, "setCacheKeyGenerator", 0);
1000: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/"
1001: + N_SIZE_USERS, "setUserCacheSize", 0);
1002: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/"
1003: + N_SIZE_GROUPS, "setGroupCacheSize", 0);
1004: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/"
1005: + N_SIZE_ORGUNITS, "setOrgUnitCacheSize", 0);
1006: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/"
1007: + N_SIZE_USERGROUPS, "setUserGroupsCacheSize", 0);
1008: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/"
1009: + N_SIZE_PROJECTS, "setProjectCacheSize", 0);
1010: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/"
1011: + N_SIZE_PROJECTRESOURCES,
1012: "setProjectResourcesCacheSize", 0);
1013: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/"
1014: + N_SIZE_RESOURCES, "setResourceCacheSize", 0);
1015: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/"
1016: + N_SIZE_ROLES, "setRolesCacheSize", 0);
1017: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/"
1018: + N_SIZE_RESOURCELISTS, "setResourcelistCacheSize", 0);
1019: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/"
1020: + N_SIZE_PROPERTIES, "setPropertyCacheSize", 0);
1021: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/"
1022: + N_SIZE_PROPERTYLISTS, "setPropertyListsCacheSize", 0);
1023: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/"
1024: + N_SIZE_ACLS, "setAclCacheSize", 0);
1025: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_CACHE + "/"
1026: + N_SIZE_PERMISSIONS, "setPermissionCacheSize", 0);
1027: digester.addSetNext("*/" + N_SYSTEM + "/" + N_CACHE,
1028: "setCacheSettings");
1029:
1030: // set the notification time
1031: digester.addCallMethod("*/" + N_SYSTEM + "/"
1032: + N_CONTENT_NOTIFICATION + "/" + N_NOTIFICATION_TIME,
1033: "setNotificationTime", 1);
1034: digester
1035: .addCallParam("*/" + N_SYSTEM + "/"
1036: + N_CONTENT_NOTIFICATION + "/"
1037: + N_NOTIFICATION_TIME, 0);
1038:
1039: // set the notification project
1040: digester.addCallMethod(
1041: "*/" + N_SYSTEM + "/" + N_CONTENT_NOTIFICATION + "/"
1042: + N_NOTIFICATION_PROJECT,
1043: "setNotificationProject", 1);
1044: digester.addCallParam(
1045: "*/" + N_SYSTEM + "/" + N_CONTENT_NOTIFICATION + "/"
1046: + N_NOTIFICATION_PROJECT, 0);
1047:
1048: // add authorization handler creation rules
1049: digester.addCallMethod("*/" + N_SYSTEM + "/"
1050: + N_AUTHORIZATIONHANDLER, "setAuthorizationHandler", 1);
1051: digester.addCallParam("*/" + N_SYSTEM + "/"
1052: + N_AUTHORIZATIONHANDLER, 0, A_CLASS);
1053:
1054: // add publish manager configuration rule
1055: digester.addObjectCreate("*/" + N_SYSTEM + "/"
1056: + N_PUBLISHMANAGER, CmsPublishManager.class);
1057: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_PUBLISHMANAGER
1058: + "/" + N_HISTORYSIZE, "setPublishHistorySize", 0);
1059: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_PUBLISHMANAGER
1060: + "/" + N_QUEUEPERSISTANCE,
1061: "setPublishQueuePersistance", 0);
1062: digester.addCallMethod("*/" + N_SYSTEM + "/" + N_PUBLISHMANAGER
1063: + "/" + N_QUEUESHUTDOWNTIME,
1064: "setPublishQueueShutdowntime", 0);
1065: digester.addSetNext("*/" + N_SYSTEM + "/" + N_PUBLISHMANAGER,
1066: "setPublishManager");
1067:
1068: // add rule for session storage provider
1069: digester.addCallMethod("*/" + N_SYSTEM + "/"
1070: + N_SESSION_STORAGEPROVIDER,
1071: "setSessionStorageProvider", 1);
1072: digester.addCallParam("*/" + N_SYSTEM + "/"
1073: + N_SESSION_STORAGEPROVIDER, 0, A_CLASS);
1074:
1075: // add rule for permission handler
1076: digester.addCallMethod("*/" + N_SYSTEM + "/"
1077: + N_PERMISSIONHANDLER, "setPermissionHandler", 1);
1078: digester.addCallParam("*/" + N_SYSTEM + "/"
1079: + N_PERMISSIONHANDLER, 0, A_CLASS);
1080: }
1081:
1082: /**
1083: * @see org.opencms.configuration.I_CmsXmlConfiguration#generateXml(org.dom4j.Element)
1084: */
1085: public Element generateXml(Element parent) {
1086:
1087: // generate vfs node and subnodes
1088: Element systemElement = parent.addElement(N_SYSTEM);
1089:
1090: if (OpenCms.getRunLevel() >= OpenCms.RUNLEVEL_3_SHELL_ACCESS) {
1091: // initialized OpenCms instance is available, use latest values
1092: m_localeManager = OpenCms.getLocaleManager();
1093: m_mailSettings = OpenCms.getSystemInfo().getMailSettings();
1094: m_configuredJobs = OpenCms.getScheduleManager().getJobs();
1095: m_historyEnabled = OpenCms.getSystemInfo()
1096: .isHistoryEnabled();
1097: m_historyVersions = OpenCms.getSystemInfo()
1098: .getHistoryVersions();
1099: m_historyVersionsAfterDeletion = OpenCms.getSystemInfo()
1100: .getHistoryVersionsAfterDeletion();
1101: // m_resourceInitHandlers instance must be the one from configuration
1102: // m_requestHandlers instance must be the one from configuration
1103: m_siteManager = OpenCms.getSiteManager();
1104: m_loginManager = OpenCms.getLoginManager();
1105: m_loginMessage = OpenCms.getLoginManager()
1106: .getLoginMessage();
1107: }
1108:
1109: // i18n nodes
1110: Element i18nElement = systemElement.addElement(N_I18N);
1111: i18nElement.addElement(N_LOCALEHANDLER)
1112: .addAttribute(
1113: A_CLASS,
1114: m_localeManager.getLocaleHandler().getClass()
1115: .getName());
1116: Iterator i;
1117: Element localesElement;
1118: localesElement = i18nElement.addElement(N_LOCALESCONFIGURED);
1119: i = m_localeManager.getAvailableLocales().iterator();
1120: while (i.hasNext()) {
1121: Locale locale = (Locale) i.next();
1122: localesElement.addElement(N_LOCALE).addText(
1123: locale.toString());
1124: }
1125: localesElement = i18nElement.addElement(N_LOCALESDEFAULT);
1126: i = m_localeManager.getDefaultLocales().iterator();
1127: while (i.hasNext()) {
1128: Locale locale = (Locale) i.next();
1129: localesElement.addElement(N_LOCALE).setText(
1130: locale.toString());
1131: }
1132:
1133: // mail nodes
1134: Element mailElement = systemElement.addElement(N_MAIL);
1135: mailElement.addElement(N_MAILFROM).setText(
1136: m_mailSettings.getMailFromDefault());
1137: i = m_mailSettings.getMailHosts().iterator();
1138: while (i.hasNext()) {
1139: CmsMailHost host = (CmsMailHost) i.next();
1140: Element hostElement = mailElement.addElement(N_MAILHOST)
1141: .addAttribute(A_NAME, host.getHostname())
1142: .addAttribute(A_ORDER, host.getOrder().toString())
1143: .addAttribute(A_PROTOCOL, host.getProtocol());
1144: if (host.isAuthenticating()) {
1145: hostElement.addAttribute(A_USER, host.getUsername())
1146: .addAttribute(A_PASSWORD, host.getPassword());
1147: }
1148: }
1149:
1150: // scheduler node
1151: Element schedulerElement = systemElement
1152: .addElement(N_SCHEDULER);
1153: i = m_configuredJobs.iterator();
1154: while (i.hasNext()) {
1155: CmsScheduledJobInfo jobInfo = (CmsScheduledJobInfo) i
1156: .next();
1157: Element jobElement = schedulerElement.addElement(N_JOB);
1158: jobElement.addElement(N_NAME).addText(jobInfo.getJobName());
1159: jobElement.addElement(N_CLASS).addText(
1160: jobInfo.getClassName());
1161: jobElement.addElement(N_REUSEINSTANCE).addText(
1162: String.valueOf(jobInfo.isReuseInstance()));
1163: jobElement.addElement(N_ACTIVE).addText(
1164: String.valueOf(jobInfo.isActive()));
1165: jobElement.addElement(N_CRONEXPRESSION).addCDATA(
1166: jobInfo.getCronExpression());
1167: Element contextElement = jobElement.addElement(N_CONTEXT);
1168: contextElement.addElement(N_USERNAME).setText(
1169: jobInfo.getContextInfo().getUserName());
1170: contextElement.addElement(N_PROJECT).setText(
1171: jobInfo.getContextInfo().getProjectName());
1172: contextElement.addElement(N_SITEROOT).setText(
1173: jobInfo.getContextInfo().getSiteRoot());
1174: contextElement.addElement(N_REQUESTEDURI).setText(
1175: jobInfo.getContextInfo().getRequestedUri());
1176: contextElement.addElement(N_LOCALE).setText(
1177: jobInfo.getContextInfo().getLocaleName());
1178: contextElement.addElement(N_ENCODING).setText(
1179: jobInfo.getContextInfo().getEncoding());
1180: contextElement.addElement(N_REMOTEADDR).setText(
1181: jobInfo.getContextInfo().getRemoteAddr());
1182: Map jobParameters = jobInfo.getConfiguration();
1183: if ((jobParameters != null) && (jobParameters.size() > 0)) {
1184: Element parameterElement = jobElement
1185: .addElement(N_PARAMETERS);
1186: Iterator it = jobParameters.entrySet().iterator();
1187: while (it.hasNext()) {
1188: Map.Entry entry = (Map.Entry) it.next();
1189: String name = (String) entry.getKey();
1190: String value = (String) entry.getValue();
1191: Element paramNode = parameterElement
1192: .addElement(N_PARAM);
1193: paramNode.addAttribute(A_NAME, name);
1194: paramNode.addText(value);
1195: }
1196: }
1197: }
1198:
1199: // <events> node
1200: Element eventsElement = systemElement.addElement(N_EVENTS);
1201: Element eventManagerElement = eventsElement
1202: .addElement(N_EVENTMANAGER);
1203: eventManagerElement.addAttribute(A_CLASS, m_eventManager
1204: .getClass().getName());
1205:
1206: // version history
1207: Element historyElement = systemElement
1208: .addElement(N_VERSIONHISTORY);
1209: historyElement.addAttribute(A_ENABLED, String
1210: .valueOf(m_historyEnabled));
1211: historyElement.addAttribute(A_COUNT, new Integer(
1212: m_historyVersions).toString());
1213: historyElement.addAttribute(A_DELETED, new Integer(
1214: m_historyVersionsAfterDeletion).toString());
1215:
1216: // resourceinit
1217: Element resourceinitElement = systemElement
1218: .addElement(N_RESOURCEINIT);
1219: i = m_resourceInitHandlers.iterator();
1220: while (i.hasNext()) {
1221: I_CmsResourceInit clazz = (I_CmsResourceInit) i.next();
1222: Element handlerElement = resourceinitElement
1223: .addElement(N_RESOURCEINITHANDLER);
1224: handlerElement.addAttribute(A_CLASS, clazz.getClass()
1225: .getName());
1226: }
1227:
1228: // request handlers
1229: Element requesthandlersElement = systemElement
1230: .addElement(N_REQUESTHANDLERS);
1231: i = m_requestHandlers.iterator();
1232: while (i.hasNext()) {
1233: I_CmsRequestHandler clazz = (I_CmsRequestHandler) i.next();
1234: Element handlerElement = requesthandlersElement
1235: .addElement(N_REQUESTHANDLER);
1236: handlerElement.addAttribute(A_CLASS, clazz.getClass()
1237: .getName());
1238: }
1239:
1240: // password handler
1241: Element passwordhandlerElement = systemElement.addElement(
1242: N_PASSWORDHANDLER).addAttribute(A_CLASS,
1243: m_passwordHandler.getClass().getName());
1244: passwordhandlerElement.addElement(N_PASSWORDENCODING).addText(
1245: m_passwordHandler.getInputEncoding());
1246: passwordhandlerElement.addElement(N_DIGESTTYPE).addText(
1247: m_passwordHandler.getDigestType());
1248: Map handlerParameters = m_passwordHandler.getConfiguration();
1249: if (handlerParameters != null) {
1250: Iterator it = handlerParameters.entrySet().iterator();
1251: while (it.hasNext()) {
1252: Map.Entry entry = (Map.Entry) it.next();
1253: String name = (String) entry.getKey();
1254: String value = (String) entry.getValue();
1255: Element paramNode = passwordhandlerElement
1256: .addElement(N_PARAM);
1257: paramNode.addAttribute(A_NAME, name);
1258: paramNode.addText(value);
1259: }
1260: }
1261:
1262: // validation handler
1263: if (m_validationHandler != null) {
1264: Element valHandlerElem = systemElement
1265: .addElement(N_VALIDATIONHANDLER);
1266: valHandlerElem.addAttribute(A_CLASS, m_validationHandler);
1267: }
1268:
1269: // login manager
1270: if (m_loginManager != null) {
1271: Element managerElement = systemElement
1272: .addElement(N_LOGINMANAGER);
1273: managerElement.addElement(N_DISABLEMINUTES).addText(
1274: String.valueOf(m_loginManager.getDisableMinutes()));
1275: managerElement.addElement(N_MAXBADATTEMPTS).addText(
1276: String.valueOf(m_loginManager.getMaxBadAttempts()));
1277: }
1278:
1279: // login message
1280: if (m_loginMessage != null) {
1281: Element messageElement = systemElement
1282: .addElement(N_LOGINMESSAGE);
1283: messageElement.addElement(N_ENABLED).addText(
1284: String.valueOf(m_loginMessage.isEnabled()));
1285: messageElement.addElement(N_MESSAGE).addCDATA(
1286: m_loginMessage.getMessage());
1287: messageElement.addElement(N_LOGINFORBIDDEN).addText(
1288: String.valueOf(m_loginMessage.isLoginForbidden()));
1289: if (m_loginMessage.getTimeStart() != CmsLoginMessage.DEFAULT_TIME_START) {
1290: messageElement.addElement(N_TIMESTART).addText(
1291: String.valueOf(m_loginMessage.getTimeStart()));
1292: }
1293: if (m_loginMessage.getTimeEnd() != CmsLoginMessage.DEFAULT_TIME_END) {
1294: messageElement.addElement(N_TIMEEND).addText(
1295: String.valueOf(m_loginMessage.getTimeEnd()));
1296: }
1297: }
1298:
1299: // create <sites> node
1300: Element sitesElement = systemElement.addElement(N_SITES);
1301: sitesElement.addElement(N_WORKPLACE_SERVER).addText(
1302: m_siteManager.getWorkplaceServer());
1303: sitesElement.addElement(N_DEFAULT_URI).addText(
1304: m_siteManager.getDefaultUri());
1305: Iterator siteIterator = new HashSet(m_siteManager.getSites()
1306: .values()).iterator();
1307: while (siteIterator.hasNext()) {
1308: CmsSite site = (CmsSite) siteIterator.next();
1309: // create <site server="" uri=""/> subnode(s)
1310: Element siteElement = sitesElement.addElement(N_SITE);
1311:
1312: siteElement.addAttribute(A_SERVER, site.getSiteMatcher()
1313: .toString());
1314: siteElement.addAttribute(A_URI, site.getSiteRoot().concat(
1315: "/"));
1316: // create <secure server=""/> subnode
1317: if (site.hasSecureServer()) {
1318: Element secureElem = siteElement.addElement(N_SECURE);
1319: secureElem.addAttribute(A_SERVER, site.getSecureUrl());
1320: secureElem.addAttribute(A_EXCLUSIVE, ""
1321: + site.isExclusiveUrl());
1322: secureElem.addAttribute(A_ERROR, ""
1323: + site.isExclusiveError());
1324: }
1325: // create <alias server=""/> subnode(s)
1326: Iterator aliasIterator = site.getAliases().iterator();
1327: while (aliasIterator.hasNext()) {
1328: String aliasServerName = ((CmsSiteMatcher) aliasIterator
1329: .next()).getUrl();
1330: siteElement.addElement(N_ALIAS).addAttribute(A_SERVER,
1331: aliasServerName);
1332: }
1333: }
1334:
1335: // create <runtimeproperties> node
1336: Element runtimepropertiesElement = systemElement
1337: .addElement(N_RUNTIMEPROPERTIES);
1338: if (m_runtimeProperties != null) {
1339: List sortedRuntimeProperties = new ArrayList(
1340: m_runtimeProperties.keySet());
1341: Collections.sort(sortedRuntimeProperties);
1342: Iterator it = sortedRuntimeProperties.iterator();
1343: while (it.hasNext()) {
1344: String key = (String) it.next();
1345: // create <param name="">value</param> subnodes
1346: runtimepropertiesElement.addElement(N_PARAM)
1347: .addAttribute(A_NAME, key).addText(
1348: (String) m_runtimeProperties.get(key));
1349: }
1350: }
1351:
1352: // create <runtimeinfo> node
1353: Element runtimeinfoElement = systemElement
1354: .addElement(N_RUNTIMECLASSES);
1355: Element runtimeinfofactoryElement = runtimeinfoElement
1356: .addElement(N_RUNTIMEINFO);
1357: runtimeinfofactoryElement.addAttribute(A_CLASS,
1358: getRuntimeInfoFactory().getClass().getName());
1359:
1360: // create <defaultusers> node
1361: Element defaultusersElement = systemElement
1362: .addElement(N_DEFAULTUSERS);
1363: // create <user-admin> subnode
1364: defaultusersElement.addElement(N_USER_ADMIN).addText(
1365: m_cmsDefaultUsers.getUserAdmin());
1366: // create <user-guest> subnode
1367: defaultusersElement.addElement(N_USER_GUEST).addText(
1368: m_cmsDefaultUsers.getUserGuest());
1369: // create <user-export> subnode
1370: defaultusersElement.addElement(N_USER_EXPORT).addText(
1371: m_cmsDefaultUsers.getUserExport());
1372: if (!m_cmsDefaultUsers.getUserDeletedResource().equals(
1373: m_cmsDefaultUsers.getUserAdmin())) {
1374: // create <user-deletedresource> subnode
1375: defaultusersElement
1376: .addElement(N_USER_DELETEDRESOURCE)
1377: .addText(m_cmsDefaultUsers.getUserDeletedResource());
1378: }
1379: // create <group-administrators> subnode
1380: defaultusersElement.addElement(N_GROUP_ADMINISTRATORS).addText(
1381: m_cmsDefaultUsers.getGroupAdministrators());
1382: // create <group-projectmanagers> subnode
1383: defaultusersElement.addElement(N_GROUP_PROJECTMANAGERS)
1384: .addText(m_cmsDefaultUsers.getGroupProjectmanagers());
1385: // create <group-users> subnode
1386: defaultusersElement.addElement(N_GROUP_USERS).addText(
1387: m_cmsDefaultUsers.getGroupUsers());
1388: // create <group-guests> subnode
1389: defaultusersElement.addElement(N_GROUP_GUESTS).addText(
1390: m_cmsDefaultUsers.getGroupGuests());
1391:
1392: // create <defaultcontentencoding> node
1393: systemElement.addElement(N_DEFAULT_CONTENT_ENCODING).addText(
1394: getDefaultContentEncoding());
1395:
1396: // create <memorymonitor> node
1397: if (m_cmsMemoryMonitorConfiguration != null) {
1398: Element memorymonitorElement = systemElement
1399: .addElement(N_MEMORYMONITOR);
1400: if (CmsStringUtil
1401: .isNotEmptyOrWhitespaceOnly(m_cmsMemoryMonitorConfiguration
1402: .getClassName())) {
1403: memorymonitorElement.addAttribute(A_CLASS,
1404: m_cmsMemoryMonitorConfiguration.getClassName());
1405: }
1406: if (m_cmsMemoryMonitorConfiguration.getMaxUsagePercent() > 0) {
1407: memorymonitorElement
1408: .addElement(N_MAXUSAGE_PERCENT)
1409: .addText(
1410: String
1411: .valueOf(m_cmsMemoryMonitorConfiguration
1412: .getMaxUsagePercent()));
1413: }
1414: if (m_cmsMemoryMonitorConfiguration.getLogInterval() > 0) {
1415: memorymonitorElement
1416: .addElement(N_LOG_INTERVAL)
1417: .addText(
1418: String
1419: .valueOf(m_cmsMemoryMonitorConfiguration
1420: .getLogInterval()));
1421: }
1422: if (m_cmsMemoryMonitorConfiguration.getEmailInterval() > 0) {
1423: memorymonitorElement
1424: .addElement(N_EMAIL_INTERVAL)
1425: .addText(
1426: String
1427: .valueOf(m_cmsMemoryMonitorConfiguration
1428: .getEmailInterval()));
1429: }
1430: if (m_cmsMemoryMonitorConfiguration.getWarningInterval() > 0) {
1431: memorymonitorElement
1432: .addElement(N_WARNING_INTERVAL)
1433: .addText(
1434: String
1435: .valueOf(m_cmsMemoryMonitorConfiguration
1436: .getWarningInterval()));
1437: }
1438: if (m_cmsMemoryMonitorConfiguration.getEmailSender() != null) {
1439: memorymonitorElement.addElement(N_EMAIL_SENDER)
1440: .addText(
1441: m_cmsMemoryMonitorConfiguration
1442: .getEmailSender());
1443: }
1444: List emailReceiver = m_cmsMemoryMonitorConfiguration
1445: .getEmailReceiver();
1446: if (!emailReceiver.isEmpty()) {
1447: Element emailreceiverElement = memorymonitorElement
1448: .addElement(N_EMAIL_RECEIVER);
1449: Iterator iter = emailReceiver.iterator();
1450: while (iter.hasNext()) {
1451: emailreceiverElement.addElement(N_RECEIVER)
1452: .addText((String) iter.next());
1453: }
1454: }
1455: }
1456:
1457: // create <flexcache> node
1458: Element flexcacheElement = systemElement
1459: .addElement(N_FLEXCACHE);
1460: flexcacheElement.addElement(N_CACHE_ENABLED).addText(
1461: String.valueOf(m_cmsFlexCacheConfiguration
1462: .isCacheEnabled()));
1463: flexcacheElement.addElement(N_CACHE_OFFLINE).addText(
1464: String.valueOf(m_cmsFlexCacheConfiguration
1465: .isCacheOffline()));
1466: flexcacheElement.addElement(N_MAXCACHEBYTES).addText(
1467: String.valueOf(m_cmsFlexCacheConfiguration
1468: .getMaxCacheBytes()));
1469: flexcacheElement.addElement(N_AVGCACHEBYTES).addText(
1470: String.valueOf(m_cmsFlexCacheConfiguration
1471: .getAvgCacheBytes()));
1472: flexcacheElement.addElement(N_MAXENTRYBYTES).addText(
1473: String.valueOf(m_cmsFlexCacheConfiguration
1474: .getMaxEntryBytes()));
1475: flexcacheElement.addElement(N_MAXKEYS).addText(
1476: String
1477: .valueOf(m_cmsFlexCacheConfiguration
1478: .getMaxKeys()));
1479:
1480: // create <http-authentication> node
1481: Element httpAuthenticationElement = systemElement
1482: .addElement(N_HTTP_AUTHENTICATION);
1483: httpAuthenticationElement.addElement(N_BROWSER_BASED).setText(
1484: Boolean.toString(m_httpAuthenticationSettings
1485: .useBrowserBasedHttpAuthentication()));
1486: if (m_httpAuthenticationSettings
1487: .getFormBasedHttpAuthenticationUri() != null) {
1488: httpAuthenticationElement.addElement(N_FORM_BASED).setText(
1489: m_httpAuthenticationSettings
1490: .getFormBasedHttpAuthenticationUri());
1491: }
1492:
1493: // cache settings
1494: Element cacheElement = systemElement.addElement(N_CACHE);
1495: cacheElement.addElement(N_KEYGENERATOR).setText(
1496: m_cacheSettings.getCacheKeyGenerator());
1497: cacheElement.addElement(N_SIZE_USERS).setText(
1498: Integer.toString(m_cacheSettings.getUserCacheSize()));
1499: cacheElement.addElement(N_SIZE_GROUPS).setText(
1500: Integer.toString(m_cacheSettings.getGroupCacheSize()));
1501: if (m_cacheSettings.getConfiguredOrgUnitCacheSize() > -1) {
1502: cacheElement.addElement(N_SIZE_ORGUNITS).setText(
1503: Integer.toString(m_cacheSettings
1504: .getConfiguredOrgUnitCacheSize()));
1505: }
1506: cacheElement.addElement(N_SIZE_USERGROUPS).setText(
1507: Integer.toString(m_cacheSettings
1508: .getUserGroupsCacheSize()));
1509: cacheElement.addElement(N_SIZE_PROJECTS)
1510: .setText(
1511: Integer.toString(m_cacheSettings
1512: .getProjectCacheSize()));
1513: if (m_cacheSettings.getConfiguredProjectResourcesCacheSize() > -1) {
1514: cacheElement.addElement(N_SIZE_PROJECTRESOURCES).setText(
1515: Integer.toString(m_cacheSettings
1516: .getConfiguredProjectResourcesCacheSize()));
1517: }
1518: cacheElement.addElement(N_SIZE_RESOURCES).setText(
1519: Integer
1520: .toString(m_cacheSettings
1521: .getResourceCacheSize()));
1522: if (m_cacheSettings.getConfiguredRolesCacheSize() > -1) {
1523: cacheElement.addElement(N_SIZE_ROLES).setText(
1524: Integer.toString(m_cacheSettings
1525: .getConfiguredRolesCacheSize()));
1526: }
1527: cacheElement.addElement(N_SIZE_RESOURCELISTS).setText(
1528: Integer.toString(m_cacheSettings
1529: .getResourcelistCacheSize()));
1530: cacheElement.addElement(N_SIZE_PROPERTIES).setText(
1531: Integer
1532: .toString(m_cacheSettings
1533: .getPropertyCacheSize()));
1534: if (m_cacheSettings.getConfiguredPropertyListsCacheSize() > -1) {
1535: cacheElement.addElement(N_SIZE_PROPERTYLISTS).setText(
1536: Integer.toString(m_cacheSettings
1537: .getConfiguredPropertyListsCacheSize()));
1538: }
1539: cacheElement.addElement(N_SIZE_ACLS).setText(
1540: Integer.toString(m_cacheSettings.getAclCacheSize()));
1541: cacheElement.addElement(N_SIZE_PERMISSIONS).setText(
1542: Integer.toString(m_cacheSettings
1543: .getPermissionCacheSize()));
1544:
1545: // content notification settings
1546: if ((m_notificationTime != null)
1547: || (m_notificationProject != null)) {
1548: Element notificationElement = systemElement
1549: .addElement(N_CONTENT_NOTIFICATION);
1550: if (m_notificationTime != null) {
1551: notificationElement.addElement(N_NOTIFICATION_TIME)
1552: .setText(m_notificationTime.toString());
1553: }
1554: if (m_notificationProject != null) {
1555: notificationElement.addElement(N_NOTIFICATION_PROJECT)
1556: .setText(m_notificationProject);
1557: }
1558: }
1559:
1560: // authorization handler
1561: if (m_authorizationHandler != null) {
1562: Element authorizationHandlerElem = systemElement
1563: .addElement(N_AUTHORIZATIONHANDLER);
1564: authorizationHandlerElem.addAttribute(A_CLASS,
1565: m_authorizationHandler);
1566: }
1567:
1568: // optional publish manager nodes
1569: if (m_publishManager != null) {
1570: Element pubHistElement = systemElement
1571: .addElement(N_PUBLISHMANAGER);
1572: pubHistElement.addElement(N_HISTORYSIZE).setText(
1573: String.valueOf(m_publishManager
1574: .getPublishHistorySize()));
1575: // optional nodes for publish queue
1576: pubHistElement.addElement(N_QUEUEPERSISTANCE).setText(
1577: String.valueOf(m_publishManager
1578: .isPublishQueuePersistanceEnabled()));
1579: pubHistElement.addElement(N_QUEUESHUTDOWNTIME).setText(
1580: String.valueOf(m_publishManager
1581: .getPublishQueueShutdowntime()));
1582: }
1583:
1584: // session storage provider
1585: if (m_sessionStorageProvider != null) {
1586: Element sessionStorageProviderElem = systemElement
1587: .addElement(N_SESSION_STORAGEPROVIDER);
1588: sessionStorageProviderElem.addAttribute(A_CLASS,
1589: m_sessionStorageProvider);
1590: }
1591:
1592: // permission handler
1593: if (m_permissionHandler != null) {
1594: Element permissionHandlerElem = systemElement
1595: .addElement(N_PERMISSIONHANDLER);
1596: permissionHandlerElem.addAttribute(A_CLASS,
1597: m_permissionHandler);
1598: }
1599:
1600: // return the system node
1601: return systemElement;
1602: }
1603:
1604: /**
1605: * Returns an instance of the configured authorization handler.<p>
1606: *
1607: * @return an instance of the configured authorization handler
1608: */
1609: public I_CmsAuthorizationHandler getAuthorizationHandler() {
1610:
1611: if (CmsStringUtil
1612: .isEmptyOrWhitespaceOnly(m_authorizationHandler)) {
1613: return new CmsDefaultAuthorizationHandler();
1614: }
1615: try {
1616: I_CmsAuthorizationHandler authorizationHandler = (I_CmsAuthorizationHandler) Class
1617: .forName(m_authorizationHandler).newInstance();
1618: if (LOG.isInfoEnabled()) {
1619: LOG
1620: .info(Messages
1621: .get()
1622: .getBundle()
1623: .key(
1624: Messages.INIT_AUTHORIZATION_HANDLER_CLASS_SUCCESS_1,
1625: m_authorizationHandler));
1626: }
1627: return authorizationHandler;
1628: } catch (Throwable t) {
1629: LOG
1630: .error(
1631: Messages
1632: .get()
1633: .getBundle()
1634: .key(
1635: Messages.INIT_AUTHORIZATION_HANDLER_CLASS_INVALID_1,
1636: m_authorizationHandler), t);
1637: return new CmsDefaultAuthorizationHandler();
1638: }
1639: }
1640:
1641: /**
1642: * Returns the settings of the driver manager.<p>
1643: *
1644: * @return the settings of the driver manager
1645: */
1646: public CmsCacheSettings getCacheSettings() {
1647:
1648: return m_cacheSettings;
1649: }
1650:
1651: /**
1652: * Returns the default users.<p>
1653: *
1654: * @return the default users
1655: */
1656: public CmsDefaultUsers getCmsDefaultUsers() {
1657:
1658: return m_cmsDefaultUsers;
1659: }
1660:
1661: /**
1662: * Returns the flexCacheConfiguration.<p>
1663: *
1664: * @return the flexCacheConfiguration
1665: */
1666: public CmsFlexCacheConfiguration getCmsFlexCacheConfiguration() {
1667:
1668: return m_cmsFlexCacheConfiguration;
1669: }
1670:
1671: /**
1672: * Returns the memory monitor configuration.<p>
1673: *
1674: * @return the memory monitor configuration
1675: */
1676: public CmsMemoryMonitorConfiguration getCmsMemoryMonitorConfiguration() {
1677:
1678: return m_cmsMemoryMonitorConfiguration;
1679: }
1680:
1681: /**
1682: * Returns the defaultContentEncoding.<p>
1683: *
1684: * @return the defaultContentEncoding
1685: */
1686: public String getDefaultContentEncoding() {
1687:
1688: return m_defaultContentEncoding;
1689: }
1690:
1691: /**
1692: * @see org.opencms.configuration.I_CmsXmlConfiguration#getDtdFilename()
1693: */
1694: public String getDtdFilename() {
1695:
1696: return CONFIGURATION_DTD_NAME;
1697: }
1698:
1699: /**
1700: * Returns the configured OpenCms event manager instance.<p>
1701: *
1702: * @return the configured OpenCms event manager instance
1703: */
1704: public CmsEventManager getEventManager() {
1705:
1706: return m_eventManager;
1707: }
1708:
1709: /**
1710: * Returns the maximum number of versions that are kept per resource in the VFS version history.<p>
1711: *
1712: * If the version history is disabled, this setting has no effect.<p>
1713: *
1714: * @return the maximum number of versions that are kept per resource
1715: *
1716: * @see #isHistoryEnabled()
1717: */
1718: public int getHistoryVersions() {
1719:
1720: return m_historyVersions;
1721: }
1722:
1723: /**
1724: * Returns the maximum number of versions that are kept in the VFS version history for deleted resources.<p>
1725: *
1726: * If the version history is disabled, this setting has no effect.<p>
1727: *
1728: * @return the maximum number of versions that are kept for deleted resources
1729: *
1730: * @see #isHistoryEnabled()
1731: */
1732: public int getHistoryVersionsAfterDeletion() {
1733:
1734: return m_historyVersionsAfterDeletion;
1735: }
1736:
1737: /**
1738: * Returns the HTTP authentication settings.<p>
1739: *
1740: * @return the HTTP authentication settings
1741: */
1742: public CmsHttpAuthenticationSettings getHttpAuthenticationSettings() {
1743:
1744: return m_httpAuthenticationSettings;
1745: }
1746:
1747: /**
1748: * Returns the configured locale manager for multi language support.<p>
1749: *
1750: * @return the configured locale manager for multi language support
1751: */
1752: public CmsLocaleManager getLocaleManager() {
1753:
1754: return m_localeManager;
1755: }
1756:
1757: /**
1758: * Returns the configured login manager.<p>
1759: *
1760: * @return the configured login manager
1761: */
1762: public CmsLoginManager getLoginManager() {
1763:
1764: if (m_loginManager == null) {
1765: // no login manager configured, create default
1766: m_loginManager = new CmsLoginManager(
1767: CmsLoginManager.DISABLE_MINUTES_DEFAULT,
1768: CmsLoginManager.MAX_BAD_ATTEMPTS_DEFAULT);
1769: }
1770: if (m_loginMessage != null) {
1771: // null OpenCms object is ok during configuration
1772: try {
1773: m_loginManager.setLoginMessage(null, m_loginMessage);
1774: } catch (CmsRoleViolationException e) {
1775: // this should never happen
1776: }
1777: }
1778: return m_loginManager;
1779: }
1780:
1781: /**
1782: * Returns the configured mail settings.<p>
1783: *
1784: * @return the configured mail settings
1785: */
1786: public CmsMailSettings getMailSettings() {
1787:
1788: return m_mailSettings;
1789: }
1790:
1791: /**
1792: * Returns the project in which timestamps for the content notification are read.<p>
1793: *
1794: * @return the project in which timestamps for the content notification are read
1795: */
1796: public String getNotificationProject() {
1797:
1798: return m_notificationProject;
1799: }
1800:
1801: /**
1802: * Returns the duration after which responsibles will be notified about out-dated content (in days).<p>
1803: *
1804: * @return the duration after which responsibles will be notified about out-dated content
1805: */
1806: public int getNotificationTime() {
1807:
1808: if (m_notificationTime != null) {
1809: return m_notificationTime.intValue();
1810: } else {
1811: return -1;
1812: }
1813: }
1814:
1815: /**
1816: * Returns the configured password handler.<p>
1817: *
1818: * @return the configured password handler
1819: */
1820: public I_CmsPasswordHandler getPasswordHandler() {
1821:
1822: return m_passwordHandler;
1823: }
1824:
1825: /**
1826: * Returns the permission Handler class name.<p>
1827: *
1828: * @return the permission Handler class name
1829: */
1830: public String getPermissionHandler() {
1831:
1832: return m_permissionHandler;
1833: }
1834:
1835: /**
1836: * Returns the configured publish manager.<p>
1837: *
1838: * @return the configured publish manager
1839: */
1840: public CmsPublishManager getPublishManager() {
1841:
1842: if (m_publishManager == null) {
1843: // no publish manager configured, create default
1844: m_publishManager = new CmsPublishManager(
1845: CmsPublishManager.DEFAULT_HISTORY_SIZE,
1846: CmsPublishManager.DEFAULT_QUEUE_PERSISTANCE,
1847: CmsPublishManager.DEFAULT_QUEUE_SHUTDOWNTIME);
1848: }
1849: return m_publishManager;
1850: }
1851:
1852: /**
1853: * Returns the list of instanciated request handler classes.<p>
1854: *
1855: * @return the list of instanciated request handler classes
1856: */
1857: public List getRequestHandlers() {
1858:
1859: return m_requestHandlers;
1860: }
1861:
1862: /**
1863: * Returns the list of instanciated resource init handler classes.<p>
1864: *
1865: * @return the list of instanciated resource init handler classes
1866: */
1867: public List getResourceInitHandlers() {
1868:
1869: return m_resourceInitHandlers;
1870: }
1871:
1872: /**
1873: * Returns the runtime info factory instance.<p>
1874: *
1875: * @return the runtime info factory instance
1876: */
1877: public I_CmsDbContextFactory getRuntimeInfoFactory() {
1878:
1879: return m_runtimeInfoFactory;
1880: }
1881:
1882: /**
1883: * Returns the runtime Properties.<p>
1884: *
1885: * @return the runtime Properties
1886: */
1887: public Map getRuntimeProperties() {
1888:
1889: return m_runtimeProperties;
1890: }
1891:
1892: /**
1893: * Returns the configured schedule manager.<p>
1894: *
1895: * @return the configured schedule manager
1896: */
1897: public CmsScheduleManager getScheduleManager() {
1898:
1899: return m_scheduleManager;
1900: }
1901:
1902: /**
1903: * Returns an instance of the configured session storage provider.<p>
1904: *
1905: * @return an instance of the configured session storage provider
1906: */
1907: public I_CmsSessionStorageProvider getSessionStorageProvider() {
1908:
1909: if (CmsStringUtil
1910: .isEmptyOrWhitespaceOnly(m_sessionStorageProvider)) {
1911: return new CmsDefaultSessionStorageProvider();
1912: }
1913: try {
1914: I_CmsSessionStorageProvider sessionCacheProvider = (I_CmsSessionStorageProvider) Class
1915: .forName(m_sessionStorageProvider).newInstance();
1916: if (CmsLog.INIT.isInfoEnabled()) {
1917: CmsLog.INIT
1918: .info(Messages
1919: .get()
1920: .getBundle()
1921: .key(
1922: Messages.INIT_SESSION_STORAGEPROVIDER_SUCCESS_1,
1923: m_sessionStorageProvider));
1924: }
1925: return sessionCacheProvider;
1926: } catch (Throwable t) {
1927: LOG
1928: .error(
1929: Messages
1930: .get()
1931: .getBundle()
1932: .key(
1933: Messages.LOG_INIT_SESSION_STORAGEPROVIDER_FAILURE_1,
1934: m_sessionStorageProvider),
1935: t);
1936: return new CmsDefaultSessionStorageProvider();
1937: }
1938: }
1939:
1940: /**
1941: * Returns the site manager.<p>
1942: *
1943: * @return the site manager
1944: */
1945: public CmsSiteManagerImpl getSiteManager() {
1946:
1947: return m_siteManager;
1948: }
1949:
1950: /**
1951: * Returns temporary file project id.<p>
1952: *
1953: * @return temporary file project id
1954: */
1955: public int getTempFileProjectId() {
1956:
1957: return m_tempFileProjectId;
1958: }
1959:
1960: /**
1961: * Returns an instance of the configured validation handler.<p>
1962: *
1963: * @return an instance of the configured validation handler
1964: */
1965: public I_CmsValidationHandler getValidationHandler() {
1966:
1967: if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_validationHandler)) {
1968: return new CmsDefaultValidationHandler();
1969: }
1970: try {
1971: I_CmsValidationHandler validationHandler = (I_CmsValidationHandler) Class
1972: .forName(m_validationHandler).newInstance();
1973: if (LOG.isInfoEnabled()) {
1974: LOG
1975: .info(Messages
1976: .get()
1977: .getBundle()
1978: .key(
1979: Messages.INIT_VALIDATION_HANDLER_CLASS_SUCCESS_1,
1980: m_validationHandler));
1981: }
1982: return validationHandler;
1983: } catch (Throwable t) {
1984: LOG.error(Messages.get().getBundle().key(
1985: Messages.INIT_VALIDATION_HANDLER_CLASS_INVALID_1,
1986: m_validationHandler), t);
1987: return new CmsDefaultValidationHandler();
1988: }
1989: }
1990:
1991: /**
1992: * Will be called when configuration of this object is finished.<p>
1993: */
1994: public void initializeFinished() {
1995:
1996: if (CmsLog.INIT.isInfoEnabled()) {
1997: CmsLog.INIT.info(Messages.get().getBundle().key(
1998: Messages.INIT_SYSTEM_CONFIG_FINISHED_0));
1999: }
2000: }
2001:
2002: /**
2003: * Returns if the VFS version history is enabled.<p>
2004: *
2005: * @return if the VFS version history is enabled
2006: */
2007: public boolean isHistoryEnabled() {
2008:
2009: return m_historyEnabled;
2010: }
2011:
2012: /**
2013: * Sets the authorization handler.<p>
2014: *
2015: * @param authorizationHandlerClass the authorization handler class to set.
2016: */
2017: public void setAuthorizationHandler(String authorizationHandlerClass) {
2018:
2019: m_authorizationHandler = authorizationHandlerClass;
2020: }
2021:
2022: /**
2023: * Sets the settings of the driver manager.<p>
2024: *
2025: * @param settings the settings of the driver manager
2026: */
2027: public void setCacheSettings(CmsCacheSettings settings) {
2028:
2029: m_cacheSettings = settings;
2030: }
2031:
2032: /**
2033: * Sets the CmsDefaultUsers.<p>
2034: *
2035: * @param userAdmin the name of the default admin user
2036: * @param userGuest the name of the guest user
2037: * @param userExport the name of the export user
2038: * @param userDeletedResource the name of the deleted resource user, can be <code>null</code>
2039: * @param groupAdministrators the name of the administrators group
2040: * @param groupProjectmanagers the name of the project managers group
2041: * @param groupUsers the name of the users group
2042: * @param groupGuests the name of the guests group
2043: */
2044: public void setCmsDefaultUsers(
2045:
2046: String userAdmin, String userGuest, String userExport,
2047: String userDeletedResource, String groupAdministrators,
2048: String groupProjectmanagers, String groupUsers,
2049: String groupGuests) {
2050:
2051: if (CmsLog.INIT.isInfoEnabled()) {
2052: CmsLog.INIT.info(Messages.get().getBundle().key(
2053: Messages.INIT_CHECKING_DEFAULT_USER_NAMES_0));
2054: }
2055: m_cmsDefaultUsers = new CmsDefaultUsers(userAdmin, userGuest,
2056: userExport, userDeletedResource, groupAdministrators,
2057: groupProjectmanagers, groupUsers, groupGuests);
2058:
2059: if (CmsLog.INIT.isInfoEnabled()) {
2060: CmsLog.INIT.info(Messages.get().getBundle().key(
2061: Messages.INIT_ADMIN_USER_1,
2062: m_cmsDefaultUsers.getUserAdmin()));
2063: CmsLog.INIT.info(Messages.get().getBundle().key(
2064: Messages.INIT_GUEST_USER_1,
2065: m_cmsDefaultUsers.getUserGuest()));
2066: CmsLog.INIT.info(Messages.get().getBundle().key(
2067: Messages.INIT_EXPORT_USER_1,
2068: m_cmsDefaultUsers.getUserExport()));
2069: CmsLog.INIT.info(Messages.get().getBundle().key(
2070: Messages.INIT_DELETED_RESOURCE_USER_1,
2071: m_cmsDefaultUsers.getUserDeletedResource()));
2072: CmsLog.INIT.info(Messages.get().getBundle().key(
2073: Messages.INIT_ADMIN_GROUP_1,
2074: m_cmsDefaultUsers.getGroupAdministrators()));
2075: CmsLog.INIT.info(Messages.get().getBundle().key(
2076: Messages.INIT_PROJECT_MANAGERS_GROUP_1,
2077: m_cmsDefaultUsers.getGroupProjectmanagers()));
2078: CmsLog.INIT.info(Messages.get().getBundle().key(
2079: Messages.INIT_USERS_GROUP_1,
2080: m_cmsDefaultUsers.getGroupUsers()));
2081: CmsLog.INIT.info(Messages.get().getBundle().key(
2082: Messages.INIT_GUESTS_GROUP_1,
2083: m_cmsDefaultUsers.getGroupGuests()));
2084: CmsLog.INIT.info(Messages.get().getBundle().key(
2085: Messages.INIT_DEFAULT_USER_NAMES_INITIALIZED_0));
2086: }
2087: }
2088:
2089: /**
2090: * Sets the flexCacheConfiguration.<p>
2091: *
2092: * @param flexCacheConfiguration the flexCacheConfiguration to set
2093: */
2094: public void setCmsFlexCacheConfiguration(
2095: CmsFlexCacheConfiguration flexCacheConfiguration) {
2096:
2097: m_cmsFlexCacheConfiguration = flexCacheConfiguration;
2098: }
2099:
2100: /**
2101: * Sets the cmsMemoryMonitorConfiguration.<p>
2102: *
2103: * @param cmsMemoryMonitorConfiguration the cmsMemoryMonitorConfiguration to set
2104: */
2105: public void setCmsMemoryMonitorConfiguration(
2106: CmsMemoryMonitorConfiguration cmsMemoryMonitorConfiguration) {
2107:
2108: m_cmsMemoryMonitorConfiguration = cmsMemoryMonitorConfiguration;
2109: }
2110:
2111: /**
2112: * Sets the defaultContentEncoding.<p>
2113: *
2114: * @param defaultContentEncoding the defaultContentEncoding to set
2115: */
2116: public void setDefaultContentEncoding(String defaultContentEncoding) {
2117:
2118: m_defaultContentEncoding = defaultContentEncoding;
2119: }
2120:
2121: /**
2122: * VFS version history settings are set here.<p>
2123: *
2124: * @param historyEnabled if true the history is enabled
2125: * @param historyVersions the maximum number of versions that are kept per VFS resource
2126: * @param historyVersionsAfterDeletion the maximum number of versions for deleted resources
2127: */
2128: public void setHistorySettings(String historyEnabled,
2129: String historyVersions, String historyVersionsAfterDeletion) {
2130:
2131: m_historyEnabled = Boolean.valueOf(historyEnabled)
2132: .booleanValue();
2133: m_historyVersions = Integer.valueOf(historyVersions).intValue();
2134: m_historyVersionsAfterDeletion = Integer.valueOf(
2135: historyVersionsAfterDeletion).intValue();
2136: if (CmsLog.INIT.isInfoEnabled()) {
2137: CmsLog.INIT.info(Messages.get().getBundle().key(
2138: Messages.INIT_HISTORY_SETTINGS_3,
2139: Boolean.valueOf(m_historyEnabled),
2140: new Integer(m_historyVersions),
2141: new Integer(m_historyVersionsAfterDeletion)));
2142: }
2143: }
2144:
2145: /**
2146: * Sets the HTTP authentication settings.<p>
2147: *
2148: * @param httpAuthenticationSettings the HTTP authentication settings to set
2149: */
2150: public void setHttpAuthenticationSettings(
2151: CmsHttpAuthenticationSettings httpAuthenticationSettings) {
2152:
2153: m_httpAuthenticationSettings = httpAuthenticationSettings;
2154: }
2155:
2156: /**
2157: * Sets the locale manager for multi language support.<p>
2158: *
2159: * @param localeManager the locale manager to set
2160: */
2161: public void setLocaleManager(CmsLocaleManager localeManager) {
2162:
2163: m_localeManager = localeManager;
2164: if (CmsLog.INIT.isInfoEnabled()) {
2165: CmsLog.INIT.info(Messages.get().getBundle().key(
2166: Messages.INIT_CONFIG_I18N_FINISHED_0));
2167: }
2168: }
2169:
2170: /**
2171: * Sets the configured login manager.<p>
2172: *
2173: * @param maxBadAttemptsStr the number of allowed bad login attempts
2174: * @param disableMinutesStr the time an account gets locked if to many bad logins are attempted
2175: */
2176: public void setLoginManager(String disableMinutesStr,
2177: String maxBadAttemptsStr) {
2178:
2179: int disableMinutes;
2180: try {
2181: disableMinutes = Integer.valueOf(disableMinutesStr)
2182: .intValue();
2183: } catch (NumberFormatException e) {
2184: disableMinutes = CmsLoginManager.DISABLE_MINUTES_DEFAULT;
2185: }
2186: int maxBadAttempts;
2187: try {
2188: maxBadAttempts = Integer.valueOf(maxBadAttemptsStr)
2189: .intValue();
2190: } catch (NumberFormatException e) {
2191: maxBadAttempts = CmsLoginManager.MAX_BAD_ATTEMPTS_DEFAULT;
2192: }
2193: m_loginManager = new CmsLoginManager(disableMinutes,
2194: maxBadAttempts);
2195: if (CmsLog.INIT.isInfoEnabled()) {
2196: CmsLog.INIT.info(Messages.get().getBundle().key(
2197: Messages.INIT_LOGINMANAGER_2,
2198: new Integer(disableMinutes),
2199: new Integer(maxBadAttempts)));
2200: }
2201: }
2202:
2203: /**
2204: * Adds the login message from the configuration.<p>
2205: *
2206: * @param message the login message to add
2207: */
2208: public void setLoginMessage(CmsLoginMessage message) {
2209:
2210: m_loginMessage = message;
2211: if (CmsLog.INIT.isInfoEnabled()) {
2212: CmsLog.INIT.info(Messages.get().getBundle().key(
2213: Messages.INIT_LOGINMESSAGE_3,
2214: Boolean.valueOf(message.isEnabled()),
2215: Boolean.valueOf(message.isLoginForbidden()),
2216: message.getMessage()));
2217: }
2218: }
2219:
2220: /**
2221: * Sets the mail settings.<p>
2222: *
2223: * @param mailSettings the mail settings to set.
2224: */
2225: public void setMailSettings(CmsMailSettings mailSettings) {
2226:
2227: m_mailSettings = mailSettings;
2228: if (LOG.isDebugEnabled()) {
2229: LOG.debug(Messages.get().getBundle().key(
2230: Messages.LOG_MAIL_SETTINGS_1, mailSettings));
2231: }
2232: }
2233:
2234: /**
2235: * Sets the project in which timestamps for the content notification are read.<p>
2236: *
2237: * @param notificationProject the project in which timestamps for the content notification are read
2238: */
2239: public void setNotificationProject(String notificationProject) {
2240:
2241: m_notificationProject = notificationProject;
2242: if (CmsLog.INIT.isInfoEnabled()) {
2243: CmsLog.INIT.info(Messages.get().getBundle().key(
2244: Messages.INIT_NOTIFICATION_PROJECT_1,
2245: m_notificationProject));
2246: }
2247: }
2248:
2249: /**
2250: * Sets the duration after which responsibles will be notified about out-dated content (in days).<p>
2251: *
2252: * @param notificationTime the duration after which responsibles will be notified about out-dated content
2253: */
2254: public void setNotificationTime(String notificationTime) {
2255:
2256: try {
2257: m_notificationTime = new Integer(notificationTime);
2258: } catch (Throwable t) {
2259: m_notificationTime = new Integer(-1);
2260: }
2261: if (CmsLog.INIT.isInfoEnabled()) {
2262: CmsLog.INIT.info(Messages.get().getBundle().key(
2263: Messages.INIT_NOTIFICATION_TIME_1,
2264: m_notificationTime));
2265: }
2266: }
2267:
2268: /**
2269: * Sets the password handler class.<p>
2270: *
2271: * @param passwordHandler the password handler to set
2272: */
2273: public void setPasswordHandler(I_CmsPasswordHandler passwordHandler) {
2274:
2275: m_passwordHandler = passwordHandler;
2276: if (CmsLog.INIT.isInfoEnabled()) {
2277: CmsLog.INIT.info(Messages.get().getBundle().key(
2278: Messages.INIT_PWD_HANDLER_SUCCESS_1,
2279: passwordHandler.getClass().getName()));
2280: }
2281: }
2282:
2283: /**
2284: * Sets the permission Handler class name.<p>
2285: *
2286: * @param permissionHandler the class name to set
2287: */
2288: public void setPermissionHandler(String permissionHandler) {
2289:
2290: m_permissionHandler = permissionHandler;
2291: }
2292:
2293: /**
2294: * Sets the publish manager.<p>
2295: *
2296: * @param publishManager the publish manager
2297: */
2298: public void setPublishManager(CmsPublishManager publishManager) {
2299:
2300: m_publishManager = publishManager;
2301: }
2302:
2303: /**
2304: * Sets the runtime info factory.<p>
2305: *
2306: * @param className the class name of the configured runtime info factory
2307: */
2308: public void setRuntimeInfoFactory(String className) {
2309:
2310: Object objectInstance;
2311:
2312: try {
2313: objectInstance = Class.forName(className).newInstance();
2314: } catch (Throwable t) {
2315: LOG
2316: .error(Messages.get().getBundle().key(
2317: Messages.LOG_RESOURCE_INIT_FAILURE_1,
2318: className), t);
2319: return;
2320: }
2321:
2322: if (objectInstance instanceof I_CmsDbContextFactory) {
2323: m_runtimeInfoFactory = (I_CmsDbContextFactory) objectInstance;
2324: if (CmsLog.INIT.isInfoEnabled()) {
2325: CmsLog.INIT.info(Messages.get().getBundle().key(
2326: Messages.INIT_RUNTIME_INFO_FACTORY_SUCCESS_1,
2327: className));
2328: }
2329: } else {
2330: if (CmsLog.INIT.isFatalEnabled()) {
2331: CmsLog.INIT.fatal(Messages.get().getBundle().key(
2332: Messages.INIT_RUNTIME_INFO_FACTORY_FAILURE_1,
2333: className));
2334: }
2335: }
2336:
2337: }
2338:
2339: /**
2340: * Sets the session storage provider.<p>
2341: *
2342: * @param sessionStorageProviderClass the session storage provider class to set.
2343: */
2344: public void setSessionStorageProvider(
2345: String sessionStorageProviderClass) {
2346:
2347: m_sessionStorageProvider = sessionStorageProviderClass;
2348: }
2349:
2350: /**
2351: * Sets the site manager.<p>
2352: *
2353: * @param siteManager the site manager to set
2354: */
2355: public void setSiteManager(CmsSiteManagerImpl siteManager) {
2356:
2357: m_siteManager = siteManager;
2358: if (CmsLog.INIT.isInfoEnabled()) {
2359: CmsLog.INIT.info(Messages.get().getBundle().key(
2360: Messages.INIT_SITE_CONFIG_FINISHED_0));
2361: }
2362: }
2363:
2364: /**
2365: * Sets the temporary file project id.<p>
2366: *
2367: * @param tempFileProjectId the temporary file project id to set
2368: */
2369: public void setTempFileProjectId(String tempFileProjectId) {
2370:
2371: try {
2372: m_tempFileProjectId = Integer.valueOf(tempFileProjectId)
2373: .intValue();
2374: } catch (Throwable t) {
2375: m_tempFileProjectId = -1;
2376: }
2377: if (CmsLog.INIT.isInfoEnabled()) {
2378: CmsLog.INIT.info(Messages.get().getBundle().key(
2379: Messages.INIT_TEMPFILE_PROJECT_ID_1,
2380: new Integer(m_tempFileProjectId)));
2381: }
2382: }
2383:
2384: /**
2385: * Sets the validation handler.<p>
2386: *
2387: * @param validationHandlerClass the validation handler class to set.
2388: */
2389: public void setValidationHandler(String validationHandlerClass) {
2390:
2391: m_validationHandler = validationHandlerClass;
2392: }
2393: }
|