Class AbstractClientContainer
- java.lang.Object
-
- org.eclipse.ecf.core.AbstractContainer
-
- org.eclipse.ecf.remoteservice.client.AbstractClientContainer
-
- All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable,IContainer,IIdentifiable,IRemoteServiceClientContainerAdapter,IRemoteServiceConsumer,IRemoteServiceContainerAdapter,IRemoteServiceHost
- Direct Known Subclasses:
AbstractRestClientContainer,AbstractRSAClientContainer
public abstract class AbstractClientContainer extends AbstractContainer implements IRemoteServiceClientContainerAdapter
Remote service client abstract superclass.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanalwaysSendDefaultParametersprotected IConnectContextconnectContextprotected IDconnectedIDprotected ObjectconnectLockprotected IDcontainerIDprotected IRemoteCallParameterSerializerparameterSerializerprotected ObjectparameterSerializerLockprotected RemoteServiceClientRegistryregistryprotected IRemoteResponseDeserializerremoteResponseDeserializerprotected ObjectremoteResponseDeserializerLockprotected IRemoteServiceFactoryremoteServiceFactoryprotected ListremoteServiceListeners
-
Constructor Summary
Constructors Constructor Description AbstractClientContainer(ID containerID)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddRemoteServiceListener(IRemoteServiceListener listener)Add listener for remote service registration/unregistration for this containerorg.eclipse.equinox.concurrent.future.IFutureasyncGetRemoteServiceReferences(ID[] idFilter, String clazz, String filter)Asynchronously returns an array ofIRemoteServiceReferenceobjects.org.eclipse.equinox.concurrent.future.IFutureasyncGetRemoteServiceReferences(ID target, String clazz, String filter)Asynchronously returns an array ofIRemoteServiceReferenceobjects.org.eclipse.equinox.concurrent.future.IFutureasyncGetRemoteServiceReferences(ID target, ID[] idFilter, String clazz, String filter)Asynchronously returns an array ofIRemoteServiceReferenceobjects.voidconnect(ID targetID, IConnectContext connectContext1)Connect to a target remote process or process group.IRemoteFiltercreateRemoteFilter(String filter)Creates aIRemoteFilterobject.protected IRemoteServicecreateRemoteService(RemoteServiceClientRegistration registration)Create a remote service for a given remote service registration.protected RemoteServiceClientRegistrationcreateRestServiceRegistration(String[] clazzes, IRemoteCallable[][] callables, Dictionary properties)protected RemoteServiceClientRegistrationcreateRestServiceRegistration(IRemoteCallable[] callables, Dictionary properties)AbstractClientService.UriRequestcreateUriRequest(String endpoint, IRemoteCall call, IRemoteCallable callable)voiddisconnect()Disconnect.voiddispose()Dispose this IContainer instance.IRemoteServiceReference[]getAllRemoteServiceReferences(String clazz, String filter)Returns an array ofIRemoteServiceReferenceobjects.IConnectContextgetConnectContextForAuthentication()IDgetConnectedID()Get the target ID that this container instance has connected to.IDgetID()Return the ID for this 'identifiable' object.protected IRemoteCallParameterSerializergetParameterSerializer()protected IRemoteCallParameterSerializergetParameterSerializer(IRemoteCallParameter parameter, Object value)protected IDgetRemoteCallTargetID()IRemoteServicegetRemoteService(IRemoteServiceReference reference)Get remote service for given IRemoteServiceReference.IRemoteServiceIDgetRemoteServiceID(ID containerID1, long containerRelativeID)Get a remote service ID from a containerID and a containerRelative long value.NamespacegetRemoteServiceNamespace()Get namespace to use for this remote service provider.IRemoteServiceReferencegetRemoteServiceReference(IRemoteServiceID serviceID)Get the remote service reference known to this container for the given IRemoteServiceID.IRemoteServiceReference[]getRemoteServiceReferences(ID[] idFilter, String clazz, String filter)Returns an array ofIRemoteServiceReferenceobjects.IRemoteServiceReference[]getRemoteServiceReferences(ID target, String clazz, String filter)Returns an array ofIRemoteServiceReferenceobjects.IRemoteServiceReference[]getRemoteServiceReferences(ID target, ID[] idFilter, String clazz, String filter)Returns an array ofIRemoteServiceReferenceobjects.IRemoteResponseDeserializergetResponseDeserializer()protected IRemoteResponseDeserializergetResponseDeserializer(IRemoteCall call, IRemoteCallable callable, Map responseHeaders)protected voidlogException(String string, Throwable e)protected IRemoteCallParameter[]prepareCallParameters(String uri, IRemoteCall call, IRemoteCallable callable)protected abstract StringprepareEndpointAddress(IRemoteCall call, IRemoteCallable callable)Prepare an endpoint address for the given call and callable.protected IRemoteCallParameter[]prepareExtraParameters(String uri, IRemoteCall call, IRemoteCallable callable)protected IRemoteCallParameter[]prepareParameters(String uri, IRemoteCall call, IRemoteCallable callable)protected ObjectprocessResponse(String uri, IRemoteCall call, IRemoteCallable callable, Map responseHeaders, byte[] responseBody)IRemoteServiceRegistrationregisterCallables(Class<?> serviceType, IRemoteCallable[] callables, Dictionary properties)IRemoteServiceRegistrationregisterCallables(String[] clazzes, IRemoteCallable[][] callables, Dictionary properties)Register remoteCallables for given serviceInterfaceNames.IRemoteServiceRegistrationregisterCallables(IRemoteCallable[] callables, Dictionary properties)Register remoteCallables for remote service client.IRemoteServiceRegistrationregisterRemoteService(String[] clazzes, Object service, Dictionary properties)Register a new remote service.voidremoveRemoteServiceListener(IRemoteServiceListener listener)Remove remote service registration/unregistration listener for this container.protected IRemoteCallParameter[]serializeParameter(String uri, IRemoteCall call, IRemoteCallable callable, List currentParameters, Object[] parameterValue)Serialize the parameter using the container's parameterSerializer.protected IRemoteCallParameterserializeParameter(String uri, IRemoteCall call, IRemoteCallable callable, IRemoteCallParameter defaultParameter, Object parameterValue)Serialize the parameter using the container's parameterSerializer.voidsetAlwaysSendDefaultParameters(boolean alwaysSendDefaultParameters)Set the flag totrueto include default parameters (which are specified when the callables are created) with every request to the remote service.voidsetConnectContextForAuthentication(IConnectContext connectContext)Set connect context for authentication upon subsequent calls toIRemoteServiceContainerAdapter.getRemoteServiceReferences(ID[], String, String)orIRemoteServiceContainerAdapter.asyncGetRemoteServiceReferences(ID[], String, String).voidsetParameterSerializer(IRemoteCallParameterSerializer serializer)Set the remote call parameter serializer.voidsetRemoteServiceFactory(IRemoteServiceFactory factory)voidsetResponseDeserializer(IRemoteResponseDeserializer resource)booleanungetRemoteService(IRemoteServiceReference reference)Unget IRemoteServiceReference.-
Methods inherited from class org.eclipse.ecf.core.AbstractContainer
addListener, fireContainerEvent, getAdapter, getPasswordFromConnectContext, removeListener
-
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.core.IContainer
getConnectNamespace
-
Methods inherited from interface org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter
setRemoteServiceCallPolicy
-
-
-
-
Field Detail
-
containerID
protected ID containerID
-
connectedID
protected ID connectedID
-
connectLock
protected Object connectLock
-
connectContext
protected IConnectContext connectContext
-
remoteResponseDeserializerLock
protected Object remoteResponseDeserializerLock
-
remoteResponseDeserializer
protected IRemoteResponseDeserializer remoteResponseDeserializer
-
parameterSerializerLock
protected Object parameterSerializerLock
-
parameterSerializer
protected IRemoteCallParameterSerializer parameterSerializer
-
registry
protected RemoteServiceClientRegistry registry
-
remoteServiceListeners
protected List remoteServiceListeners
-
remoteServiceFactory
protected IRemoteServiceFactory remoteServiceFactory
- Since:
- 8.12
-
alwaysSendDefaultParameters
protected boolean alwaysSendDefaultParameters
- Since:
- 4.1
-
-
Constructor Detail
-
AbstractClientContainer
public AbstractClientContainer(ID containerID)
-
-
Method Detail
-
setRemoteServiceFactory
public void setRemoteServiceFactory(IRemoteServiceFactory factory)
- Since:
- 8.12
-
setConnectContextForAuthentication
public void setConnectContextForAuthentication(IConnectContext connectContext)
Description copied from interface:IRemoteServiceContainerAdapterSet connect context for authentication upon subsequent calls toIRemoteServiceContainerAdapter.getRemoteServiceReferences(ID[], String, String)orIRemoteServiceContainerAdapter.asyncGetRemoteServiceReferences(ID[], String, String). This method should be called with a non-null connectContext in order to allow authentication to occur during.- Specified by:
setConnectContextForAuthenticationin interfaceIRemoteServiceConsumer- Specified by:
setConnectContextForAuthenticationin interfaceIRemoteServiceContainerAdapter- Parameters:
connectContext- the connect context to use for authenticating. Ifnull, then no authentication will be attempted.
-
getConnectContextForAuthentication
public IConnectContext getConnectContextForAuthentication()
-
setResponseDeserializer
public void setResponseDeserializer(IRemoteResponseDeserializer resource)
- Specified by:
setResponseDeserializerin interfaceIRemoteServiceClientContainerAdapter
-
getResponseDeserializer
public IRemoteResponseDeserializer getResponseDeserializer()
-
setParameterSerializer
public void setParameterSerializer(IRemoteCallParameterSerializer serializer)
Description copied from interface:IRemoteServiceClientContainerAdapterSet the remote call parameter serializer.- Specified by:
setParameterSerializerin interfaceIRemoteServiceClientContainerAdapter- Parameters:
serializer- the remote call parameter serializer to set for this container. May benull.
-
getParameterSerializer
protected IRemoteCallParameterSerializer getParameterSerializer()
-
getResponseDeserializer
protected IRemoteResponseDeserializer getResponseDeserializer(IRemoteCall call, IRemoteCallable callable, Map responseHeaders)
-
getParameterSerializer
protected IRemoteCallParameterSerializer getParameterSerializer(IRemoteCallParameter parameter, Object value)
-
setAlwaysSendDefaultParameters
public void setAlwaysSendDefaultParameters(boolean alwaysSendDefaultParameters)
Set the flag totrueto include default parameters (which are specified when the callables are created) with every request to the remote service.Setting to
falsewill only send those parameter specified when the call is invoked.Parameters which are specifed with the call override the defaults. Default parameters with a value of
nullare not included.- Parameters:
alwaysSendDefaultParameters- whether to send default parameters with every remote call- Since:
- 4.1
-
addRemoteServiceListener
public void addRemoteServiceListener(IRemoteServiceListener listener)
Description copied from interface:IRemoteServiceContainerAdapterAdd listener for remote service registration/unregistration for this container- Specified by:
addRemoteServiceListenerin interfaceIRemoteServiceConsumer- Specified by:
addRemoteServiceListenerin interfaceIRemoteServiceContainerAdapter- Specified by:
addRemoteServiceListenerin interfaceIRemoteServiceHost- Parameters:
listener- notified of service registration/unregistration events. Must not benull.
-
asyncGetRemoteServiceReferences
public org.eclipse.equinox.concurrent.future.IFuture asyncGetRemoteServiceReferences(ID[] idFilter, String clazz, String filter)
Description copied from interface:IRemoteServiceContainerAdapterAsynchronously returns an array ofIRemoteServiceReferenceobjects. The returned array ofIRemoteServiceReferenceobjects contains services that were registered under the specified class and match the specified idFilter, and filter criteria.Note this method assumes that the enclosing container has previously been connected, and uses the idFilter to filter among targets within the previously connected set of container IDs. To request connection as part of reference lookup, see
IRemoteServiceContainerAdapter.getRemoteServiceReferences(ID, String, String).The IFuture is returned immediately, and subsequent calls to
IFuture.get()orIFuture.get(long)will return the actual results received. The type of the Object returned fromIFuture.get()will be IRemoteServiceReference [].The list is valid at the time of the call to this method, however since the Framework is a very dynamic environment, services can be modified or unregistered at anytime.
idFilteris used to select a registered services that were registered by a given set of containers with id in idFilter. Only services exposed by a container with id in idFilter will be returned.If
idFilterisnull, all containers are considered to match the filter.filteris used to select the registered service whose properties objects contain keys and values which satisfy the filter. SeeFilterfor a description of the filter string syntax.- Specified by:
asyncGetRemoteServiceReferencesin interfaceIRemoteServiceConsumer- Specified by:
asyncGetRemoteServiceReferencesin interfaceIRemoteServiceContainerAdapter- Parameters:
idFilter- an array of ID instances that will restrict the search for matching container ids If null, all remote containers will be considered in search for matching IRemoteServiceReference instances. May benull.clazz- the fully qualified name of the interface class that describes the desired service. Must not benull.filter- The filter criteria. May benull.- Returns:
- IFuture that through subsequent calls to IFuture#get() will return
IRemoteServiceReference [] with IRemoteServiceReferences matching given search criteria.
Will not return
null.
-
asyncGetRemoteServiceReferences
public org.eclipse.equinox.concurrent.future.IFuture asyncGetRemoteServiceReferences(ID target, String clazz, String filter)
Description copied from interface:IRemoteServiceContainerAdapterAsynchronously returns an array ofIRemoteServiceReferenceobjects. The returned array ofIRemoteServiceReferenceobjects contains services that were registered under the specified class and match the specified idFilter, and filter criteria.The IFuture is returned immediately, and subsequent calls to
IFuture.get()orIFuture.get(long)will return the actual results received. The type of the Object returned fromIFuture.get()will be IRemoteServiceReference [].The list is valid at the time of the call to this method, however since the Framework is a very dynamic environment, services can be modified or unregistered at anytime.
idFilteris used to select a registered services that were registered by a given set of containers with id in idFilter. Only services exposed by a container with id in idFilter will be returned.target is a remote container to connect to.
filteris used to select the registered service whose properties objects contain keys and values which satisfy the filter. SeeFilterfor a description of the filter string syntax.- Specified by:
asyncGetRemoteServiceReferencesin interfaceIRemoteServiceConsumer- Specified by:
asyncGetRemoteServiceReferencesin interfaceIRemoteServiceContainerAdapter- Parameters:
target- an target to connect to if enclosing container is not already connected. May benull.clazz- the fully qualified name of the interface class that describes the desired service. Must not benull.filter- The filter criteria. May benull.- Returns:
- IFuture that through subsequent calls to IFuture#get() will return
IRemoteServiceReference [] with IRemoteServiceReferences matching given search criteria.
Will not return
null.
-
asyncGetRemoteServiceReferences
public org.eclipse.equinox.concurrent.future.IFuture asyncGetRemoteServiceReferences(ID target, ID[] idFilter, String clazz, String filter)
Description copied from interface:IRemoteServiceContainerAdapterAsynchronously returns an array ofIRemoteServiceReferenceobjects. The returned array ofIRemoteServiceReferenceobjects contains services that were registered under the specified class and match the specified idFilter, and filter criteria.The IFuture is returned immediately, and subsequent calls to
IFuture.get()orIFuture.get(long)will return the actual results received. The type of the Object returned fromIFuture.get()will be IRemoteServiceReference [].The list is valid at the time of the call to this method, however since the Framework is a very dynamic environment, services can be modified or unregistered at anytime.
targetis a remote container to connect to. Ifnull, no connection attempt is made.idFilteris used to select a registered services that were registered by a given set of containers with id in idFilter. Only services exposed by a container with id in idFilter will be returned. IfidFilterisnull, all containers are considered to match the filter.filteris used to select the registered service whose properties objects contain keys and values which satisfy the filter. SeeFilterfor a description of the filter string syntax. Iffilterisnull, all registered services are considered to match the filter. Iffiltercannot be parsed, anInvalidSyntaxExceptionwill be thrown with a human readable message where the filter became unparsable.- Specified by:
asyncGetRemoteServiceReferencesin interfaceIRemoteServiceConsumer- Specified by:
asyncGetRemoteServiceReferencesin interfaceIRemoteServiceContainerAdapter- Parameters:
target- an target to connect to if enclosing container is not already connected. May benull.idFilter- an array of ID instances that will restrict the search for matching container ids If null, all remote containers will be considered in search for matching IRemoteServiceReference instances. May benull.clazz- the fully qualified name of the interface class that describes the desired service. Must not benull.filter- The filter criteria. May benull.- Returns:
- IFuture that through subsequent calls to IFuture#get() will return
IRemoteServiceReference [] with IRemoteServiceReferences matching given search criteria.
Will not return
null. - Since:
- 5.0
-
createRemoteFilter
public IRemoteFilter createRemoteFilter(String filter) throws InvalidSyntaxException
Description copied from interface:IRemoteServiceContainerAdapterCreates aIRemoteFilterobject. ThisIRemoteFilterobject may be used to match aIRemoteServiceReferenceobject or aDictionaryobject.If the filter cannot be parsed, an
InvalidSyntaxExceptionwill be thrown with a human readable message where the filter became unparsable.- Specified by:
createRemoteFilterin interfaceIRemoteServiceConsumer- Specified by:
createRemoteFilterin interfaceIRemoteServiceContainerAdapter- Parameters:
filter- The filter string.- Returns:
- A
IRemoteFilterobject encapsulating the filter string. - Throws:
InvalidSyntaxException- Iffiltercontains an invalid filter string that cannot be parsed.- See Also:
- "Framework specification for a description of the filter string syntax.",
FrameworkUtil.createFilter(String)
-
getAllRemoteServiceReferences
public IRemoteServiceReference[] getAllRemoteServiceReferences(String clazz, String filter) throws InvalidSyntaxException
Description copied from interface:IRemoteServiceContainerAdapterReturns an array of
IRemoteServiceReferenceobjects. The returned array ofIRemoteServiceReferenceobjects contains services that were registered under the specified class, or if the clazz parameter isnullall services registered.The list is valid at the time of the call to this method, however since the remote service container is a very dynamic environment, services can be modified or unregistered at anytime.
filteris used to select the registered service whose properties objects contain keys and values which satisfy the filter. SeeFilterfor a description of the filter string syntax.If
filterisnull, all registered services are considered to match the filter. Iffiltercannot be parsed, anInvalidSyntaxExceptionwill be thrown with a human readable message where the filter became unparsable.- Specified by:
getAllRemoteServiceReferencesin interfaceIRemoteServiceConsumer- Specified by:
getAllRemoteServiceReferencesin interfaceIRemoteServiceContainerAdapter- Parameters:
clazz- the fully qualified name of the interface class that describes the desired service. May benull.filter- The filter criteria. May benull.- Returns:
- Array of IRemoteServiceReferences matching given search criteria or
nullif no services are found that match the search. - Throws:
InvalidSyntaxException- If filter contains an invalid filter string that cannot be parsed.
-
getRemoteService
public IRemoteService getRemoteService(IRemoteServiceReference reference)
Description copied from interface:IRemoteServiceContainerAdapterGet remote service for given IRemoteServiceReference. Note that clients that call this method successfully should later callIRemoteServiceContainerAdapter.ungetRemoteService(IRemoteServiceReference)when the IRemoteService will no longer be used.- Specified by:
getRemoteServicein interfaceIRemoteServiceConsumer- Specified by:
getRemoteServicein interfaceIRemoteServiceContainerAdapter- Parameters:
reference- the IRemoteServiceReference for the desired service. Must not benull.- Returns:
- IRemoteService representing the remote service. If remote service
no longer exists for reference, then
nullis returned. - See Also:
IRemoteServiceContainerAdapter.ungetRemoteService(IRemoteServiceReference)
-
getRemoteServiceID
public IRemoteServiceID getRemoteServiceID(ID containerID1, long containerRelativeID)
Description copied from interface:IRemoteServiceContainerAdapterGet a remote service ID from a containerID and a containerRelative long value. Will return a non-null value if the IRemoteServiceRegistration/Reference is currently 'known' to this container adapter.nullif not.- Specified by:
getRemoteServiceIDin interfaceIRemoteServiceConsumer- Specified by:
getRemoteServiceIDin interfaceIRemoteServiceContainerAdapter- Specified by:
getRemoteServiceIDin interfaceIRemoteServiceHost- Parameters:
containerID1- the containerID that is the server/host for the remote service. Must not benull. This must be the containerID for the server/host of the remote service.containerRelativeID- the long value identifying the remote service relative to the container ID.- Returns:
- IRemoteServiceID instance if the associated IRemoteServiceRegistration/Reference is known to this container
adapter,
nullif it is not.
-
getRemoteServiceNamespace
public Namespace getRemoteServiceNamespace()
Description copied from interface:IRemoteServiceContainerAdapterGet namespace to use for this remote service provider.- Specified by:
getRemoteServiceNamespacein interfaceIRemoteServiceConsumer- Specified by:
getRemoteServiceNamespacein interfaceIRemoteServiceContainerAdapter- Specified by:
getRemoteServiceNamespacein interfaceIRemoteServiceHost- Returns:
- Namespace to use for creating IRemoteServiceID for this remote service provider. Will
not return
null.
-
getRemoteServiceReference
public IRemoteServiceReference getRemoteServiceReference(IRemoteServiceID serviceID)
Description copied from interface:IRemoteServiceContainerAdapterGet the remote service reference known to this container for the given IRemoteServiceID. Note that this method must be guaranteed not to block by the provider implementation.- Specified by:
getRemoteServiceReferencein interfaceIRemoteServiceConsumer- Specified by:
getRemoteServiceReferencein interfaceIRemoteServiceContainerAdapter- Parameters:
serviceID- the serviceID to retrieve the IRemoteServiceReference for.- Returns:
- IRemoteServiceReference the remote service reference associated with the given serviceID.
Will return
nullif no IRemoteServiceReference found for the given serviceID.
-
getRemoteServiceReferences
public IRemoteServiceReference[] getRemoteServiceReferences(ID[] idFilter, String clazz, String filter) throws InvalidSyntaxException
Description copied from interface:IRemoteServiceContainerAdapterReturns an array ofIRemoteServiceReferenceobjects. The returned array ofIRemoteServiceReferenceobjects contains services that were registered under the specified class and match the specified idFilter, and filter criteria.Note this method assumes that the enclosing container has previously been connected, and uses the idFilter to filter among targets within the previously connected set of container IDs. To request connection as part of reference lookup, see
IRemoteServiceContainerAdapter.getRemoteServiceReferences(ID, String, String).The list is valid at the time of the call to this method, however since the Framework is a very dynamic environment, services can be modified or unregistered at anytime.
idFilteris used to select a registered services that were registered by a given set of containers with id in idFilter. Only services exposed by a container with id in idFilter will be returned.If
idFilterisnull, all containers are considered to match the filter.filteris used to select the registered service whose properties objects contain keys and values which satisfy the filter. SeeFilterfor a description of the filter string syntax.If
filterisnull, all registered services are considered to match the filter. Iffiltercannot be parsed, anInvalidSyntaxExceptionwill be thrown with a human readable message where the filter became unparsable.- Specified by:
getRemoteServiceReferencesin interfaceIRemoteServiceConsumer- Specified by:
getRemoteServiceReferencesin interfaceIRemoteServiceContainerAdapter- Parameters:
idFilter- an array of ID instances that will restrict the search for matching container ids If null, all remote containers will be considered in search for matching IRemoteServiceReference instances. May benull.clazz- the fully qualified name of the interface class that describes the desired service. Must not benull.filter- The filter criteria. May benull.- Returns:
- Array of IRemoteServiceReferences matching given search criteria or
nullif no services are found that match the search. - Throws:
InvalidSyntaxException- If filter contains an invalid filter string that cannot be parsed.
-
getRemoteServiceReferences
public IRemoteServiceReference[] getRemoteServiceReferences(ID target, String clazz, String filter) throws InvalidSyntaxException, ContainerConnectException
Description copied from interface:IRemoteServiceContainerAdapterReturns an array of
IRemoteServiceReferenceobjects. The returned array ofIRemoteServiceReferenceobjects contains services that were registered under the specified class and match the specified idFilter, and filter criteria.The list is valid at the time of the call to this method, however since the Framework is a very dynamic environment, services can be modified or unregistered at anytime.
target is a remote container to connect to.
filteris used to select the registered service whose properties objects contain keys and values which satisfy the filter. SeeFilterfor a description of the filter string syntax.If
filterisnull, all registered services are considered to match the filter. Iffiltercannot be parsed, anInvalidSyntaxExceptionwill be thrown with a human readable message where the filter became unparsable.- Specified by:
getRemoteServiceReferencesin interfaceIRemoteServiceConsumer- Specified by:
getRemoteServiceReferencesin interfaceIRemoteServiceContainerAdapter- Parameters:
target- an target to connect to if enclosing container is not already connected. May benull.clazz- the fully qualified name of the interface class that describes the desired service. Must not benull.filter- The filter criteria. May benull.- Returns:
- Array of IRemoteServiceReferences matching given search criteria or
nullif no services are found that match the search. - Throws:
InvalidSyntaxException- If filter contains an invalid filter string that cannot be parsed.ContainerConnectException- if container cannot connect
-
getRemoteServiceReferences
public IRemoteServiceReference[] getRemoteServiceReferences(ID target, ID[] idFilter, String clazz, String filter) throws InvalidSyntaxException, ContainerConnectException
Description copied from interface:IRemoteServiceContainerAdapterReturns an array ofIRemoteServiceReferenceobjects. The returned array ofIRemoteServiceReferenceobjects contains services that were registered under the specified class and match the specified idFilter, and filter criteria.Note this method assumes that the enclosing container has previously been connected, and uses the idFilter to filter among targets within the previously connected set of container IDs. To request connection as part of reference lookup, see
IRemoteServiceContainerAdapter.getRemoteServiceReferences(ID, String, String).The list is valid at the time of the call to this method, however since the Framework is a very dynamic environment, services can be modified or unregistered at anytime.
targetis a remote container to connect to. Ifnull, no connection attempt is made.idFilteris used to select a registered services that were registered by a given set of containers with id in idFilter. Only services exposed by a container with id in idFilter will be returned. IfidFilterisnull, all containers are considered to match the filter.filteris used to select the registered service whose properties objects contain keys and values which satisfy the filter. SeeFilterfor a description of the filter string syntax. Iffilterisnull, all registered services are considered to match the filter. Iffiltercannot be parsed, anInvalidSyntaxExceptionwill be thrown with a human readable message where the filter became unparsable.- Specified by:
getRemoteServiceReferencesin interfaceIRemoteServiceConsumer- Specified by:
getRemoteServiceReferencesin interfaceIRemoteServiceContainerAdapter- Parameters:
target- a target container to connect to if enclosing container is not already connected. May benull.idFilter- an array of ID instances that will restrict the search for matching container ids If null, all remote containers will be considered in search for matching IRemoteServiceReference instances. May benull.clazz- the fully qualified name of the interface class that describes the desired service. Must not benull.filter- The filter criteria. May benull.- Returns:
- Array of IRemoteServiceReferences matching given search criteria or
nullif no services are found that match the search. - Throws:
InvalidSyntaxException- If filter contains an invalid filter string that cannot be parsed.ContainerConnectException- if container cannot connect- Since:
- 5.0
-
registerRemoteService
public IRemoteServiceRegistration registerRemoteService(String[] clazzes, Object service, Dictionary properties)
Description copied from interface:IRemoteServiceContainerAdapterRegister a new remote service. This method is to be called by the service server...i.e. the client that wishes to make available a service to other client within this container.- Specified by:
registerRemoteServicein interfaceIRemoteServiceContainerAdapter- Specified by:
registerRemoteServicein interfaceIRemoteServiceHost- Parameters:
clazzes- the interface classes that the service exposes to remote clients. Must not benulland must not be an empty array.service- the service object. Under normal conditions this object must- not be
null - implement all of the classes specified by the first parameter
nullis if the service propertyConstants.SERVICE_REGISTER_PROXYis set in the properties. IfConstants.SERVICE_REGISTER_PROXYis set in the properties parameter (to an arbitrary value), then the service object may then benull.- not be
properties- to be associated with service- Returns:
- IRemoteServiceRegistration the service registration. Will not
return
null.
-
removeRemoteServiceListener
public void removeRemoteServiceListener(IRemoteServiceListener listener)
Description copied from interface:IRemoteServiceContainerAdapterRemove remote service registration/unregistration listener for this container.- Specified by:
removeRemoteServiceListenerin interfaceIRemoteServiceConsumer- Specified by:
removeRemoteServiceListenerin interfaceIRemoteServiceContainerAdapter- Specified by:
removeRemoteServiceListenerin interfaceIRemoteServiceHost- Parameters:
listener- to remove. Must not benull.
-
ungetRemoteService
public boolean ungetRemoteService(IRemoteServiceReference reference)
Description copied from interface:IRemoteServiceContainerAdapterUnget IRemoteServiceReference. Release all resources associated with the given IRemoteServiceReference. This method should be called by users of the IRemoteServiceReference that have previously calledIRemoteServiceContainerAdapter.getRemoteService(IRemoteServiceReference). If this method returns true, then the previously used IRemoteService will no longer be usable.- Specified by:
ungetRemoteServicein interfaceIRemoteServiceConsumer- Specified by:
ungetRemoteServicein interfaceIRemoteServiceContainerAdapter- Parameters:
reference- the IRemoteServiceReference to unget- Returns:
- true if unget successful, false if not. If this method returns true, then the IRemoteService instance previously retrieved via the given IRemoteServiceReference instance provided will no longer be usable.
- See Also:
IRemoteServiceContainerAdapter.getRemoteService(IRemoteServiceReference)
-
registerCallables
public IRemoteServiceRegistration registerCallables(IRemoteCallable[] callables, Dictionary properties)
Description copied from interface:IRemoteServiceClientContainerAdapterRegister remoteCallables for remote service client. This method allows providers to registerIRemoteCallableinstances, so that subsequent lookup operations result in appropriate remote service registrations.- Specified by:
registerCallablesin interfaceIRemoteServiceClientContainerAdapter- Parameters:
callables- the IRemoteCallables to register. Each IRemoteCallable represents a specific method to resourcePath mapping. Must not benull.properties- any service properties to associate with the given registration.- Returns:
- IRemoteServiceRegistration to use to unregister the remote service. Will not be
null.
-
registerCallables
public IRemoteServiceRegistration registerCallables(Class<?> serviceType, IRemoteCallable[] callables, Dictionary properties)
- Parameters:
serviceType- serviceTypecallables- callablesproperties- properties- Returns:
- IRemoteServiceRegistration registration created for registration
- Since:
- 8.5
-
registerCallables
public IRemoteServiceRegistration registerCallables(String[] clazzes, IRemoteCallable[][] callables, Dictionary properties)
Description copied from interface:IRemoteServiceClientContainerAdapterRegister remoteCallables for given serviceInterfaceNames. This method allows providers to register
IRemoteCallableinstances and associate an array of IRemoteCallables with each given serviceInterfaceName, so that subsequent lookup operations result in appropriate remote service registrations. The IRemoteCallable instances should correspond to methods within the particular service interface class.Note that the number of serviceInterfaceNames (i.e. the length of the given String[]) must be equal to the number of rows of the remoteCallable two-dimensional array.
For example, suppose we have a service interface "org.eclipse.ecf.IFoo":
public interface IFoo { public String getFoo(); }We can define for this service inteface the following two dimensional array of callables:IRemoteCallable[][] callables = new IRemoteCallable[] { new RemoteCallable("foo","foo/bar/resourcePath",null,requestType) }};and then register with this method:IRemoteServiceRegistration reg = this.registerRemoteCallable(new String[] { "org.eclipse.ecf.IFoo" }, callables, null);- Specified by:
registerCallablesin interfaceIRemoteServiceClientContainerAdapter- Parameters:
clazzes- service interface namescallables- the IRemoteCallables to register. Each IRemoteCallable represents a specific method to resourcePath mapping. Must not benull.properties- any service properties to associate with the given registration.- Returns:
- IRemoteServiceRegistration to use to unregister the remote service. Will not be
null.
-
connect
public void connect(ID targetID, IConnectContext connectContext1) throws ContainerConnectException
Description copied from interface:IContainerConnect to a target remote process or process group. The target identified by the first parameter (targetID) is connected the implementation class. If authentication information is required, the required information is given via via the second parameter (connectContext). Callers note that depending upon the provider implementation this method may block. It is suggested that callers use a separate thread to call this method. This method provides an implementation independent way for container implementations to connect, authenticate, and communicate with a remote service or group of services. Providers are responsible for implementing this operation in a way appropriate to the given remote service (or group) via expected protocol.- Specified by:
connectin interfaceIContainer- Parameters:
targetID- the ID of the remote server or group to connect to. SeeIContainer.getConnectNamespace()for a explanation of the constraints upon this parameter.connectContext1- any required context to allow this container to authenticate. May benullif underlying provider does not have any authentication requirements for connection.- Throws:
ContainerConnectException- thrown if communication cannot be established with remote service. Causes can include network connection failure, authentication failure, server error, or if container is already connected.
-
disconnect
public void disconnect()
Description copied from interface:IContainerDisconnect. This operation will disconnect the local container instance from any previously joined target or group. Subsequent calls to getConnectedID() will returnnull.- Specified by:
disconnectin interfaceIContainer
-
getConnectedID
public ID getConnectedID()
Description copied from interface:IContainerGet the target ID that this container instance has connected to. Returns null if not connected.- Specified by:
getConnectedIDin interfaceIContainer- Returns:
- ID of the target we are connected to. Returns
nullif container not connected.
-
getID
public ID getID()
Description copied from interface:IIdentifiableReturn the ID for this 'identifiable' object. The returned ID should be unique within its namespace. May returnnull.- Specified by:
getIDin interfaceIIdentifiable- Returns:
- the ID for this identifiable object. May return
null.
-
dispose
public void dispose()
Description copied from interface:IContainerDispose this IContainer instance. The container instance will be made inactive after the completion of this method and will be unavailable for subsequent usage.- Specified by:
disposein interfaceIContainer- Overrides:
disposein classAbstractContainer
-
createRestServiceRegistration
protected RemoteServiceClientRegistration createRestServiceRegistration(String[] clazzes, IRemoteCallable[][] callables, Dictionary properties)
-
createRestServiceRegistration
protected RemoteServiceClientRegistration createRestServiceRegistration(IRemoteCallable[] callables, Dictionary properties)
-
getRemoteCallTargetID
protected ID getRemoteCallTargetID()
-
prepareCallParameters
protected IRemoteCallParameter[] prepareCallParameters(String uri, IRemoteCall call, IRemoteCallable callable) throws NotSerializableException
- Parameters:
uri- uricall- remote callcallable- callable- Returns:
- IRemoteCallParameter[] remote call parameters prepared
- Throws:
NotSerializableException- if cannot be serialized- Since:
- 8.5
-
prepareExtraParameters
protected IRemoteCallParameter[] prepareExtraParameters(String uri, IRemoteCall call, IRemoteCallable callable) throws NotSerializableException
- Parameters:
uri- uricall- callcallable- callable- Returns:
- IRemoteCallParameter[] extra parameters
- Throws:
NotSerializableException- if not serializable- Since:
- 8.5
-
prepareParameters
protected IRemoteCallParameter[] prepareParameters(String uri, IRemoteCall call, IRemoteCallable callable) throws NotSerializableException
- Throws:
NotSerializableException
-
serializeParameter
protected IRemoteCallParameter serializeParameter(String uri, IRemoteCall call, IRemoteCallable callable, IRemoteCallParameter defaultParameter, Object parameterValue) throws NotSerializableException
Serialize the parameter using the container's parameterSerializer. If there is no serializer for this container, return null.- Parameters:
uri- uricall- callcallable- callabledefaultParameter- default parameterparameterValue- parameter value- Returns:
- IRemoteCallParameter the serialized parameter or null if there is no parameterSerializer for this container
- Throws:
NotSerializableException- thrown if parameters cannot be serialized- Since:
- 4.1
- See Also:
IRemoteCallParameterSerializer.serializeParameter(String, IRemoteCall, IRemoteCallable, IRemoteCallParameter, Object)
-
serializeParameter
protected IRemoteCallParameter[] serializeParameter(String uri, IRemoteCall call, IRemoteCallable callable, List currentParameters, Object[] parameterValue) throws NotSerializableException
Serialize the parameter using the container's parameterSerializer. If there is no serializer for this container, return null.- Parameters:
uri- uricall- callcallable- callablecurrentParameters- current parametersparameterValue- parameter value- Returns:
- IRemoteCallParameter[] parameters for given
- Throws:
NotSerializableException- thrown if parameters cannot be serialized- Since:
- 8.0
-
processResponse
protected Object processResponse(String uri, IRemoteCall call, IRemoteCallable callable, Map responseHeaders, byte[] responseBody) throws NotSerializableException
- Parameters:
uri- uricall- callcallable- callableresponseHeaders- http response headersresponseBody- response body as byte[]- Returns:
- Object response deserialized via response deserializer
- Throws:
NotSerializableException- if response cannot be deserialized for processing- Since:
- 8.0
-
createRemoteService
protected IRemoteService createRemoteService(RemoteServiceClientRegistration registration)
Create a remote service for a given remote service registration. This method will be called as part of the RemoteServiceAdmin.importService.- Parameters:
registration- the remote service client registration associated with the service being imported. Will not benull.
-
prepareEndpointAddress
protected abstract String prepareEndpointAddress(IRemoteCall call, IRemoteCallable callable)
Prepare an endpoint address for the given call and callable.- Parameters:
call- to create an endpoint for. Will not benull.callable- to create an endpoing for. Will not benull.- Returns:
- String that represents the endpoing for the given call and callable. May only return
nullif the given call should not be completed (i.e. there is no endpoint associated with the given call).
-
createUriRequest
public AbstractClientService.UriRequest createUriRequest(String endpoint, IRemoteCall call, IRemoteCallable callable)
- Parameters:
endpoint- endpointcall- callcallable- callable- Returns:
- UriRequest to use for request. May be
null - Since:
- 8.5
-
-