org.licas.service

## Class ModuleServiceFactory

- java.lang.Object
- - org.licas.service.ModuleServiceFactory

-     public abstract class ModuleServiceFactory
      extends java.lang.Object

  This service factory is read automatically by the GUI when loaded, to store a pre-programmed script of the services it provides.
  Author:
    Kieran Greer

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.HashMap<java.lang.String,org.ai_heuristic.model.FactoryInfo>` | `serviceGuis` List of GUI interfaces that are available for any of the services.
    `protected java.util.HashMap<java.lang.String,ServiceModuleInfo>` | `services` List of services that this module provides.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ModuleServiceFactory()` Create a new instance of ModuleServiceFactory.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract ServiceDef` | `createDefaultService(java.lang.String serviceUuid, java.lang.String serviceType, org.licas_xml.abs.Element adminXml, PasswordHandler passwordHandler)` Create a new default service or module.
    `abstract java.lang.String` | `getDefaultServiceClassname(java.lang.String serviceType)` Get the class name for a specified service type.
    `abstract void` | `getDefaultServiceInfo(java.lang.String categoryType, java.util.ArrayList<ServiceModuleInfo> defaultServices, LicasConfig licasConfig)` Get a list of the default services that can be loaded for the category type.
    `abstract java.lang.String` | `getServiceClass(java.lang.String serviceType)` Return the stored service class for the specified service type.
    `java.util.HashMap<java.lang.String,org.ai_heuristic.model.FactoryInfo>` | `getServiceGui()` Return the full list of initialised GUI interface for the specified service.
    `abstract ServiceGuiDef` | `getServiceGui(java.lang.String serviceType)` Return the initialised GUI interface for the specified service.
    `protected abstract void` | `setGuiInfo()` Set or create a list of the service GUI classes that operate as the service.
    `protected abstract void` | `setServiceInfo()` Set or create a list of the default services that can be loaded from this module.

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

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

- - ### Field Detail

    - #### services

          protected java.util.HashMap<java.lang.String,ServiceModuleInfo> services

      List of services that this module provides. Key is the service type and value is the related `ServiceModuleInfo` info.

    - #### serviceGuis

          protected java.util.HashMap<java.lang.String,org.ai_heuristic.model.FactoryInfo> serviceGuis

      List of GUI interfaces that are available for any of the services. Key is the service type and value is the related `FactoryInfo` info.

  - ### Constructor Detail

    - #### ModuleServiceFactory

          public ModuleServiceFactory()

      Create a new instance of ModuleServiceFactory. This constructor does not initialise the service factory properly and should be used only to create an instance of the object for type checking.

  - ### Method Detail

    - #### setServiceInfo

          protected abstract void setServiceInfo()

      Set or create a list of the default services that can be loaded from this module. This is automatically called as part of the constructor. Also add related default parsers.

    - #### setGuiInfo

          protected abstract void setGuiInfo()

      Set or create a list of the service GUI classes that operate as the service. This is automatically called as part of the constructor.

    - #### getDefaultServiceInfo

          public abstract void getDefaultServiceInfo(java.lang.String categoryType,
                                                     java.util.ArrayList<ServiceModuleInfo> defaultServices,
                                                     LicasConfig licasConfig)

      Get a list of the default services that can be loaded for the category type. Also add related default parsers.
      Parameters:
        `categoryType` - the type of category to retrieve default services for. `ServiceConst`.`ALLCATEGORIES` means all services. If the licas config file has overwritten an entry, then return that instead.
        `defaultServices` - list of currently loaded service info.
        `licasConfig` - the factory config to add the service information to.

    - #### getDefaultServiceClassname

          public abstract java.lang.String getDefaultServiceClassname(java.lang.String serviceType)

      Get the class name for a specified service type.
      Parameters:
        `serviceType` - the service type.
      Returns:
        the default service class or null if it does not exist.

    - #### createDefaultService

          public abstract ServiceDef createDefaultService(java.lang.String serviceUuid,
                                                          java.lang.String serviceType,
                                                          org.licas_xml.abs.Element adminXml,
                                                          PasswordHandler passwordHandler)
                                                   throws java.lang.Exception

      Create a new default service or module.
      Parameters:
        `serviceUuid` - the uuid for the new default service to add.
        `serviceType` - the type of service to create. Note that a uuid is not set.
        `adminXml` - the admin info or description of the new service.
        `passwordHandler` - the password handler for the service that calls this method.
      Returns:
        the service or module if it can be created, null otherwise.
      Throws:
        `java.lang.Exception` - any error.

    - #### getServiceGui

          public abstract ServiceGuiDef getServiceGui(java.lang.String serviceType)
                                               throws java.lang.Exception

      Return the initialised GUI interface for the specified service.
      Parameters:
        `serviceType` - the type of service.
      Returns:
        return a GUI interface that is compatible with the service methods.
      Throws:
        `java.lang.Exception` - any error.

    - #### getServiceClass

          public abstract java.lang.String getServiceClass(java.lang.String serviceType)
                                                    throws java.lang.Exception

      Return the stored service class for the specified service type. This is only for the known default service types, not any types added by a user. For the Linker service the most commonly used class is returned. The LinkConfig class can be passed the linking method to return a more accurate result.
      Parameters:
        `serviceType` - the type of service.
      Returns:
        the service class stored for that type, or null if it is missing.
      Throws:
        `java.lang.Exception` - any error.

    - #### getServiceGui

          public java.util.HashMap<java.lang.String,org.ai_heuristic.model.FactoryInfo> getServiceGui()

      Return the full list of initialised GUI interface for the specified service.
      Returns:
        the value of serviceGuis.