org.eclipse.ecf.remoteservice.client
Class AbstractClientService
java.lang.Object
org.eclipse.ecf.remoteservice.AbstractRemoteService
org.eclipse.ecf.remoteservice.client.AbstractClientService
- All Implemented Interfaces:
- java.lang.reflect.InvocationHandler, IRemoteService
- Direct Known Subclasses:
- RestClientService
public abstract class AbstractClientService
- extends AbstractRemoteService
Remote service client service. Implements IRemoteService
.
- Since:
- 4.0
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 org.eclipse.equinox.concurrent.future.IFuture |
callAsync(IRemoteCall call,
IRemoteCallable callable)
|
protected void |
callAsync(IRemoteCall call,
IRemoteCallable restClientCallable,
IRemoteCallListener listener)
|
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. |
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 AbstractClientContainer |
getClientContainer()
|
protected java.lang.String[] |
getInterfaceClassNames()
|
protected long |
getNextRequestID()
|
protected RemoteServiceClientRegistration |
getRegistration()
|
protected IRemoteServiceID |
getRemoteServiceID()
|
protected IRemoteServiceReference |
getRemoteServiceReference()
|
protected void |
handleInvokeException(java.lang.String message,
java.lang.Throwable e)
|
protected abstract java.lang.Object |
invokeRemoteCall(IRemoteCall call,
IRemoteCallable callable)
Invoke remote call. |
protected java.lang.Object |
invokeSync(IRemoteCall remoteCall)
|
protected java.lang.String |
prepareEndpointAddress(IRemoteCall call,
IRemoteCallable callable)
|
protected IRemoteCallParameter[] |
prepareParameters(java.lang.String uri,
IRemoteCall call,
IRemoteCallable callable)
|
protected java.lang.Object |
processResponse(java.lang.String uri,
IRemoteCall call,
IRemoteCallable callable,
java.util.Map responseHeaders,
java.lang.String responseBody)
|
Methods inherited from class org.eclipse.ecf.remoteservice.AbstractRemoteService |
convertInterfaceNameToAsyncInterfaceName, createProxy, findAsyncRemoteServiceProxyClass, getAsyncArgs, getAsyncInvokeMethodName, getCallTimeoutForProxyInvoke, getDefaultTimeout, getProxy, getRemoteService, invoke, invokeAsync, invokeObject, loadInterfaceClass, logWarning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
registration
protected RemoteServiceClientRegistration registration
container
protected AbstractClientContainer container
AbstractClientService
public AbstractClientService(AbstractClientContainer container,
RemoteServiceClientRegistration registration)
callSync
public java.lang.Object callSync(IRemoteCall call)
throws ECFException
- Description copied from interface:
IRemoteService
- Call remote method specified by call parameter synchronously.
- 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
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
- Overrides:
callAsync
in class AbstractRemoteService
- 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.
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.
- 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
.- See Also:
IRemoteCallStartEvent
,
IRemoteCallCompleteEvent
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
- Parameters:
call
- the remote call to make. Must not be null
.
- Throws:
ECFException
- if caller not currently connected
invokeSync
protected java.lang.Object invokeSync(IRemoteCall remoteCall)
throws ECFException
- Overrides:
invokeSync
in class AbstractRemoteService
- Throws:
ECFException
getCallParametersForProxyInvoke
protected java.lang.Object[] getCallParametersForProxyInvoke(java.lang.String callMethod,
java.lang.reflect.Method proxyMethod,
java.lang.Object[] args)
- Overrides:
getCallParametersForProxyInvoke
in class AbstractRemoteService
getCallMethodNameForProxyInvoke
protected java.lang.String getCallMethodNameForProxyInvoke(java.lang.reflect.Method method,
java.lang.Object[] args)
- Overrides:
getCallMethodNameForProxyInvoke
in class AbstractRemoteService
getNextRequestID
protected long getNextRequestID()
callAsync
protected void callAsync(IRemoteCall call,
IRemoteCallable restClientCallable,
IRemoteCallListener listener)
callAsync
protected org.eclipse.equinox.concurrent.future.IFuture callAsync(IRemoteCall call,
IRemoteCallable callable)
handleInvokeException
protected void handleInvokeException(java.lang.String message,
java.lang.Throwable e)
throws ECFException
- Throws:
ECFException
getClientContainer
protected AbstractClientContainer getClientContainer()
getRegistration
protected RemoteServiceClientRegistration getRegistration()
prepareEndpointAddress
protected java.lang.String prepareEndpointAddress(IRemoteCall call,
IRemoteCallable callable)
prepareParameters
protected IRemoteCallParameter[] prepareParameters(java.lang.String uri,
IRemoteCall call,
IRemoteCallable callable)
throws java.io.NotSerializableException
- Throws:
java.io.NotSerializableException
processResponse
protected java.lang.Object processResponse(java.lang.String uri,
IRemoteCall call,
IRemoteCallable callable,
java.util.Map responseHeaders,
java.lang.String responseBody)
throws java.io.NotSerializableException
- Throws:
java.io.NotSerializableException
getRemoteServiceID
protected IRemoteServiceID getRemoteServiceID()
- Specified by:
getRemoteServiceID
in class AbstractRemoteService
getRemoteServiceReference
protected IRemoteServiceReference getRemoteServiceReference()
- Specified by:
getRemoteServiceReference
in class AbstractRemoteService
getInterfaceClassNames
protected java.lang.String[] getInterfaceClassNames()
- Specified by:
getInterfaceClassNames
in class AbstractRemoteService
invokeRemoteCall
protected abstract java.lang.Object invokeRemoteCall(IRemoteCall call,
IRemoteCallable callable)
throws ECFException
- Invoke remote call. The implementation of this method should actually
make the remote call for the given call and associated callable.
- Parameters:
call
- the call for the remote call. Will not be null
.callable
- the callable associated with the remote call. Will not be null
.
- Returns:
- Object the result of the remote call. May be
null
.
- Throws:
ECFException
- thrown if the call fails.