JSR-043: JTAPI-1.4

javax.telephony.media.provider
Class Request

java.lang.Object
  |
  +--javax.telephony.media.provider.Request

public class Request
extends java.lang.Object

Represents an API method request on a MediaGroup.

A Request is a Method plus some args. When the request is invoked, the indicated Method is invoked (on the given MPI.MediaGroup) with the previously supplied args.

Requests are created in BasicMediaService, and invoked in Base_MediaService. This technique allows Base_MediaService to invoke methods that are beyond the pre-defined MPI methods; including all the Resource methods.

This class includes a static wrapper around reflect.getMethod(...) which catches any exceptions, so that method can be used in static initializers to find the required Method.

The constructor comes in various flavors with different numbers of Object arguments, and a couple with strategically placed int args. These are sufficient to handle the S.410 media resource methods.

This bit of reflection allows the MediaGroup object and its public methods to be hidden from the application.

Since:
JTAPI-1.4

Constructor Summary
Request(java.lang.reflect.Method method)
           
Request(java.lang.reflect.Method method, int arg0, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
           
Request(java.lang.reflect.Method method, java.lang.Object arg0)
           
Request(java.lang.reflect.Method method, java.lang.Object[] arglist)
           
Request(java.lang.reflect.Method method, java.lang.Object arg0, int arg1, java.lang.Object arg2, java.lang.Object arg3)
           
Request(java.lang.reflect.Method method, java.lang.Object arg0, java.lang.Object arg1)
           
Request(java.lang.reflect.Method method, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2)
           
Request(java.lang.reflect.Method method, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
           
Request(java.lang.reflect.Method method, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4)
           
 
Method Summary
 java.lang.reflect.Method getMethod()
          return the internal, cached Method, so one can look up the declaring class.
 java.lang.Object invoke(MPI.MediaGroup group)
          Invoke this Request on the target object.
static java.lang.reflect.Method theMethod(java.lang.Class clas, java.lang.String name, java.lang.Class[] argtypes)
          Find the indicated Method.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Request

public Request(java.lang.reflect.Method method,
               java.lang.Object[] arglist)

Request

public Request(java.lang.reflect.Method method)

Request

public Request(java.lang.reflect.Method method,
               java.lang.Object arg0)

Request

public Request(java.lang.reflect.Method method,
               java.lang.Object arg0,
               java.lang.Object arg1)

Request

public Request(java.lang.reflect.Method method,
               java.lang.Object arg0,
               java.lang.Object arg1,
               java.lang.Object arg2)

Request

public Request(java.lang.reflect.Method method,
               java.lang.Object arg0,
               java.lang.Object arg1,
               java.lang.Object arg2,
               java.lang.Object arg3)

Request

public Request(java.lang.reflect.Method method,
               java.lang.Object arg0,
               java.lang.Object arg1,
               java.lang.Object arg2,
               java.lang.Object arg3,
               java.lang.Object arg4)

Request

public Request(java.lang.reflect.Method method,
               int arg0,
               java.lang.Object arg1,
               java.lang.Object arg2,
               java.lang.Object arg3)

Request

public Request(java.lang.reflect.Method method,
               java.lang.Object arg0,
               int arg1,
               java.lang.Object arg2,
               java.lang.Object arg3)
Method Detail

getMethod

public java.lang.reflect.Method getMethod()
return the internal, cached Method, so one can look up the declaring class.
Returns:
the Method to be invoked.

invoke

public java.lang.Object invoke(MPI.MediaGroup group)
Invoke this Request on the target object.

The Request.method is not invoked directly on the given MPI.MediaGroup. The MPI.MediaGroup is allowed to delegate the method to any implementation object. The MPI.MediaGroup implementation should return the proper object for each method as the value of MPI.MediaGroup.getTargetForMethod(java.lang.reflect.Method).

If an Exception is generated, either by Method.invoke() or by the actual method implementation, it is wrapped as a RuntimeException and thrown.

Note: for media resource methods, most exceptions are bundled into the return value.

Parameters:
group - the MPI.MediaGroup on which this request is invoked.
Returns:
the Object that is the return value of the method.
Throws:
java.lang.RuntimeException - if any Throwable/Exception is generated.

theMethod

public static java.lang.reflect.Method theMethod(java.lang.Class clas,
                                                 java.lang.String name,
                                                 java.lang.Class[] argtypes)
Find the indicated Method. Catch any Exceptions so this can be used in static initializers

JSR-043: JTAPI-1.4

Send comments to: JSR-43@ectf.org