edu.emory.mathcs.rmix.spi
Class AbstractInvoker

java.lang.Object
  extended byedu.emory.mathcs.rmix.spi.AbstractInvoker
All Implemented Interfaces:
Invoker
Direct Known Subclasses:
AbstractAsyncInvoker

public abstract class AbstractInvoker
extends java.lang.Object
implements Invoker

Convenience base class for RMIX providers to implement Invoker. Subclasses must provide implementation for abstract method invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]). Most implementations will additionally override getParameter(java.lang.String) and setParameter(java.lang.String, java.lang.Object).

Version:
1.0
Author:
Dawid Kurzyniec

Field Summary
protected  BasicBindParams bindParams
           
protected  java.lang.Class[] interfaces
           
protected  RemoteRef ref
           
 
Constructor Summary
protected AbstractInvoker(RemoteRef ref, java.lang.ClassLoader cloader, boolean resolveAll, BasicBindParams bindParams)
           
 
Method Summary
 boolean equals(java.lang.Object other)
           
 Parameters getBindParameters()
          Retrieves parameters associated with this invoker.
 java.lang.Class[] getInterfaces()
          Gets remote interfaces which methods may be invoked on the target object through this invoker.
 java.lang.Object getParameter(java.lang.String name)
          This implementation delegates to the setParameter of the underlying RemoteRef.
 RemoteRef getRef()
          Gets the RemoteRef that this invoker is bound to.
 int hashCode()
           
abstract  java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method m, java.lang.Object[] params)
          Performs the remote method invocation.
 void setParameter(java.lang.String name, java.lang.Object value)
          This implementation always throws IllegalParameterException.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ref

protected final RemoteRef ref

interfaces

protected final java.lang.Class[] interfaces

bindParams

protected BasicBindParams bindParams
Constructor Detail

AbstractInvoker

protected AbstractInvoker(RemoteRef ref,
                          java.lang.ClassLoader cloader,
                          boolean resolveAll,
                          BasicBindParams bindParams)
                   throws java.lang.ClassNotFoundException
Method Detail

invoke

public abstract java.lang.Object invoke(java.lang.Object proxy,
                                        java.lang.reflect.Method m,
                                        java.lang.Object[] params)
                                 throws java.lang.Exception
Description copied from interface: Invoker
Performs the remote method invocation. The requested method must belong to one of the interfaces available through #getInterfaces.

Specified by:
invoke in interface Invoker
Parameters:
proxy - the client-side proxy that originated the invocation.
m - the remote method to invoke.
params - invocation parameters.
Returns:
the value returned by the remote method call.
Throws:
java.lang.Exception - exception thrown by the remote method.

getRef

public RemoteRef getRef()
Description copied from interface: Invoker
Gets the RemoteRef that this invoker is bound to.

Specified by:
getRef in interface Invoker
Returns:
the RemoteRef of this invoker.

getInterfaces

public java.lang.Class[] getInterfaces()
Description copied from interface: Invoker
Gets remote interfaces which methods may be invoked on the target object through this invoker.

Specified by:
getInterfaces in interface Invoker
Returns:
exported remote interfaces.

getBindParameters

public Parameters getBindParameters()
Description copied from interface: Invoker
Retrieves parameters associated with this invoker. Binding to this invoker's remote reference using these parameters will create invoker indistinguishable from this one.

Specified by:
getBindParameters in interface Invoker
Returns:
bind parameters

setParameter

public void setParameter(java.lang.String name,
                         java.lang.Object value)
                  throws IllegalParameterException,
                         java.lang.UnsupportedOperationException
This implementation always throws IllegalParameterException.

Specified by:
setParameter in interface Invoker
Parameters:
name - the name of the parameter to set.
value - the value of the parameter.
Throws:
IllegalParameterException - if the provider does not recognize the parameter with that name, or if the parameter is not of the appropriate type.
java.lang.UnsupportedOperationException - if the parameter cannot be written (for instance, if it is read-only).
See Also:
Invoker.setParameter(java.lang.String, java.lang.Object)

getParameter

public java.lang.Object getParameter(java.lang.String name)
                              throws IllegalParameterException,
                                     java.lang.UnsupportedOperationException
This implementation delegates to the setParameter of the underlying RemoteRef.

Specified by:
getParameter in interface Invoker
Parameters:
name - the parameter name.
Returns:
the parameter value.
Throws:
IllegalParameterException - if the provider does not recognize the parameter with that name.
java.lang.UnsupportedOperationException - if the parameter cannot be read (for instance, if it is write-only).
See Also:
Invoker.setParameter(java.lang.String, java.lang.Object)

equals

public boolean equals(java.lang.Object other)

hashCode

public int hashCode()