/** * @see org.opencms.main.CmsRuntimeException#createException(org.opencms.i18n.CmsMessageContainer, java.lang.Throwable) */ @Override public CmsRuntimeException createException(CmsMessageContainer container, Throwable cause) { return new CmsInitException(container, cause); }
/** * @see org.opencms.main.CmsRuntimeException#createException(org.opencms.i18n.CmsMessageContainer, java.lang.Throwable) */ @Override public CmsRuntimeException createException(CmsMessageContainer container, Throwable cause) { return new CmsInitException(container, cause); }
/** * Returns the initialized OpenCms singleton instance.<p> * * @return the initialized OpenCms singleton instance */ protected static OpenCmsCore getInstance() { if (m_errorCondition != null) { // OpenCms is not properly initialized throw new CmsInitException(m_errorCondition, false); } if (m_instance == null) { try { // create a new core object with runlevel 1 m_instance = new OpenCmsCore(); } catch (CmsInitException e) { // already initialized, this is all we need } } return m_instance; }
/** * Public constructor for user defined relation types.<p> * * @param id the id of the relation type * @param name the name of the relation * @param type the type of relation type, strong or weak */ public CmsRelationType(int id, String name, String type) { m_name = name.toUpperCase(); if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_2_INITIALIZING) { // allow relation type definitions only during startup throw new CmsInitException(Messages.get().container(Messages.ERR_RELATION_TYPE_INIT_1, m_name)); } m_strong = type.toUpperCase().equals(VALUE_STRONG); m_defInContent = false; m_id = USER_DEFINED_MODE_LIMIT + id; }
/** * Public constructor for user defined relation types.<p> * * @param id the id of the relation type * @param name the name of the relation * @param type the type of relation type, strong or weak */ public CmsRelationType(int id, String name, String type) { m_name = name.toUpperCase(); if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_2_INITIALIZING) { // allow relation type definitions only during startup throw new CmsInitException(Messages.get().container(Messages.ERR_RELATION_TYPE_INIT_1, m_name)); } m_strong = type.toUpperCase().equals(VALUE_STRONG); m_defInContent = false; m_id = USER_DEFINED_MODE_LIMIT + id; }
/** * Returns the initialized OpenCms singleton instance.<p> * * @return the initialized OpenCms singleton instance */ protected static OpenCmsCore getInstance() { if (m_errorCondition != null) { // OpenCms is not properly initialized throw new CmsInitException(m_errorCondition, false); } if (m_instance == null) { try { // create a new core object with runlevel 1 m_instance = new OpenCmsCore(); } catch (CmsInitException e) { // already initialized, this is all we need LOG.debug(e.getMessage(), e); } } return m_instance; }
/** * Method to create a new instance of a pool.<p> * * @param configuration the configurations from the propertyfile * @param poolName the configuration name of the pool * * @throws CmsInitException if the pools could not be initialized */ public void newPoolInstance(CmsParameterConfiguration configuration, String poolName) throws CmsInitException { PoolingDriver driver; try { driver = CmsDbPool.createDriverManagerConnectionPool(configuration, poolName); } catch (Exception e) { CmsMessageContainer message = Messages.get().container(Messages.ERR_INIT_CONN_POOL_1, poolName); if (LOG.isErrorEnabled()) { LOG.error(message.key(), e); } throw new CmsInitException(message, e); } m_connectionPools.add(driver); }
/** * Method to create a new instance of a pool.<p> * * @param configuration the configurations from the propertyfile * @param poolName the configuration name of the pool * * @throws CmsInitException if the pools could not be initialized */ public void newPoolInstance(Map configuration, String poolName) throws CmsInitException { PoolingDriver driver; try { driver = CmsDbPool.createDriverManagerConnectionPool(configuration, poolName); } catch (Exception e) { CmsMessageContainer message = Messages.get().container(Messages.ERR_INIT_CONN_POOL_1, poolName); if (LOG.isErrorEnabled()) { LOG.error(message.key(), e); } throw new CmsInitException(message, e); } m_connectionPools.add(driver); }
/** * @see org.opencms.db.I_CmsUserDriver#fillDefaults(org.opencms.db.CmsDbContext) */ public void fillDefaults(CmsDbContext dbc) throws CmsInitException { try { internalCreateDefaultGroups(dbc, "", "", false); } catch (CmsException e) { if (CmsLog.INIT.isErrorEnabled()) { CmsLog.INIT.error(Messages.get().getBundle().key(Messages.INIT_DEFAULT_USERS_CREATION_FAILED_0), e); } throw new CmsInitException(Messages.get().container(Messages.ERR_INITIALIZING_USER_DRIVER_0), e); } }
/** * @see org.opencms.db.I_CmsUserDriver#fillDefaults(org.opencms.db.CmsDbContext) */ public void fillDefaults(CmsDbContext dbc) throws CmsInitException { try { internalCreateDefaultGroups(dbc, "", "", false); } catch (CmsException e) { if (CmsLog.INIT.isErrorEnabled()) { CmsLog.INIT.error(Messages.get().getBundle().key(Messages.INIT_DEFAULT_USERS_CREATION_FAILED_0), e); } throw new CmsInitException(Messages.get().container(Messages.ERR_INITIALIZING_USER_DRIVER_0), e); } }
/** * Initialize the UUID generator with the ethernet address of the server machine.<p> * * The ethernetAddress parameter must represent a 'standard' ethernet MAC address string * (e.g. '00:C0:F0:3D:5B:7C'). * * @param ethernetAddress the ethernet address of the server machine * @throws CmsInitException in case the ethernetAddress String is not a valid ethernet address */ public static void init(String ethernetAddress) throws CmsInitException { try { m_ethernetAddress = new EthernetAddress(ethernetAddress); } catch (Exception e) { throw new CmsInitException( Messages.get().container(Messages.ERR_INVALID_ETHERNET_ADDRESS_1, ethernetAddress)); } }
/** * @see org.opencms.security.I_CmsPermissionHandler#init(org.opencms.db.CmsDriverManager, CmsSystemConfiguration) */ public void init(CmsDriverManager driverManager, CmsSystemConfiguration systemConfiguration) { m_driverManager = driverManager; m_securityManager = driverManager.getSecurityManager(); CmsCacheSettings settings = systemConfiguration.getCacheSettings(); String className = settings.getCacheKeyGenerator(); try { // initialize the key generator m_keyGenerator = (I_CmsCacheKey)Class.forName(className).newInstance(); } catch (Exception e) { throw new CmsInitException( org.opencms.main.Messages.get().container( org.opencms.main.Messages.ERR_CRITICAL_CLASS_CREATION_1, className), e); } } }
/** * Initialize the UUID generator with the ethernet address of the server machine.<p> * * The ethernetAddress parameter must represent a 'standard' ethernet MAC address string * (e.g. '00:C0:F0:3D:5B:7C'). * * @param ethernetAddress the ethernet address of the server machine * @throws CmsInitException in case the ethernetAddress String is not a valid ethernet address */ public static void init(String ethernetAddress) throws CmsInitException { try { m_ethernetAddress = new EthernetAddress(ethernetAddress); } catch (Exception e) { throw new CmsInitException(Messages.get().container( Messages.ERR_INVALID_ETHERNET_ADDRESS_1, ethernetAddress)); } }
/** * @see org.opencms.security.I_CmsPermissionHandler#init(org.opencms.db.CmsDriverManager, CmsSystemConfiguration) */ public void init(CmsDriverManager driverManager, CmsSystemConfiguration systemConfiguration) { m_driverManager = driverManager; m_securityManager = driverManager.getSecurityManager(); CmsCacheSettings settings = systemConfiguration.getCacheSettings(); String className = settings.getCacheKeyGenerator(); try { // initialize the key generator m_keyGenerator = (I_CmsCacheKey)Class.forName(className).newInstance(); } catch (Exception e) { throw new CmsInitException(org.opencms.main.Messages.get().container( org.opencms.main.Messages.ERR_CRITICAL_CLASS_CREATION_1, className), 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())); } }
/** * @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())); } }
/** * 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); } }
/** * Creates a new instance of the OpenCms security manager.<p> * * @param configurationManager the configuration manager * @param runtimeInfoFactory the initialized OpenCms runtime info factory * @param publishEngine the publish engine * * @return a new instance of the OpenCms security manager * * @throws CmsInitException if the security manager could not be initialized */ public static CmsSecurityManager newInstance( CmsConfigurationManager configurationManager, I_CmsDbContextFactory runtimeInfoFactory, CmsPublishEngine publishEngine) throws CmsInitException { if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_2_INITIALIZING) { // OpenCms is already initialized throw new CmsInitException(org.opencms.main.Messages.get().container( org.opencms.main.Messages.ERR_ALREADY_INITIALIZED_0)); } CmsSecurityManager securityManager = new CmsSecurityManager(); securityManager.init(configurationManager, runtimeInfoFactory, publishEngine); return securityManager; }
/** * @see org.opencms.db.I_CmsUserDriver#fillDefaults(org.opencms.db.CmsDbContext) */ public void fillDefaults(CmsDbContext dbc) throws CmsInitException { try { CmsOrganizationalUnit ou = (CmsOrganizationalUnit)(dbc.getAttribute(CmsDriverManager.ATTR_INIT_OU)); if (ou == null) { internalCreateDefaultGroups(dbc, "", "", false); } else { internalCreateDefaultGroups(dbc, ou.getName(), ou.getDescription(), ou.hasFlagWebuser()); } } catch (CmsException e) { if (CmsLog.INIT.isErrorEnabled()) { CmsLog.INIT.error(Messages.get().getBundle().key(Messages.INIT_DEFAULT_USERS_CREATION_FAILED_0), e); } throw new CmsInitException(Messages.get().container(Messages.ERR_INITIALIZING_USER_DRIVER_0), e); } }