org.eclipse.ecf.provider.remoteservice.generic
Class RemoteServiceImpl

java.lang.Object
  extended by org.eclipse.ecf.provider.remoteservice.generic.RemoteServiceImpl
All Implemented Interfaces:
java.lang.reflect.InvocationHandler, IRemoteService

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


Field Summary
protected static long DEFAULT_TIMEOUT
           
protected  RemoteServiceRegistrationImpl registration
           
protected  RegistrySharedObject sharedObject
           
 
Constructor Summary
RemoteServiceImpl(RegistrySharedObject sharedObject, RemoteServiceRegistrationImpl registration)
           
 
Method Summary
 org.eclipse.equinox.concurrent.future.IFuture callAsync(IRemoteCall call)
          Call remote method specified by call parameter asynchronously, and immediately return IFuture instance.
 void callAsync(IRemoteCall call, IRemoteCallListener listener)
          Call remote method specified by call parameter asynchronously, and notify specified listener when call starts and completes.
 java.lang.Object callSync(IRemoteCall call)
          Call remote method specified by call parameter synchronously.
 void fireAsync(IRemoteCall call)
          Fire remote method specified by call parameter.
 java.lang.Object getProxy()
          Get local proxy for remote 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
 

Field Detail

DEFAULT_TIMEOUT

protected static final long DEFAULT_TIMEOUT

registration

protected RemoteServiceRegistrationImpl registration

sharedObject

protected RegistrySharedObject sharedObject
Constructor Detail

RemoteServiceImpl

public RemoteServiceImpl(RegistrySharedObject sharedObject,
                         RemoteServiceRegistrationImpl registration)
Method Detail

callAsync

public void callAsync(IRemoteCall call,
                      IRemoteCallListener listener)
Description copied from interface: IRemoteService
Call remote method specified by call parameter asynchronously, and notify specified listener when call starts and completes.

Specified by:
callAsync in interface IRemoteService
Parameters:
call - the remote call to make. Must not be null .
listener - the listener to notify when call starts and is completed. The listener will be notified via the two event types IRemoteCallStartEvent and IRemoteCallCompleteEvent. Must not be null .
Since:
3.0
See Also:
IRemoteService.callAsync(org.eclipse.ecf.remoteservice.IRemoteCall, org.eclipse.ecf.remoteservice.IRemoteCallListener)

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.
Since:
3.0
See Also:
IRemoteService.callAsync(org.eclipse.ecf.remoteservice.IRemoteCall)

callSync

public java.lang.Object callSync(IRemoteCall call)
                          throws ECFException
Description copied from interface: IRemoteService
Call remote method specified by call parameter synchronously.

Specified by:
callSync in interface IRemoteService
Parameters:
call - the remote call to make
Returns:
Object the result of the call. Will be null if remote provides null as result.
Throws:
ECFException - thrown if disconnect occurs, caller not currently connected, or remote throws Exception
Since:
3.0
See Also:
IRemoteService.callSync(org.eclipse.ecf.remoteservice.IRemoteCall)

fireAsync

public void fireAsync(IRemoteCall call)
               throws ECFException
Description copied from interface: IRemoteService
Fire remote method specified by call parameter. The remote method will be invoked as a result of asynchronous message send, but no failure/exception information will be returned, and no result will be returned

Specified by:
fireAsync in interface IRemoteService
Parameters:
call - the remote call to make. Must not be null .
Throws:
ECFException - if caller not currently connected
Since:
3.0
See Also:
IRemoteService.fireAsync(org.eclipse.ecf.remoteservice.IRemoteCall)

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

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