info.magnolia.module
Class InstallContextImpl

java.lang.Object
  extended by info.magnolia.module.InstallContextImpl
All Implemented Interfaces:
InstallContext

@Singleton
public class InstallContextImpl
extends Object
implements InstallContext

Default implementation of InstallContext; provided by the ModuleManager.

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

Nested Class Summary
 
Nested classes/interfaces inherited from interface info.magnolia.module.InstallContext
InstallContext.Message, InstallContext.MessagePriority
 
Constructor Summary
InstallContextImpl(ModuleRegistry moduleRegistry)
           
 
Method Summary
 void error(String message, Throwable th)
           
 HierarchyManager getConfigHierarchyManager()
           
 javax.jcr.Session getConfigJCRSession()
           
 ModuleDefinition getCurrentModuleDefinition()
          Allows generic tasks to know what's being installed/updated.
 int getExecutedTaskCount()
           
 HierarchyManager getHierarchyManager(String workspace)
           
 javax.jcr.Session getJCRSession(String workspaceName)
           
 Map<String,List<InstallContext.Message>> getMessages()
          A Map of messages where the key is the module name.
protected  String getModuleKey()
          The key used in the map of messages.
 Content getModulesNode()
           
 Content getOrCreateCurrentModuleConfigNode()
           
 Content getOrCreateCurrentModuleNode()
           
 InstallStatus getStatus()
           
 int getTotalTaskCount()
           
 boolean hasModulesNode()
           
 void info(String message)
           
 boolean isModuleRegistered(String moduleName)
           
protected  void log(InstallContext.Message message)
           
 void restartNeeded(String message)
           
 void setCurrentModule(ModuleDefinition module)
           
 void warn(String message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstallContextImpl

@Inject
public InstallContextImpl(ModuleRegistry moduleRegistry)
Method Detail

setCurrentModule

public void setCurrentModule(ModuleDefinition module)

info

public void info(String message)
Specified by:
info in interface InstallContext

warn

public void warn(String message)
Specified by:
warn in interface InstallContext

error

public void error(String message,
                  Throwable th)
Specified by:
error in interface InstallContext

restartNeeded

public void restartNeeded(String message)
Specified by:
restartNeeded in interface InstallContext

getExecutedTaskCount

public int getExecutedTaskCount()
Specified by:
getExecutedTaskCount in interface InstallContext

getTotalTaskCount

public int getTotalTaskCount()
Specified by:
getTotalTaskCount in interface InstallContext

getStatus

public InstallStatus getStatus()
Specified by:
getStatus in interface InstallContext

getMessages

public Map<String,List<InstallContext.Message>> getMessages()
Description copied from interface: InstallContext
A Map of messages where the key is the module name.

Specified by:
getMessages in interface InstallContext

getCurrentModuleDefinition

public ModuleDefinition getCurrentModuleDefinition()
Description copied from interface: InstallContext
Allows generic tasks to know what's being installed/updated.

Specified by:
getCurrentModuleDefinition in interface InstallContext

isModuleRegistered

public boolean isModuleRegistered(String moduleName)
Specified by:
isModuleRegistered in interface InstallContext

getHierarchyManager

public HierarchyManager getHierarchyManager(String workspace)
Specified by:
getHierarchyManager in interface InstallContext

getConfigHierarchyManager

public HierarchyManager getConfigHierarchyManager()
Specified by:
getConfigHierarchyManager in interface InstallContext

getJCRSession

public javax.jcr.Session getJCRSession(String workspaceName)
                                throws javax.jcr.RepositoryException
Specified by:
getJCRSession in interface InstallContext
Throws:
javax.jcr.RepositoryException

getConfigJCRSession

public javax.jcr.Session getConfigJCRSession()
                                      throws javax.jcr.RepositoryException
Specified by:
getConfigJCRSession in interface InstallContext
Throws:
javax.jcr.RepositoryException

hasModulesNode

public boolean hasModulesNode()
Specified by:
hasModulesNode in interface InstallContext

getModulesNode

public Content getModulesNode()
                       throws javax.jcr.RepositoryException
Specified by:
getModulesNode in interface InstallContext
Returns:
the root node for all modules in the config workspace.
Throws:
javax.jcr.RepositoryException

getOrCreateCurrentModuleNode

public Content getOrCreateCurrentModuleNode()
                                     throws javax.jcr.RepositoryException
Specified by:
getOrCreateCurrentModuleNode in interface InstallContext
Throws:
javax.jcr.RepositoryException

getOrCreateCurrentModuleConfigNode

public Content getOrCreateCurrentModuleConfigNode()
                                           throws javax.jcr.RepositoryException
Specified by:
getOrCreateCurrentModuleConfigNode in interface InstallContext
Throws:
javax.jcr.RepositoryException

log

protected void log(InstallContext.Message message)

getModuleKey

protected String getModuleKey()
The key used in the map of messages. This is mostly because Maps keys in FreeMarker can only be Strings... We just need to make sure this is consistent across templates...



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