/** * Returns the XML content type manager.<p> * * @return the XML content type manager */ protected CmsXmlContentTypeManager getXmlContentTypeManager() { if (m_xmlContentTypeManager != null) { return m_xmlContentTypeManager; } if (getRunLevel() == OpenCms.RUNLEVEL_1_CORE_OBJECT) { // this is only to enable test cases to run m_xmlContentTypeManager = CmsXmlContentTypeManager.createTypeManagerForTestCases(); } return m_xmlContentTypeManager; }
/** * Returns the XML content type manager.<p> * * @return the XML content type manager */ protected CmsXmlContentTypeManager getXmlContentTypeManager() { if (m_xmlContentTypeManager != null) { return m_xmlContentTypeManager; } if (getRunLevel() == OpenCms.RUNLEVEL_1_CORE_OBJECT) { // this is only to enable test cases to run m_xmlContentTypeManager = CmsXmlContentTypeManager.createTypeManagerForTestCases(); } return m_xmlContentTypeManager; }
/** * Returns the current OpenCms run level.<p> * * The following runlevels are defined: * <dl> * <dt>Runlevel {@link OpenCms#RUNLEVEL_0_OFFLINE}:</dt><dd> * OpenCms is in the process of being shut down, the system is offline.</dd> * * <dt>Runlevel {@link OpenCms#RUNLEVEL_1_CORE_OBJECT}:</dt><dd> * OpenCms instance available, but configuration has not been processed. * No database or VFS available.</dd> * * <dt>Runlevel {@link OpenCms#RUNLEVEL_2_INITIALIZING}:</dt><dd> * OpenCms is initializing, but the process is not finished. * The database with the VFS is currently being connected but can't be accessed.</dd> * * <dt>Runlevel {@link OpenCms#RUNLEVEL_3_SHELL_ACCESS}:</dt><dd> * OpenCms database and VFS available, but http processing (i.e. servlet) not initialized. * This is the runlevel the OpenCms shell operates in.</dd> * * <dt>Runlevel {@link OpenCms#RUNLEVEL_4_SERVLET_ACCESS}:</dt><dd> * OpenCms fully initialized, servlet and database available. * This is the "default" when OpenCms is in normal operation.</dd> * </dl> * * @return the OpenCms run level */ public static int getRunLevel() { return OpenCmsCore.getInstance().getRunLevel(); }
/** * Returns the current OpenCms run level.<p> * * The following runlevels are defined: * <dl> * <dt>Runlevel {@link OpenCms#RUNLEVEL_0_OFFLINE}:</dt><dd> * OpenCms is in the process of being shut down, the system is offline.</dd> * * <dt>Runlevel {@link OpenCms#RUNLEVEL_1_CORE_OBJECT}:</dt><dd> * OpenCms instance available, but configuration has not been processed. * No database or VFS available.</dd> * * <dt>Runlevel {@link OpenCms#RUNLEVEL_2_INITIALIZING}:</dt><dd> * OpenCms is initializing, but the process is not finished. * The database with the VFS is currently being connected but can't be accessed.</dd> * * <dt>Runlevel {@link OpenCms#RUNLEVEL_3_SHELL_ACCESS}:</dt><dd> * OpenCms database and VFS available, but http processing (i.e. servlet) not initialized. * This is the runlevel the OpenCms shell operates in.</dd> * * <dt>Runlevel {@link OpenCms#RUNLEVEL_4_SERVLET_ACCESS}:</dt><dd> * OpenCms fully initialized, servlet and database available. * This is the "default" when OpenCms is in normal operation.</dd> * </dl> * * @return the OpenCms run level */ public static int getRunLevel() { return OpenCmsCore.getInstance().getRunLevel(); }
if ((m_instance != null) && (getRunLevel() >= OpenCms.RUNLEVEL_2_INITIALIZING)) { if (getRunLevel() != OpenCms.RUNLEVEL_1_CORE_OBJECT) { CmsLog.INIT.error(Messages.get().getBundle().key( Messages.LOG_WRONG_INIT_SEQUENCE_2, new Integer(3), new Integer(getRunLevel()))); return m_instance;
if ((m_instance != null) && (getRunLevel() >= OpenCms.RUNLEVEL_2_INITIALIZING)) { if (getRunLevel() != OpenCms.RUNLEVEL_1_CORE_OBJECT) { CmsLog.INIT.error( Messages.get().getBundle().key( Messages.LOG_WRONG_INIT_SEQUENCE_2, new Integer(3), new Integer(getRunLevel()))); return m_instance;
if ((m_instance != null) && (getRunLevel() >= OpenCms.RUNLEVEL_4_SERVLET_ACCESS)) { if (getRunLevel() != OpenCms.RUNLEVEL_1_CORE_OBJECT) { CmsLog.INIT.error( Messages.get().getBundle().key( Messages.LOG_WRONG_INIT_SEQUENCE_2, new Integer(4), new Integer(getRunLevel()))); return m_instance;
if (errorStatus != null) { if (OpenCmsCore.getInstance().getRunLevel() > OpenCms.RUNLEVEL_3_SHELL_ACCESS) {
if (errorStatus != null) { if (OpenCmsCore.getInstance().getRunLevel() > OpenCms.RUNLEVEL_3_SHELL_ACCESS) {
/** * Sets the error condition.<p> * * @param errorCondition the error condition to set */ protected static void setErrorCondition(CmsMessageContainer errorCondition) { // init exceptions should only be thrown during setup process if ((m_instance != null) && (m_instance.getRunLevel() < OpenCms.RUNLEVEL_3_SHELL_ACCESS)) { if (!Messages.ERR_CRITICAL_INIT_WIZARD_0.equals(errorCondition.getKey())) { // if wizard is still enabled allow retry of initialization (for setup wizard) m_errorCondition = errorCondition; // output an error message to the console System.err.println( Messages.get().getBundle().key(Messages.LOG_INIT_FAILURE_MESSAGE_1, errorCondition.key())); } LOG.error(errorCondition.key(), new CmsException(errorCondition)); m_instance = null; } else if (m_instance != null) { // OpenCms already was successful initialized LOG.warn( Messages.get().getBundle().key( Messages.LOG_INIT_INVALID_ERROR_2, new Integer(m_instance.getRunLevel()), errorCondition.key())); } }
if ((m_instance != null) && (getRunLevel() >= OpenCms.RUNLEVEL_4_SERVLET_ACCESS)) { if (getRunLevel() != OpenCms.RUNLEVEL_1_CORE_OBJECT) { CmsLog.INIT.error(Messages.get().getBundle().key( Messages.LOG_WRONG_INIT_SEQUENCE_2, new Integer(4), new Integer(getRunLevel()))); return m_instance;
/** * Sets the error condition.<p> * * @param errorCondition the error condition to set */ protected static void setErrorCondition(CmsMessageContainer errorCondition) { // init exceptions should only be thrown during setup process if ((m_instance != null) && (m_instance.getRunLevel() < OpenCms.RUNLEVEL_3_SHELL_ACCESS)) { if (!Messages.ERR_CRITICAL_INIT_WIZARD_0.equals(errorCondition.getKey())) { // if wizard is still enabled allow retry of initialization (for setup wizard) m_errorCondition = errorCondition; // output an error message to the console System.err.println(Messages.get().getBundle().key( Messages.LOG_INIT_FAILURE_MESSAGE_1, errorCondition.key())); } LOG.error(errorCondition.key(), new CmsException(errorCondition)); m_instance = null; } else if (m_instance != null) { // OpenCms already was successfull initialized LOG.warn(Messages.get().getBundle().key( Messages.LOG_INIT_INVALID_ERROR_2, new Integer(m_instance.getRunLevel()), errorCondition.key())); } }
/** * Protected constructor that will initialize the singleton OpenCms instance * with runlevel {@link OpenCms#RUNLEVEL_1_CORE_OBJECT}.<p> * * @throws CmsInitException in case of errors during the initialization */ private OpenCmsCore() throws CmsInitException { synchronized (LOCK) { if ((m_instance != null) && (m_instance.getRunLevel() > OpenCms.RUNLEVEL_0_OFFLINE)) { throw new CmsInitException(Messages.get().container(Messages.ERR_ALREADY_INITIALIZED_0)); } initMembers(); m_instance = this; setRunLevel(OpenCms.RUNLEVEL_1_CORE_OBJECT); } }
/** * Protected constructor that will initialize the singleton OpenCms instance * with runlevel {@link OpenCms#RUNLEVEL_1_CORE_OBJECT}.<p> * * @throws CmsInitException in case of errors during the initialization */ private OpenCmsCore() throws CmsInitException { synchronized (LOCK) { if ((m_instance != null) && (m_instance.getRunLevel() > OpenCms.RUNLEVEL_0_OFFLINE)) { throw new CmsInitException(Messages.get().container(Messages.ERR_ALREADY_INITIALIZED_0)); } initMembers(); m_instance = this; setRunLevel(OpenCms.RUNLEVEL_1_CORE_OBJECT); } }
int runlevel = OpenCmsCore.getInstance().getRunLevel();
int runlevel = OpenCmsCore.getInstance().getRunLevel();
int runlevel = OpenCmsCore.getInstance().getRunLevel();
if (getRunLevel() > OpenCms.RUNLEVEL_0_OFFLINE) { System.err.println( Messages.get().getBundle().key( getSystemInfo().getVersionNumber() + " [" + getSystemInfo().getVersionId() + "]")); CmsLog.INIT.info( Messages.get().getBundle().key(Messages.INIT_CURRENT_RUNLEVEL_1, new Integer(getRunLevel()))); CmsLog.INIT.info( Messages.get().getBundle().key(
if (getRunLevel() > OpenCms.RUNLEVEL_0_OFFLINE) { System.err.println(Messages.get().getBundle().key( Messages.LOG_SHUTDOWN_CONSOLE_NOTE_2, CmsLog.INIT.info(Messages.get().getBundle().key( Messages.INIT_CURRENT_RUNLEVEL_1, new Integer(getRunLevel()))); CmsLog.INIT.info(Messages.get().getBundle().key( Messages.INIT_SHUTDOWN_TIME_1,