org.licas.service

## Class ServiceFactory

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

- Direct Known Subclasses:
    DefaultServiceFactory

      public abstract class ServiceFactory
      extends java.lang.Object

  This class determines what service interfaces are returned for each service type.
  Author:
    Kieran Greer

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static java.util.ArrayList<java.lang.String>` | `defaultJars` List of default service jar files
    `protected static java.util.ArrayList<ModuleServiceFactory>` | `serviceModules` List of modules automatically loaded in during startup.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServiceFactory()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `addServiceClass(java.lang.String serviceFunction, org.ai_heuristic.model.FactoryInfo factoryInfo)` Add a particular class to be loaded for the specified service type and function.
    `void` | `addServiceModule(ModuleServiceFactory serviceModule)` Add a factory service module, for retrieving service info details.
    `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.
    `java.lang.String` | `getBehaviourViewDescr(java.lang.String viewType)` Get a short description of the view type.
    `java.util.ArrayList<java.lang.String>` | `getBehaviourViewTypes()` Get a list of types that can represent the default query engine.
    `static java.util.ArrayList<java.lang.String>` | `getDefaultQueryEngineTypes()` Get a list of types that can represent the default query engine.
    `abstract java.lang.String` | `getDefaultServiceClassname(java.lang.String serviceType)` Get the class name for a specified service type.
    `abstract java.util.ArrayList<ServiceModuleInfo>` | `getDefaultServiceInfo()` Get a list of the default services that can be loaded.
    `abstract java.util.ArrayList<ServiceModuleInfo>` | `getDefaultServiceInfo(java.lang.String categoryType)` Get a list of the default services that can be loaded for the category type.
    `static ServiceFactory` | `getInstance()` Get the created instance of the service factory.
    `abstract java.lang.String` | `getServiceClass(java.lang.String serviceType)` Return the stored service class for the specified service type.
    `abstract ServiceGuiDef` | `getServiceGui(java.lang.String serviceType)` Return the initialised GUI interface for the specified service.
    `boolean` | `isGlobalService(java.lang.String serviceType)` Return true if the service can be added as a global server service.
    `abstract void` | `removeServiceClass(java.lang.String serviceFunction, org.ai_heuristic.model.FactoryInfo factoryInfo)` Remove a particular class for the specified service type and function.
    `static void` | `setServiceFactory(ServiceFactory thisServiceFactory, java.lang.String thisFactoryKey)` Set the instance of the service factory to be used.

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

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

- - ### Field Detail

    - #### serviceModules

          protected static java.util.ArrayList<ModuleServiceFactory> serviceModules

      List of modules automatically loaded in during startup. Of type `ModuleServiceFactory`.

    - #### defaultJars

          protected static java.util.ArrayList<java.lang.String> defaultJars

      List of default service jar files

  - ### Constructor Detail

    - #### ServiceFactory

          public ServiceFactory()

  - ### Method Detail

    - #### getInstance

          public static ServiceFactory getInstance()

      Get the created instance of the service factory.
      Returns:
        the value of serviceFactory.

    - #### setServiceFactory

          public static void setServiceFactory(ServiceFactory thisServiceFactory,
                                               java.lang.String thisFactoryKey)

      Set the instance of the service factory to be used. This can be set if either: the service factory is currently null, or the factory key is correct. This will also set the factory key value for the initial (if null) assignment.
      Parameters:
        `thisServiceFactory` - the service factory that is retrieved for any method call.
        `thisFactoryKey` - a key to protect dynamic changing of the factory.

    - #### isGlobalService

          public boolean isGlobalService(java.lang.String serviceType)

      Return true if the service can be added as a global server service.
      Parameters:
        `serviceType` - the service type.
      Returns:
        true if the service type can be a global server service.

    - #### addServiceModule

          public void addServiceModule(ModuleServiceFactory serviceModule)

      Add a factory service module, for retrieving service info details.
      Parameters:
        `serviceModule` - the factory service module.

    - #### getDefaultServiceInfo

          public abstract java.util.ArrayList<ServiceModuleInfo> getDefaultServiceInfo()

      Get a list of the default services that can be loaded.
      Returns:
        the list of default services that can be loaded.

    - #### getDefaultServiceInfo

          public abstract java.util.ArrayList<ServiceModuleInfo> getDefaultServiceInfo(java.lang.String categoryType)

      Get a list of the default services that can be loaded for the category type.
      Parameters:
        `categoryType` - the type of category to retrieve default services for. `ServiceConst`.`ALLCATEGORIES` means all services.
      Returns:
        the list of default services that can be loaded.

    - #### 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. This must be a recognised module from its service type, for this service factory.
      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.

    - #### addServiceClass

          public abstract void addServiceClass(java.lang.String serviceFunction,
                                               org.ai_heuristic.model.FactoryInfo factoryInfo)
                                        throws java.lang.Exception

      Add a particular class to be loaded for the specified service type and function. This will automatically overwrite any existing saved classname.
      Parameters:
        `serviceFunction` - the function of the service.
        `factoryInfo` - the info object for the interface.
      Throws:
        `java.lang.Exception` - any error.

    - #### removeServiceClass

          public abstract void removeServiceClass(java.lang.String serviceFunction,
                                                  org.ai_heuristic.model.FactoryInfo factoryInfo)
                                           throws java.lang.Exception

      Remove a particular class for the specified service type and function.
      Parameters:
        `serviceFunction` - the function of the service.
        `factoryInfo` - the info object for the interface.
      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. 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.

    - #### getBehaviourViewTypes

          public java.util.ArrayList<java.lang.String> getBehaviourViewTypes()

      Get a list of types that can represent the default query engine.
      Returns:
        the list of default query engine types.

    - #### getBehaviourViewDescr

          public java.lang.String getBehaviourViewDescr(java.lang.String viewType)

      Get a short description of the view type.
      Parameters:
        `viewType` - the behaviour view type.
      Returns:
        the graph type description.

    - #### getDefaultQueryEngineTypes

          public static java.util.ArrayList<java.lang.String> getDefaultQueryEngineTypes()

      Get a list of types that can represent the default query engine.
      Returns:
        the list of default query engine types.