Class RegistrySharedObject
- All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable
,IIdentifiable
,ISharedObject
,IRemoteServiceConsumer
,IRemoteServiceContainerAdapter
,IRemoteServiceHost
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
protected Map
Map of add registration requests.protected int
Add registration request default timeoutprotected IConnectContext
Connect context to be used for connect.protected RemoteServiceRegistryImpl
registry impl for local remote service registrationsprotected static final boolean
protected long
protected final Map
map of registry impls for remote registrys key: ID (identifier of remote container), value: RemoteServiceRegistryImpl (copy of remote service registry for remote containerprotected List
List of invocation requests...instances of Requestprotected boolean
Whether or not we are connectedprotected final Object
protected int
Add registration request default timeout.protected final List
List of remote service listeners (added to/removed from by addRemoteServiceListener/removeRemoteServiceListenerFields inherited from class org.eclipse.ecf.core.sharedobject.BaseSharedObject
DESTROYREMOTE_CODE, DESTROYSELFLOCAL_CODE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected RemoteServiceRegistryImpl
addRemoteRegistry
(RemoteServiceRegistryImpl registry) void
Add listener for remote service registration/unregistration for this containerprotected boolean
addRequest
(Request request) org.eclipse.equinox.concurrent.future.IFuture
asyncGetRemoteServiceReferences
(ID[] idFilter, String clazz, String filter) Asynchronously returns an array ofIRemoteServiceReference
objects.org.eclipse.equinox.concurrent.future.IFuture
asyncGetRemoteServiceReferences
(ID target, String clazz, String filter) Asynchronously returns an array ofIRemoteServiceReference
objects.org.eclipse.equinox.concurrent.future.IFuture
asyncGetRemoteServiceReferences
(ID target, ID[] idFilter, String clazz, String filter) Asynchronously returns an array ofIRemoteServiceReference
objects.protected Object
callSynch
(RemoteServiceRegistrationImpl registration, IRemoteCall call) protected void
checkRequestServiceAuthorization
(ID remoteContainerID, AddRegistrationRequest request, Serializable credentials) protected void
protected void
connectToRemoteServiceTarget
(ID targetID) protected IRemoteServiceRegisteredEvent
createRegisteredEvent
(RemoteServiceRegistrationImpl registration) createRemoteFilter
(String filter) Creates aIRemoteFilter
object.protected RemoteServiceImpl
createRemoteService
(RemoteServiceRegistrationImpl registration) protected org.eclipse.equinox.concurrent.future.IExecutor
createRequestExecutor
(Request request) protected IRemoteServiceUnregisteredEvent
createUnregisteredEvent
(RemoteServiceRegistrationImpl registration) protected Request
deserializeCallRequest
(byte[] requestBytes) protected Response
deserializeCallResponse
(byte[] responseBytes) void
Method called by the ISharedObjectContainer upon ISharedObject destruction.protected void
executeRequest
(org.eclipse.equinox.concurrent.future.IExecutor executor, Request request, ID responseTarget, RemoteServiceRegistrationImpl localRegistration, boolean respond) protected void
fireCallCompleteEvent
(IRemoteCallListener listener, long requestId, Object response, boolean hadException, Throwable exception) protected void
fireCallStartEvent
(IRemoteCallListener listener, long requestId, IRemoteServiceReference reference, IRemoteCall call) protected void
protected Serializable
protected int
getAllRemoteServiceReferences
(String clazz, String filter) Returns an array ofIRemoteServiceReference
objects.protected RemoteServiceRegistrationImpl
getLocalRegistrationForRequest
(Request request) protected long
protected RemoteServiceRegistryImpl
getRemoteRegistry
(ID containerID) getRemoteService
(IRemoteServiceReference reference) Get remote service for given IRemoteServiceReference.protected IRemoteServiceCallPolicy
getRemoteServiceID
(ID containerId, long containerRelativeId) Get a remote service ID from a containerID and a containerRelative long value.Get namespace to use for this remote service provider.getRemoteServiceReference
(IRemoteServiceID serviceId) Get the remote service reference known to this container for the given IRemoteServiceID.getRemoteServiceReferences
(ID[] idFilter, String clazz, String filter) Returns an array ofIRemoteServiceReference
objects.getRemoteServiceReferences
(ID targetID, String clazz, String filter) Returns an array ofIRemoteServiceReference
objects.getRemoteServiceReferences
(ID target, ID[] idFilter, String clazz, String filter) Returns an array ofIRemoteServiceReference
objects.protected Request
getRequest
(long requestId) protected int
protected ISharedObjectContext
protected ID[]
getTargetsFromProperties
(Dictionary properties) protected void
handleAddRegistration
(ID remoteContainerID, Integer requestId, RemoteServiceRegistrationImpl registration) protected void
handleAddRegistration
(ID remoteContainerID, RemoteServiceRegistrationImpl registration) protected void
handleAddRegistrationRequestRefused
(ID remoteContainerID, Integer requestId, AccessControlException e) protected void
handleAddRegistrations
(ID remoteContainerID, Integer requestId, RemoteServiceRegistrationImpl[] registrations) protected void
handleCallRequest
(Request request) protected void
handleCallRequestBytes
(byte[] requestBytes) protected void
handleCallResponse
(Response response) protected void
handleCallResponseBytes
(byte[] responseBytes) protected void
protected void
protected void
protected void
handleFireRequest
(Request request) protected void
protected void
handleRegistryUpdateRequest
(ID remoteContainerID) protected void
handleRegistryUpdateRequest
(ID remoteContainerID, Integer requestId) protected void
handleRequestService
(ID remoteContainerID, AddRegistrationRequest request, Integer requestId, Serializable credentials) protected boolean
SharedObjectMsg handler method.protected void
handleTargetConnected
(ID targetID) protected void
handleUnregister
(ID containerID, Long serviceId) void
Initialize this shared object.protected Object
protected void
protected void
logException
(int code, String message, Throwable e) protected void
logRemoteCallException
(String message, Throwable e) protected void
notifyAddRegistrationResponse
(ID remoteContainerID, Integer requestId, AccessControlException exception) registerRemoteService
(String[] clazzes, Object service, Dictionary properties) Register a new remote service.protected RemoteServiceRegistryImpl
removeRemoteRegistry
(ID containerID) void
Remove remote service registration/unregistration listener for this container.protected boolean
removeRequest
(Request request) protected void
sendAddRegistration
(ID receiver, Integer requestId, RemoteServiceRegistrationImpl reg) protected void
sendAddRegistration
(ID receiver, RemoteServiceRegistrationImpl reg) protected AddRegistrationRequest
sendAddRegistrationRequest
(ID receiver, AddRegistrationRequest request, Serializable credentials) protected void
sendAddRegistrationRequestRefused
(ID receiver, Integer requestId, Exception except) protected void
sendAddRegistrations
(ID receiver, Integer requestId, RemoteServiceRegistrationImpl[] regs) protected Request
sendCallRequest
(RemoteServiceRegistrationImpl remoteRegistration, IRemoteCall call) protected void
sendCallRequestWithListener
(RemoteServiceRegistrationImpl remoteRegistration, IRemoteCall call, IRemoteCallListener listener) protected void
sendCallResponse
(ID responseTarget, Response response) protected Request
sendFireRequest
(RemoteServiceRegistrationImpl remoteRegistration, IRemoteCall call) protected void
sendRegistryUpdate
(ID targetContainerID) protected void
sendRegistryUpdate
(ID targetContainerID, Integer requestId) protected void
protected void
sendRegistryUpdateRequest
(ID receiver, Integer requestId) protected void
sendUnregister
(RemoteServiceRegistrationImpl serviceRegistration) protected byte[]
serializeCallRequest
(Request request) protected byte[]
serializeCallResponse
(Response response) void
setConnectContextForAuthentication
(IConnectContext connectContext) Set connect context for authentication upon subsequent calls toIRemoteServiceContainerAdapter.getRemoteServiceReferences(ID[], String, String)
orIRemoteServiceContainerAdapter.asyncGetRemoteServiceReferences(ID[], String, String)
.protected void
setRegistryConnected
(boolean connected) boolean
Set the remote service call policy to enable authorization on remote service method callsboolean
Unget IRemoteServiceReference.Methods inherited from class org.eclipse.ecf.core.sharedobject.BaseSharedObject
addEventProcessor, clearEventProcessors, creationCompleted, destroyRemote, destroySelf, destroySelfLocal, fireEventProcessors, getAdapter, getConfig, getConnectedID, getContext, getGroupMemberIDs, getHomeContainerID, getID, getLocalContainerID, getProperties, getReplicaDescription, getReplicaDescriptions, getSharedObjectMsgFromEvent, handleEvent, handleEvents, handleSharedObjectCreateResponseEvent, handleSharedObjectMsg, handleSharedObjectMsgEvent, handleUnhandledEvent, init, isConnected, isPrimary, log, removeEventProcessor, replicateToRemoteContainers, sendSharedObjectMsgTo, sendSharedObjectMsgToPrimary, sendSharedObjectMsgToSelf, trace, traceCatching, traceEntering, traceEntering, traceEntering, traceExiting, traceExiting
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
-
Field Details
-
ADD_REGISTRATION_REQUEST_TIMEOUT
protected static final int ADD_REGISTRATION_REQUEST_TIMEOUT- Since:
- 3.3
-
PROPAGATE_RESPONSE_ERROR
protected static final boolean PROPAGATE_RESPONSE_ERROR- Since:
- 4.2
-
localRegistry
registry impl for local remote service registrations -
remoteRegistrys
map of registry impls for remote registrys key: ID (identifier of remote container), value: RemoteServiceRegistryImpl (copy of remote service registry for remote container -
serviceListeners
List of remote service listeners (added to/removed from by addRemoteServiceListener/removeRemoteServiceListener -
addRegistrationRequests
Map of add registration requests. key: Integer (unique Request id), value: AddRegistrationRequest -
addRegistrationRequestTimeout
protected int addRegistrationRequestTimeoutAdd registration request default timeout- Since:
- 3.0
-
requests
List of invocation requests...instances of Request -
connectContext
Connect context to be used for connect.- Since:
- 3.0
-
rsConnectLock
- Since:
- 3.3
-
rsConnected
protected boolean rsConnectedWhether or not we are connected- Since:
- 3.3
-
rsConnectTimeout
protected int rsConnectTimeoutAdd registration request default timeout.- Since:
- 3.3
-
registryUpdateRequestTimeout
protected long registryUpdateRequestTimeout- Since:
- 3.4
-
-
Constructor Details
-
RegistrySharedObject
public RegistrySharedObject()
-
-
Method Details
-
getRemoteServiceReferences
public IRemoteServiceReference[] getRemoteServiceReferences(ID target, ID[] idFilter, String clazz, String filter) throws InvalidSyntaxException, ContainerConnectException Description copied from interface:IRemoteServiceContainerAdapter
Returns an array ofIRemoteServiceReference
objects. The returned array ofIRemoteServiceReference
objects 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.
target
is a remote container to connect to. Ifnull
, no connection attempt is made.idFilter
is 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. IfidFilter
isnull
, all containers are considered to match the filter.filter
is used to select the registered service whose properties objects contain keys and values which satisfy the filter. SeeFilter
for a description of the filter string syntax. Iffilter
isnull
, all registered services are considered to match the filter. Iffilter
cannot be parsed, anInvalidSyntaxException
will be thrown with a human readable message where the filter became unparsable.- Specified by:
getRemoteServiceReferences
in interfaceIRemoteServiceConsumer
- Specified by:
getRemoteServiceReferences
in 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
null
if 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:
- 3.4
-
getRemoteServiceReferences
public IRemoteServiceReference[] getRemoteServiceReferences(ID[] idFilter, String clazz, String filter) throws InvalidSyntaxException Description copied from interface:IRemoteServiceContainerAdapter
Returns an array ofIRemoteServiceReference
objects. The returned array ofIRemoteServiceReference
objects 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.
idFilter
is 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
idFilter
isnull
, all containers are considered to match the filter.filter
is used to select the registered service whose properties objects contain keys and values which satisfy the filter. SeeFilter
for a description of the filter string syntax.If
filter
isnull
, all registered services are considered to match the filter. Iffilter
cannot be parsed, anInvalidSyntaxException
will be thrown with a human readable message where the filter became unparsable.- Specified by:
getRemoteServiceReferences
in interfaceIRemoteServiceConsumer
- Specified by:
getRemoteServiceReferences
in 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
null
if 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 targetID, String clazz, String filter) throws InvalidSyntaxException, ContainerConnectException Description copied from interface:IRemoteServiceContainerAdapter
Returns an array of
IRemoteServiceReference
objects. The returned array ofIRemoteServiceReference
objects 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.
filter
is used to select the registered service whose properties objects contain keys and values which satisfy the filter. SeeFilter
for a description of the filter string syntax.If
filter
isnull
, all registered services are considered to match the filter. Iffilter
cannot be parsed, anInvalidSyntaxException
will be thrown with a human readable message where the filter became unparsable.- Specified by:
getRemoteServiceReferences
in interfaceIRemoteServiceConsumer
- Specified by:
getRemoteServiceReferences
in interfaceIRemoteServiceContainerAdapter
- Parameters:
targetID
- 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
null
if 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:
- 3.0
-
getAllRemoteServiceReferences
public IRemoteServiceReference[] getAllRemoteServiceReferences(String clazz, String filter) throws InvalidSyntaxException Description copied from interface:IRemoteServiceContainerAdapter
Returns an array of
IRemoteServiceReference
objects. The returned array ofIRemoteServiceReference
objects contains services that were registered under the specified class, or if the clazz parameter isnull
all 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.
filter
is used to select the registered service whose properties objects contain keys and values which satisfy the filter. SeeFilter
for a description of the filter string syntax.If
filter
isnull
, all registered services are considered to match the filter. Iffilter
cannot be parsed, anInvalidSyntaxException
will be thrown with a human readable message where the filter became unparsable.- Specified by:
getAllRemoteServiceReferences
in interfaceIRemoteServiceConsumer
- Specified by:
getAllRemoteServiceReferences
in 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
null
if no services are found that match the search. - Throws:
InvalidSyntaxException
- If filter contains an invalid filter string that cannot be parsed.- Since:
- 3.0
-
addRemoteServiceListener
Description copied from interface:IRemoteServiceContainerAdapter
Add listener for remote service registration/unregistration for this container- Specified by:
addRemoteServiceListener
in interfaceIRemoteServiceConsumer
- Specified by:
addRemoteServiceListener
in interfaceIRemoteServiceContainerAdapter
- Specified by:
addRemoteServiceListener
in interfaceIRemoteServiceHost
- Parameters:
listener
- notified of service registration/unregistration events. Must not benull
.
-
removeRemoteServiceListener
Description copied from interface:IRemoteServiceContainerAdapter
Remove remote service registration/unregistration listener for this container.- Specified by:
removeRemoteServiceListener
in interfaceIRemoteServiceConsumer
- Specified by:
removeRemoteServiceListener
in interfaceIRemoteServiceContainerAdapter
- Specified by:
removeRemoteServiceListener
in interfaceIRemoteServiceHost
- Parameters:
listener
- to remove. Must not benull
.
-
createRemoteService
- Parameters:
registration
- registration- Returns:
- RemoteServiceImpl remote service implementation
- Since:
- 4.1
-
getRemoteService
Description copied from interface:IRemoteServiceContainerAdapter
Get 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:
getRemoteService
in interfaceIRemoteServiceConsumer
- Specified by:
getRemoteService
in 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
null
is returned. - See Also:
-
registerRemoteService
public IRemoteServiceRegistration registerRemoteService(String[] clazzes, Object service, Dictionary properties) Description copied from interface:IRemoteServiceContainerAdapter
Register 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:
registerRemoteService
in interfaceIRemoteServiceContainerAdapter
- Specified by:
registerRemoteService
in interfaceIRemoteServiceHost
- Parameters:
clazzes
- the interface classes that the service exposes to remote clients. Must not benull
and 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
null
is if the service propertyConstants.SERVICE_REGISTER_PROXY
is set in the properties. IfConstants.SERVICE_REGISTER_PROXY
is 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
.
-
ungetRemoteService
Description copied from interface:IRemoteServiceContainerAdapter
Unget 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:
ungetRemoteService
in interfaceIRemoteServiceConsumer
- Specified by:
ungetRemoteService
in interfaceIRemoteServiceContainerAdapter
- Parameters:
ref
- 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:
-
asyncGetRemoteServiceReferences
public org.eclipse.equinox.concurrent.future.IFuture asyncGetRemoteServiceReferences(ID[] idFilter, String clazz, String filter) Description copied from interface:IRemoteServiceContainerAdapter
Asynchronously returns an array ofIRemoteServiceReference
objects. The returned array ofIRemoteServiceReference
objects 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.
idFilter
is 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
idFilter
isnull
, all containers are considered to match the filter.filter
is used to select the registered service whose properties objects contain keys and values which satisfy the filter. SeeFilter
for a description of the filter string syntax.- Specified by:
asyncGetRemoteServiceReferences
in interfaceIRemoteServiceConsumer
- Specified by:
asyncGetRemoteServiceReferences
in 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
. - Since:
- 3.0
-
asyncGetRemoteServiceReferences
public org.eclipse.equinox.concurrent.future.IFuture asyncGetRemoteServiceReferences(ID target, ID[] idFilter, String clazz, String filter) Description copied from interface:IRemoteServiceContainerAdapter
Asynchronously returns an array ofIRemoteServiceReference
objects. The returned array ofIRemoteServiceReference
objects 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.
target
is a remote container to connect to. Ifnull
, no connection attempt is made.idFilter
is 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. IfidFilter
isnull
, all containers are considered to match the filter.filter
is used to select the registered service whose properties objects contain keys and values which satisfy the filter. SeeFilter
for a description of the filter string syntax. Iffilter
isnull
, all registered services are considered to match the filter. Iffilter
cannot be parsed, anInvalidSyntaxException
will be thrown with a human readable message where the filter became unparsable.- Specified by:
asyncGetRemoteServiceReferences
in interfaceIRemoteServiceConsumer
- Specified by:
asyncGetRemoteServiceReferences
in 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:
- 3.4
-
asyncGetRemoteServiceReferences
public org.eclipse.equinox.concurrent.future.IFuture asyncGetRemoteServiceReferences(ID target, String clazz, String filter) Description copied from interface:IRemoteServiceContainerAdapter
Asynchronously returns an array ofIRemoteServiceReference
objects. The returned array ofIRemoteServiceReference
objects 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.
idFilter
is 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.
filter
is used to select the registered service whose properties objects contain keys and values which satisfy the filter. SeeFilter
for a description of the filter string syntax.- Specified by:
asyncGetRemoteServiceReferences
in interfaceIRemoteServiceConsumer
- Specified by:
asyncGetRemoteServiceReferences
in 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
. - Since:
- 3.0
-
getRemoteServiceNamespace
Description copied from interface:IRemoteServiceContainerAdapter
Get namespace to use for this remote service provider.- Specified by:
getRemoteServiceNamespace
in interfaceIRemoteServiceConsumer
- Specified by:
getRemoteServiceNamespace
in interfaceIRemoteServiceContainerAdapter
- Specified by:
getRemoteServiceNamespace
in interfaceIRemoteServiceHost
- Returns:
- Namespace to use for creating IRemoteServiceID for this remote service provider. Will
not return
null
. - Since:
- 3.0
-
createRemoteFilter
Description copied from interface:IRemoteServiceContainerAdapter
Creates aIRemoteFilter
object. ThisIRemoteFilter
object may be used to match aIRemoteServiceReference
object or aDictionary
object.If the filter cannot be parsed, an
InvalidSyntaxException
will be thrown with a human readable message where the filter became unparsable.- Specified by:
createRemoteFilter
in interfaceIRemoteServiceConsumer
- Specified by:
createRemoteFilter
in interfaceIRemoteServiceContainerAdapter
- Parameters:
filter
- The filter string.- Returns:
- A
IRemoteFilter
object encapsulating the filter string. - Throws:
InvalidSyntaxException
- Iffilter
contains an invalid filter string that cannot be parsed.- Since:
- 3.0
- See Also:
-
- "Framework specification for a description of the filter string syntax."
FrameworkUtil.createFilter(String)
-
getRemoteServiceReference
Description copied from interface:IRemoteServiceContainerAdapter
Get 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:
getRemoteServiceReference
in interfaceIRemoteServiceConsumer
- Specified by:
getRemoteServiceReference
in interfaceIRemoteServiceContainerAdapter
- Parameters:
serviceId
- the serviceID to retrieve the IRemoteServiceReference for.- Returns:
- IRemoteServiceReference the remote service reference associated with the given serviceID.
Will return
null
if no IRemoteServiceReference found for the given serviceID. - Since:
- 3.0
-
getRemoteServiceID
Description copied from interface:IRemoteServiceContainerAdapter
Get 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.null
if not.- Specified by:
getRemoteServiceID
in interfaceIRemoteServiceConsumer
- Specified by:
getRemoteServiceID
in interfaceIRemoteServiceContainerAdapter
- Specified by:
getRemoteServiceID
in interfaceIRemoteServiceHost
- Parameters:
containerId
- 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,
null
if it is not. - Since:
- 3.0
-
setConnectContextForAuthentication
Description copied from interface:IRemoteServiceContainerAdapter
Set 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:
setConnectContextForAuthentication
in interfaceIRemoteServiceConsumer
- Specified by:
setConnectContextForAuthentication
in interfaceIRemoteServiceContainerAdapter
- Parameters:
connectContext
- the connect context to use for authenticating. Ifnull
, then no authentication will be attempted.- Since:
- 3.0
-
initialize
Description copied from class:BaseSharedObject
Initialize this shared object. Subclasses may override as appropriate to define custom initialization behavior. If initialization should fail, then a SharedObjectInitException should be thrown by implementing code. Also, subclasses overriding this method should call super.initialize() before running their own code.- Overrides:
initialize
in classBaseSharedObject
- Throws:
SharedObjectInitException
- if initialization should throw
-
dispose
Description copied from interface:ISharedObject
Method called by the ISharedObjectContainer upon ISharedObject destruction. Once this method is called, no more Events will be passed to a ISharedObject until the init method is called again.- Specified by:
dispose
in interfaceISharedObject
- Overrides:
dispose
in classBaseSharedObject
- Parameters:
containerID
- the ID of the container that is disposing this ISharedObject
-
getRSConnectTimeout
protected int getRSConnectTimeout()- Returns:
- int connect timeout
- Since:
- 3.3
-
getRegistryUpdateRequestTimeout
protected long getRegistryUpdateRequestTimeout()- Returns:
- long registry update request timeout
- Since:
- 3.4
-
getAddRegistrationRequestTimeout
protected int getAddRegistrationRequestTimeout()- Returns:
- int add registration request timeout
- Since:
- 3.0
-
connectToRemoteServiceTarget
- Parameters:
targetID
- target ID to connect to- Throws:
ContainerConnectException
- if container cannot connect to target ID- Since:
- 3.3 for preventing issues like bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=304427
-
getAddRegistrationRequestCredentials
-
getTargetsFromProperties
-
getSOContext
-
handleRegistryActivatedEvent
protected void handleRegistryActivatedEvent()- Since:
- 3.4
-
handleContainerEjectedEvent
- Parameters:
event
- event to handle- Since:
- 3.3
-
clearRemoteRegistrys
protected void clearRemoteRegistrys()- Since:
- 3.4
-
setRegistryConnected
protected void setRegistryConnected(boolean connected) - Parameters:
connected
- true if registry is connected, false otherwise- Since:
- 3.3
-
handleContainerDisconnectedEvent
-
sendRegistryUpdate
-
sendRegistryUpdate
- Parameters:
targetContainerID
- target container IDrequestId
- requestId- Since:
- 3.4
-
handleContainerConnectedEvent
-
handleTargetConnected
- Parameters:
targetID
- targetID- Since:
- 3.4
-
fireRemoteServiceListeners
-
callSynch
protected Object callSynch(RemoteServiceRegistrationImpl registration, IRemoteCall call) throws ECFException - Throws:
ECFException
-
fireCallStartEvent
protected void fireCallStartEvent(IRemoteCallListener listener, long requestId, IRemoteServiceReference reference, IRemoteCall call) -
fireCallCompleteEvent
protected void fireCallCompleteEvent(IRemoteCallListener listener, long requestId, Object response, boolean hadException, Throwable exception) -
sendRegistryUpdateRequest
- Parameters:
receiver
- receiverrequestId
- requestId- Since:
- 3.4
-
handleRegistryUpdateRequest
- Parameters:
remoteContainerID
- remoteContainerIDrequestId
- requestId- Since:
- 3.4
-
sendRegistryUpdateRequest
protected void sendRegistryUpdateRequest() -
handleRegistryUpdateRequest
-
sendAddRegistrationRequest
protected AddRegistrationRequest sendAddRegistrationRequest(ID receiver, AddRegistrationRequest request, Serializable credentials) -
checkRequestServiceAuthorization
protected void checkRequestServiceAuthorization(ID remoteContainerID, AddRegistrationRequest request, Serializable credentials) throws AccessControlException - Throws:
AccessControlException
-
handleRequestService
protected void handleRequestService(ID remoteContainerID, AddRegistrationRequest request, Integer requestId, Serializable credentials) -
sendAddRegistration
-
sendAddRegistration
protected void sendAddRegistration(ID receiver, Integer requestId, RemoteServiceRegistrationImpl reg) -
sendAddRegistrations
protected void sendAddRegistrations(ID receiver, Integer requestId, RemoteServiceRegistrationImpl[] regs) - Parameters:
receiver
- receiverrequestId
- requestIdregs
- registrations to send- Since:
- 3.3
-
sendAddRegistrationRequestRefused
-
handleAddRegistrationRequestRefused
protected void handleAddRegistrationRequestRefused(ID remoteContainerID, Integer requestId, AccessControlException e) -
handleAddRegistration
protected void handleAddRegistration(ID remoteContainerID, RemoteServiceRegistrationImpl registration) -
handleAddRegistrations
protected void handleAddRegistrations(ID remoteContainerID, Integer requestId, RemoteServiceRegistrationImpl[] registrations) - Parameters:
remoteContainerID
- container idrequestId
- requestIdregistrations
- the registrations to add- Since:
- 3.3
-
handleAddRegistration
protected void handleAddRegistration(ID remoteContainerID, Integer requestId, RemoteServiceRegistrationImpl registration) -
notifyAddRegistrationResponse
protected void notifyAddRegistrationResponse(ID remoteContainerID, Integer requestId, AccessControlException exception) - Parameters:
remoteContainerID
- remoteContainerIDrequestId
- requestIdexception
- exception- Since:
- 3.2
-
sendCallRequest
protected Request sendCallRequest(RemoteServiceRegistrationImpl remoteRegistration, IRemoteCall call) throws IOException - Throws:
IOException
-
serializeCallRequest
- Throws:
IOException
- Since:
- 4.6
-
deserializeCallRequest
- Throws:
IOException
- Since:
- 4.6
-
serializeCallResponse
- Throws:
IOException
- Since:
- 4.6
-
deserializeCallResponse
- Throws:
IOException
- Since:
- 4.6
-
createRequestExecutor
- Parameters:
request
- request- Returns:
- IExcecutor excecutor to use for given request
- Since:
- 3.4
-
invokeLocal
protected Object invokeLocal(RemoteServiceRegistrationImpl reg, RemoteCallImpl call) throws InvocationTargetException, Exception, NoClassDefFoundError - Throws:
InvocationTargetException
Exception
NoClassDefFoundError
- Since:
- 4.4
-
executeRequest
protected void executeRequest(org.eclipse.equinox.concurrent.future.IExecutor executor, Request request, ID responseTarget, RemoteServiceRegistrationImpl localRegistration, boolean respond) - Parameters:
executor
- executor to use to execute requestrequest
- the request to executeresponseTarget
- response targetlocalRegistration
- the local registrationrespond
- true if response is expected, false otherwise- Since:
- 3.4
-
handleCallRequestBytes
protected void handleCallRequestBytes(byte[] requestBytes) - Since:
- 4.6
-
handleCallRequest
-
logRemoteCallException
- Parameters:
message
- messagee
- the exception- Since:
- 3.4
-
sendCallRequestWithListener
protected void sendCallRequestWithListener(RemoteServiceRegistrationImpl remoteRegistration, IRemoteCall call, IRemoteCallListener listener) -
log
- Overrides:
log
in classBaseSharedObject
-
sendCallResponse
-
handleCallResponse
-
handleCallResponseBytes
protected void handleCallResponseBytes(byte[] responseBytes) - Since:
- 4.6
-
sendFireRequest
protected Request sendFireRequest(RemoteServiceRegistrationImpl remoteRegistration, IRemoteCall call) throws ECFException - Throws:
ECFException
-
handleFireRequest
-
sendUnregister
-
handleUnregister
-
createUnregisteredEvent
protected IRemoteServiceUnregisteredEvent createUnregisteredEvent(RemoteServiceRegistrationImpl registration) -
createRegisteredEvent
protected IRemoteServiceRegisteredEvent createRegisteredEvent(RemoteServiceRegistrationImpl registration) -
addRemoteRegistry
-
getRemoteRegistry
-
removeRemoteRegistry
-
getLocalRegistrationForRequest
- Parameters:
request
- request- Returns:
- RemoteServiceRegistrationImpl the registration
- Since:
- 3.2
-
addRequest
- Parameters:
request
- the request to add- Returns:
- true if added, false if not added
- Since:
- 3.2
-
getRequest
- Parameters:
requestId
- requestId- Returns:
- Request the request associated with the given requestId or
null
- Since:
- 3.2
-
removeRequest
- Parameters:
request
- request- Returns:
- boolean true if removed, false otherwise
- Since:
- 3.2
-
logException
-
getRemoteServiceCallPolicy
- Returns:
- IRemoteServiceCallPolicy the policy. May be
null
- Since:
- 4.0
-
setRemoteServiceCallPolicy
Description copied from interface:IRemoteServiceContainerAdapter
Set the remote service call policy to enable authorization on remote service method calls- Specified by:
setRemoteServiceCallPolicy
in interfaceIRemoteServiceContainerAdapter
- Parameters:
policy
- the policy to set. May benull
- Returns:
- boolean true if set, false if cannot be set.
- Since:
- 4.0
-