org.licas.call

## Class MethodInfo

- java.lang.Object
- - org.licas.call.MethodInfo

- Direct Known Subclasses:
    WsMethodInfo

      public class MethodInfo
      extends java.lang.Object

  This class stores information relating to a single method of a service. The full description of the method invocation should be specified in this class. Constructing the correct method call can be time consuming, so there is a method `MethodFactory`.`createMethodCall` that can construct most method call descriptions automatically. It will format this object correctly with the appropriate values, based on the parameter values that are passed in. Care must be taken however, because the passwords must already be saved for the server and service to be invoked. If it is a utility `Linker` service, for example, a password might not be saved directly, where the parent password is required instead.

  Manual construction is therefore also possible and may be safer, as you will automatically enter a value for each required field. Something like the following:

  methodInfo = new MethodInfo(theService);
  methodInfo.setName(methodName);
  methodInfo.setServerURL(serverUrl);
  methodInfo.setServiceURI(serviceUri);
  methodInfo.setRtnType(rtnType);
  methodInfo.setServerPassword(serverPassword);
  methodInfo.setPassword(servicePassword);
  methodInfo.addParam(param1);
  methodInfo.addParam(param2);
  reply = callObject.call(methodInfo);

  Author:
    Kieran Greer

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.ArrayList<ParamInfo>` | `params` Parameters.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MethodInfo()` Creates a new instance of MethodInfo and sets the `clientUri` to the server address if one is running or `null` if one is not running.
    `MethodInfo(Service thisService)` Creates a new instance of MethodInfo and sets the `clientUri` to the local service path.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addParam(java.lang.Object theParam)` Add a method parameter.
    `protected void` | `checkServerURL()` Check the server url format.
    `void` | `clearParams()` Clear the list of method parameters.
    `java.lang.Object` | `clone()` Return a clone of this MethodInfo object.
    `void` | `copyValues(MethodInfo copyInfo)` Copy the values from the method info passed in to this object.
    `int` | `getCallTimeout()` Get the maximum allowed amount of time for a synchronous call.
    `java.lang.String` | `getCallType()` Get the value indicating the type of remote call.
    `org.licas_xml.abs.Element` | `getClientURI()` Get the full uri path to the client service.
    `java.lang.String` | `getCommunicationID()` Get the communication id.
    `boolean` | `getIsRemote()` Get the value indicating if a remote service method call.
    `java.lang.String` | `getName()` Get the method name.
    `int` | `getPacketSize()` Get the packet size.
    `ParamInfo` | `getParameter(java.lang.String paramName)` Get the parameter with the specified name, case ignored.
    `java.util.ArrayList<ParamInfo>` | `getParams()` Get the method parameters.
    `java.util.ArrayList<java.lang.Object>` | `getParamValues()` Convert the method parameters into a vector of parameter objects.
    `java.lang.String` | `getPassword()` Get the service password.
    `org.licas_xml.abs.Element` | `getRestOfServiceURI()` Get the full uri path for the rest of the service call.
    `java.lang.String` | `getRtnType()` Get the return type, can also be for intermediary service calls..
    `java.lang.String` | `getServerPassword()` Get the server password.
    `java.lang.String` | `getServerURL()` Get the http address of the server.
    `java.lang.String` | `getServiceRtnType()` Get the service return type, for the service method call only.
    `java.lang.Object` | `getServiceURI()` Get the full current call uri path.
    `boolean` | `isVoid()` Return true if the method does not return a value.
    `java.util.ArrayList<java.lang.String>` | `objParameterTypes()` Get the method parameter types as an ordered a list.
    `void` | `setCallTimeout(int theCallTimeout)` Set the maximum allowed amount of time for a synchronous call.
    `void` | `setCallType(java.lang.String thisCallType)` Set the value indicating the type of remote call.
    `void` | `setClientURI(org.licas_xml.abs.Element theClientUri)` Set the uri for the client service.
    `void` | `setCommunicationID(java.lang.String theCommunicationID)` Set the communication id.
    `void` | `setIfRemote()` Determine if a remote method call.
    `void` | `setName(java.lang.String theName)` Set the method name.
    `void` | `setPacketSize(int thePacketSize)` Set the packet size to the value passed in.
    `void` | `setPassword(java.lang.String thePassword)` Set the service password.
    `void` | `setRestOfServiceURI(org.licas_xml.abs.Element theServiceUri)` Set the uri for the rest of the service call path.
    `void` | `setRtnType(java.lang.String theRtnType)` Set the return type, can also be for intermediary service calls.
    `void` | `setServerPassword(java.lang.String theServerPassword)` Set the server password.
    `protected void` | `setServerURL(org.licas_xml.abs.Element theServerUri)` Set the url for the server from the full uri address.
    `void` | `setServiceObj(java.lang.Object theServiceObj)` Set a direct reference to a service object.
    `void` | `setServiceRtnType(java.lang.String theRtnType)` Set the service return type, for the service method call only.
    `void` | `setServiceURI(java.lang.Object theServiceUri)` Set the uri for the current call path.
    `java.lang.String` | `toString()` Convert the method info to a String.
    `void` | `updateServiceURIs()` Update the service uris to have the correct values.

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

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

- - ### Field Detail

    - #### params

          protected java.util.ArrayList<ParamInfo> params

      Parameters. Values are of type ParamInfo.

  - ### Constructor Detail

    - #### MethodInfo

          public MethodInfo()
                     throws java.lang.Exception

      Creates a new instance of MethodInfo and sets the `clientUri` to the server address if one is running or `null` if one is not running.
      Throws:
        `java.lang.Exception` - any error.

    - #### MethodInfo

          public MethodInfo(Service thisService)
                     throws java.lang.Exception

      Creates a new instance of MethodInfo and sets the `clientUri` to the local service path.
      Parameters:
        `thisService` - the service making the call.
      Throws:
        `java.lang.Exception` - any error.

  - ### Method Detail

    - #### isVoid

          public boolean isVoid()

      Return true if the method does not return a value.
      Returns:
        true fi the method has a void return type.

    - #### setIfRemote

          public void setIfRemote()

      Determine if a remote method call. If service uri is not an element then a local call. Is remote if the client and server or service uris are different.

    - #### updateServiceURIs

          public void updateServiceURIs()

      Update the service uris to have the correct values.

    - #### setPacketSize

          public void setPacketSize(int thePacketSize)

      Set the packet size to the value passed in.
      Parameters:
        `thePacketSize` - the packet size, or maximum number of characters in a message transaction.

    - #### getPacketSize

          public int getPacketSize()

      Get the packet size.
      Returns:
        the value of packetSize.

    - #### setCallTimeout

          public void setCallTimeout(int theCallTimeout)

      Set the maximum allowed amount of time for a synchronous call. This is in milliseconds (thousands of a second), so 10000 equals 10 seconds.
      Parameters:
        `theCallTimeout` - the maximum allowed amount of time for a synchronous call.

    - #### getCallTimeout

          public int getCallTimeout()

      Get the maximum allowed amount of time for a synchronous call. This is in milliseconds (thousands of a second), so 10000 equals 10 seconds.
      Returns:
        the value of callTimeout.

    - #### getIsRemote

          public boolean getIsRemote()

      Get the value indicating if a remote service method call.
      Returns:
        the value of isRemote.

    - #### setCallType

          public void setCallType(java.lang.String thisCallType)

      Set the value indicating the type of remote call.
      Parameters:
        `thisCallType` - the type of remote call.

    - #### getCallType

          public java.lang.String getCallType()

      Get the value indicating the type of remote call.
      Returns:
        the value of callType.

    - #### setName

          public void setName(java.lang.String theName)

      Set the method name.
      Parameters:
        `theName` - the method name. Can also include service names.

    - #### getName

          public java.lang.String getName()

      Get the method name.
      Returns:
        the value of name.

    - #### setRtnType

          public void setRtnType(java.lang.String theRtnType)

      Set the return type, can also be for intermediary service calls.
      Parameters:
        `theRtnType` - the fully qualified class name of the return type.

    - #### getRtnType

          public java.lang.String getRtnType()

      Get the return type, can also be for intermediary service calls..
      Returns:
        the value of rtnType.

    - #### setServiceRtnType

          public void setServiceRtnType(java.lang.String theRtnType)

      Set the service return type, for the service method call only.
      Parameters:
        `theRtnType` - the fully qualified class name of the return type.

    - #### getServiceRtnType

          public java.lang.String getServiceRtnType()

      Get the service return type, for the service method call only.
      Returns:
        the value of serviceRtnType.

    - #### setServerPassword

          public void setServerPassword(java.lang.String theServerPassword)

      Set the server password.
      Parameters:
        `theServerPassword` - the password to allow access to the server to call.

    - #### getServerPassword

          public java.lang.String getServerPassword()

      Get the server password.
      Returns:
        the value of serverPassword.

    - #### setPassword

          public void setPassword(java.lang.String thePassword)

      Set the service password.
      Parameters:
        `thePassword` - the password to allow access to the service to call.

    - #### getPassword

          public java.lang.String getPassword()

      Get the service password.
      Returns:
        the value of password.

    - #### setCommunicationID

          public void setCommunicationID(java.lang.String theCommunicationID)

      Set the communication id.
      Parameters:
        `theCommunicationID` - a unique id to identify the communication.

    - #### getCommunicationID

          public java.lang.String getCommunicationID()

      Get the communication id.
      Returns:
        the value of communicationID.

    - #### clearParams

          public void clearParams()

      Clear the list of method parameters.

    - #### addParam

          public void addParam(java.lang.Object theParam)

      Add a method parameter.
      Parameters:
        `theParam` - the parameter to add. If it is not of type ParamInfo, then it will be wrapped inside of a ParamInfo object.

    - #### getParameter

          public ParamInfo getParameter(java.lang.String paramName)

      Get the parameter with the specified name, case ignored.
      Parameters:
        `paramName` - the name of the parameter.
      Returns:
        the parameter object, or null if one does not exist.

    - #### getParams

          public java.util.ArrayList<ParamInfo> getParams()

      Get the method parameters.
      Returns:
        the value of params. Values are of type ParamInfo.

    - #### getParamValues

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

      Convert the method parameters into a vector of parameter objects.
      Returns:
        the parameter values as a list.

    - #### setClientURI

          public void setClientURI(org.licas_xml.abs.Element theClientUri)

      Set the uri for the client service.
      Parameters:
        `theClientUri` - the full uri path to the client service.

    - #### getClientURI

          public org.licas_xml.abs.Element getClientURI()

      Get the full uri path to the client service.
      Returns:
        the value of clientUri.

    - #### setServerURL

          protected void setServerURL(org.licas_xml.abs.Element theServerUri)

      Set the url for the server from the full uri address. This is just the http protocol, ip address plus port and not the whole handle.
      Parameters:
        `theServerUri` - the full uri path to the server to call.

    - #### getServerURL

          public java.lang.String getServerURL()

      Get the http address of the server.
      Returns:
        the value of serverUrl.

    - #### checkServerURL

          protected void checkServerURL()

      Check the server url format.

    - #### setServiceURI

          public void setServiceURI(java.lang.Object theServiceUri)
                             throws java.lang.Exception

      Set the uri for the current call path.
      Parameters:
        `theServiceUri` - the full uri path for the current call.
      Throws:
        `java.lang.Exception` - any error.

    - #### setServiceObj

          public void setServiceObj(java.lang.Object theServiceObj)
                             throws java.lang.Exception

      Set a direct reference to a service object. This actually calls `setServiceURI` as the service setting is now the object itself, but its use is for a direct reference.
      Parameters:
        `theServiceObj` - the service object to execute on.
      Throws:
        `java.lang.Exception` - any error.

    - #### getServiceURI

          public java.lang.Object getServiceURI()

      Get the full current call uri path.
      Returns:
        the value of serviceUri.

    - #### setRestOfServiceURI

          public void setRestOfServiceURI(org.licas_xml.abs.Element theServiceUri)

      Set the uri for the rest of the service call path.
      Parameters:
        `theServiceUri` - the full uri path for the rest of the service call.

    - #### getRestOfServiceURI

          public org.licas_xml.abs.Element getRestOfServiceURI()

      Get the full uri path for the rest of the service call.
      Returns:
        the value of serviceUri.

    - #### objParameterTypes

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

      Get the method parameter types as an ordered a list. This is for the actual parameter object instances and not the stored type field. If the value is `null`, it is replaced with `Object.class`.
      Returns:
        the parameter types as a list.

    - #### copyValues

          public void copyValues(MethodInfo copyInfo)

      Copy the values from the method info passed in to this object.
      Parameters:
        `copyInfo` - the info object to copy.

    - #### clone

          public java.lang.Object clone()

      Return a clone of this MethodInfo object.
      Overrides:
        `clone` in class `java.lang.Object`
      Returns:
        a clone of this object.

    - #### toString

          public java.lang.String toString()

      Convert the method info to a String.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        the description as a String.