info.magnolia.module
Class ModuleManagerImpl

java.lang.Object
  extended by info.magnolia.module.ModuleManagerImpl
All Implemented Interfaces:
ModuleManager

@Singleton
public class ModuleManagerImpl
extends Object
implements ModuleManager

TODO : factor out into simpler units.

Version:
$Revision: $ ($Author: $)
Author:
gjoseph

Nested Class Summary
 
Nested classes/interfaces inherited from interface info.magnolia.module.ModuleManager
ModuleManager.Factory, ModuleManager.ModuleAndDeltas, ModuleManager.ModuleManagementState
 
Constructor Summary
protected ModuleManagerImpl()
          Deprecated. since 4.5 - use IoC - temporarily kept for tests ?
protected ModuleManagerImpl(InstallContextImpl installContext, ModuleDefinitionReader moduleDefinitionReader)
          Deprecated. since 4.5 - use IoC - temporarily kept for tests ?
  ModuleManagerImpl(InstallContextImpl installContext, ModuleDefinitionReader moduleDefinitionReader, ModuleRegistry moduleRegistry, DependencyChecker dependencyChecker)
           
 
Method Summary
protected  void applyDeltas(ModuleDefinition moduleDef, List<Delta> deltas, InstallContextImpl ctx)
          Applies to given deltas for the given module.
 void checkForInstallOrUpdates()
          In addition to checking for install or updates, this method also loads repositories when there are no pending install or update tasks.
protected  void executeStartupTasks()
          Process startup tasks.
 InstallContext getInstallContext()
           
protected  Map<String,Object> getModuleInstanceProperties(ModuleDefinition moduleDefinition)
          Builds a map of properties to be set on the module instance, the properties are "moduleDefinition", "name", "moduleNode" and "configNode".
 ModuleManager.ModuleManagementState getStatus()
          Returns the status as discovered by checkForInstallOrUpdates().
 ModuleManagerUI getUI()
           
protected  void installOrUpdateModule(ModuleManager.ModuleAndDeltas moduleAndDeltas, InstallContextImpl ctx)
           
 List<ModuleDefinition> loadDefinitions()
          Loads modules definitions, validates dependencies and sorts modules by dependencies.
protected  ModuleVersionHandler newVersionHandler(ModuleDefinition module)
           
 void performInstallOrUpdate()
           
protected  void populateModuleInstance(Object moduleInstance, Map<String,Object> moduleProperties)
           
protected  void startModule(Object moduleInstance, ModuleDefinition moduleDefinition, ModuleLifecycleContextImpl lifecycleContext)
           
 void startModules()
           
protected  void stopModule(Object moduleInstance, ModuleDefinition moduleDefinition, ModuleLifecycleContextImpl lifecycleContext)
           
 void stopModules()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModuleManagerImpl

protected ModuleManagerImpl()
Deprecated. since 4.5 - use IoC - temporarily kept for tests ?


ModuleManagerImpl

protected ModuleManagerImpl(InstallContextImpl installContext,
                            ModuleDefinitionReader moduleDefinitionReader)
Deprecated. since 4.5 - use IoC - temporarily kept for tests ?


ModuleManagerImpl

@Inject
public ModuleManagerImpl(InstallContextImpl installContext,
                                ModuleDefinitionReader moduleDefinitionReader,
                                ModuleRegistry moduleRegistry,
                                DependencyChecker dependencyChecker)
Method Detail

loadDefinitions

public List<ModuleDefinition> loadDefinitions()
                                       throws ModuleManagementException
Description copied from interface: ModuleManager
Loads modules definitions, validates dependencies and sorts modules by dependencies. TODO - this should not be done by ModuleManager

Specified by:
loadDefinitions in interface ModuleManager
Throws:
ModuleManagementException

checkForInstallOrUpdates

public void checkForInstallOrUpdates()
In addition to checking for install or updates, this method also loads repositories when there are no pending install or update tasks.

Specified by:
checkForInstallOrUpdates in interface ModuleManager
See Also:
ModuleManager.checkForInstallOrUpdates()

getStatus

public ModuleManager.ModuleManagementState getStatus()
Description copied from interface: ModuleManager
Returns the status as discovered by checkForInstallOrUpdates().

Specified by:
getStatus in interface ModuleManager

getUI

public ModuleManagerUI getUI()
Specified by:
getUI in interface ModuleManager

newVersionHandler

protected ModuleVersionHandler newVersionHandler(ModuleDefinition module)

performInstallOrUpdate

public void performInstallOrUpdate()
Specified by:
performInstallOrUpdate in interface ModuleManager

getInstallContext

public InstallContext getInstallContext()
Specified by:
getInstallContext in interface ModuleManager

startModules

public void startModules()
Specified by:
startModules in interface ModuleManager

executeStartupTasks

protected void executeStartupTasks()
Process startup tasks. Tasks retured by ModuleDefinition.getStartupTasks() are always executed and do not require manual intervention.


startModule

protected void startModule(Object moduleInstance,
                           ModuleDefinition moduleDefinition,
                           ModuleLifecycleContextImpl lifecycleContext)

stopModule

protected void stopModule(Object moduleInstance,
                          ModuleDefinition moduleDefinition,
                          ModuleLifecycleContextImpl lifecycleContext)

getModuleInstanceProperties

protected Map<String,Object> getModuleInstanceProperties(ModuleDefinition moduleDefinition)
Builds a map of properties to be set on the module instance, the properties are "moduleDefinition", "name", "moduleNode" and "configNode". This map is rebuilt every-time reloading takes place just in case the nodes have changed since startup. One situation where this is necessary is when a module does not have a config node at startup but one is added later on, see MAGNOLIA-3457.


populateModuleInstance

protected void populateModuleInstance(Object moduleInstance,
                                      Map<String,Object> moduleProperties)

stopModules

public void stopModules()
Specified by:
stopModules in interface ModuleManager

installOrUpdateModule

protected void installOrUpdateModule(ModuleManager.ModuleAndDeltas moduleAndDeltas,
                                     InstallContextImpl ctx)

applyDeltas

protected void applyDeltas(ModuleDefinition moduleDef,
                           List<Delta> deltas,
                           InstallContextImpl ctx)
Applies to given deltas for the given module. It is NOT responsible for setting the given module as being the current module in the given context, but it is responsible for unsetting it when done, and for saving upon success.



Copyright © 2003-2013 Magnolia International Ltd.. All Rights Reserved.