/** * Creates a new instance for the resource manager, * will be called by the vfs configuration manager.<p> */ public CmsRepositoryManager() { if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_STARTING_REPOSITORY_CONFIG_0)); } m_repositoryList = new ArrayList(); m_repositoryMap = new HashMap(); m_frozen = false; m_configured = true; }
/** * Adds a new configured repository.<p> * * @param rep the repository to add * * @throws CmsConfigurationException in case the resource manager configuration is already initialized */ public void addRepositoryClass(I_CmsRepository rep) throws CmsConfigurationException { // check if new repositories can still be added if (m_frozen) { throw new CmsConfigurationException(Messages.get().container(Messages.ERR_NO_CONFIG_AFTER_STARTUP_0)); } m_repositoryList.add(rep); }
/** * Initializes a configuration after all parameters have been added.<p> * * @throws CmsConfigurationException if something goes wrong */ public void initConfiguration() throws CmsConfigurationException { if ((!TYPE_INCLUDE.equals(m_type)) && (!TYPE_EXCLUDE.equals(m_type))) { throw new CmsConfigurationException(Messages.get().container(Messages.ERR_INVALID_FILTER_TYPE_1, m_type)); } if (CmsLog.INIT.isInfoEnabled()) { Iterator iter = m_filterRules.iterator(); while (iter.hasNext()) { Pattern rule = (Pattern)iter.next(); CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_ADD_FILTER_RULE_2, m_type, rule.pattern())); } } m_filterRules = Collections.unmodifiableList(m_filterRules); }
/** * Initializes a configuration after all parameters have been added.<p> * * @throws CmsConfigurationException if something goes wrong */ public void initConfiguration() throws CmsConfigurationException { if ((!TYPE_INCLUDE.equals(m_type)) && (!TYPE_EXCLUDE.equals(m_type))) { throw new CmsConfigurationException(Messages.get().container(Messages.ERR_INVALID_FILTER_TYPE_1, m_type)); } if (CmsLog.INIT.isInfoEnabled()) { Iterator<Pattern> iter = m_filterRules.iterator(); while (iter.hasNext()) { Pattern rule = iter.next(); CmsLog.INIT.info( Messages.get().getBundle().key(Messages.INIT_ADD_FILTER_RULE_2, m_type, rule.pattern())); } } m_filterRules = Collections.unmodifiableList(m_filterRules); }
/** * Adds a new configured repository.<p> * * @param repository the repository to add * * @throws CmsConfigurationException in case the resource manager configuration is already initialized */ public void addRepositoryClass(I_CmsRepository repository) throws CmsConfigurationException { // check if new repositories can still be added if (m_frozen) { throw new CmsConfigurationException(Messages.get().container(Messages.ERR_NO_CONFIG_AFTER_STARTUP_0)); } m_repositoryList.add(repository); }
/** * Creates a new instance for the resource manager, * will be called by the vfs configuration manager.<p> */ public CmsRepositoryManager() { if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_STARTING_REPOSITORY_CONFIG_0)); } m_repositoryMap = new HashMap<String, I_CmsRepository>(); m_jlanThreadManager = new CmsJlanThreadManager(); m_frozen = false; m_configured = true; }
/** * @see org.opencms.repository.I_CmsRepositorySession#unlock(java.lang.String) */ public void unlock(String path) { try { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_UNLOCK_ITEM_1, path)); } m_cms.unlockResource(path); } catch (CmsException ex) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.ERR_UNLOCK_FAILED_0), ex); } } }
/** * @see org.opencms.repository.I_CmsRepositorySession#unlock(java.lang.String) */ public void unlock(String path) { try { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_UNLOCK_ITEM_1, path)); } m_cms.unlockResource(path); } catch (CmsException ex) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.ERR_UNLOCK_FAILED_0), ex); } } }
/** * @see org.opencms.repository.I_CmsRepositorySession#lock(java.lang.String, org.opencms.repository.CmsRepositoryLockInfo) */ public boolean lock(String path, CmsRepositoryLockInfo lock) throws CmsException { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_LOCK_ITEM_1, path)); } m_cms.lockResource(path); return true; }
/** * @see org.opencms.repository.I_CmsRepositorySession#lock(java.lang.String, org.opencms.repository.CmsRepositoryLockInfo) */ public boolean lock(String path, CmsRepositoryLockInfo lock) throws CmsException { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_LOCK_ITEM_1, path)); } m_cms.lockResource(path); return true; }
/** * Initializes a configuration after all parameters have been added.<p> * * @throws CmsConfigurationException if something goes wrong */ public void initConfiguration() throws CmsConfigurationException { m_repositoryList = Collections.unmodifiableList(m_repositoryList); Iterator iter = m_repositoryList.iterator(); while (iter.hasNext()) { A_CmsRepository rep = (A_CmsRepository)iter.next(); m_repositoryMap.put(rep.getName(), rep); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key( Messages.INIT_ADD_REPOSITORY_2, rep.getClass().getName(), rep.getName())); } rep.initConfiguration(); } m_frozen = true; if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_REPOSITORY_CONFIG_FINISHED_0)); } }
/** * Initializes a configuration after all parameters have been added.<p> * * @throws CmsConfigurationException if something goes wrong */ public void initConfiguration() throws CmsConfigurationException { for (I_CmsRepository rep : m_repositoryList) { if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info( Messages.get().getBundle().key( Messages.INIT_ADD_REPOSITORY_2, rep.getClass().getName(), rep.getName())); } rep.initConfiguration(); m_repositoryMap.put(rep.getName(), rep); } m_frozen = true; if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_REPOSITORY_CONFIG_FINISHED_0)); } }
/** * @see org.opencms.repository.I_CmsRepositorySession#getItem(java.lang.String) */ public I_CmsRepositoryItem getItem(String path) throws CmsException { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_READ_ITEM_1, path)); } CmsResource res = m_cms.readResource(path, CmsResourceFilter.DEFAULT); CmsRepositoryItem item = new CmsRepositoryItem(res, m_cms); return item; }
/** * @see org.opencms.repository.I_CmsRepositorySession#getItem(java.lang.String) */ public I_CmsRepositoryItem getItem(String path) throws CmsException { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_READ_ITEM_1, path)); } CmsResource res = m_cms.readResource(path, CmsResourceFilter.DEFAULT); CmsRepositoryItem item = new CmsRepositoryItem(res, m_cms); return item; }
/** * Adds the site root to the path name and checks then if the path * is filtered.<p> * * @see org.opencms.repository.A_CmsRepositorySession#isFiltered(java.lang.String) */ @Override protected boolean isFiltered(String name) { boolean ret = super.isFiltered(m_cms.getRequestContext().addSiteRoot(name)); if (ret) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.ERR_ITEM_FILTERED_1, name)); } } return ret; }
nameClazz = Class.forName(classname); } catch (ClassNotFoundException e) { LOG.error(Messages.get().getBundle().key(Messages.LOG_WRAPPER_CLASS_NOT_FOUND_1, classname), e); return; wrapper = (I_CmsResourceWrapper)nameClazz.newInstance(); } catch (InstantiationException e) { throw new CmsConfigurationException(Messages.get().container( Messages.ERR_INVALID_WRAPPER_NAME_1, classname)); } catch (IllegalAccessException e) { throw new CmsConfigurationException(Messages.get().container( Messages.ERR_INVALID_WRAPPER_NAME_1, classname)); } catch (ClassCastException e) { throw new CmsConfigurationException(Messages.get().container( Messages.ERR_INVALID_WRAPPER_NAME_1, classname)); CmsLog.INIT.info(Messages.get().getBundle().key( Messages.INIT_ADD_WRAPPER_1, wrapper.getClass().getName()));
/** * Adds the site root to the path name and checks then if the path * is filtered.<p> * * @see org.opencms.repository.A_CmsRepositorySession#isFiltered(java.lang.String) */ @Override protected boolean isFiltered(String name) { boolean ret = super.isFiltered(m_cms.getRequestContext().addSiteRoot(name)); if (ret) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.ERR_ITEM_FILTERED_1, name)); } } return ret; }
nameClazz = Class.forName(className); } catch (ClassNotFoundException e) { log.error(Messages.get().getBundle().key(Messages.LOG_WRAPPER_CLASS_NOT_FOUND_1, className), e); wrapperObjects.clear(); break; Messages.get().container(Messages.ERR_INVALID_WRAPPER_NAME_1, wrapperString)); } catch (IllegalAccessException e) { throw new CmsConfigurationException( Messages.get().container(Messages.ERR_INVALID_WRAPPER_NAME_1, wrapperString)); } catch (ClassCastException e) { throw new CmsConfigurationException( Messages.get().container(Messages.ERR_INVALID_WRAPPER_NAME_1, wrapperString)); Messages.get().getBundle().key(Messages.INIT_ADD_WRAPPER_1, wrapper.getClass().getName()));
/** * @see org.opencms.repository.I_CmsRepositorySession#create(java.lang.String) */ public void create(String path) throws CmsException { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_CREATE_ITEM_1, path)); } // create the folder CmsResource res = m_cms.createResource(path, CmsResourceTypeFolder.RESOURCE_TYPE_ID); // unlock new created folders if lock is not inherited if (!m_cms.getLock(res).isInherited()) { m_cms.unlockResource(path); } }
LOG.debug(Messages.get().getBundle().key(Messages.LOG_COPY_ITEM_2, src, dest)); LOG.debug(Messages.get().getBundle().key(Messages.LOG_DELETE_DEST_0)); LOG.debug(Messages.get().getBundle().key(Messages.ERR_OVERWRITE_0)); throw new CmsException(Messages.get().container(Messages.ERR_OVERWRITE_0)); LOG.debug(Messages.get().getBundle().key(Messages.ERR_DEST_EXISTS_0)); throw new CmsVfsResourceAlreadyExistsException(Messages.get().container(Messages.ERR_DEST_EXISTS_0));