/** * Returns the display string for a given module.<p> * * @param module a module * * @return the display string for the given module */ public String getDisplayForModule(CmsModule module) { String name = module.getNiceName(); String group = module.getGroup(); String version = module.getVersion().getVersion(); String display = name; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(group)) { display = group + ": " + display; } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(version)) { display += " (" + version + ")"; } return display; }
String modulePath = CmsWorkplace.VFS_PATH_MODULES + module.getName() + "/"; List<CmsExportPoint> exportPoints = module.getExportPoints(); List<String> resources = module.getResources(); if (module.isCreateClassesFolder() || module.isCreateElementsFolder() || module.isCreateLibFolder() || module.isCreateResourcesFolder() || module.isCreateSchemasFolder() || module.isCreateTemplateFolder() || module.isCreateFormattersFolder()) { module.setCreateModuleFolder(true); if (module.isCreateModuleFolder()) { getCms().createResource(modulePath, folderId); module.setResources(resources); if (module.isCreateTemplateFolder()) { String path = modulePath + PATH_TEMPLATES; getCms().createResource(path, folderId); if (module.isCreateElementsFolder()) { String path = modulePath + PATH_ELEMENTS; getCms().createResource(path, folderId); if (module.isCreateFormattersFolder()) { String path = modulePath + PATH_FORMATTERS; getCms().createResource(path, folderId);
/** * 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"; } }
CmsModule result = new CmsModule( m_name, m_niceName, if (getExplorerTypes() != null) { result.setExplorerTypes(new ArrayList(getExplorerTypes())); if (getResourceTypes() != null) { result.setResourceTypes(new ArrayList(getResourceTypes())); if (getDependencies() != null) { result.setDependencies(new ArrayList(getDependencies())); result.setCreateClassesFolder(m_createClassesFolder); result.setCreateElementsFolder(m_createElementsFolder); result.setCreateLibFolder(m_createLibFolder); result.setCreateModuleFolder(m_createModuleFolder); result.setCreateResourcesFolder(m_createResourcesFolder); result.setCreateTemplateFolder(m_createTemplateFolder); result.setResources(new ArrayList(m_resources)); result.setExportPoints(new ArrayList(m_exportPoints)); return result;
/** * 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(); } }
moduleElement.addElement(N_NAME).setText(module.getName()); if (!module.getName().equals(module.getNiceName())) { moduleElement.addElement(N_NICENAME).addCDATA(module.getNiceName()); } else { moduleElement.addElement(N_NICENAME); if (CmsStringUtil.isNotEmpty(module.getGroup())) { moduleElement.addElement(N_GROUP).setText(module.getGroup()); if (CmsStringUtil.isNotEmpty(module.getActionClass())) { moduleElement.addElement(N_CLASS).setText(module.getActionClass()); } else { moduleElement.addElement(N_CLASS); String importScript = module.getImportScript(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(importScript)) { moduleElement.addElement(N_IMPORT_SCRIPT).addCDATA(importScript); String importSite = module.getImportSite(); if (!CmsStringUtil.isEmptyOrWhitespaceOnly(importSite)) { moduleElement.addElement(N_IMPORT_SITE).setText(importSite); moduleElement.addElement(N_EXPORT_MODE).addAttribute(A_NAME, module.getExportMode().toString()); if (CmsStringUtil.isNotEmpty(module.getDescription())) { moduleElement.addElement(N_DESCRIPTION).addCDATA(module.getDescription()); } else { moduleElement.addElement(N_DESCRIPTION);
CmsModule result = new CmsModule( m_name, m_niceName, if (getExplorerTypes() != null) { List<CmsExplorerTypeSettings> settings = new ArrayList<CmsExplorerTypeSettings>(); for (CmsExplorerTypeSettings setting : getExplorerTypes()) { settings.add((CmsExplorerTypeSettings)setting.clone()); result.setExplorerTypes(settings); if (getResourceTypes() != null) { result.setResourceTypes(new ArrayList<I_CmsResourceType>(getResourceTypes())); if (getDependencies() != null) { List<CmsModuleDependency> deps = new ArrayList<CmsModuleDependency>(); for (CmsModuleDependency dep : getDependencies()) { deps.add((CmsModuleDependency)dep.clone()); result.setDependencies(new ArrayList<CmsModuleDependency>(getDependencies())); if (getExportPoints() != null) { List<CmsExportPoint> exps = new ArrayList<CmsExportPoint>(); for (CmsExportPoint exp : getExportPoints()) { exps.add((CmsExportPoint)exp.clone()); result.setExportPoints(exps);
moduleElement.addElement(N_NAME).setText(module.getName()); if (!module.getName().equals(module.getNiceName())) { moduleElement.addElement(N_NICENAME).addCDATA(module.getNiceName()); } else { moduleElement.addElement(N_NICENAME); if (CmsStringUtil.isNotEmpty(module.getGroup())) { moduleElement.addElement(N_GROUP).setText(module.getGroup()); if (CmsStringUtil.isNotEmpty(module.getActionClass())) { moduleElement.addElement(N_CLASS).setText(module.getActionClass()); } else { moduleElement.addElement(N_CLASS); if (CmsStringUtil.isNotEmpty(module.getDescription())) { moduleElement.addElement(N_DESCRIPTION).addCDATA(module.getDescription()); } else { moduleElement.addElement(N_DESCRIPTION); moduleElement.addElement(N_VERSION).setText(module.getVersion().toString()); if (CmsStringUtil.isNotEmpty(module.getAuthorName())) { moduleElement.addElement(N_AUTHORNAME).addCDATA(module.getAuthorName()); } else { moduleElement.addElement(N_AUTHORNAME); if (CmsStringUtil.isNotEmpty(module.getAuthorEmail())) { moduleElement.addElement(N_AUTHOREMAIL).addCDATA(module.getAuthorEmail()); } else { moduleElement.addElement(N_AUTHOREMAIL);
CmsModule targetModule = (CmsModule)sourceModule.clone(); targetModule.setName(m_cloneInfo.getName()); targetModule.setNiceName(m_cloneInfo.getNiceName()); targetModule.setDescription(m_cloneInfo.getDescription()); targetModule.setAuthorEmail(m_cloneInfo.getAuthorEmail()); targetModule.setAuthorName(m_cloneInfo.getAuthorName()); targetModule.setGroup(m_cloneInfo.getGroup()); targetModule.setActionClass(m_cloneInfo.getActionClass()); String sourceModulePath = CmsWorkplace.VFS_PATH_MODULES + sourceModule.getName() + "/"; String targetModulePath = CmsWorkplace.VFS_PATH_MODULES + targetModule.getName() + "/"; String sourcePathPart = sourceModule.getName().replaceAll("\\.", "/"); String targetPathPart = targetModule.getName().replaceAll("\\.", "/"); List<CmsResource> resources = cms.readResources(targetModulePath, filter); replacesMessages(descKeys, resources); renameXmlVfsBundles(resources, targetModule, sourceModule.getName()); && !targetModule.getResourceTypes().isEmpty()) { replaceFormatterPaths(targetModule); if (targetModule.getResourceTypes() != Collections.EMPTY_LIST) { OpenCms.getResourceManager().initialize(cms); if (targetModule.getExplorerTypes() != Collections.EMPTY_LIST) { OpenCms.getWorkplaceManager().addExplorerTypeSettings(targetModule);
if (detailId.equals(LIST_DETAIL_AUTHORINFO)) { html.append(module.getAuthorName()); html.append(" ("); html.append(module.getAuthorEmail()); html.append(")"); } else if (detailId.equals(LIST_DETAIL_RESOURCES)) { Iterator j = module.getResources().iterator(); while (j.hasNext()) { String resource = (String)j.next(); Iterator j = module.getExcludeResources().iterator(); while (j.hasNext()) { String resource = (String)j.next(); Iterator k = module.getDependencies().iterator(); while (k.hasNext()) { CmsModuleDependency dep = (CmsModuleDependency)k.next(); Iterator l = module.getResourceTypes().iterator(); boolean addRestypes = false; while (l.hasNext()) { Iterator m = module.getExplorerTypes().iterator(); boolean addExplorersettings = false; while (m.hasNext()) {
/** * 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; }
CmsModule oldModule = (CmsModule)m_modules.get(module.getName()); throw new CmsConfigurationException(Messages.get().container(Messages.ERR_OLD_MOD_ERR_1, module.getName())); LOG.info(Messages.get().getBundle().key(Messages.LOG_MOD_UPDATE_1, module.getName())); if (oldModule.getVersion().compareTo(module.getVersion()) == 0) { module.getVersion().increment(); module.getVersion().setUpdated(true); module.initialize(cms); m_modules.put(module.getName(), module); I_CmsModuleAction moduleAction = oldModule.getActionInstance(); module.setActionInstance(moduleAction); LOG.error(Messages.get().getBundle().key(Messages.LOG_INSTANCE_UPDATE_ERR_1, module.getName()), t);
targetModule.getResources(), sourceModule.getName(), targetModule.getName(), sourcePathPart, targetPathPart, iconPaths); targetModule.setResources(newTargetResources); targetModule.getExcludeResources(), sourceModule.getName(), targetModule.getName(), sourcePathPart, targetPathPart, iconPaths); targetModule.setExcludeResources(newTargetExcludeResources);
/** * @see org.opencms.workplace.list.A_CmsListDialog#getListItems() */ @Override protected List getListItems() { List ret = new ArrayList(); // get content Set moduleNames = OpenCms.getModuleManager().getModuleNames(); Iterator i = moduleNames.iterator(); while (i.hasNext()) { String moduleName = (String)i.next(); CmsModule module = OpenCms.getModuleManager().getModule(moduleName); CmsListItem item = getList().newItem(module.getName()); // name item.set(LIST_COLUMN_NAME, moduleName); // nicename item.set(LIST_COLUMN_NICENAME, module.getNiceName()); //version item.set(LIST_COLUMN_VERSION, module.getVersion()); //group item.set(LIST_COLUMN_GROUP, module.getGroup()); ret.add(item); } return ret; }
while (i.hasNext()) { CmsModule otherModule = i.next(); CmsModuleDependency dependency = otherModule.checkDependency(module); if (dependency != null) { result.add(new CmsModuleDependency(otherModule.getName(), otherModule.getVersion())); result.addAll(module.getDependencies()); while (i.hasNext() && (result.size() > 0)) { CmsModule otherModule = i.next(); CmsModuleDependency dependency = module.checkDependency(otherModule); if (dependency != null) {
if (OpenCms.getModuleManager().hasModule(importedModule.getName())) { throw new CmsConfigurationException( Messages.get().container(Messages.ERR_MOD_ALREADY_INSTALLED_1, importedModule.getName())); Messages.get().container( Messages.ERR_MOD_DEPENDENCY_INFO_2, importedModule.getName() + ", Version " + importedModule.getVersion(), missingModules)); for (I_CmsResourceType type : importedModule.getResourceTypes()) { type.getTypeName(), new Integer(type.getTypeId()), importedModule.getName(), conflictingType.getTypeName(), new Integer(conflictingType.getTypeId())})); org.opencms.loader.Messages.ERR_CONFLICTING_RESTYPES_IN_MODULE_5, new Object[] { importedModule.getName(), type.getTypeName(), new Integer(type.getTypeId()), if (importedModule.getResourceTypes() != Collections.EMPTY_LIST) { OpenCms.getResourceManager().initialize(cms); if (importedModule.getExplorerTypes() != Collections.EMPTY_LIST) { OpenCms.getWorkplaceManager().addExplorerTypeSettings(importedModule);
if (OpenCms.getModuleManager().hasModule(importedModule.getName())) { throw new CmsConfigurationException(Messages.get().container( Messages.ERR_MOD_ALREADY_INSTALLED_1, importedModule.getName())); importedModule.getName() + ", Version " + importedModule.getVersion(), missingModules)); Iterator i = importedModule.getResourceTypes().iterator(); while (i.hasNext()) { I_CmsResourceType type = (I_CmsResourceType)i.next(); type.getTypeName(), new Integer(type.getTypeId()), importedModule.getName(), conflictingType.getTypeName(), new Integer(conflictingType.getTypeId())})); org.opencms.loader.Messages.ERR_CONFLICTING_RESTYPES_IN_MODULE_5, new Object[] { importedModule.getName(), type.getTypeName(), new Integer(type.getTypeId()), if (importedModule.getResourceTypes() != Collections.EMPTY_LIST) { OpenCms.getResourceManager().initialize(cms); if (importedModule.getExplorerTypes() != Collections.EMPTY_LIST) { OpenCms.getWorkplaceManager().addExplorerTypeSettings(importedModule);
String importSite = module.getImportSite(); if (!CmsStringUtil.isEmptyOrWhitespaceOnly(importSite)) { CmsObject newCms; I_CmsModuleAction moduleAction = module.getActionInstance(); boolean removeResourceTypes = !module.getResourceTypes().isEmpty(); if (removeResourceTypes) { cms.getRequestContext().getCurrentUser()); CmsLockFilter filter2 = CmsLockFilter.FILTER_INHERITED; List<String> moduleResources = module.getResources(); for (int iLock = 0; iLock < moduleResources.size(); iLock++) { String resourceName = moduleResources.get(iLock); while (it.hasNext()) { CmsExportPoint point = it.next(); if ((point.getUri().endsWith(module.getName() + "/lib/") || point.getUri().endsWith(module.getName() + "/lib")) && point.getConfiguredDestination().equals("WEB-INF/lib/")) { it.remove(); List<CmsResource> moduleResources = CmsModule.calculateModuleResources(cms, module); for (CmsResource resource : moduleResources) { try {
if (module.getActionClass() != null) { I_CmsModuleAction moduleAction = module.getActionInstance(); if (module.getActionClass() != null) { try { moduleAction = (I_CmsModuleAction)Class.forName(module.getActionClass()).newInstance(); } catch (Exception e) { CmsLog.INIT.info(Messages.get().getBundle().key( Messages.INIT_CREATE_INSTANCE_FAILED_1, module.getName()), e); module.setActionInstance(moduleAction); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(
m_module = new CmsModule( moduleName, niceName, m_module.setResourceTypes(moduleResourceTypes); m_module.setExplorerTypes(m_explorerTypeSettings);