public class CmsModuleManager extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DEPENDENCY_MODE_DELETE
Indicates dependency check for module deletion.
|
static int |
DEPENDENCY_MODE_IMPORT
Indicates dependency check for module import.
|
Constructor and Description |
---|
CmsModuleManager(java.util.List<CmsModule> configuredModules)
Basic constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addModule(CmsObject cms,
CmsModule module)
Adds a new module to the module manager.
|
static java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
buildDepsForAllModules(java.lang.String rfsAbsPath,
boolean mode)
Returns a map of dependencies.
|
static java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
buildDepsForModulelist(java.util.List<java.lang.String> moduleNames,
java.lang.String rfsAbsPath,
boolean mode)
Returns a map of dependencies between the given modules.
|
java.util.List<CmsModuleDependency> |
checkDependencies(CmsModule module,
int mode)
Checks if a modules dependencies are fulfilled.
|
void |
checkModuleSelectionList(java.util.List<java.lang.String> moduleNames,
java.lang.String rfsAbsPath,
boolean forDeletion)
Checks the module selection list for consistency, that means
that if a module is selected, all its dependencies are also selected.
|
void |
deleteModule(CmsObject cms,
java.lang.String moduleName,
boolean replace,
boolean preserveLibs,
I_CmsReport report)
Deletes a module from the configuration.
|
void |
deleteModule(CmsObject cms,
java.lang.String moduleName,
boolean replace,
I_CmsReport report)
Deletes a module from the configuration.
|
java.util.List<CmsModule> |
getAllInstalledModules()
Returns a list of installed modules.
|
static java.util.Map<CmsModule,java.lang.String> |
getAllModulesFromPath(java.lang.String rfsAbsPath)
Returns a map of modules found in the given RFS absolute path.
|
java.util.Set<CmsExportPoint> |
getExportPoints()
Returns the (immutable) list of configured module export points.
|
CmsModuleImportExportRepository |
getImportExportRepository()
Returns the importExportRepository.
|
CmsModule |
getModule(java.lang.String name)
Returns the module with the given module name,
or
null if no module with the given name is configured. |
java.util.Set<java.lang.String> |
getModuleNames()
Returns the set of names of all the installed modules.
|
boolean |
hasModule(java.lang.String name)
Checks if this module manager has a module with the given name installed.
|
void |
initialize(CmsObject cms,
CmsConfigurationManager configurationManager)
Initializes all module instance classes managed in this module manager.
|
void |
shutDown()
Shuts down all module instance classes managed in this module manager.
|
static java.util.List<java.lang.String> |
topologicalSort(java.util.List<java.lang.String> moduleNames,
java.lang.String rfsAbsPath)
Sorts a given list of module names by dependencies,
so that the resulting list can be imported in that given order,
that means modules without dependencies first.
|
void |
updateModule(CmsObject cms,
CmsModule module)
Updates a already configured module with new values.
|
public static final int DEPENDENCY_MODE_DELETE
public static final int DEPENDENCY_MODE_IMPORT
public CmsModuleManager(java.util.List<CmsModule> configuredModules)
configuredModules
- the list of configured modulespublic static java.util.Map<java.lang.String,java.util.List<java.lang.String>> buildDepsForAllModules(java.lang.String rfsAbsPath, boolean mode) throws CmsConfigurationException
The module dependencies are get from the installed modules or from the module manifest.xml files found in the given FRS path.
Two types of dependency lists can be generated:
rfsAbsPath
- a RFS absolute path to search for modules, or null
to use the installed modulesmode
- if true
a list of forward dependency is build, is not a list of backward dependencyCmsConfigurationException
- if something goes wrongpublic static java.util.Map<java.lang.String,java.util.List<java.lang.String>> buildDepsForModulelist(java.util.List<java.lang.String> moduleNames, java.lang.String rfsAbsPath, boolean mode) throws CmsConfigurationException
The module dependencies are get from the installed modules or from the module manifest.xml files found in the given FRS path.
Two types of dependency lists can be generated:
moduleNames
- a list of module namesrfsAbsPath
- a RFS absolute path to search for modules, or null
to use the installed modulesmode
- if true
a list of forward dependency is build, is not a list of backward dependencyCmsConfigurationException
- if something goes wrongpublic static java.util.Map<CmsModule,java.lang.String> getAllModulesFromPath(java.lang.String rfsAbsPath) throws CmsConfigurationException
rfsAbsPath
- the path to look for module distributionsCmsModule
objects for keys and filename for valuesCmsConfigurationException
- if something goes wrongpublic static java.util.List<java.lang.String> topologicalSort(java.util.List<java.lang.String> moduleNames, java.lang.String rfsAbsPath) throws CmsConfigurationException
The module dependencies are get from the installed modules or from the module manifest.xml files found in the given FRS path.
moduleNames
- a list of module namesrfsAbsPath
- a RFS absolute path to search for modules, or null
to use the installed modulesCmsConfigurationException
- if something goes wrongpublic void addModule(CmsObject cms, CmsModule module) throws CmsSecurityException, CmsConfigurationException
cms
- must be initialized with "Admin" permissionsmodule
- the module to addCmsSecurityException
- if the required permissions are not available (i.e. no "Admin" CmsObject has been provided)CmsConfigurationException
- if a module with this name is already configuredpublic java.util.List<CmsModuleDependency> checkDependencies(CmsModule module, int mode)
The possible values for the mode
parameter are:
DEPENDENCY_MODE_DELETE
DEPENDENCY_MODE_IMPORT
module
- the module to check the dependencies formode
- the dependency check modepublic void checkModuleSelectionList(java.util.List<java.lang.String> moduleNames, java.lang.String rfsAbsPath, boolean forDeletion) throws CmsIllegalArgumentException, CmsConfigurationException
The module dependencies are get from the installed modules or from the module manifest.xml files found in the given FRS path.
moduleNames
- a list of module namesrfsAbsPath
- a RFS absolute path to search for modules, or null
to use the installed modulesforDeletion
- there are two modes, one for installation of modules, and one for deletion.CmsIllegalArgumentException
- if the module list is not consistentCmsConfigurationException
- if something goes wrongpublic void deleteModule(CmsObject cms, java.lang.String moduleName, boolean replace, boolean preserveLibs, I_CmsReport report) throws CmsRoleViolationException, CmsConfigurationException, CmsLockException
cms
- must be initialized with "Admin" permissionsmoduleName
- the name of the module to deletereplace
- indicates if the module is replaced (true) or finally deleted (false)report
- the report to print progress messages toCmsRoleViolationException
- if the required module manager role permissions are not availableCmsConfigurationException
- if a module with this name is not available for deletingCmsLockException
- if the module resources can not be lockedpublic void deleteModule(CmsObject cms, java.lang.String moduleName, boolean replace, I_CmsReport report) throws CmsRoleViolationException, CmsConfigurationException, CmsLockException
cms
- must be initialized with "Admin" permissionsmoduleName
- the name of the module to deletereplace
- indicates if the module is replaced (true) or finally deleted (false)report
- the report to print progress messages toCmsRoleViolationException
- if the required module manager role permissions are not availableCmsConfigurationException
- if a module with this name is not available for deletingCmsLockException
- if the module resources can not be lockedpublic java.util.List<CmsModule> getAllInstalledModules()
CmsModule
objectspublic java.util.Set<CmsExportPoint> getExportPoints()
CmsExportPoint
public CmsModuleImportExportRepository getImportExportRepository()
public CmsModule getModule(java.lang.String name)
null
if no module with the given name is configured.name
- the name of the module to returnpublic java.util.Set<java.lang.String> getModuleNames()
public boolean hasModule(java.lang.String name)
name
- the name of the module to checkpublic void initialize(CmsObject cms, CmsConfigurationManager configurationManager) throws CmsRoleViolationException
cms
- an initialized CmsObject with "manage modules" role permissionsconfigurationManager
- the initialized OpenCms configuration managerCmsRoleViolationException
- if the provided OpenCms context does not have "manage modules" role permissionspublic void shutDown()
public void updateModule(CmsObject cms, CmsModule module) throws CmsRoleViolationException, CmsConfigurationException
cms
- must be initialized with "Admin" permissionsmodule
- the module to updateCmsRoleViolationException
- if the required module manager role permissions are not availableCmsConfigurationException
- if a module with this name is not available for updating