/** * @see org.opencms.configuration.preferences.A_CmsPreference#isDisabled(CmsObject) */ @Override public boolean isDisabled(CmsObject cms) { return !OpenCms.getModuleManager().hasModule("org.opencms.workplace.traditional"); } }
/** * Returns a list of all module names.<p> * * @return a list of all module names */ public List<String> getAllModuleNames() { List<String> sortedModuleNames = new ArrayList<String>(OpenCms.getModuleManager().getModuleNames()); java.util.Collections.sort(sortedModuleNames); return sortedModuleNames; }
/** * Gets the module which corresponds to the given virtual file name.<p> * * @param fileName the file name * * @return the module which corresponds to the given file name */ private CmsModule getModuleForFileName(String fileName) { String moduleName = fileName; if (fileName.endsWith(SUFFIX)) { moduleName = fileName.substring(0, fileName.length() - SUFFIX.length()); } CmsModule result = OpenCms.getModuleManager().getModule(moduleName); return result; }
/** * Gets the list of modules as file names.<p> * * @return the list of modules as file names */ public List<String> getModuleFileNames() { List<String> result = Lists.newArrayList(); for (CmsModule module : OpenCms.getModuleManager().getAllInstalledModules()) { result.add(getFileNameForModule(module)); } return result; }
/** * Returns the visibility flag module parameter value.<p> * * @return the visibility flag module parameter value */ protected String getVisibilityFlag() { CmsModule module = OpenCms.getModuleManager().getModule(this.getClass().getPackage().getName()); if (module == null) { return VISIBILITY_ALL; } return module.getParameter(PARAM_VISIBILITY_FLAG, VISIBILITY_ALL); } }
/** * @see org.opencms.workplace.list.A_CmsListDialog#validateParamaters() */ @Override protected void validateParamaters() throws Exception { if (OpenCms.getModuleManager().getModule(getParamModule()) == null) { // just throw a dummy exception here since getModule does not produce an exception when a // module is not found throw new Exception(); } }
/** * Displays a list of all currently installed modules.<p> * * @throws Exception if something goes wrong */ public void listModules() throws Exception { Set modules = OpenCms.getModuleManager().getModuleNames(); System.out.println("\n" + getMessages().key(Messages.GUI_SHELL_LIST_MODULES_1, new Integer(modules.size()))); Iterator i = modules.iterator(); while (i.hasNext()) { String moduleName = (String)i.next(); System.out.println(moduleName); } System.out.println(); }
/** * Collects all resource names belonging to a module in a Vector.<p> * * @param moduleName the name of the module * * @return Vector with path Strings of resources */ public static Vector getModuleResources(String moduleName) { Vector resNames = new Vector(OpenCms.getModuleManager().getModule(moduleName).getResources()); return resNames; }
/** * @see org.opencms.workplace.list.A_CmsListDialog#validateParamaters() */ @Override protected void validateParamaters() throws Exception { if (OpenCms.getModuleManager().getModule(getParamModule()) == null) { // just throw a dummy exception here since getModule does not produce an exception when a // module is not found throw new Exception(); } }
/** * Return true if user uses new workplace.<p> * * @return true if the user users the new workplace */ public boolean usesNewWorkplace() { boolean traditionalWorkplaceExists = OpenCms.getModuleManager().hasModule("org.opencms.workplace.traditional"); if (!traditionalWorkplaceExists) { return true; } else { return !(WORKPLACE_MODE_OLD.equals(getAdditionalPreference(PREF_WORKPLACE_MODE, true))); } }
/** * @see org.opencms.workplace.CmsWidgetDialog#validateParamaters() */ @Override protected void validateParamaters() throws Exception { String moduleName = getParamModule(); // check module CmsModule module = OpenCms.getModuleManager().getModule(moduleName); if (module == null) { throw new Exception(); } } }
/** * Returns <code>true</code> if the module has been created successful.<p> * * @return <code>true</code> if the module has been created successful */ public boolean success() { return OpenCms.getModuleManager().getModule(m_cloneInfo.getName()) != null; }
/** * Returns a parameter value from the module parameters.<p> * * @param name the name of the module * @param key the parameter to return the value for * @return the parameter value from the module parameters, or <code>null</code> if the parameter is not set */ public static String getModuleParam(String name, String key) { CmsModule module = OpenCms.getModuleManager().getModule(name); if (module != null) { return module.getParameter(key); } return null; }
/** * Displays a list of all currently installed modules.<p> * * @throws Exception if something goes wrong */ public void listModules() throws Exception { Set<String> modules = OpenCms.getModuleManager().getModuleNames(); m_shell.getOut().println( "\n" + getMessages().key(Messages.GUI_SHELL_LIST_MODULES_1, new Integer(modules.size()))); Iterator<String> i = modules.iterator(); while (i.hasNext()) { String moduleName = i.next(); m_shell.getOut().println(moduleName); } m_shell.getOut().println(); }
/** * @see org.opencms.workplace.CmsWidgetDialog#validateParamaters() */ @Override protected void validateParamaters() throws Exception { String moduleName = getParamModule(); // check module if (!isNewModule()) { CmsModule module = OpenCms.getModuleManager().getModule(moduleName); if (module == null) { throw new Exception(); } } }
/** * Deletes a module.<p> * * @param moduleName the name of the module * @throws Exception if something goes wrong */ public void deleteModule(String moduleName) throws Exception { OpenCms.getModuleManager().deleteModule( m_cms, moduleName, false, new CmsShellReport(m_cms.getRequestContext().getLocale())); }
/** * Deletes a module.<p> * * @param moduleName the name of the module * @throws Exception if something goes wrong */ public void deleteModule(String moduleName) throws Exception { OpenCms.getModuleManager().deleteModule( m_cms, moduleName, false, new CmsShellReport(m_cms.getRequestContext().getLocale())); }
/** * @see org.opencms.file.wrapper.A_CmsResourceWrapper#deleteResource(org.opencms.file.CmsObject, java.lang.String, org.opencms.file.CmsResource.CmsResourceDeleteMode) */ @Override public boolean deleteResource(CmsObject cms, String resourcename, CmsResource.CmsResourceDeleteMode siblingMode) throws CmsException { if (matchParentPath(EXPORT_PATH, resourcename)) { String fileName = CmsResource.getName(resourcename); boolean result = OpenCms.getModuleManager().getImportExportRepository().deleteModule(fileName); return result; } else { return false; } }
/** * @see org.opencms.file.wrapper.A_CmsResourceWrapper#writeFile(org.opencms.file.CmsObject, org.opencms.file.CmsFile) */ @Override public CmsFile writeFile(CmsObject cms, CmsFile resource) throws CmsException { if (matchParentPath(IMPORT_PATH, resource.getRootPath())) { OpenCms.getModuleManager().getImportExportRepository().importModule( CmsResource.getName(resource.getRootPath()), resource.getContents()); m_importFileUpdateCache.put(resource.getRootPath(), Long.valueOf(System.currentTimeMillis())); m_importDataCache.put(resource.getRootPath(), resource); return resource; } else { return super.writeFile(cms, resource); } }
/** * Gets the module export handler containing all resources used in the module export.<p> * @return CmsModuleImportExportHandler with all module resources */ private CmsModuleImportExportHandler getExportHandler() { String moduleName = getParamModule(); // get the module CmsModule module = OpenCms.getModuleManager().getModule(moduleName); // create the handler description String handlerDescription = Messages.get().getBundle(getLocale()).key( Messages.GUI_MODULES_LIST_EXPORT_REPORT_HANDLER_NAME_1, moduleName); return CmsModuleImportExportHandler.getExportHandler(getCms(), module, handlerDescription); } }