public class ServiceRegistry extends java.lang.Object implements IServiceRegistry, IRegistryDataProvider
| Modifier and Type | Class and Description |
|---|---|
static class |
ServiceRegistry.UnlimitedIntermediateDelegationResultListener<E>
Listener that forwards only results and ignores finished / exception.
|
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Set<IComponentIdentifier> |
excluded
The excluded components.
|
protected java.util.Map<IComponentIdentifier,java.util.Set<IService>> |
excludedservices
The excluded services cache.
|
protected java.util.List<IRegistryListener> |
listeners
The registry listeners.
|
protected java.util.Map<ClassInfo,java.util.Set<ServiceQueryInfo<?>>> |
queries
The persistent service queries.
|
protected RegistrySearchFunctionality |
searchfunc
The search functionality.
|
protected java.util.Map<ClassInfo,java.util.Set<IService>> |
services
The map of published services sorted by type.
|
| Constructor and Description |
|---|
ServiceRegistry()
Create a new registry.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEventListener(IRegistryListener listener)
Add an event listener.
|
void |
addExcludedComponent(IComponentIdentifier cid)
Add an excluded component.
|
<T> ISubscriptionIntermediateFuture<T> |
addQuery(ServiceQuery<T> query)
Add a service query to the registry.
|
IFuture<java.lang.Void> |
addService(ClassInfo key,
IService service)
Add a service to the registry.
|
<T> java.util.Set<ServiceQueryInfo<T>> |
getQueries(ClassInfo type)
Get queries per type.
|
static IServiceRegistry |
getRegistry(IComponentIdentifier platform)
Get the registry from a component.
|
static IServiceRegistry |
getRegistry(IInternalAccess ia)
Get the registry from a component.
|
protected <T> T |
getService(java.lang.Class<T> type)
Get a service per type.
|
java.util.Map<ClassInfo,java.util.Set<IService>> |
getServiceMap()
Get the service map.
|
java.util.Iterator<IService> |
getServices(ClassInfo type)
Get services per type.
|
IServiceRegistry |
getSubregistry(IComponentIdentifier cid)
Get a subregistry.
|
boolean |
isIncluded(IComponentIdentifier cid,
IService ser)
Test if a service is included.
|
protected void |
notifyListeners(RegistryListenerEvent event)
Notify the event listeners (if any).
|
void |
removeEventListener(IRegistryListener listener)
Remove an event listener.
|
IFuture<java.lang.Void> |
removeExcludedComponent(IComponentIdentifier cid)
Remove an excluded component.
|
void |
removeQueries(IComponentIdentifier owner)
Remove all service queries of a specific component from the registry.
|
<T> void |
removeQuery(ServiceQuery<T> query)
Remove a service query from the registry.
|
void |
removeService(ClassInfo key,
IService service)
Remove a service from the registry.
|
void |
removeSubregistry(IComponentIdentifier cid)
Remove a subregistry.
|
<T> IFuture<T> |
searchGlobalService(ClassInfo type,
IComponentIdentifier cid,
IAsyncFilter<T> filter)
Search for services.
|
<T> ISubscriptionIntermediateFuture<T> |
searchGlobalServices(ClassInfo type,
IComponentIdentifier cid,
IAsyncFilter<T> filter)
Search for services.
|
protected <T> IFuture<T> |
searchRemoteService(IComponentIdentifier caller,
ClassInfo type,
IAsyncFilter<T> filter)
Search for services on remote platforms.
|
protected <T> ITerminableIntermediateFuture<T> |
searchRemoteServices(IComponentIdentifier caller,
ClassInfo type,
IAsyncFilter<T> filter)
Search for services on remote platforms.
|
<T> T |
searchService(ClassInfo type,
IComponentIdentifier cid,
java.lang.String scope)
Search for services.
|
<T> T |
searchService(ClassInfo type,
IComponentIdentifier cid,
java.lang.String scope,
boolean excluded)
Search for services.
|
<T> IFuture<T> |
searchService(ClassInfo type,
IComponentIdentifier cid,
java.lang.String scope,
IAsyncFilter<T> filter)
Search for service.
|
<T> T |
searchService(ClassInfo type,
IComponentIdentifier cid,
java.lang.String scope,
IFilter<T> filter)
Search for service.
|
<T> java.util.Collection<T> |
searchServices(ClassInfo type,
IComponentIdentifier cid,
java.lang.String scope)
Search for services.
|
<T> ISubscriptionIntermediateFuture<T> |
searchServices(ClassInfo type,
IComponentIdentifier cid,
java.lang.String scope,
IAsyncFilter<T> filter)
Search for services.
|
<T> java.util.Collection<T> |
searchServices(ClassInfo type,
IComponentIdentifier cid,
java.lang.String scope,
IFilter<T> filter)
Search for service.
|
protected java.util.Map<ClassInfo,java.util.Set<IService>> services
protected java.util.Set<IComponentIdentifier> excluded
protected java.util.Map<ClassInfo,java.util.Set<ServiceQueryInfo<?>>> queries
protected java.util.Map<IComponentIdentifier,java.util.Set<IService>> excludedservices
protected java.util.List<IRegistryListener> listeners
protected RegistrySearchFunctionality searchfunc
protected <T> T getService(java.lang.Class<T> type)
type - The interface type.public java.util.Iterator<IService> getServices(ClassInfo type)
getServices in interface IRegistryDataProvidergetServices in interface IServiceRegistrytype - The interface type. If type is null all services are returned.public boolean isIncluded(IComponentIdentifier cid, IService ser)
isIncluded in interface IRegistryDataProviderisIncluded in interface IServiceRegistryser - The service.public void addExcludedComponent(IComponentIdentifier cid)
addExcludedComponent in interface IServiceRegistrycid - component identifier.public IFuture<java.lang.Void> removeExcludedComponent(IComponentIdentifier cid)
removeExcludedComponent in interface IServiceRegistrycid - component identifier.public IFuture<java.lang.Void> addService(ClassInfo key, IService service)
addService in interface IServiceRegistryservice - The service.public void removeService(ClassInfo key, IService service)
removeService in interface IServiceRegistryservice - The service.public <T> T searchService(ClassInfo type, IComponentIdentifier cid, java.lang.String scope)
searchService in interface IServiceRegistrypublic <T> T searchService(ClassInfo type, IComponentIdentifier cid, java.lang.String scope, boolean excluded)
searchService in interface IServiceRegistrypublic <T> java.util.Collection<T> searchServices(ClassInfo type, IComponentIdentifier cid, java.lang.String scope)
searchServices in interface IServiceRegistrypublic <T> T searchService(ClassInfo type, IComponentIdentifier cid, java.lang.String scope, IFilter<T> filter)
searchService in interface IServiceRegistrypublic <T> java.util.Collection<T> searchServices(ClassInfo type, IComponentIdentifier cid, java.lang.String scope, IFilter<T> filter)
searchServices in interface IServiceRegistrypublic <T> IFuture<T> searchService(ClassInfo type, IComponentIdentifier cid, java.lang.String scope, IAsyncFilter<T> filter)
searchService in interface IServiceRegistrypublic <T> ISubscriptionIntermediateFuture<T> searchServices(ClassInfo type, IComponentIdentifier cid, java.lang.String scope, IAsyncFilter<T> filter)
searchServices in interface IServiceRegistrypublic <T> ISubscriptionIntermediateFuture<T> addQuery(ServiceQuery<T> query)
addQuery in interface IServiceRegistryquery - ServiceQuery.public <T> void removeQuery(ServiceQuery<T> query)
removeQuery in interface IServiceRegistryquery - ServiceQuery.public void removeQueries(IComponentIdentifier owner)
removeQueries in interface IServiceRegistryowner - The query owner.public <T> java.util.Set<ServiceQueryInfo<T>> getQueries(ClassInfo type)
getQueries in interface IRegistryDataProvidergetQueries in interface IServiceRegistrytype - The interface type. If type is null all services are returned.public <T> IFuture<T> searchGlobalService(ClassInfo type, IComponentIdentifier cid, IAsyncFilter<T> filter)
searchGlobalService in interface IServiceRegistrypublic <T> ISubscriptionIntermediateFuture<T> searchGlobalServices(ClassInfo type, IComponentIdentifier cid, IAsyncFilter<T> filter)
searchGlobalServices in interface IServiceRegistryprotected <T> ITerminableIntermediateFuture<T> searchRemoteServices(IComponentIdentifier caller, ClassInfo type, IAsyncFilter<T> filter)
caller - The component that started the search.type - The type.filter - The filter.protected <T> IFuture<T> searchRemoteService(IComponentIdentifier caller, ClassInfo type, IAsyncFilter<T> filter)
type - The type.filter - The filter.public IServiceRegistry getSubregistry(IComponentIdentifier cid)
getSubregistry in interface IServiceRegistrycid - The platform id.public void removeSubregistry(IComponentIdentifier cid)
removeSubregistry in interface IServiceRegistrycid - The platform id.public java.util.Map<ClassInfo,java.util.Set<IService>> getServiceMap()
getServiceMap in interface IServiceRegistryprotected void notifyListeners(RegistryListenerEvent event)
event - The event.public void addEventListener(IRegistryListener listener)
addEventListener in interface IServiceRegistrylistener - The listener.public void removeEventListener(IRegistryListener listener)
removeEventListener in interface IServiceRegistrylistener - The listener.public static IServiceRegistry getRegistry(IComponentIdentifier platform)
public static IServiceRegistry getRegistry(IInternalAccess ia)