public static Map<String, List<String>> buildDepsForAllModules(String rfsAbsPath, boolean mode)
    throws CmsConfigurationException {

        Map<String, List<String>> ret = new HashMap<String, List<String>>();
        List<CmsModule> modules;
        if (rfsAbsPath == null) {
            modules = OpenCms.getModuleManager().getAllInstalledModules();
        } else {
            modules = new ArrayList<CmsModule>(getAllModulesFromPath(rfsAbsPath).keySet());
        }
        Iterator<CmsModule> itMods = modules.iterator();
        while (itMods.hasNext()) {
            CmsModule module = itMods.next();

            // if module a depends on module b, and module c depends also on module b:
            // build a map with a list containing "a" and "c" keyed by "b" to get a
            // list of modules depending on module "b"...
            Iterator<CmsModuleDependency> itDeps = module.getDependencies().iterator();
            while (itDeps.hasNext()) {
                CmsModuleDependency dependency = itDeps.next();
                // module dependency package name
                String moduleDependencyName = dependency.getName();

                if (mode) {
                    // get the list of dependent modules
                    List<String> moduleDependencies = ret.get(moduleDependencyName);
                    if (moduleDependencies == null) {
                        // build a new list if "b" has no dependent modules yet
                        moduleDependencies = new ArrayList<String>();
                        ret.put(moduleDependencyName, moduleDependencies);
                    }
                    // add "a" as a module depending on "b"
                    moduleDependencies.add(module.getName());
                } else {
                    List<String> moduleDependencies = ret.get(module.getName());
                    if (moduleDependencies == null) {
                        moduleDependencies = new ArrayList<String>();
                        ret.put(module.getName(), moduleDependencies);
                    }
                    moduleDependencies.add(dependency.getName());
                }
            }
        }
        itMods = modules.iterator();
        while (itMods.hasNext()) {
            CmsModule module = itMods.next();
            if (ret.get(module.getName()) == null) {
                ret.put(module.getName(), new ArrayList<String>());
            }
        }
        return ret;
    }
public static Map < String , List < String > > buildDepsForAllModules ( String rfsAbsPath , boolean mode ) throws CmsConfigurationException { Map < String , List < String > > ret = new HashMap < String , List < String > > ( ) ; List < CmsModule > modules ; if ( rfsAbsPath == null ) { modules = OpenCms . getModuleManager ( ) . getAllInstalledModules ( ) ; } else { modules = new ArrayList < CmsModule > ( getAllModulesFromPath ( rfsAbsPath ) . keySet ( ) ) ; } Iterator < CmsModule > itMods = modules . iterator ( ) ; while ( itMods . hasNext ( ) ) { CmsModule module = itMods . next ( ) ; Iterator < CmsModuleDependency > itDeps = module . getDependencies ( ) . iterator ( ) ; while ( itDeps . hasNext ( ) ) { CmsModuleDependency dependency = itDeps . next ( ) ; String moduleDependencyName = dependency . getName ( ) ; if ( mode ) { List < String > moduleDependencies = ret . get ( moduleDependencyName ) ; if ( moduleDependencies == null ) { moduleDependencies = new ArrayList < String > ( ) ; ret . put ( moduleDependencyName , moduleDependencies ) ; } moduleDependencies . add ( module . getName ( ) ) ; } else { List < String > moduleDependencies = ret . get ( module . getName ( ) ) ; if ( moduleDependencies == null ) { moduleDependencies = new ArrayList < String > ( ) ; ret . put ( module . getName ( ) , moduleDependencies ) ; } moduleDependencies . add ( dependency . getName ( ) ) ; } } } itMods = modules . iterator ( ) ; while ( itMods . hasNext ( ) ) { CmsModule module = itMods . next ( ) ; if ( ret . get ( module . getName ( ) ) == null ) { ret . put ( module . getName ( ) , new ArrayList < String > ( ) ) ; } } return ret ; }
Returns a map of dependencies.<p>

The module dependencies are get from the installed modules or
from the module manifest.xml files found in the given FRS path.<p>

Two types of dependency lists can be generated:<br>
<ul>
<li>Forward dependency lists: a list of modules that depends on a module</li>
<li>Backward dependency lists: a list of modules that a module depends on</li>
</ul>

@param rfsAbsPath a RFS absolute path to search for modules, or <code>null</code> to use the installed modules
@param mode if <code>true</code> a list of forward dependency is build, is not a list of backward dependency

@return a Map of module names as keys and a list of dependency names as values

@throws CmsConfigurationException if something goes wrong