info.magnolia.module
Class AbstractModuleVersionHandler

java.lang.Object
  extended by info.magnolia.module.AbstractModuleVersionHandler
All Implemented Interfaces:
ModuleVersionHandler
Direct Known Subclasses:
CoreModuleVersionHandler, DefaultModuleVersionHandler

public abstract class AbstractModuleVersionHandler
extends Object
implements ModuleVersionHandler

Extend this and register your deltas in the constructor using the register method. Add your own install tasks by overriding the getExtraInstallTasks() method. In most cases, modules won't need to override any other method.

See Also:
DefaultModuleVersionHandler

Nested Class Summary
 class AbstractModuleVersionHandler.ModuleVersionToLatestTask
          The task which modifies the "version" property to the version being installed.
 class AbstractModuleVersionHandler.ModuleVersionUpdateTask
          The task which modifies the "version" property to the version we're updating to.
 
Field Summary
protected  org.slf4j.Logger log
           
 
Constructor Summary
AbstractModuleVersionHandler()
           
 
Method Summary
protected abstract  List<Task> getBasicInstallTasks(InstallContext installContext)
           
 Version getCurrentlyInstalled(InstallContext ctx)
          Gets the currently installed version number of this module.
protected  Delta getDefaultUpdate(InstallContext installContext)
          The minimal delta to be applied for each update, even if no delta was specifically registered for the version being installed.
protected  List<Condition> getDefaultUpdateConditions(Version forVersion)
           
protected  List<Task> getDefaultUpdateTasks(Version forVersion)
           
 List<Delta> getDeltas(InstallContext installContext, Version from)
          Returns the deltas to be applied to update from the given Version from to the current one.
protected  List<Task> getExtraInstallTasks(InstallContext installContext)
          Override this method to add specific install tasks to your module.
protected  Delta getInstall(InstallContext installContext)
           
protected  List<Condition> getInstallConditions()
           
 Delta getStartupDelta(InstallContext installContext)
          Returns a Delta that needs to be executed always before this module is started.
protected  List<Task> getStartupTasks(InstallContext installContext)
          Override this method to add specific startup tasks to your module.
protected  List<Delta> getUpdateDeltas(InstallContext installContext, Version from)
           
protected  void register(Delta delta)
          Registers the delta needed to update to version v from the previous one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.slf4j.Logger log
Constructor Detail

AbstractModuleVersionHandler

public AbstractModuleVersionHandler()
Method Detail

register

protected void register(Delta delta)
Registers the delta needed to update to version v from the previous one. Adds a Task to update the module version in the repository.


getCurrentlyInstalled

public Version getCurrentlyInstalled(InstallContext ctx)
Description copied from interface: ModuleVersionHandler
Gets the currently installed version number of this module.

Specified by:
getCurrentlyInstalled in interface ModuleVersionHandler

getDeltas

public List<Delta> getDeltas(InstallContext installContext,
                             Version from)
Description copied from interface: ModuleVersionHandler
Returns the deltas to be applied to update from the given Version from to the current one. If from is null, it means the module is being installed, and we should thus return the necessary deltas to install it. It is also responsible for updating the current version number of the module, wherever it is stored.

Specified by:
getDeltas in interface ModuleVersionHandler

getUpdateDeltas

protected List<Delta> getUpdateDeltas(InstallContext installContext,
                                      Version from)

getDefaultUpdate

protected Delta getDefaultUpdate(InstallContext installContext)
The minimal delta to be applied for each update, even if no delta was specifically registered for the version being installed.


getDefaultUpdateTasks

protected List<Task> getDefaultUpdateTasks(Version forVersion)

getDefaultUpdateConditions

protected List<Condition> getDefaultUpdateConditions(Version forVersion)

getInstall

protected Delta getInstall(InstallContext installContext)
See Also:
override this method if you need a different set of default install tasks., override this method if you need extra tasks for install.

getBasicInstallTasks

protected abstract List<Task> getBasicInstallTasks(InstallContext installContext)

getExtraInstallTasks

protected List<Task> getExtraInstallTasks(InstallContext installContext)
Override this method to add specific install tasks to your module. Returns an empty list by default.


getInstallConditions

protected List<Condition> getInstallConditions()

getStartupDelta

public Delta getStartupDelta(InstallContext installContext)
Description copied from interface: ModuleVersionHandler
Returns a Delta that needs to be executed always before this module is started. These tasks will be silently applied at startup.

Specified by:
getStartupDelta in interface ModuleVersionHandler
Parameters:
installContext - InstallContext

getStartupTasks

protected List<Task> getStartupTasks(InstallContext installContext)
Override this method to add specific startup tasks to your module. Returns an empty list by default.



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