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 javax.jcr.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(javax.jcr.Node moduleConfig)
Lifecycle callback to allow aDaemonModule
to configure itself.protected abstract void
doConfigure(javax.jcr.Node moduleConfig)
Lifecycle callback to allow aDaemonModule
to configure itself.protected abstract void
doInitialize(javax.jcr.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(javax.jcr.Session session)
Lifecycle callback method that is called when the component is started.protected boolean
isReconfigureEvent(javax.jcr.observation.Event event)
Called by the module configuration listener on event.protected void
onConfigurationChange(javax.jcr.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(javax.jcr.Node moduleConfig) throws javax.jcr.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:
javax.jcr.RepositoryException
-
doConfigure
protected abstract void doConfigure(javax.jcr.Node moduleConfig) throws javax.jcr.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:
javax.jcr.RepositoryException
-
initialize
public final void initialize(javax.jcr.Session session) throws javax.jcr.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:
javax.jcr.RepositoryException
-
doInitialize
protected abstract void doInitialize(javax.jcr.Session session) throws javax.jcr.RepositoryException
Lifecycle callback that is called when this module is started.- Parameters:
session
- aSession
that can be used throughout this module's life.- Throws:
javax.jcr.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(javax.jcr.Node moduleConfig) throws javax.jcr.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:
javax.jcr.RepositoryException
-
isReconfigureEvent
protected boolean isReconfigureEvent(javax.jcr.observation.Event event) throws javax.jcr.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:
javax.jcr.RepositoryException
-
getModuleConfigPath
public String getModuleConfigPath()
-
getModuleName
public String getModuleName()
-
-