Package org.onehippo.repository.modules
Class AbstractReconfigurableDaemonModule
- java.lang.Object
-
- org.onehippo.repository.modules.AbstractReconfigurableDaemonModule
-
- All Implemented Interfaces:
ConfigurableDaemonModule
,DaemonModule
public abstract class AbstractReconfigurableDaemonModule extends Object implements ConfigurableDaemonModule
Abstract base class forConfigurableDaemonModule
s that wish to reconfigure when their module configuration changes in the repository.Note that implementations must make sure to take care of thread safety issues that arise as a consequence of a reconfiguration callback. This can happen at any time, possibly in the middle of servicing other threads.
-
-
Field Summary
Fields Modifier and Type Field Description protected String
moduleConfigPath
protected String
moduleName
protected Session
session
-
Constructor Summary
Constructors Constructor Description AbstractReconfigurableDaemonModule()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
configure(Node moduleConfig)
Lifecycle callback to allow aDaemonModule
to configure itself.protected abstract void
doConfigure(Node moduleConfig)
Lifecycle callback to allow aDaemonModule
to configure itself.protected abstract void
doInitialize(Session session)
Lifecycle callback that is called when this module is started.protected abstract void
doShutdown()
Lifecycle callback method that is called by the repository before shutting down .String
getModuleConfigPath()
String
getModuleName()
void
initialize(Session session)
Lifecycle callback method that is called when the component is started.protected boolean
isReconfigureEvent(Event event)
Called by the module configuration listener on event.protected void
onConfigurationChange(Node moduleConfig)
Called when the module configuration has changed.void
shutdown()
Lifecycle callback method that is called by the repository before shutting down
-
-
-
Method Detail
-
configure
public final void configure(Node moduleConfig) throws RepositoryException
Description copied from interface:ConfigurableDaemonModule
Lifecycle callback to allow aDaemonModule
to configure itself. This method is called on startup if there is module config node, and beforeDaemonModule.initialize(javax.jcr.Session)
is called.- Specified by:
configure
in interfaceConfigurableDaemonModule
- Parameters:
moduleConfig
- the node containing the configuration of this module- Throws:
RepositoryException
-
doConfigure
protected abstract void doConfigure(Node moduleConfig) throws RepositoryException
Lifecycle callback to allow aDaemonModule
to configure itself. This method is called on startup iff there is module config node, and beforeinitialize(javax.jcr.Session)
is called. This method is also called when the module config node or any of its descendants changes.- Parameters:
moduleConfig
- the node containing the configuration of this module- Throws:
RepositoryException
-
initialize
public final void initialize(Session session) throws RepositoryException
Description copied from interface:DaemonModule
Lifecycle callback method that is called when the component is started.- Specified by:
initialize
in interfaceDaemonModule
- Parameters:
session
- aSession
that can be used throughout this module's life.- Throws:
RepositoryException
-
doInitialize
protected abstract void doInitialize(Session session) throws RepositoryException
Lifecycle callback that is called when this module is started.- Parameters:
session
- aSession
that can be used throughout this module's life.- Throws:
RepositoryException
-
shutdown
public final void shutdown()
Description copied from interface:DaemonModule
Lifecycle callback method that is called by the repository before shutting down- Specified by:
shutdown
in interfaceDaemonModule
-
doShutdown
protected abstract void doShutdown()
Lifecycle callback method that is called by the repository before shutting down .
-
onConfigurationChange
protected void onConfigurationChange(Node moduleConfig) throws RepositoryException
Called when the module configuration has changed. The default implementation just callsdoConfigure(javax.jcr.Node)
but this method may be overridden.- Parameters:
moduleConfig
- the new module configuration node- Throws:
RepositoryException
-
isReconfigureEvent
protected boolean isReconfigureEvent(Event event) throws RepositoryException
Called by the module configuration listener on event. As an optimization, may be overridden to return false for events that are actually not a configuration change, so that they don't trigger a reconfiguration.- Parameters:
event
- event returned by the EventIterator- Returns:
- true if this event requires reloading of the configuration
- Throws:
RepositoryException
-
getModuleConfigPath
public String getModuleConfigPath()
-
getModuleName
public String getModuleName()
-
-