uk.ac.soton.itinnovation.grid.comms.client
Class RemoteResourceProxy

java.lang.Object
  extended by uk.ac.soton.itinnovation.grid.comms.client.RemoteResourceProxy
All Implemented Interfaces:
InvocationHandler

public final class RemoteResourceProxy
extends Object
implements InvocationHandler

A factory for Conversation implementations. Given a Java interface representing a remote contextualised resource we want to access, we could write a trivial implementation of it where invoking any method invokes the appropriate operation on the remote service.

To save us from having to do this, this class dynamically generates Java proxies to do it for us.

Note: Each member of the interface corresponding to a SOAP operation must be annotated as a WebMethod.


Method Summary
static StorableInStateRepository createConv(StateRepository repository, org.apache.axis.message.addressing.EndpointReferenceType epr)
          Create a proxy object for a remote contextualised resource.
static
<T extends StorableInStateRepository>
T
createConv(StateRepository repository, org.apache.axis.message.addressing.EndpointReferenceType epr, Class<T> iface)
          Create a proxy object for a remote contextualised resource.
 Object invoke(Object proxy, Method method, Object[] args)
          Invoke an operation on the proxy object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createConv

public static StorableInStateRepository createConv(StateRepository repository,
                                                   org.apache.axis.message.addressing.EndpointReferenceType epr)
                                            throws ObjectAlreadyExists
Create a proxy object for a remote contextualised resource. Wrapper for createConv(StateRepository, EndpointReferenceType, Class) that extracts the class from them EPR.

Throws:
ObjectAlreadyExists

createConv

public static <T extends StorableInStateRepository> T createConv(StateRepository repository,
                                                                 org.apache.axis.message.addressing.EndpointReferenceType epr,
                                                                 Class<T> iface)
                                                      throws ObjectAlreadyExists
Create a proxy object for a remote contextualised resource. Before calling this, use ConversationID.setType(org.apache.axis.message.addressing.EndpointReferenceType, java.lang.String) to set the type meta-data of the EPR to the Java interface describing the SOAP interface. This interface must extend StorableInStateRepository and each remote operation must carry a WebMethod annotation. This method is the default factory if none has been passed to ImplementationFactory.registerFactory(java.lang.Class, java.lang.Class, java.lang.String) or listed in the implementationfactory.properties file.

Parameters:
repository - the StateRepository in which to store the new proxy
epr - an EPR for the resource
iface - the Java interface for the resource
Returns:
a new proxy object
Throws:
ObjectAlreadyExists - if the EPR describes a resource already in the repository

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Invoke an operation on the proxy object. If the operation is provided by the helper, then the helper method is invoked. Otherwise, if it is a WebMethod then a SOAP call is made.

Specified by:
invoke in interface InvocationHandler
Throws:
Throwable


Copyright © 2001-2007 University of Southampton IT Innovation Centre. All Rights Reserved.