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 javax.jcr.Session session
    • Constructor Detail

      • AbstractReconfigurableDaemonModule

        public AbstractReconfigurableDaemonModule()
    • Method Detail

      • doConfigure

        protected abstract void doConfigure​(javax.jcr.Node moduleConfig)
                                     throws javax.jcr.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:
        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 interface DaemonModule
        Parameters:
        session - a Session 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 - a Session 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 interface DaemonModule
      • 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 calls doConfigure(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()