org.eclipse.ecf.remoteservice
Class AbstractRemoteService

java.lang.Object
  extended by org.eclipse.ecf.remoteservice.AbstractRemoteService
All Implemented Interfaces:
java.lang.reflect.InvocationHandler, IRemoteService
Direct Known Subclasses:
AbstractClientService, RemoteServiceImpl

public abstract class AbstractRemoteService
extends java.lang.Object
implements IRemoteService, java.lang.reflect.InvocationHandler

Abstract remote service implementation. Clients may subclass to avoid re-implementing methods from IRemoteService.

Since:
4.1

Nested Class Summary
protected  class AbstractRemoteService.AsyncArgs
           
 
Field Summary
protected static java.lang.Object[] EMPTY_ARGS
           
 
Constructor Summary
AbstractRemoteService()
           
 
Method Summary
 org.eclipse.equinox.concurrent.future.IFuture callAsync(IRemoteCall call)
          Call remote method specified by call parameter asynchronously, and immediately return IFuture instance.
protected  java.lang.String convertInterfaceNameToAsyncInterfaceName(java.lang.String interfaceName)
           
protected  java.lang.Object createProxy(java.lang.Class[] classes)
           
protected  java.lang.Class findAsyncRemoteServiceProxyClass(java.lang.Class c)
           
protected  AbstractRemoteService.AsyncArgs getAsyncArgs(java.lang.reflect.Method method, java.lang.Object[] args)
           
protected  java.lang.String getAsyncInvokeMethodName(java.lang.reflect.Method method)
           
protected  java.lang.String getCallMethodNameForProxyInvoke(java.lang.reflect.Method method, java.lang.Object[] args)
           
protected  java.lang.Object[] getCallParametersForProxyInvoke(java.lang.String callMethod, java.lang.reflect.Method proxyMethod, java.lang.Object[] args)
           
protected  long getCallTimeoutForProxyInvoke(java.lang.String callMethod, java.lang.reflect.Method proxyMethod, java.lang.Object[] args)
           
protected  long getDefaultTimeout()
           
protected abstract  java.lang.String[] getInterfaceClassNames()
           
 java.lang.Object getProxy()
          Get local proxy for remote interface.
protected  IRemoteService getRemoteService()
           
protected abstract  IRemoteServiceID getRemoteServiceID()
           
protected abstract  IRemoteServiceReference getRemoteServiceReference()
           
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
           
protected  java.lang.Object invokeAsync(java.lang.reflect.Method method, java.lang.Object[] args)
           
protected  java.lang.Object invokeObject(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
           
protected  java.lang.Object invokeSync(IRemoteCall call)
           
protected  java.lang.Class loadInterfaceClass(java.lang.String className)
           
protected  void logWarning(java.lang.String string, java.lang.Throwable e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ecf.remoteservice.IRemoteService
callAsync, callSync, fireAsync
 

Field Detail

EMPTY_ARGS

protected static final java.lang.Object[] EMPTY_ARGS
Constructor Detail

AbstractRemoteService

public AbstractRemoteService()
Method Detail

getInterfaceClassNames

protected abstract java.lang.String[] getInterfaceClassNames()

getRemoteServiceID

protected abstract IRemoteServiceID getRemoteServiceID()

getRemoteServiceReference

protected abstract IRemoteServiceReference getRemoteServiceReference()

loadInterfaceClass

protected java.lang.Class loadInterfaceClass(java.lang.String className)
                                      throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

getRemoteService

protected IRemoteService getRemoteService()

getDefaultTimeout

protected long getDefaultTimeout()

callAsync

public org.eclipse.equinox.concurrent.future.IFuture callAsync(IRemoteCall call)
Description copied from interface: IRemoteService
Call remote method specified by call parameter asynchronously, and immediately return IFuture instance. Returned IFuture will not be null, and allows the caller to retrieve the actual resulting value from the remote call (or exception).

Specified by:
callAsync in interface IRemoteService
Parameters:
call - the remote call to make. Must not be null .
Returns:
IFuture the asynchronous result to allow the caller to poll for whether the result IFuture.isDone(), and then to IFuture.get() the actual result.

getProxy

public java.lang.Object getProxy()
                          throws ECFException
Description copied from interface: IRemoteService
Get local proxy for remote interface. The local proxy may then be used to make remote method calls transparently by invoking the local proxy method

Specified by:
getProxy in interface IRemoteService
Returns:
Object that implements the interface specified in the IRemoteServiceReference instance used to retrieve the IRemoteService object. The result may then be cast to the appropriate type. The getProxy() contract guarantees that if a non-null Object is returned, that it will implement the interface specified for the IRemoteServiceReference. Will not be null .
Throws:
ECFException - if not currently connected to remote service

createProxy

protected java.lang.Object createProxy(java.lang.Class[] classes)

findAsyncRemoteServiceProxyClass

protected java.lang.Class findAsyncRemoteServiceProxyClass(java.lang.Class c)
Since:
3.3

convertInterfaceNameToAsyncInterfaceName

protected java.lang.String convertInterfaceNameToAsyncInterfaceName(java.lang.String interfaceName)

getCallParametersForProxyInvoke

protected java.lang.Object[] getCallParametersForProxyInvoke(java.lang.String callMethod,
                                                             java.lang.reflect.Method proxyMethod,
                                                             java.lang.Object[] args)

getCallTimeoutForProxyInvoke

protected long getCallTimeoutForProxyInvoke(java.lang.String callMethod,
                                            java.lang.reflect.Method proxyMethod,
                                            java.lang.Object[] args)

getCallMethodNameForProxyInvoke

protected java.lang.String getCallMethodNameForProxyInvoke(java.lang.reflect.Method method,
                                                           java.lang.Object[] args)

invokeObject

protected java.lang.Object invokeObject(java.lang.Object proxy,
                                        java.lang.reflect.Method method,
                                        java.lang.Object[] args)
                                 throws java.lang.Throwable
Throws:
java.lang.Throwable

invokeSync

protected java.lang.Object invokeSync(IRemoteCall call)
                               throws ECFException
Throws:
ECFException

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

invokeAsync

protected java.lang.Object invokeAsync(java.lang.reflect.Method method,
                                       java.lang.Object[] args)
                                throws java.lang.Throwable
Throws:
java.lang.Throwable
Since:
3.3

getAsyncArgs

protected AbstractRemoteService.AsyncArgs getAsyncArgs(java.lang.reflect.Method method,
                                                       java.lang.Object[] args)
Since:
3.3

getAsyncInvokeMethodName

protected java.lang.String getAsyncInvokeMethodName(java.lang.reflect.Method method)
Since:
3.3

logWarning

protected void logWarning(java.lang.String string,
                          java.lang.Throwable e)