de.netseeker.ejoe
Class RemotingService

java.lang.Object
  extended by de.netseeker.ejoe.RemotingService
All Implemented Interfaces:
java.lang.reflect.InvocationHandler

public class RemotingService
extends java.lang.Object
implements java.lang.reflect.InvocationHandler

JDK Proxy factory and InvocationHandler This factory implementation can be used to do Remoting Requests in a very elegantly way by using Interfaces for the targeted remote service class. Basic usage:

 EJClient client = new EJClient(...);
 MyInterface service = (ISimpleTypes) RemotingService.createService( 
                              MyRemoteService.class.getName(), MyInterface.class, client );
 SomeResponse response = service.doSomething(someArgument,...);
 

Since:
0.3.9.2
Author:
netseeker

Constructor Summary
protected RemotingService(java.lang.String remoteClassName, EJClient client, EJAsyncCallback callback)
           
 
Method Summary
static java.lang.Object createAsyncService(java.lang.String svRemoteClassName, java.lang.Class svInterface, EJClient svClient, EJAsyncCallback svCallback)
          Creates a new JDK Proxy for doing asynchronous Remoting Requests using a given Interface
static java.lang.Object createService(java.lang.String svRemoteClassName, java.lang.Class svInterface, EJClient svClient)
          Creates a new JDK Proxy for doing Remoting Requests using a given Interface
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemotingService

protected RemotingService(java.lang.String remoteClassName,
                          EJClient client,
                          EJAsyncCallback callback)
Parameters:
remoteClassName -
client -
callback -
Method Detail

createService

public static java.lang.Object createService(java.lang.String svRemoteClassName,
                                             java.lang.Class svInterface,
                                             EJClient svClient)
Creates a new JDK Proxy for doing Remoting Requests using a given Interface

Parameters:
svRemoteClassName - Targeted remote service class within the EJServer
svInterface - Interface according to the methods in targeted remote service class
svClient - EJClient to use for processing requests
Returns:
JDK Proxy implementing the given Interface

createAsyncService

public static java.lang.Object createAsyncService(java.lang.String svRemoteClassName,
                                                  java.lang.Class svInterface,
                                                  EJClient svClient,
                                                  EJAsyncCallback svCallback)
Creates a new JDK Proxy for doing asynchronous Remoting Requests using a given Interface

Parameters:
svRemoteClassName - Targeted remote service class within the EJServer
svInterface - Interface according to the methods in targeted remote service class
svClient - EJClient to use for processing requests
svCallback - Callback handler to inform whenever a request is completed or an error occured
Returns:
JDK Proxy implementing the given Interface for processing asynchronous requests

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Throws:
java.lang.Throwable


Copyright © 2005-2007 netseeker. All Rights Reserved.