public class ServiceRegistry extends java.lang.Object implements IServiceRegistry
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<IComponentIdentifier,java.util.Set<IServiceIdentifier>> |
excludedservices
The excluded services cache.
|
protected Indexer<IServiceIdentifier> |
indexer
The service indexer.
|
protected java.util.Map<IServiceIdentifier,IService> |
localserviceproxies
Map for looking up local services using the service identifier.
|
protected java.util.concurrent.locks.ReadWriteLock |
proxyrwlock
Read-Write Lock for proxy map.
|
protected Indexer<ServiceQueryInfo<?>> |
queries
The persistent service queries.
|
protected java.util.concurrent.locks.ReadWriteLock |
rwlock
Read-Write Lock
|
| Constructor and Description |
|---|
ServiceRegistry()
Create a new registry.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addExcludedComponent(IComponentIdentifier cid)
Add an excluded component.
|
void |
addLocalService(IService service)
Add a local service to the registry.
|
<T> ISubscriptionIntermediateFuture<T> |
addQuery(ServiceQuery<T> query)
Add a service query to the registry.
|
void |
addService(IServiceIdentifier service)
Add a service to the registry.
|
protected boolean |
checkLifecycleVisibility(ServiceQuery<?> query,
IServiceIdentifier ser)
Test if a service is visible, i.e.
|
protected boolean |
checkPublicationScope(ServiceQuery<?> query,
IServiceIdentifier ser)
Check if service is ok with respect to publication scope.
|
protected IFuture<java.lang.Void> |
checkQueries(IServiceIdentifier ser,
int eventtype)
Check the persistent queries for a new service.
|
protected boolean |
checkRestrictions(ServiceQuery<?> query,
IServiceIdentifier ser)
Check the services according additional restrictions like scope.
|
protected boolean |
checkSearchScope(ServiceQuery<?> query,
IServiceIdentifier ser)
Check if service is ok with respect to search scope of caller.
|
protected void |
dispatchQueryEvent(ServiceQueryInfo<?> queryinfo,
IServiceIdentifier ser,
int eventtype) |
java.util.Set<ServiceQueryInfo<?>> |
getAllQueries()
Get all queries.
|
java.util.Set<IServiceIdentifier> |
getAllServices()
Get all services.
|
static java.lang.String |
getApplicationName(IComponentIdentifier cid)
Get the application name.
|
static java.lang.String |
getDotName(IComponentIdentifier cid)
Get the name without @ replaced by dot.
|
protected Indexer<IServiceIdentifier> |
getIndexer()
Get the indexer.
|
IService |
getLocalService(IServiceIdentifier serviceid)
Returns the service proxy of a local service identified by service ID.
|
java.util.concurrent.locks.ReadWriteLock |
getLock()
Returns the lock on the registry.
|
static IServiceRegistry |
getRegistry(IComponentIdentifier platform)
Get the registry from a component.
|
static IServiceRegistry |
getRegistry(IInternalAccess ia)
Get the registry from a component.
|
protected java.util.Set<IServiceIdentifier> |
getServices()
Get all services.
|
protected java.util.Set<IServiceIdentifier> |
getServices(ServiceQuery<?> query)
Get services per query.
|
static java.lang.String |
getSubcomponentName(IComponentIdentifier cid)
Get the subcomponent name.
|
void |
removeExcludedComponent(IComponentIdentifier cid)
Remove an excluded component.
|
void |
removeQueries(IComponentIdentifier owner)
Remove all service queries of a specific component from the registry.
|
void |
removeQueriesOfPlatform(IComponentIdentifier platform)
Remove all service queries of a specific platform from the registry.
|
void |
removeQuery(ServiceQuery<?> query)
Remove a service query from the registry.
|
void |
removeService(IServiceIdentifier service)
Remove a service from the registry.
|
void |
removeServices(IComponentIdentifier platform)
Remove services of a platform from the registry.
|
IServiceIdentifier |
searchService(ServiceQuery<?> query)
Search for services.
|
java.util.Set<IServiceIdentifier> |
searchServices(ServiceQuery<?> query)
Search for services.
|
void |
updateService(IServiceIdentifier service)
Updates a service if the service meta-information
has changes.
|
void |
updateService(IServiceIdentifier service,
java.lang.String propname)
Updates a service if the service meta-information
has changes.
|
protected java.util.concurrent.locks.ReadWriteLock rwlock
protected Indexer<IServiceIdentifier> indexer
protected Indexer<ServiceQueryInfo<?>> queries
protected java.util.Map<IComponentIdentifier,java.util.Set<IServiceIdentifier>> excludedservices
protected java.util.concurrent.locks.ReadWriteLock proxyrwlock
protected java.util.Map<IServiceIdentifier,IService> localserviceproxies
public IServiceIdentifier searchService(ServiceQuery<?> query)
searchService in interface IServiceRegistrypublic java.util.Set<IServiceIdentifier> searchServices(ServiceQuery<?> query)
searchServices in interface IServiceRegistrypublic void addService(IServiceIdentifier service)
addService in interface IServiceRegistryservice - The service.public void addLocalService(IService service)
addLocalService in interface IServiceRegistryservice - The local service.public void updateService(IServiceIdentifier service)
updateService in interface IServiceRegistryservice - The service.public void updateService(IServiceIdentifier service, java.lang.String propname)
service - The service (null = all).public void removeService(IServiceIdentifier service)
removeService in interface IServiceRegistrysid - The service id.public void removeServices(IComponentIdentifier platform)
removeServices in interface IServiceRegistryplatform - The platform, null for everything.public IService getLocalService(IServiceIdentifier serviceid)
getLocalService in interface IServiceRegistryserviceid - The service ID.public java.util.Set<IServiceIdentifier> getAllServices()
getAllServices in interface IServiceRegistrypublic java.util.Set<ServiceQueryInfo<?>> getAllQueries()
getAllQueries in interface IServiceRegistrypublic java.util.concurrent.locks.ReadWriteLock getLock()
getLock in interface IServiceRegistrypublic <T> ISubscriptionIntermediateFuture<T> addQuery(ServiceQuery<T> query)
addQuery in interface IServiceRegistryquery - ServiceQuery.public void removeQuery(ServiceQuery<?> query)
removeQuery in interface IServiceRegistryquery - ServiceQuery.public void removeQueries(IComponentIdentifier owner)
removeQueries in interface IServiceRegistryowner - The query owner.public void removeQueriesOfPlatform(IComponentIdentifier platform)
removeQueriesOfPlatform in interface IServiceRegistryplatform - The platform from which the query owner comes.public void addExcludedComponent(IComponentIdentifier cid)
addExcludedComponent in interface IServiceRegistryThe - component identifier.public void removeExcludedComponent(IComponentIdentifier cid)
removeExcludedComponent in interface IServiceRegistryThe - component identifier.protected boolean checkLifecycleVisibility(ServiceQuery<?> query, IServiceIdentifier ser)
query - The query.ser - The service.protected IFuture<java.lang.Void> checkQueries(IServiceIdentifier ser, int eventtype)
ser - The service.removed - Indicates if the query was removed.protected void dispatchQueryEvent(ServiceQueryInfo<?> queryinfo, IServiceIdentifier ser, int eventtype)
protected boolean checkRestrictions(ServiceQuery<?> query, IServiceIdentifier ser)
query - The query.ser - The service.protected boolean checkSearchScope(ServiceQuery<?> query, IServiceIdentifier ser)
protected boolean checkPublicationScope(ServiceQuery<?> query, IServiceIdentifier ser)
protected java.util.Set<IServiceIdentifier> getServices()
protected java.util.Set<IServiceIdentifier> getServices(ServiceQuery<?> query)
query - The query.public static IServiceRegistry getRegistry(IComponentIdentifier platform)
public static IServiceRegistry getRegistry(IInternalAccess ia)
public static java.lang.String getApplicationName(IComponentIdentifier cid)
public static java.lang.String getSubcomponentName(IComponentIdentifier cid)
cid - The component id.public static java.lang.String getDotName(IComponentIdentifier cid)
protected Indexer<IServiceIdentifier> getIndexer()