org.licas.meta

## Class ServerMetadata

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

-     public class ServerMetadata
      extends java.lang.Object

  This class relates to metadata stored on the server, providing an extra layer of protection over the service metadata repository. This class is used internally by the system and the programmer does not need to program this class for any additional actions. The retrieval process would also typically be password protected at the server level, with this class stored on a server privately.
  Author:
    Kieran Greer

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ServiceRepository` | `serviceRepos` Stores the metadata of all services that have loaded onto this server, no matter where they are stored.

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addServiceMeta(java.lang.String theAdminKey, ServiceMeta theServiceMeta)` Add the metadata for the service.
    `void` | `clearServiceMetadata()` Clear all service metadata apart from the server itself.
    `void` | `clearServiceMetadata(java.util.ArrayList<java.lang.String> serviceIDs)` Clear all service metadata for the specified services, apart from the server itself.
    `org.licas_xml.abs.Element` | `getServiceMeta(java.lang.String theServiceID)` Get a subset of the metadata for the service, for info purposes only.
    `org.licas_xml.abs.Element` | `getServiceMeta(java.lang.String theServiceID, java.util.ArrayList<java.lang.String> toInclude, ServiceMeta serviceObjMeta)` Get a subset of the metadata for the service, plus other sections.
    `ServiceMeta` | `getServiceMeta(java.lang.String theServiceID, java.lang.String theAdminKey)` Get the service metadata from the repository.
    `org.licas_xml.abs.Element` | `getServiceMetaPart(java.lang.String theServiceID, java.lang.String toInclude, ServiceMeta serviceObjMeta)` Retrieve just one part of the metadata, not the whole object.
    `java.util.ArrayList<java.lang.String>` | `getServiceTypes()` Get a list of all of the service types in the network.
    `java.util.ArrayList<java.lang.String>` | `getServiceTypes(java.lang.String category)` Get a list of all of the service types in the network for a particular category.
    `boolean` | `isStoredService(java.lang.String theServiceID)` Return true if the service id is stored for a loaded service.
    `boolean` | `removeServiceMeta(java.lang.String theServiceID, java.lang.String theAdminKey)` Remove the service metadata from the repository.

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

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

- - ### Field Detail

    - #### serviceRepos

          protected ServiceRepository serviceRepos

      Stores the metadata of all services that have loaded onto this server, no matter where they are stored. Any service that is added through the `Service` `addService` method will automatically have metadata created and added to this repository as part of the process. The metadata that is added is created using the `Service` `createServiceMeta` method internally, and is by default a description generated through the Java `Reflection` classes.

  - ### Constructor Detail

    - #### ServerMetadata

          public ServerMetadata()

      Create a new instance of ServerMetadata.

  - ### Method Detail

    - #### addServiceMeta

          public boolean addServiceMeta(java.lang.String theAdminKey,
                                        ServiceMeta theServiceMeta)

      Add the metadata for the service.
      Parameters:
        `theAdminKey` - the admin service key for the service.
        `theServiceMeta` - the metadata for the service.
      Returns:
        true if added or false if it already exists.

    - #### getServiceMeta

          public org.licas_xml.abs.Element getServiceMeta(java.lang.String theServiceID)
                                                   throws java.lang.Exception

      Get a subset of the metadata for the service, for info purposes only.
      Parameters:
        `theServiceID` - the unique id to define the service.
      Returns:
        the metadata in XML format if it exists or null if it does not.
      Throws:
        `java.lang.Exception` - any error.

    - #### getServiceMeta

          public org.licas_xml.abs.Element getServiceMeta(java.lang.String theServiceID,
                                                          java.util.ArrayList<java.lang.String> toInclude,
                                                          ServiceMeta serviceObjMeta)
                                                   throws java.lang.Exception

      Get a subset of the metadata for the service, plus other sections.
      Parameters:
        `theServiceID` - the unique id to define the service.
        `toInclude` - list of additional meta parts to return.
        `serviceObjMeta` - full description of the service metadata.
      Returns:
        the metadata in XML format if it exists, or null if it does not.
      Throws:
        `java.lang.Exception` - any error.

    - #### getServiceMetaPart

          public org.licas_xml.abs.Element getServiceMetaPart(java.lang.String theServiceID,
                                                              java.lang.String toInclude,
                                                              ServiceMeta serviceObjMeta)

      Retrieve just one part of the metadata, not the whole object.
      Parameters:
        `theServiceID` - the unique id to define the service.
        `toInclude` - meta part to return.
        `serviceObjMeta` - full description of the service metadata.
      Returns:
        the metadata in XML format if it exists, or null if it does not.

    - #### getServiceMeta

          public ServiceMeta getServiceMeta(java.lang.String theServiceID,
                                            java.lang.String theAdminKey)

      Get the service metadata from the repository.
      Parameters:
        `theServiceID` - the unique id to define the service.
        `theAdminKey` - the unique admin key for the service.
      Returns:
        a direct reference to the object itself so that it can be changed.

    - #### removeServiceMeta

          public boolean removeServiceMeta(java.lang.String theServiceID,
                                           java.lang.String theAdminKey)

      Remove the service metadata from the repository.
      Parameters:
        `theServiceID` - the unique id of the service to remove.
        `theAdminKey` - the unique admin key for the service.
      Returns:
        true if the info is removed or false otherwise.

    - #### isStoredService

          public boolean isStoredService(java.lang.String theServiceID)

      Return true if the service id is stored for a loaded service.
      Parameters:
        `theServiceID` - the unique service id.
      Returns:
        true if registered for a loaded service, false otherwise.

    - #### clearServiceMetadata

          public void clearServiceMetadata()

      Clear all service metadata apart from the server itself.

    - #### clearServiceMetadata

          public void clearServiceMetadata(java.util.ArrayList<java.lang.String> serviceIDs)

      Clear all service metadata for the specified services, apart from the server itself.
      Parameters:
        `serviceIDs` - list of service IDs to remove metadata for.

    - #### getServiceTypes

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

      Get a list of all of the service types in the network.
      Returns:
        a list of all of the service types, of type String.

    - #### getServiceTypes

          public java.util.ArrayList<java.lang.String> getServiceTypes(java.lang.String category)

      Get a list of all of the service types in the network for a particular category.
      Parameters:
        `category` - the category to return service types for.
      Returns:
        a list of all of the service types, of type String.