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 for
ConfigurableDaemonModule
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
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
Lifecycle callback method that is called by the repository before shutting down .final 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.final void
shutdown()
Lifecycle callback method that is called by the repository before shutting down
-
Field Details
-
moduleName
-
moduleConfigPath
-
session
-
-
Constructor Details
-
AbstractReconfigurableDaemonModule
public AbstractReconfigurableDaemonModule()
-
-
Method Details
-
configure
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
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
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
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
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
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
-
getModuleName
-