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 IRegistryDataProvider
getServices
in interface IServiceRegistry
type
- The interface type. If type is null all services are returned.public boolean isIncluded(IComponentIdentifier cid, IService ser)
isIncluded
in interface IRegistryDataProvider
isIncluded
in interface IServiceRegistry
ser
- The service.public void addExcludedComponent(IComponentIdentifier cid)
addExcludedComponent
in interface IServiceRegistry
cid
- component identifier.public IFuture<java.lang.Void> removeExcludedComponent(IComponentIdentifier cid)
removeExcludedComponent
in interface IServiceRegistry
cid
- component identifier.public IFuture<java.lang.Void> addService(ClassInfo key, IService service)
addService
in interface IServiceRegistry
service
- The service.public void removeService(ClassInfo key, IService service)
removeService
in interface IServiceRegistry
service
- The service.public <T> T searchService(ClassInfo type, IComponentIdentifier cid, java.lang.String scope)
searchService
in interface IServiceRegistry
public <T> T searchService(ClassInfo type, IComponentIdentifier cid, java.lang.String scope, boolean excluded)
searchService
in interface IServiceRegistry
public <T> java.util.Collection<T> searchServices(ClassInfo type, IComponentIdentifier cid, java.lang.String scope)
searchServices
in interface IServiceRegistry
public <T> T searchService(ClassInfo type, IComponentIdentifier cid, java.lang.String scope, IFilter<T> filter)
searchService
in interface IServiceRegistry
public <T> java.util.Collection<T> searchServices(ClassInfo type, IComponentIdentifier cid, java.lang.String scope, IFilter<T> filter)
searchServices
in interface IServiceRegistry
public <T> IFuture<T> searchService(ClassInfo type, IComponentIdentifier cid, java.lang.String scope, IAsyncFilter<T> filter)
searchService
in interface IServiceRegistry
public <T> ISubscriptionIntermediateFuture<T> searchServices(ClassInfo type, IComponentIdentifier cid, java.lang.String scope, IAsyncFilter<T> filter)
searchServices
in interface IServiceRegistry
public <T> ISubscriptionIntermediateFuture<T> addQuery(ServiceQuery<T> query)
addQuery
in interface IServiceRegistry
query
- ServiceQuery.public <T> void removeQuery(ServiceQuery<T> query)
removeQuery
in interface IServiceRegistry
query
- ServiceQuery.public void removeQueries(IComponentIdentifier owner)
removeQueries
in interface IServiceRegistry
owner
- The query owner.public <T> java.util.Set<ServiceQueryInfo<T>> getQueries(ClassInfo type)
getQueries
in interface IRegistryDataProvider
getQueries
in interface IServiceRegistry
type
- 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 IServiceRegistry
public <T> ISubscriptionIntermediateFuture<T> searchGlobalServices(ClassInfo type, IComponentIdentifier cid, IAsyncFilter<T> filter)
searchGlobalServices
in interface IServiceRegistry
protected <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 IServiceRegistry
cid
- The platform id.public void removeSubregistry(IComponentIdentifier cid)
removeSubregistry
in interface IServiceRegistry
cid
- The platform id.public java.util.Map<ClassInfo,java.util.Set<IService>> getServiceMap()
getServiceMap
in interface IServiceRegistry
protected void notifyListeners(RegistryListenerEvent event)
event
- The event.public void addEventListener(IRegistryListener listener)
addEventListener
in interface IServiceRegistry
listener
- The listener.public void removeEventListener(IRegistryListener listener)
removeEventListener
in interface IServiceRegistry
listener
- The listener.public static IServiceRegistry getRegistry(IComponentIdentifier platform)
public static IServiceRegistry getRegistry(IInternalAccess ia)