org.licas.call.client

## Class CallHandler

- java.lang.Object
- - org.licas.call.client.CallHandler

-     public final class CallHandler
      extends java.lang.Object

  This provides general functionality for retrieving the correct object to make a remote call. The default communication mechanism in licas is an XML-RPC mechanism. If this is indicated then a `RPC_MethodHandler` will be returned. Calls to web services can be described in the same way, in classes that extend the licas default ones. A `Rest_MethodHandler` can be used to make REST-style calls on remote sources. If a SOAP web service call is specified, then a `Soap_BaseHandler` object can be returned. To use these, you need to set the factory objects in your main code. That is: `RestFactory` and `WsFactory`.
  Author:
    Kieran Greer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CallHandler()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `canInvoke(java.lang.String serverURL, java.lang.String serverPassword, java.lang.String serviceID, int callTimeout)` Try to call the server to test the connection and then check if a service with the specified name is running and can be invoked.
    `static RemoteCallDef` | `getRemoteCommunicationObject(MethodInfo methodInfo)` Get the appropriate object to make a remote communication call with.
    `static boolean` | `isREST(java.lang.String callType)` Return true if the call type is a SOAP call.
    `static boolean` | `isSOAP(java.lang.String callType)` Return true if the call type is a SOAP call.
    `static boolean` | `isWsCall(MethodInfo methodInfo)` Return true if the info object indicates a web service call (REST or SOAP).
    `static boolean` | `isXMLRPC(java.lang.String callType)` Return true if the call type is an XML-RPC call.
    `static boolean` | `testPing(java.lang.String ipAddress)` Ping the ip address and return true if it is reachable.
    `static boolean` | `testServerConnection(org.licas_xml.abs.Element serverHandle)` Try to call the server to test the connection.
    `static boolean` | `testServerConnection(org.licas_xml.abs.Element serverHandle, java.lang.String serverPassword)` Try to call the server to test the connection.

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

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

- - ### Constructor Detail

    - #### CallHandler

          public CallHandler()

  - ### Method Detail

    - #### getRemoteCommunicationObject

          public static RemoteCallDef getRemoteCommunicationObject(MethodInfo methodInfo)

      Get the appropriate object to make a remote communication call with.
      Parameters:
        `methodInfo` - the method call description with all of the required information.
      Returns:
        the generated remote communication object.

    - #### isXMLRPC

          public static boolean isXMLRPC(java.lang.String callType)

      Return true if the call type is an XML-RPC call.
      Parameters:
        `callType` - the call type description.
      Returns:
        true if an XML-RPC call type.

    - #### isREST

          public static boolean isREST(java.lang.String callType)

      Return true if the call type is a SOAP call.
      Parameters:
        `callType` - the call type description.
      Returns:
        true if a SOAP call type.

    - #### isSOAP

          public static boolean isSOAP(java.lang.String callType)

      Return true if the call type is a SOAP call.
      Parameters:
        `callType` - the call type description.
      Returns:
        true if a SOAP call type.

    - #### isWsCall

          public static boolean isWsCall(MethodInfo methodInfo)

      Return true if the info object indicates a web service call (REST or SOAP).
      Parameters:
        `methodInfo` - the info object to check.
      Returns:
        true if ws info object.

    - #### testServerConnection

          public static boolean testServerConnection(org.licas_xml.abs.Element serverHandle)

      Try to call the server to test the connection.
      Parameters:
        `serverHandle` - the server uri handle.
      Returns:
        true if connection is OK, false otherwise. Exception returns false.

    - #### testServerConnection

          public static boolean testServerConnection(org.licas_xml.abs.Element serverHandle,
                                                     java.lang.String serverPassword)

      Try to call the server to test the connection.
      Parameters:
        `serverHandle` - the server uri handle.
        `serverPassword` - the server password to use.
      Returns:
        true if connection is OK, false otherwise. Exception returns false.

    - #### testPing

          public static boolean testPing(java.lang.String ipAddress)

      Ping the ip address and return true if it is reachable.
      Parameters:
        `ipAddress` - the address to ping.
      Returns:
        true if reachable, false otherwise.

    - #### canInvoke

          public static boolean canInvoke(java.lang.String serverURL,
                                          java.lang.String serverPassword,
                                          java.lang.String serviceID,
                                          int callTimeout)

      Try to call the server to test the connection and then check if a service with the specified name is running and can be invoked. This calls `testServerConnection` as part of the process.
      Parameters:
        `serverURL` - the server url address.
        `serverPassword` - the server password to use.
        `serviceID` - the service uuid.
        `callTimeout` - allowed reply time in milliseconds.
      Returns:
        true the server is accessible and is running the service, false otherwise.