Package com.onwbp.base.repository

# Class ModulesRegister

java.lang.Object
com.onwbp.base.repository.ModulesRegister

public class ModulesRegister extends Object
This class has been replaced by `ModuleRegistrationServlet`.

See Also:
  - `ModuleRegistrationServlet`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ModulesRegister()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static List<com.onwbp.base.schema.definition.TNode>`
  `getDependentModuleNames(ServletContext aServletContext)`
  Deprecated.
  Since 5.7.0, this method returns an empty list.
  `static boolean`
  `registerDirectory(File aModuleDirectory)`
  Registers a new module whose root is at the specified directory.
  `static boolean`
  `registerDirectoryIfModule(File aModuleDirectory)`
  Registers a new module whose root is at the specified directory.
  `static boolean`
  `registerWebApp(Servlet aServlet, ServletConfig aServletConfig)`
  Deprecated.
  Since 5.9.0, this method is replaced by `ModuleRegistrationListener`.
  `static void`
  `unregisterWebApp(Servlet aServlet, ServletConfig aServletConfig)`
  Deprecated.
  Since 5.9.0, this method is replaced by `ModuleRegistrationListener`.

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

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

- ## Constructor Details

  - ### ModulesRegister

    public ModulesRegister()

- ## Method Details

  - ### registerDirectoryIfModule

    public static boolean registerDirectoryIfModule(File aModuleDirectory) throws ModuleDefinitionException
    Registers a new module whose root is at the specified directory.

    A directory is identified as a module if, and only if, the file '/WEB-INF/ebx/module.xml' is defined under this directory.

    Parameters:
      `aModuleDirectory` - the module directory to register
    Returns:
      `true` if registration has succeeded, `false` if registration has failed because a module with same name has been already registered.
    Throws:
      `ModuleDefinitionException` - if file '/WEB-INF/ebx/module.xml' is defined but it cannot be read properly (this event is also added as an error to 'kernel' logs).

  - ### registerDirectory

    public static boolean registerDirectory(File aModuleDirectory) throws ModuleDefinitionException
    Registers a new module whose root is at the specified directory.

    Requires the file `/WEB-INF/ebx/module.xml` to be defined under this directory.

    Parameters:
      `aModuleDirectory` - the module directory to register
    Returns:
      `true` if registration has succeeded. Returns `false` if registration has failed because a module with same name has been already registered.
    Throws:
      `ModuleDefinitionException` - if file '/WEB-INF/ebx/module.xml' is not defined or if it cannot be read properly (this event is also added as an error to 'kernel' logs).

  - ### getDependentModuleNames

    @Deprecated public static List<com.onwbp.base.schema.definition.TNode> getDependentModuleNames(ServletContext aServletContext) throws ModuleDefinitionException
    Deprecated.
    Since 5.7.0, this method returns an empty list.
    Throws:
      `ModuleDefinitionException`

  - ### registerWebApp

    @Deprecated public static boolean registerWebApp(Servlet aServlet, ServletConfig aServletConfig) throws ModuleDefinitionException
    Deprecated.
    Since 5.9.0, this method is replaced by `ModuleRegistrationListener`.
    Registers a new module based on the specified servlet's web application.

    This method must be called by the method `Servlet.init()`.

    The file '/WEB-INF/ebx/module.xml' in the corresponding web application defines the module name and other basic module features.

    If the web application defines some specific module classes (like `ServiceInstaller`), the `Servlet` provided must have been loaded by the web application itself (that is , it must be in '/WEB-INF/classes/' or in '/WEB-INF/lib/*.jar').

    Parameters:
      `aServlet` - the Java Servlet API
      `aServletConfig` - the servlet's configuration and initialization parameters
    Returns:
      `true` as registration has succeeded.
    Throws:
      `ModuleDefinitionException` - if file '/WEB-INF/ebx/module.xml' is not defined by the web application, or if it cannot be read properly (this event is also added as an error to 'kernel' logs).
    See Also:
      - `unregisterWebApp(Servlet, ServletConfig)`
      - `Servlet.init(jakarta.servlet.ServletConfig)`

  - ### unregisterWebApp

    @Deprecated public static void unregisterWebApp(Servlet aServlet, ServletConfig aServletConfig)
    Deprecated.
    Since 5.9.0, this method is replaced by `ModuleRegistrationListener`.
    Unregisters a module that has been registered by the `registerWebApp()`.

    This method must be called by the method `Servlet.destroy()`.

    Parameters:
      `aServlet` - the Java Servlet API
      `aServletConfig` - the servlet's configuration and initialization parameters
    Throws:
      `ModuleDefinitionException` - if file '/WEB-INF/ebx/module.xml' is not defined by the web application, or if it cannot be read properly (this event is also added as an error to 'kernel' logs).
    See Also:
      - `registerWebApp(Servlet, ServletConfig)`
      - `Servlet.destroy()`