Class AbstractClientService
- java.lang.Object
-
- org.eclipse.ecf.remoteservice.asyncproxy.AbstractAsyncProxyRemoteService
-
- org.eclipse.ecf.remoteservice.AbstractRemoteService
-
- org.eclipse.ecf.remoteservice.client.AbstractClientService
-
- All Implemented Interfaces:
InvocationHandler
,IRemoteService
- Direct Known Subclasses:
AbstractRestClientService
,AbstractRSAClientService
public abstract class AbstractClientService extends AbstractRemoteService
Remote service client service. ImplementsIRemoteService
.- Since:
- 4.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractClientService.AsyncResult
inner class implementing the asynchronous result object.static class
AbstractClientService.UriRequest
-
Nested classes/interfaces inherited from class org.eclipse.ecf.remoteservice.AbstractRemoteService
AbstractRemoteService.AsyncArgs, AbstractRemoteService.ProxyClassLoader
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractClientContainer
container
protected RemoteServiceClientRegistration
registration
-
Fields inherited from class org.eclipse.ecf.remoteservice.AbstractRemoteService
EMPTY_ARGS, futureExecutorService, futureExecutorServiceMaxThreads, iFutureExecutor
-
-
Constructor Summary
Constructors Constructor Description AbstractClientService(AbstractClientContainer container, RemoteServiceClientRegistration registration)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description org.eclipse.equinox.concurrent.future.IFuture
callAsync(IRemoteCall call)
Call remote method specified by call parameter asynchronously, and immediately returnIFuture
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.Object
callSync(IRemoteCall call)
Call remote method specified by call parameter synchronously.protected AbstractClientService.UriRequest
createUriRequest(String endpoint, IRemoteCall call, IRemoteCallable callable)
void
fireAsync(IRemoteCall call)
Fire remote method specified by call parameter.protected String
getCallMethodNameForProxyInvoke(Method method, Object[] args)
protected Object[]
getCallParametersForProxyInvoke(String callMethod, Method proxyMethod, Object[] args)
protected AbstractClientContainer
getClientContainer()
protected String[]
getInterfaceClassNames()
protected long
getNextRequestID()
protected RemoteServiceClientRegistration
getRegistration()
protected IRemoteServiceID
getRemoteServiceID()
protected IRemoteServiceReference
getRemoteServiceReference()
protected void
handleInvokeException(String message, Throwable e)
protected abstract Object
invokeRemoteCall(IRemoteCall call, IRemoteCallable callable)
Invoke remote call.protected Object
invokeSync(IRemoteCall remoteCall)
protected String
prepareEndpointAddress(IRemoteCall call, IRemoteCallable callable)
protected IRemoteCallParameter[]
prepareParameters(String uri, IRemoteCall call, IRemoteCallable callable)
protected Object
processResponse(String uri, IRemoteCall call, IRemoteCallable callable, Map responseHeaders, byte[] responseBody)
-
Methods inherited from class org.eclipse.ecf.remoteservice.AbstractRemoteService
addAsyncProxyClasses, addRemoteServiceProxyToProxy, callAsync, callAsync, callAsyncWithResult, callAsyncWithTimeout, callAsyncWithTimeout, callCompletableAsync, callFutureAsync, callFutureAsync, callSync, convertInterfaceNameToAsyncInterfaceName, createProxy, createProxy, createRCCE, createRCCEFailure, createRCCESuccess, createRemoteCall, dispose, findAsyncRemoteServiceProxyClass, findAsyncRemoteServiceProxyClass, getAsyncArgs, getAsyncInvokeMethodName, getAsyncRemoteCall, getCallTimeoutForProxyInvoke, getDefaultTimeout, getFutureExecutorService, getIFutureExecutor, getProxy, getProxy, getRemoteService, getRemoteServiceProxyCreator, handleInvokeSyncException, handleProxyException, invoke, invokeAsync, invokeObject, invokeReturnAsync, isAsync, isInterfaceAsync, isMethodAsync, isOSGIAsync, loadInterfaceClass, loadInterfaceClass, logWarning, setFutureExecutorService, setIFutureExecutor
-
Methods inherited from class org.eclipse.ecf.remoteservice.asyncproxy.AbstractAsyncProxyRemoteService
callFuture, isReturnAsync
-
-
-
-
Field Detail
-
registration
protected RemoteServiceClientRegistration registration
-
container
protected AbstractClientContainer container
-
-
Constructor Detail
-
AbstractClientService
public AbstractClientService(AbstractClientContainer container, RemoteServiceClientRegistration registration)
-
-
Method Detail
-
callSync
public 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 providesnull
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 returnIFuture
instance. Returned IFuture will not benull
, and allows the caller to retrieve the actual resulting value from the remote call (or exception).- Specified by:
callAsync
in interfaceIRemoteService
- Overrides:
callAsync
in classAbstractRemoteService
- Parameters:
call
- the remote call to make. Must not benull
.- Returns:
- IFuture the asynchronous result to allow the caller to poll
for whether the result
IFuture.isDone()
, and then toIFuture.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 benull
.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 benull
.- 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 benull
.- Throws:
ECFException
- if caller not currently connected
-
invokeSync
protected Object invokeSync(IRemoteCall remoteCall) throws ECFException
- Overrides:
invokeSync
in classAbstractRemoteService
- Throws:
ECFException
-
getCallParametersForProxyInvoke
protected Object[] getCallParametersForProxyInvoke(String callMethod, Method proxyMethod, Object[] args)
- Overrides:
getCallParametersForProxyInvoke
in classAbstractRemoteService
-
getCallMethodNameForProxyInvoke
protected String getCallMethodNameForProxyInvoke(Method method, Object[] args)
- Overrides:
getCallMethodNameForProxyInvoke
in classAbstractRemoteService
-
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(String message, Throwable e) throws ECFException
- Throws:
ECFException
-
getClientContainer
protected AbstractClientContainer getClientContainer()
-
getRegistration
protected RemoteServiceClientRegistration getRegistration()
-
prepareEndpointAddress
protected String prepareEndpointAddress(IRemoteCall call, IRemoteCallable callable)
-
prepareParameters
protected IRemoteCallParameter[] prepareParameters(String uri, IRemoteCall call, IRemoteCallable callable) throws NotSerializableException
- Throws:
NotSerializableException
-
processResponse
protected Object processResponse(String uri, IRemoteCall call, IRemoteCallable callable, Map responseHeaders, byte[] responseBody) throws NotSerializableException
- Parameters:
uri
- uricall
- callcallable
- callableresponseHeaders
- responseHeadersresponseBody
- responseBody- Returns:
- Object processed response
- Throws:
NotSerializableException
- if response cannot be deserialized- Since:
- 8.0
-
getRemoteServiceID
protected IRemoteServiceID getRemoteServiceID()
- Specified by:
getRemoteServiceID
in classAbstractRemoteService
-
getRemoteServiceReference
protected IRemoteServiceReference getRemoteServiceReference()
- Specified by:
getRemoteServiceReference
in classAbstractRemoteService
-
getInterfaceClassNames
protected String[] getInterfaceClassNames()
- Specified by:
getInterfaceClassNames
in classAbstractRemoteService
-
createUriRequest
protected AbstractClientService.UriRequest createUriRequest(String endpoint, IRemoteCall call, IRemoteCallable callable)
- Parameters:
endpoint
- endpointcall
- callcallable
- callable- Returns:
- UriRequest new UriRequest
- Since:
- 8.5
-
invokeRemoteCall
protected abstract 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 benull
.callable
- the callable associated with the remote call. Will not benull
.- Returns:
- Object the result of the remote call. May be
null
. - Throws:
ECFException
- thrown if the call fails.
-
-