org.licas

## Class ServiceComm

- java.lang.Object
- - org.licas.ServiceComm

-     public class ServiceComm
      extends java.lang.Object

  Communication bridge between protected `Service` methods and other packages.
  Author:
    Kieran Greer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServiceComm()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `addCommunicationID(java.lang.String communicationID, java.lang.Object clientURI, Service service)` Store the communicationID with the related client URI, stored as a `MessageInfo` object with timestamps.
    `static boolean` | `addCommunicationID(java.lang.String communicationID, java.lang.Object clientURI, ServiceWrapperDef wrapper)` Store the commID with the related client URI, on the embedded service.
    `static void` | `addMessageMetrics(MethodInfo messageInfo, java.lang.String password, Service service)` Add metric or stat values for the message object.
    `static void` | `addMessageMetrics(MethodInfo messageInfo, java.lang.String password, ServiceWrapperDef service)` Add metric or stat values for the message object.
    `static java.lang.Object` | `getClientURI(java.lang.String communicationID, Service service)` Get the client URI associated with a communication ID.
    `static java.lang.String` | `getCommID(Service service)` Get the last read communication ID.
    `static boolean` | `hasCommunicationID(java.lang.String commID, Service service)` Return true if this service currently stores a conversation with the specified communication ID.
    `static void` | `removeCommunicationID(java.lang.String communicationID, Service service)` Remove the communication ID reference.
    `static boolean` | `setParent(Service thisParent, ServiceWrapperDef wrapper)` Set the parent component value.
    `static void` | `setServerPassword(java.lang.String thePassword, ServiceWrapperDef wrapper)` Set the password that will allow this service to access the server it runs on.
    `static void` | `setServiceGrade(java.lang.String serviceGrade, ServiceWrapperDef wrapper)` Set the service grade or status.

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

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

- - ### Constructor Detail

    - #### ServiceComm

          public ServiceComm()

  - ### Method Detail

    - #### hasCommunicationID

          public static boolean hasCommunicationID(java.lang.String commID,
                                                   Service service)

      Return true if this service currently stores a conversation with the specified communication ID.
      Parameters:
        `commID` - the communication ID to check for.
        `service` - direct reference to the service to invoke.
      Returns:
        true if the communication ID, false otherwise.

    - #### addCommunicationID

          public static boolean addCommunicationID(java.lang.String communicationID,
                                                   java.lang.Object clientURI,
                                                   Service service)
                                            throws java.lang.Exception

      Store the communicationID with the related client URI, stored as a `MessageInfo` object with timestamps. The method now also checks the timestamps and removes any communicationIDs that are older than 3 days.
      Parameters:
        `communicationID` - the communication id.
        `clientURI` - the URI/reference for the calling client.
        `service` - direct reference to the service to invoke.
      Returns:
        true if the id is new and can be added, or false if the comm id already exists, or cannot be added.
      Throws:
        `java.lang.Exception` - any error.

    - #### removeCommunicationID

          public static void removeCommunicationID(java.lang.String communicationID,
                                                   Service service)

      Remove the communication ID reference.
      Parameters:
        `communicationID` - the communication ID.
        `service` - direct reference to the service to invoke.

    - #### getClientURI

          public static java.lang.Object getClientURI(java.lang.String communicationID,
                                                      Service service)

      Get the client URI associated with a communication ID.
      Parameters:
        `communicationID` - the communication ID.
        `service` - direct reference to the service to invoke.
      Returns:
        the clientURI stored in the message info object.

    - #### getCommID

          public static java.lang.String getCommID(Service service)

      Get the last read communication ID.
      Parameters:
        `service` - the service to query.
      Returns:
        the value of commID.

    - #### addCommunicationID

          public static boolean addCommunicationID(java.lang.String communicationID,
                                                   java.lang.Object clientURI,
                                                   ServiceWrapperDef wrapper)
                                            throws java.lang.Exception

      Store the commID with the related client URI, on the embedded service. Stored as `MessageInfo` objects with timestamps. The method now also checks the timestamps and removes any communicationIDs that are older than 3 days.
      Parameters:
        `communicationID` - the communication id.
        `clientURI` - the URI/reference for the calling client.
        `wrapper` - direct reference to the service to invoke.
      Returns:
        true if the id is new and can be added, or false if the comm id already exists, or cannot be added.
      Throws:
        `java.lang.Exception` - any error.

    - #### setServiceGrade

          public static void setServiceGrade(java.lang.String serviceGrade,
                                             ServiceWrapperDef wrapper)

      Set the service grade or status.
      Parameters:
        `serviceGrade` - the service grade.
        `wrapper` - direct reference to the service to invoke.

    - #### setServerPassword

          public static void setServerPassword(java.lang.String thePassword,
                                               ServiceWrapperDef wrapper)
                                        throws java.lang.Exception

      Set the password that will allow this service to access the server it runs on.
      Parameters:
        `thePassword` - the server password.
        `wrapper` - direct reference to the service to invoke.
      Throws:
        `java.lang.Exception` - any error.

    - #### setParent

          public static boolean setParent(Service thisParent,
                                          ServiceWrapperDef wrapper)

      Set the parent component value. If the parent is the ESB server then it is not added, so only for child services.
      Parameters:
        `thisParent` - the parent component representation.
        `wrapper` - direct reference to the service to invoke.
      Returns:
        true if set, false if already set, or try to add server.

    - #### addMessageMetrics

          public static void addMessageMetrics(MethodInfo messageInfo,
                                               java.lang.String password,
                                               Service service)
                                        throws java.lang.Exception

      Add metric or stat values for the message object. The metrics are added to the base service only, or the service directly loaded onto the ESB, not any utility service, so this firstly traverses back o the base service before adding any stats.
      Parameters:
        `messageInfo` - the message info with the message object.
        `password` - the password for this service.
        `service` - the service that adds the metrics.
      Throws:
        `java.lang.Exception` - any error.

    - #### addMessageMetrics

          public static void addMessageMetrics(MethodInfo messageInfo,
                                               java.lang.String password,
                                               ServiceWrapperDef service)

      Add metric or stat values for the message object. The metrics are added to the base service only, or the service directly loaded onto the ESB, not any utility service, so this firstly traverses back o the base service before adding any stats.
      Parameters:
        `messageInfo` - the message info with the message object.
        `password` - the password for this service.
        `service` - the service that adds the metrics.