Package com.orchestranetworks.module

# Class ModuleRegistrationListener

java.lang.Object
com.orchestranetworks.module.ModuleRegistrationListener

All Implemented Interfaces:
  `ModuleRegistration`, `ServletContextListener`, `EventListener`

public abstract class ModuleRegistrationListener extends Object implements ServletContextListener, ModuleRegistration
Ensures the EBX® module registration from a servlet context listener.

This abstract class implements `ServletContextListener`, then the implementation class must be annotated with `WebListener` in order to receive the `ModuleRegistration`'s handle methods.

If further initialization or termination is required, see `ModuleRegistration` for more information.

Since:
  5.9.0
See Also:
  - Module registration

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final void`
  `contextDestroyed(ServletContextEvent anEvent)`
  Receives a notification that the web application servlet context event is about to be destroyed.
  `final void`
  `contextInitialized(ServletContextEvent anEvent)`
  Receives a notification that the web application servlet context event is about to be initialized.
  `void`
  `handleContextInitialized(ModuleInitializedContext aContext)`
  Handles the registration of dynamic resources and performs module-specific initializations.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface com.orchestranetworks.module.ModuleRegistration

  `destroyBeforeUnregisterModule, handleRepositoryShutdown, handleRepositoryStartup, handleSearchRegistration, handleServiceRegistration`

- ## Method Details

  - ### handleContextInitialized

    public void handleContextInitialized(ModuleInitializedContext aContext)
    Handles the registration of dynamic resources and performs module-specific initializations.

    It is invoked once the EBX® module has been registered, before the repository has been started.

    This method can be overridden.

    Default implementation does nothing.

    Parameters:
      `aContext` - the module's initialized context generated after the module's registration.

  - ### contextInitialized

    public final void contextInitialized(ServletContextEvent anEvent) throws ModuleDefinitionException
    Receives a notification that the web application servlet context event is about to be initialized.

    This 'final' implementation registers the EBX® module to the modules registry.

    Specified by:
      `contextInitialized` in interface `ServletContextListener`
    Parameters:
      `anEvent` - event class for notifications about changes to the servlet context of a web application
    Throws:
      `ModuleDefinitionException` - if the module cannot be registered properly

  - ### contextDestroyed

    public final void contextDestroyed(ServletContextEvent anEvent)
    Receives a notification that the web application servlet context event is about to be destroyed.

    This 'final' implementation:

    1. invokes the method `ModuleRegistration.destroyBeforeUnregisterModule()`
    2. unregisters the EBX® module from the modules registry.
    Specified by:
      `contextDestroyed` in interface `ServletContextListener`