Class AbstractReconfigurableDaemonModule

  • All Implemented Interfaces:
    ConfigurableDaemonModule, DaemonModule

    public abstract class AbstractReconfigurableDaemonModule
    extends Object
    implements ConfigurableDaemonModule
    Abstract base class for ConfigurableDaemonModules 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 Detail

      • moduleName

        protected String moduleName
      • moduleConfigPath

        protected String moduleConfigPath
      • session

        protected Session session
    • Constructor Detail

      • AbstractReconfigurableDaemonModule

        public AbstractReconfigurableDaemonModule()
    • Method Detail

      • doConfigure

        protected abstract void doConfigure​(Node moduleConfig)
                                     throws RepositoryException
        Lifecycle callback to allow a DaemonModule to configure itself. This method is called on startup iff there is module config node, and before initialize(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
      • doInitialize

        protected abstract void doInitialize​(Session session)
                                      throws RepositoryException
        Lifecycle callback that is called when this module is started.
        Parameters:
        session - a Session 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 interface DaemonModule
      • 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 calls doConfigure(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()