/** * Creates a new multi exception, a container for several exception messages.<p> */ public CmsMultiException() { this(Messages.get().container(Messages.ERR_MULTI_EXCEPTION_1, new Integer(0))); }
/** * Creates a new multi exception, a container for several exception messages.<p> */ public CmsMultiException() { this(Messages.get().container(Messages.ERR_MULTI_EXCEPTION_1, new Integer(0))); }
/** * Creates a resource init exception for a given resource init handler class.<p> * * @param cls the resource init handler class */ public CmsResourceInitException(Class<? extends I_CmsResourceInit> cls) { this(Messages.get().container(Messages.ERR_RESOURCE_INIT_ABORTED_1, cls.getName())); }
/** * Sets the default encoding, called after the configuration files have been read.<p> * * @param encoding the default encoding to set */ protected void setDefaultEncoding(String encoding) { m_defaultEncoding = encoding.intern(); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.LOG_SET_DEFAULT_ENCODING_1, m_defaultEncoding)); } }
/** * Sets the default encoding, called after the configuration files have been read.<p> * * @param encoding the default encoding to set */ protected void setDefaultEncoding(String encoding) { m_defaultEncoding = encoding.intern(); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.LOG_SET_DEFAULT_ENCODING_1, m_defaultEncoding)); } }
/** * Updates the intenal message for the Exception.<p> */ protected void updateMessage() { if (!hasIndividualMessage()) { m_message = Messages.get().container(Messages.ERR_MULTI_EXCEPTION_1, new Integer(m_exceptions.size())); } } }
/** * Updates the intenal message for the Exception.<p> */ protected void updateMessage() { if (!hasIndividualMessage()) { m_message = Messages.get().container(Messages.ERR_MULTI_EXCEPTION_1, new Integer(m_exceptions.size())); } } }
/** * Sets the server name.<p> * * The server name is set in <code>opencms.properties</code>. * It is not related to any DNS name the server might also have. * The server name is useful e.g. in a cluster to distinguish different servers, * or if you compare log files from multiple servers.<p> * * @param serverName the server name to set */ protected void setServerName(String serverName) { m_serverName = serverName; if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.LOG_SET_SERVERNAME_1, m_serverName)); } }
/** * Sets the server name.<p> * * The server name is set in <code>opencms.properties</code>. * It is not related to any DNS name the server might also have. * The server name is useful e.g. in a cluster to distinguish different servers, * or if you compare log files from multiple servers.<p> * * @param serverName the server name to set */ protected void setServerName(String serverName) { m_serverName = serverName; if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.LOG_SET_SERVERNAME_1, m_serverName)); } }
/** * Checks if this context info configuration is frozen.<p> * * @throws CmsRuntimeException in case the configuration is already frozen */ protected void checkFrozen() throws CmsRuntimeException { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONTEXT_INFO_FROZEN_0)); } } }
/** * Checks if this context info configuration is frozen.<p> * * @throws CmsRuntimeException in case the configuration is already frozen */ protected void checkFrozen() throws CmsRuntimeException { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONTEXT_INFO_FROZEN_0)); } } }
/** * Sets the init level of this OpenCmsCore object instance.<p> * * For a detailed description about the possible run levels, * please see {@link OpenCms#getRunLevel()}.<p> * * @param level the level to set */ private void setRunLevel(int level) { if (m_instance != null) { if (m_instance.m_runLevel >= OpenCms.RUNLEVEL_1_CORE_OBJECT) { // otherwise the log is not available if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info( Messages.get().getBundle().key( Messages.INIT_RUNLEVEL_CHANGE_2, new Integer(m_instance.m_runLevel), new Integer(level))); } } m_instance.m_runLevel = level; } }
/** * Called by the {@link OpenCmsListener} when a http session is created.<p> * * @param event the http session event * * @see javax.servlet.http.HttpSessionListener#sessionCreated(javax.servlet.http.HttpSessionEvent) * @see OpenCmsListener#sessionCreated(HttpSessionEvent) */ protected void sessionCreated(HttpSessionEvent event) { synchronized (m_lockSessionCount) { m_sessionCountCurrent = (m_sessionCountCurrent <= 0) ? 1 : (m_sessionCountCurrent + 1); m_sessionCountTotal++; if (LOG.isInfoEnabled()) { LOG.info(Messages.get().getBundle().key( Messages.LOG_SESSION_CREATED_2, new Integer(m_sessionCountTotal), new Integer(m_sessionCountCurrent))); } } if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_SESSION_CREATED_1, event.getSession().getId())); } }
/** * Sets the init level of this OpenCmsCore object instance.<p> * * For a detailed description about the possible run levels, * please see {@link OpenCms#getRunLevel()}.<p> * * @param level the level to set */ private void setRunLevel(int level) { if (m_instance != null) { if (m_instance.m_runLevel >= OpenCms.RUNLEVEL_1_CORE_OBJECT) { // otherwise the log is not available if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key( Messages.INIT_RUNLEVEL_CHANGE_2, new Integer(m_instance.m_runLevel), new Integer(level))); } } m_instance.m_runLevel = level; } }
/** * Method to dump all currently known Threads.<p> */ private void dumpThreads() { if (LOG.isDebugEnabled()) { StringBuffer b = new StringBuffer(512); Iterator i = m_threads.keySet().iterator(); while (i.hasNext()) { CmsUUID key = (CmsUUID)i.next(); A_CmsReportThread thread = (A_CmsReportThread)m_threads.get(key); b.append(thread.getName()); b.append(" - "); b.append(thread.getUUID()); b.append('\n'); } LOG.debug(Messages.get().getBundle().key( Messages.LOG_THREADSTORE_POOL_CONTENT_2, new Integer(m_threads.size()), b.toString())); } } }
/** * Method to dump all currently known Threads.<p> */ private void dumpThreads() { if (LOG.isDebugEnabled()) { StringBuffer b = new StringBuffer(512); Iterator<CmsUUID> i = m_threads.keySet().iterator(); while (i.hasNext()) { CmsUUID key = i.next(); A_CmsReportThread thread = m_threads.get(key); b.append(thread.getName()); b.append(" - "); b.append(thread.getUUID()); b.append('\n'); } LOG.debug( Messages.get().getBundle().key( Messages.LOG_THREADSTORE_POOL_CONTENT_2, new Integer(m_threads.size()), b.toString())); } } }
/** * Adds the specified request handler to the Map of OpenCms request handlers. <p> * * @param handler the handler to add */ protected void addRequestHandler(I_CmsRequestHandler handler) { if (handler == null) { return; } String[] names = handler.getHandlerNames(); for (int i = 0; i < names.length; i++) { String name = names[i]; if (m_requestHandlers.get(name) != null) { CmsLog.INIT.error(Messages.get().getBundle().key(Messages.LOG_DUPLICATE_REQUEST_HANDLER_1, name)); continue; } m_requestHandlers.put(name, handler); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info( Messages.get().getBundle().key( Messages.INIT_ADDED_REQUEST_HANDLER_2, name, handler.getClass().getName())); } } }
/** * Writes the XML configuration for the provided configuration class.<p> * * @param clazz the configuration class to write the XML for */ protected void writeConfiguration(Class clazz) { // exception handling is provided here to ensure identical log messages try { m_configurationManager.writeConfiguration(clazz); } catch (IOException e) { CmsLog.getLog(CmsConfigurationManager.class).error( Messages.get().getBundle().key(Messages.LOG_ERROR_WRITING_CONFIG_1, clazz.getName()), e); } catch (CmsConfigurationException e) { CmsLog.getLog(CmsConfigurationManager.class).error( Messages.get().getBundle().key(Messages.LOG_ERROR_WRITING_CONFIG_1, clazz.getName()), e); } }
/** * Writes the XML configuration for the provided configuration class.<p> * * @param clazz the configuration class to write the XML for */ protected void writeConfiguration(Class<?> clazz) { // exception handling is provided here to ensure identical log messages try { m_configurationManager.writeConfiguration(clazz); } catch (IOException e) { CmsLog.getLog(CmsConfigurationManager.class).error( Messages.get().getBundle().key(Messages.LOG_ERROR_WRITING_CONFIG_1, clazz.getName()), e); } catch (CmsConfigurationException e) { CmsLog.getLog(CmsConfigurationManager.class).error( Messages.get().getBundle().key(Messages.LOG_ERROR_WRITING_CONFIG_1, clazz.getName()), e); } }
/** * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent) */ public void contextInitialized(ServletContextEvent event) { try { // upgrade the OpenCms runlevel OpenCmsCore.getInstance().upgradeRunlevel(event.getServletContext()); } catch (CmsInitException e) { if (e.isNewError()) { // only log new init errors LOG.error(e.getLocalizedMessage(), e); } } catch (Throwable t) { // make sure all other errors are displayed in the OpenCms log LOG.error(Messages.get().getBundle().key(Messages.LOG_ERROR_GENERIC_0), t); // throw a new init Exception to make sure a "context destroyed" event is triggered throw new CmsInitException(Messages.get().container(Messages.ERR_CRITICAL_INIT_GENERIC_1, t.getMessage())); } }