/** * Gets the virtual file name to use for the given module.<p> * * @param module the module for which to get the file name * * @return the file name */ private String getFileNameForModule(CmsModule module) { return module.getName() + SUFFIX; }
/** * Gets the module configuration path.<p> * * @return the module configuration path */ public String getConfigurationPath() { String parameter = getParameter("config.sitemap"); if (parameter != null) { return parameter; } else { return "/system/modules/" + getName() + "/.config"; } }
/** * Sorts the modules for display.<p> * * @param modules the list of {@link CmsModule} objects * * @return a sorted list of module names */ public List<String> sortModules(Collection<CmsModule> modules) { List<CmsModule> aux = new ArrayList<CmsModule>(modules); Collections.sort(aux, new Comparator<CmsModule>() { public int compare(CmsModule module1, CmsModule module2) { return getDisplayForModule(module1).compareTo(getDisplayForModule(module2)); } }); List<String> ret = new ArrayList<String>(aux.size()); for (Iterator<CmsModule> it = aux.iterator(); it.hasNext();) { CmsModule module = it.next(); ret.add(module.getName()); } return ret; }
/** * @see org.opencms.module.I_CmsModuleAction#moduleUpdate(org.opencms.module.CmsModule) */ public void moduleUpdate(CmsModule module) { if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_MODULE_UPDATED_2, module.getName(), this.getClass().getName())); } }
/** * @see org.opencms.module.I_CmsModuleAction#moduleUpdate(org.opencms.module.CmsModule) */ public void moduleUpdate(CmsModule module) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key( Messages.LOG_MODULE_UPDATED_2, module.getName(), this.getClass().getName())); } }
/** * @see org.opencms.module.I_CmsModuleAction#shutDown(CmsModule) */ public void shutDown(CmsModule module) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key( Messages.LOG_MODULE_SHUTDOWN_2, module.getName(), this.getClass().getName())); } } }
/** * @see org.opencms.module.I_CmsModuleAction#moduleUninstall(CmsModule) */ public void moduleUninstall(CmsModule module) { if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_MODULE_UNINSTALLED_2, module.getName(), this.getClass().getName())); } }
/** * @see org.opencms.module.I_CmsModuleAction#initialize(org.opencms.file.CmsObject, CmsConfigurationManager, CmsModule) */ public void initialize(CmsObject adminCms, CmsConfigurationManager configurationManager, CmsModule module) { if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_MODULE_INITIALIZED_2, module.getName(), this.getClass().getName())); } }
/** * @see org.opencms.module.I_CmsModuleAction#shutDown(CmsModule) */ public void shutDown(CmsModule module) { if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_MODULE_SHUTDOWN_2, module.getName(), this.getClass().getName())); } } }
/** * @see org.opencms.module.I_CmsModuleAction#initialize(org.opencms.file.CmsObject, CmsConfigurationManager, CmsModule) */ public void initialize(CmsObject adminCms, CmsConfigurationManager configurationManager, CmsModule module) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key( Messages.LOG_MODULE_INITIALIZED_2, module.getName(), this.getClass().getName())); } }
/** * @see org.opencms.module.I_CmsModuleAction#moduleUninstall(CmsModule) */ public void moduleUninstall(CmsModule module) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key( Messages.LOG_MODULE_UNINSTALLED_2, module.getName(), this.getClass().getName())); } }
/** * Sets the "nice" display name of this module.<p> * * <i>Please note:</i>It's not possible to set the modules "nice" name once the module * configuration has been frozen.<p> * * @param value the "nice" display name of this module to set */ public void setNiceName(String value) { checkFrozen(); if (CmsStringUtil.isEmptyOrWhitespaceOnly(value)) { m_niceName = getName(); } else { m_niceName = value.trim(); } }
/** * Sets the "nice" display name of this module.<p> * * <i>Please note:</i>It's not possible to set the modules "nice" name once the module * configuration has been frozen.<p> * * @param value the "nice" display name of this module to set */ public void setNiceName(String value) { checkFrozen(); if (CmsStringUtil.isEmptyOrWhitespaceOnly(value)) { m_niceName = getName(); } else { m_niceName = value.trim(); } }
/** * Collect GWT build ids from the different ADE modules.<p> * * @return the map of GWT build ids */ protected Map<String, String> getBuildIds() { List<CmsModule> modules = OpenCms.getModuleManager().getAllInstalledModules(); Map<String, String> result = new HashMap<String, String>(); for (CmsModule module : modules) { String buildid = module.getParameter(CmsCoreData.KEY_GWT_BUILDID); if (buildid != null) { result.put(module.getName(), buildid); } } return result; }
/** * Clones the export points of the module and adjusts its paths.<p> * * @param sourceModule the source module * @param targetModule the target module * @param sourcePathPart the source path part * @param targetPathPart the target path part */ private void cloneExportPoints( CmsModule sourceModule, CmsModule targetModule, String sourcePathPart, String targetPathPart) { for (CmsExportPoint exp : targetModule.getExportPoints()) { if (exp.getUri().contains(sourceModule.getName())) { exp.setUri(exp.getUri().replaceAll(sourceModule.getName(), targetModule.getName())); } if (exp.getUri().contains(sourcePathPart)) { exp.setUri(exp.getUri().replaceAll(sourcePathPart, targetPathPart)); } } }
/** * Checks if this module depends on another given module, * will return the dependency, or <code>null</code> if no dependency was found.<p> * * @param module the other module to check against * @return the dependency, or null if no dependency was found */ public CmsModuleDependency checkDependency(CmsModule module) { CmsModuleDependency otherDepdendency = new CmsModuleDependency(module.getName(), module.getVersion()); // loop through all the dependencies for (int i = 0; i < m_dependencies.size(); i++) { CmsModuleDependency dependency = m_dependencies.get(i); if (dependency.dependesOn(otherDepdendency)) { // short circuit here return dependency; } } // no dependency was found return null; }
/** * Checks if this module depends on another given module, * will return the dependency, or <code>null</code> if no dependency was found.<p> * * @param module the other module to check against * @return the dependency, or null if no dependency was found */ public CmsModuleDependency checkDependency(CmsModule module) { CmsModuleDependency otherDepdendency = new CmsModuleDependency(module.getName(), module.getVersion()); // loop through all the dependencies for (int i = 0; i < m_dependencies.size(); i++) { CmsModuleDependency dependency = (CmsModuleDependency)m_dependencies.get(i); if (dependency.dependesOn(otherDepdendency)) { // short circuit here return dependency; } } // no dependency was found return null; }
/** * Checks if this modules configuration is frozen.<p> * * @throws CmsIllegalArgumentException in case the configuration is already frozen */ protected void checkFrozen() throws CmsIllegalArgumentException { if (m_frozen) { throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_MODULE_FROZEN_1, getName())); } }
/** * Checks if this modules configuration is frozen.<p> * * @throws CmsIllegalArgumentException in case the configuration is already frozen */ protected void checkFrozen() throws CmsIllegalArgumentException { if (m_frozen) { throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_MODULE_FROZEN_1, getName())); } }
/** * Gets the virtual resources in the log folder.<p> * * @param cms the CMS context * @return the list of virtual log resources * * @throws CmsException if something goes wrong */ private List<CmsResource> getVirtualLogResources(CmsObject cms) throws CmsException { List<CmsResource> virtualResources = Lists.newArrayList(); for (CmsModule module : OpenCms.getModuleManager().getAllInstalledModules()) { String path = CmsStringUtil.joinPaths(LOG_PATH, module.getName() + ".log"); CmsResource res = createFakeBinaryFile(path); virtualResources.add(res); } return virtualResources; }