org.licas.call

## Class MethodHandler

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

-     public final class MethodHandler
      extends java.lang.Object

  This class parses a `Service` method specification and tests at each step if the calling sequence is allowed. This is the main class for controlling the traversal through the nested services and also checks if the specified method exists and can be legally called with the specified passwords. The comparison check tests for the method name, return type and also all of the input parameter types. If the call is to a remote object, then this class will construct the remote calling object and try to make the remote call automatically as well.
  Author:
    Kieran Greer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MethodHandler(java.lang.String thisTempPassword, Service thisParent)` Creates a new instance of MethodHandler.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `execute(MethodInfo methodInfo)` Execute a call using the invoke method of Java `Reflection`.
    `boolean` | `reRoute(MethodInfo methodInfo)` Parse the method info to determine the next path stage and return the next method call.

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

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

- - ### Constructor Detail

    - #### MethodHandler

          public MethodHandler(java.lang.String thisTempPassword,
                               Service thisParent)

      Creates a new instance of MethodHandler.
      Parameters:
        `thisTempPassword` - a temporary password.
        `thisParent` - the parent service that the service to invoke is retrieved from. This can get traversed through a path description, from the server to the final parent service, but the final password is always required.

  - ### Method Detail

    - #### reRoute

          public final boolean reRoute(MethodInfo methodInfo)
                                throws java.lang.Exception

      Parse the method info to determine the next path stage and return the next method call.
      Parameters:
        `methodInfo` - the method call description with all of the required information.
      Returns:
        true if need to re-route.
      Throws:
        `java.lang.Exception` - any error.

    - #### execute

          public final java.lang.Object execute(MethodInfo methodInfo)
                                         throws ServiceException,
                                                ServiceNotFoundException,
                                                PasswordException,
                                                java.lang.Exception

      Execute a call using the invoke method of Java `Reflection`.
      Parameters:
        `methodInfo` - the method call description with all of the required information.
      Returns:
        Object the reply to the call.
      Throws:
        `ServiceException` - access to the service is not allowed.
        `ServiceNotFoundException` - the service has not been found.
        `PasswordException` - password is not correct.
        `java.lang.Exception` - any other error.