org.licas.module

## Class ModuleHandler

- java.lang.Object
- - org.licas.module.ModuleHandler

-     public class ModuleHandler
      extends java.lang.Object

  This class can be used to store and retrieve the service modules.
  Author:
    Kieran Greer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ModuleHandler()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static BehaviourModule` | `behaviourFromClass(java.lang.Class serviceClass, Auto service, PasswordHandler pHandler)` Return a behaviour instance for the service class.
    `static BehaviourModule` | `behaviourModule(Auto service, PasswordHandler pHandler)` Return a behaviour instance for an `Auto-related` service.
    `protected static ControlModule` | `controlFromClass(java.lang.Class serviceClass, Service service, PasswordHandler pHandler)` Return a behaviour instance for the service class.
    `static ControlModule` | `controlModule(Service service, PasswordHandler pHandler)` Return a control instance for the service class type.
    `static DataModule` | `dataModule(Service service, PasswordHandler pHandler)` Return a data module instance.
    `static DataModule` | `dataModule(Service service, PasswordHandler pHandler, org.licas_xml.abs.Element adminDataXml)` Return a data module instance.
    `static java.lang.String` | `heuristicClass(java.lang.String heuristicType)` Return a likely heuristic module class type for a description.
    `static boolean` | `isAuto(java.lang.Object thisObj)` Return true if the parameter is derived from the `Auto` object.
    `static boolean` | `isAutoManager(java.lang.Object thisObj)` Return true if this module is an autonomic manager.
    `static boolean` | `isFrameworkModule(java.lang.Object thisObj)` Return true if the parameter is derived from the `FrameworkModule` object.
    `static boolean` | `isLicasModule(java.lang.Object thisObj)` Return true if the parameter is derived from the `LicasModule` object.
    `static boolean` | `isScriptModule(SM_Service sModule)` Return true if the service module can create and execute a script.
    `static boolean` | `isServer(java.lang.Object thisObj)` Return true if the parameter is derived from the `ESB` object.
    `static boolean` | `isService(java.lang.Object thisObj)` Return true if the parameter is derived from the `Service` object.
    `static boolean` | `isServiceModule(java.lang.Object thisObj)` Return true if the parameter is derived from the `ServiceModule` object.
    `static boolean` | `isWrapper(java.lang.Object thisObj)` Return true if this module is a service wrapper.
    `static java.lang.String` | `linkClass(java.lang.String linkMethod)` Return a likely linking module class type for a description.
    `static Link` | `linkModuleType(java.lang.String linkType, Service service, PasswordHandler pHandler)` Return a linking module instance for the linker service type.
    `protected static SM_Service` | `moduleFromClass(java.lang.Class serviceClass, Service service, PasswordHandler pHandler)` Return a module instance for the service type or class.
    `static SM_Service` | `serviceModule(Service service, PasswordHandler pHandler)` Return a module instance for the service class type.

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

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

- - ### Constructor Detail

    - #### ModuleHandler

          public ModuleHandler()

  - ### Method Detail

    - #### isLicasModule

          public static boolean isLicasModule(java.lang.Object thisObj)

      Return true if the parameter is derived from the `LicasModule` object.
      Parameters:
        `thisObj` - the object to query.
      Returns:
        true if thisObj is derived from LicasModule, false otherwise.

    - #### isFrameworkModule

          public static boolean isFrameworkModule(java.lang.Object thisObj)

      Return true if the parameter is derived from the `FrameworkModule` object.
      Parameters:
        `thisObj` - the object to query.
      Returns:
        true if thisObj is derived from FrameworkModule, false otherwise.

    - #### isServiceModule

          public static boolean isServiceModule(java.lang.Object thisObj)

      Return true if the parameter is derived from the `ServiceModule` object.
      Parameters:
        `thisObj` - the object to query.
      Returns:
        true if thisObj is derived from ServiceModule, false otherwise.

    - #### isService

          public static boolean isService(java.lang.Object thisObj)

      Return true if the parameter is derived from the `Service` object.
      Parameters:
        `thisObj` - the object to query.
      Returns:
        true if thisObj is derived from Service, false otherwise.

    - #### isAuto

          public static boolean isAuto(java.lang.Object thisObj)

      Return true if the parameter is derived from the `Auto` object.
      Parameters:
        `thisObj` - the object to query.
      Returns:
        true if thisObj is derived from Auto, false otherwise.

    - #### isServer

          public static boolean isServer(java.lang.Object thisObj)

      Return true if the parameter is derived from the `ESB` object.
      Parameters:
        `thisObj` - the object to query.
      Returns:
        true if thisObj is derived from ESB, false otherwise.

    - #### isWrapper

          public static boolean isWrapper(java.lang.Object thisObj)

      Return true if this module is a service wrapper.
      Parameters:
        `thisObj` - the object to query.
      Returns:
        true if a service wrapper, false otherwise.

    - #### isAutoManager

          public static boolean isAutoManager(java.lang.Object thisObj)

      Return true if this module is an autonomic manager.
      Parameters:
        `thisObj` - the object to query.
      Returns:
        true if derived from `AutonomicManager`, false otherwise.

    - #### isScriptModule

          public static boolean isScriptModule(SM_Service sModule)

      Return true if the service module can create and execute a script.
      Parameters:
        `sModule` - the service module. Should be script or link data type.
      Returns:
        true if the module can create a script, false otherwise.

    - #### serviceModule

          public static SM_Service serviceModule(Service service,
                                                 PasswordHandler pHandler)
                                          throws java.lang.Exception

      Return a module instance for the service class type. With `Service-related` classes, the base class is fully implemented and so the most basic module can always be returned. A closest superclass match is used if a direct match is not available.
      Parameters:
        `service` - the service instance.
        `pHandler` - the password handler.
      Returns:
        the appropriate module instance, or basic for unknown type.
      Throws:
        `java.lang.Exception` - any error.

    - #### controlModule

          public static ControlModule controlModule(Service service,
                                                    PasswordHandler pHandler)
                                             throws java.lang.Exception

      Return a control instance for the service class type. With `Service-related` classes, this might simply be to retrieve some data, but with the `Auto-related` classes, the behaviour methods might need to be implemented. Note that the abstract `behaviourAction` is still implemented in the service itself and can make use of a `BehaviourModule` to evaluate this.
      Parameters:
        `service` - the service instance.
        `pHandler` - the password handler.
      Returns:
        the appropriate behaviour instance, or basic for unknown type.
      Throws:
        `java.lang.Exception` - any error.

    - #### behaviourModule

          public static BehaviourModule behaviourModule(Auto service,
                                                        PasswordHandler pHandler)
                                                 throws java.lang.Exception

      Return a behaviour instance for an `Auto-related` service. The behaviour needs to be able to carry out the evaluation as part of the `behaviourAction` method. It can do this in whole, or in part and has a slightly different interface.
      Parameters:
        `service` - the service instance. Must be `Auto` or derived.
        `pHandler` - the password handler.
      Returns:
        the appropriate behaviour instance, or basic for unknown type.
      Throws:
        `java.lang.Exception` - any error.

    - #### dataModule

          public static DataModule dataModule(Service service,
                                              PasswordHandler pHandler)
                                       throws java.lang.Exception

      Return a data module instance.
      Parameters:
        `service` - the service instance.
        `pHandler` - the password handler.
      Returns:
        the appropriate data module.
      Throws:
        `java.lang.Exception` - any error.

    - #### dataModule

          public static DataModule dataModule(Service service,
                                              PasswordHandler pHandler,
                                              org.licas_xml.abs.Element adminDataXml)
                                       throws java.lang.Exception

      Return a data module instance.
      Parameters:
        `service` - the parent service.
        `pHandler` - the parent password handler.
        `adminDataXml` - xml description to create the data resource from.
      Returns:
        the appropriate data module.
      Throws:
        `java.lang.Exception` - any error.

    - #### linkModuleType

          public static Link linkModuleType(java.lang.String linkType,
                                            Service service,
                                            PasswordHandler pHandler)
                                     throws java.lang.Exception

      Return a linking module instance for the linker service type.
      Parameters:
        `linkType` - the linker type. For example `ServiceConst`.`LINKER`.
        `service` - the service instance.
        `pHandler` - the password handler.
      Returns:
        the appropriate linker type.
      Throws:
        `java.lang.Exception` - any error.

    - #### moduleFromClass

          protected static SM_Service moduleFromClass(java.lang.Class serviceClass,
                                                      Service service,
                                                      PasswordHandler pHandler)
                                               throws java.lang.Exception

      Return a module instance for the service type or class.
      Parameters:
        `serviceClass` - the service class type the module is for.
        `service` - the service instance.
        `pHandler` - the password handler.
      Returns:
        the appropriate module instance, or `null` if not recognised.
      Throws:
        `java.lang.Exception` - any error.

    - #### controlFromClass

          protected static ControlModule controlFromClass(java.lang.Class serviceClass,
                                                          Service service,
                                                          PasswordHandler pHandler)
                                                   throws java.lang.Exception

      Return a behaviour instance for the service class.
      Parameters:
        `serviceClass` - the service class type the module is for.
        `service` - the service instance.
        `pHandler` - the password handler.
      Returns:
        the appropriate behaviour instance, or `null` if not recognised.
      Throws:
        `java.lang.Exception` - any error.

    - #### behaviourFromClass

          protected static BehaviourModule behaviourFromClass(java.lang.Class serviceClass,
                                                              Auto service,
                                                              PasswordHandler pHandler)
                                                       throws java.lang.Exception

      Return a behaviour instance for the service class.
      Parameters:
        `serviceClass` - the service class type.
        `service` - the service instance.
        `pHandler` - the password handler.
      Returns:
        the appropriate behaviour instance, or `null` if not recognised.
      Throws:
        `java.lang.Exception` - any error.

    - #### heuristicClass

          public static java.lang.String heuristicClass(java.lang.String heuristicType)

      Return a likely heuristic module class type for a description.
      Parameters:
        `heuristicType` - description of the heuristic features.
      Returns:
        a possible heuristic module class, or `null` if not recognised.

    - #### linkClass

          public static java.lang.String linkClass(java.lang.String linkMethod)

      Return a likely linking module class type for a description.
      Parameters:
        `linkMethod` - description of the function of the linking class, probably created by `LinkConfig`.`addLinkMethod`.
      Returns:
        the appropriate linker type.