org.licas.meta

## Class ServiceMeta

- java.lang.Object
- - org.licas.meta.ServiceMeta

-     public class ServiceMeta
      extends java.lang.Object

  This is a lightweight description of a service for information purposes. This stores the information of a service that can be retrieved through reflection of its class type and also some of the admin or other values such as a uuid, path, description, jar file path, list of nested services and also some linking information. Not all of the fields are always populated, so it is up to the administrator of the service to add whatever information is required. This might require an admin document being used during initialisation.

  A Service's `AdminInfo` or `ServiceLinks` objects also store metadata info that represent the current service's use and associations, and helps to create these descriptive entries. A ServiceMeta object is not stored permanently, but is created dynamically on request and populated with information from these objects.

  One `ServiceMeta` object however is stored permanently on the server in the `metadata repository`. It is added, with the default subset of values, when the service is firstly loaded onto the server and it is not updated unless the service manually updates it. Linking info would not typically be updated automatically, for example, but an initialisation admin document can be included.

  The metadata can be retrieved in parts as well, by asking for particular fields, as part of an `include` list. These can be defined by: `Const`.`UUID` , `SERVICETYPE` , `SERVICEGRADE` , `SERVICECATEGORY` , `MODULE` , `SERVICEPATH` , `DESCRIPTION` , `KEYWORDS` , `CHILDSERVICES` , `LINKS` , `ASSOCIATEDLINKS` , `CLASSNAME` , `JARFILE` , `CONSTRUCTORS` , `METHODS` , `OTHERMETA` , `DATA` , `INSTANCEVALUES` , `PARAMETERS` . Some of these require the admin key for access.

  Author:
    Kieran Greer

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `org.licas_xml.abs.Element` | `childServiceMeta` The child service ids.
    `java.util.ArrayList<org.licas_xml.abs.Element>` | `constructorMeta` A list of constructors.
    `org.licas_xml.abs.Element` | `data` Any value-based metadata
    `org.licas_xml.abs.Element` | `description` A description of the service
    `org.licas_xml.abs.Element` | `instanceValues` List of variables with or without instance values
    `java.util.ArrayList<java.lang.String>` | `jarFile` The name of the jar file(s) that the class can be loaded from.
    `KeywordHandler` | `keywordHandler` The list of keywords relating to any of the concepts
    `org.licas_xml.abs.Element` | `linkServiceMeta` The uuids of permanently linked services.
    `org.licas_xml.abs.Element` | `meta` Any other metadata, such as keywords, etc
    `java.util.ArrayList<org.licas_xml.abs.Element>` | `methodMeta` A list of public methods.
    `java.lang.String` | `moduleName` The name of the module that the service class is loaded from
    `org.licas_xml.abs.Element` | `parameters` Constructor parameters.
    `org.licas_xml.abs.Element` | `serviceAssociations` The full paths of services that this service knows about.
    `java.lang.String` | `serviceCategory` The service category
    `java.lang.String` | `serviceClass` The service class
    `java.lang.String` | `serviceGrade` The service grade
    `java.lang.String` | `serviceType` The service type
    `org.licas_xml.abs.Element` | `serviceUri` The service URI path
    `java.lang.String` | `uuid` The service uuid

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMetaPart(java.lang.String toInclude, ServiceMeta thisMeta)` Add a meta part to this metadata object from the meta passed in.
    `void` | `clearChildAndLinksMeta()` Clear all metadata descriptions for child services or links
    `java.lang.Object` | `clone()` Return a cloned copy of this object.
    `java.util.ArrayList<java.lang.String>` | `getAssociationServices()` Parse the association link service XML and return a list of stored IDs.
    `java.util.ArrayList<java.lang.Object>` | `getChildServices()` Parse the child service metadata and return the text or XML-based descriptions.
    `org.licas_xml.abs.Element` | `getKeywordXml()` Get the keywords metadata lists in XML format.
    `java.util.ArrayList<java.lang.String>` | `getLinkServices()` Parse the permanent link service XML and return a list of stored IDs.
    `ServiceMeta` | `getMetaForInfo()` Retrieve the meta that can be returned for info purposes.
    `boolean` | `hasMetaForInfo(java.lang.String toInclude)` Return true if the this metadata object contains an entry for the specified metadata part.
    `void` | `setKeywordHandler(KeywordHandler theKeywordHandler)` Set the keyword handler for processing all keywords.
    `boolean` | `setServiceMeta(java.lang.String theUuid, java.lang.String theServiceType, java.lang.String theServiceGrade, java.lang.String theServiceClass, org.licas_xml.abs.Element theServicePath, java.util.ArrayList<java.lang.String> theJarFile)` Set the ServiceMeta details.
    `boolean` | `setServiceMeta(java.lang.String theUuid, java.lang.String theServiceType, java.lang.String theServiceGrade, java.lang.String theServiceClass, org.licas_xml.abs.Element theServicePath, java.util.ArrayList<java.lang.String> theJarFile, AdminInfo adminInfo)` Set the ServiceMeta details.
    `boolean` | `setServiceMeta(java.lang.String theUuid, java.lang.String theServiceType, java.lang.String theServiceGrade, java.lang.String theServiceClass, org.licas_xml.abs.Element theServicePath, java.util.ArrayList<java.lang.String> theJarFile, java.util.ArrayList<org.licas_xml.abs.Element> theConstructors, java.util.ArrayList<org.licas_xml.abs.Element> theMethods, AdminInfo adminInfo)` Set the ServiceMeta details.

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

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

- - ### Field Detail

    - #### uuid

          public java.lang.String uuid

      The service uuid

    - #### serviceClass

          public java.lang.String serviceClass

      The service class

    - #### serviceType

          public java.lang.String serviceType

      The service type

    - #### serviceGrade

          public java.lang.String serviceGrade

      The service grade

    - #### serviceCategory

          public java.lang.String serviceCategory

      The service category

    - #### moduleName

          public java.lang.String moduleName

      The name of the module that the service class is loaded from

    - #### serviceUri

          public org.licas_xml.abs.Element serviceUri

      The service URI path

    - #### description

          public org.licas_xml.abs.Element description

      A description of the service

    - #### meta

          public org.licas_xml.abs.Element meta

      Any other metadata, such as keywords, etc

    - #### data

          public org.licas_xml.abs.Element data

      Any value-based metadata

    - #### instanceValues

          public org.licas_xml.abs.Element instanceValues

      List of variables with or without instance values

    - #### constructorMeta

          public java.util.ArrayList<org.licas_xml.abs.Element> constructorMeta

      A list of constructors. Values are in XML format.

    - #### methodMeta

          public java.util.ArrayList<org.licas_xml.abs.Element> methodMeta

      A list of public methods. Values are in XML format.

    - #### jarFile

          public java.util.ArrayList<java.lang.String> jarFile

      The name of the jar file(s) that the class can be loaded from. Values are the jar file paths of type String.

    - #### keywordHandler

          public KeywordHandler keywordHandler

      The list of keywords relating to any of the concepts

    - #### childServiceMeta

          public org.licas_xml.abs.Element childServiceMeta

      The child service ids. Values are the ids of type String.

    - #### linkServiceMeta

          public org.licas_xml.abs.Element linkServiceMeta

      The uuids of permanently linked services. This forms the static network structure. Values are the service ids of type String.

    - #### serviceAssociations

          public org.licas_xml.abs.Element serviceAssociations

      The full paths of services that this service knows about. This is an additional list to the permanent and dynamic linking lists, for associations that can be used in any way desired. It can be used, for example, to describe permanent links or associations between services on different servers. The `linkServiceMeta` structure would typically form the permanent network structure and therefore would be confined to a single server only.

    - #### parameters

          public org.licas_xml.abs.Element parameters

      Constructor parameters.

  - ### Constructor Detail

    - #### ServiceMeta

          public ServiceMeta()

      Create a new instance of ServiceMeta.

  - ### Method Detail

    - #### clearChildAndLinksMeta

          public void clearChildAndLinksMeta()

      Clear all metadata descriptions for child services or links

    - #### hasMetaForInfo

          public boolean hasMetaForInfo(java.lang.String toInclude)

      Return true if the this metadata object contains an entry for the specified metadata part.
      Parameters:
        `toInclude` - additional meta parts to include as well as the default part.
      Returns:
        true if the metadata part has an entry of any type, false otherwise.

    - #### setServiceMeta

          public boolean setServiceMeta(java.lang.String theUuid,
                                        java.lang.String theServiceType,
                                        java.lang.String theServiceGrade,
                                        java.lang.String theServiceClass,
                                        org.licas_xml.abs.Element theServicePath,
                                        java.util.ArrayList<java.lang.String> theJarFile)
                                 throws java.lang.Exception

      Set the ServiceMeta details.
      Parameters:
        `theUuid` - the service uuid.
        `theServiceType` - the service type.
        `theServiceGrade` - the service grade, for example `ServiceConst`.{code BASE} or `UTILITY`.
        `theServiceClass` - the fully qualified class name of the service the meta describes.
        `theServicePath` - the fully qualified path to the service.
        `theJarFile` - a list of jar files required to load the service. Values are the jar file paths of type String.
      Returns:
        true if the constructors meta is set OK.
      Throws:
        `java.lang.Exception` - any error.

    - #### setServiceMeta

          public boolean setServiceMeta(java.lang.String theUuid,
                                        java.lang.String theServiceType,
                                        java.lang.String theServiceGrade,
                                        java.lang.String theServiceClass,
                                        org.licas_xml.abs.Element theServicePath,
                                        java.util.ArrayList<java.lang.String> theJarFile,
                                        AdminInfo adminInfo)

      Set the ServiceMeta details.
      Parameters:
        `theUuid` - the service uuid.
        `theServiceType` - the service type.
        `theServiceGrade` - the service grade, for example `ServiceConst`.{code BASE} or `UTILITY`.
        `theServiceClass` - the fully qualified class name of the service the meta describes.
        `theServicePath` - the fully qualified path to the service.
        `theJarFile` - a list of jar files required to load the service. Values are the jar file paths of type String.
        `adminInfo` - admin info with description and other metadata.
      Returns:
        true if the constructors meta is set OK.

    - #### setServiceMeta

          public boolean setServiceMeta(java.lang.String theUuid,
                                        java.lang.String theServiceType,
                                        java.lang.String theServiceGrade,
                                        java.lang.String theServiceClass,
                                        org.licas_xml.abs.Element theServicePath,
                                        java.util.ArrayList<java.lang.String> theJarFile,
                                        java.util.ArrayList<org.licas_xml.abs.Element> theConstructors,
                                        java.util.ArrayList<org.licas_xml.abs.Element> theMethods,
                                        AdminInfo adminInfo)

      Set the ServiceMeta details.
      Parameters:
        `theUuid` - the service uuid.
        `theServiceType` - the service type.
        `theServiceGrade` - the service grade, for example `ServiceConst`.{code BASE} or `UTILITY`.
        `theServiceClass` - the fully qualified class name of the service the meta describes.
        `theServicePath` - the fully qualified path to the service.
        `theJarFile` - a list of jar files required to load the service. Values are the jar file paths of type String.
        `theConstructors` - a list of constructor definitions in XML.
        `theMethods` - a list of method definitions in XML.
        `adminInfo` - admin info with description and other metadata.
      Returns:
        true if the constructors meta is set OK.

    - #### getMetaForInfo

          public ServiceMeta getMetaForInfo()

      Retrieve the meta that can be returned for info purposes.
      Returns:
        a new ServiceMeta object with the relevant information.

    - #### addMetaPart

          public void addMetaPart(java.lang.String toInclude,
                                  ServiceMeta thisMeta)

      Add a meta part to this metadata object from the meta passed in.
      Parameters:
        `toInclude` - the section to include
        `thisMeta` - the other metadata object to copy from.

    - #### setKeywordHandler

          public void setKeywordHandler(KeywordHandler theKeywordHandler)

      Set the keyword handler for processing all keywords.
      Parameters:
        `theKeywordHandler` - the keyword handler.

    - #### getKeywordXml

          public org.licas_xml.abs.Element getKeywordXml()
                                                  throws java.lang.Exception

      Get the keywords metadata lists in XML format.
      Returns:
        the keywords lists in XML format.
      Throws:
        `java.lang.Exception` - any error.

    - #### getChildServices

          public java.util.ArrayList<java.lang.Object> getChildServices()

      Parse the child service metadata and return the text or XML-based descriptions.
      Returns:
        a list of child service IDs or full XML descriptions, or an empty list if there are none.

    - #### getLinkServices

          public java.util.ArrayList<java.lang.String> getLinkServices()
                                                                throws java.lang.Exception

      Parse the permanent link service XML and return a list of stored IDs.
      Returns:
        a string-based list of linked to service paths, or an empty list if there are none.
      Throws:
        `java.lang.Exception` - any error.

    - #### getAssociationServices

          public java.util.ArrayList<java.lang.String> getAssociationServices()
                                                                       throws java.lang.Exception

      Parse the association link service XML and return a list of stored IDs.
      Returns:
        a list of association service IDs, or an empty list if there are none.
      Throws:
        `java.lang.Exception` - any error.

    - #### clone

          public java.lang.Object clone()

      Return a cloned copy of this object.
      Overrides:
        `clone` in class `java.lang.Object`
      Returns:
        an exact copy of this object.