public class RequiredServicesComponentFeature extends AbstractComponentFeature implements IRequiredServicesFeature, IInternalServiceMonitoringFeature, IInternalRequiredServicesFeature
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,RequiredServiceInfo> |
requiredserviceinfos
The required service infos.
|
protected java.util.Set<SubscriptionIntermediateFuture<ServiceCallEvent>> |
subscriptions
The current subscriptions.
|
Constructor and Description |
---|
RequiredServicesComponentFeature(IInternalAccess component,
ComponentCreationInfo cinfo)
Factory method constructor for instance level.
|
Modifier and Type | Method and Description |
---|---|
<T> ISubscriptionIntermediateFuture<T> |
addQuery(java.lang.Class<T> type)
Add a query for a declared required service.
|
<T> ISubscriptionIntermediateFuture<T> |
addQuery(ServiceQuery<T> query)
Add a service query.
|
<T> ISubscriptionIntermediateFuture<T> |
addQuery(java.lang.String name)
Add a query for a declared required service.
|
protected void |
addRequiredServiceInfos(RequiredServiceInfo[] requiredservices)
Add required services for a given prefix.
|
protected <T> RequiredServiceInfo |
createServiceInfo(ServiceQuery<T> query)
When searching with query -> create required service info from service query.
|
protected java.lang.Object |
createServiceProxy(java.lang.Object service,
RequiredServiceInfo info)
Create the user-facing object from the received search or query result.
|
protected <T> void |
enhanceQuery(ServiceQuery<T> query,
boolean multi)
Enhance a query before processing.
|
<T> T |
getLocalService(java.lang.Class<T> type)
Resolve a required service of a given type.
|
<T> T |
getLocalService(java.lang.String name)
Resolve a declared required service of a given name.
|
<T> T |
getLocalService0(java.lang.Class<T> type)
Resolve a required service of a given type.
|
<T> java.util.Collection<T> |
getLocalServices(java.lang.Class<T> type)
Resolve a required services of a given type.
|
<T> java.util.Collection<T> |
getLocalServices(java.lang.String name)
Resolve a required services of a given name.
|
<T> T |
getRawService(java.lang.Class<T> type)
Get a service raw (i.e.
|
<T> java.util.Collection<T> |
getRawServices(java.lang.Class<T> type)
Get a service raw (i.e.
|
<T> IFuture<T> |
getService(java.lang.Class<T> type)
Resolve a required service of a given type.
|
<T> IFuture<T> |
getService(java.lang.String name)
Resolve a declared required service of a given name.
|
ISubscriptionIntermediateFuture<ServiceCallEvent> |
getServiceEvents()
Listen to service call events (call, result and commands).
|
protected RequiredServiceInfo |
getServiceInfo(java.lang.Class<?> type)
Get the required service info for a type.
|
RequiredServiceInfo |
getServiceInfo(java.lang.String name)
Get the required service info for a name.
|
RequiredServiceInfo[] |
getServiceInfos()
Get the required services.
|
protected <T> ServiceQuery<T> |
getServiceQuery(RequiredServiceInfo info)
When searching for declared service -> map required service declaration to service query.
|
<T> ITerminableIntermediateFuture<T> |
getServices(java.lang.Class<T> type)
Resolve a required services of a given type.
|
<T> ITerminableIntermediateFuture<T> |
getServices(java.lang.String name)
Resolve a required services of a given name.
|
boolean |
hasUserBody()
Check if the feature potentially executed user code in body.
|
IFuture<java.lang.Void> |
init()
Init the required services
|
boolean |
isMonitoring()
Check if there is someone monitoring.
|
boolean |
isRemote(ServiceQuery<?> query)
Check if a query is potentially remote.
|
void |
postServiceEvent(ServiceCallEvent event)
Post a service call event.
|
<T> T |
resolveLocalService(ServiceQuery<T> query,
RequiredServiceInfo info)
Search for matching services and provide first result.
|
<T> java.util.Collection<T> |
resolveLocalServices(ServiceQuery<T> query,
RequiredServiceInfo info)
Search for all matching services.
|
<T> ISubscriptionIntermediateFuture<T> |
resolveQuery(ServiceQuery<T> query,
RequiredServiceInfo info)
Query for all matching services.
|
<T> ITerminableFuture<T> |
resolveService(ServiceQuery<T> query,
RequiredServiceInfo info)
Search for matching services and provide first result.
|
<T> ITerminableIntermediateFuture<T> |
resolveServices(ServiceQuery<T> query,
RequiredServiceInfo info)
Search for all matching services.
|
<T> T |
searchLocalService(ServiceQuery<T> query)
Search for matching services and provide first result.
|
<T> java.util.Collection<T> |
searchLocalServices(ServiceQuery<T> query)
Search for all matching services.
|
<T> IFuture<T> |
searchService(ServiceQuery<T> query)
Search for matching services and provide first result.
|
<T> ITerminableIntermediateFuture<T> |
searchServices(ServiceQuery<T> query)
Search for all matching services.
|
IFuture<java.lang.Void> |
shutdown()
Called when the feature is shutdowned.
|
protected java.util.Map<java.lang.String,RequiredServiceInfo> requiredserviceinfos
protected java.util.Set<SubscriptionIntermediateFuture<ServiceCallEvent>> subscriptions
public RequiredServicesComponentFeature(IInternalAccess component, ComponentCreationInfo cinfo)
public IFuture<java.lang.Void> init()
public boolean hasUserBody()
public IFuture<java.lang.Void> shutdown()
protected void addRequiredServiceInfos(RequiredServiceInfo[] requiredservices)
prefix
- The name prefix to use.required
- services The required services to set.public <T> IFuture<T> getService(java.lang.String name)
getService
in interface IRequiredServicesFeature
name
- The service name.public <T> IFuture<T> getService(java.lang.Class<T> type)
getService
in interface IRequiredServicesFeature
type
- The service type.public <T> ITerminableIntermediateFuture<T> getServices(java.lang.String name)
getServices
in interface IRequiredServicesFeature
name
- The services name.public <T> ITerminableIntermediateFuture<T> getServices(java.lang.Class<T> type)
getServices
in interface IRequiredServicesFeature
type
- The services type.public <T> T getLocalService(java.lang.String name)
getLocalService
in interface IRequiredServicesFeature
name
- The service name.public <T> T getLocalService(java.lang.Class<T> type)
getLocalService
in interface IRequiredServicesFeature
type
- The service type.public <T> T getLocalService0(java.lang.Class<T> type)
getLocalService0
in interface IRequiredServicesFeature
type
- The service type.public <T> java.util.Collection<T> getLocalServices(java.lang.String name)
getLocalServices
in interface IRequiredServicesFeature
name
- The services name.public <T> java.util.Collection<T> getLocalServices(java.lang.Class<T> type)
getLocalServices
in interface IRequiredServicesFeature
type
- The services type.public <T> IFuture<T> searchService(ServiceQuery<T> query)
searchService
in interface IExternalRequiredServicesFeature
query
- The search query.public <T> T searchLocalService(ServiceQuery<T> query)
searchLocalService
in interface IRequiredServicesFeature
query
- The search query.public <T> ITerminableIntermediateFuture<T> searchServices(ServiceQuery<T> query)
searchServices
in interface IExternalRequiredServicesFeature
query
- The search query.public <T> java.util.Collection<T> searchLocalServices(ServiceQuery<T> query)
searchLocalServices
in interface IRequiredServicesFeature
query
- The search query.public <T> ISubscriptionIntermediateFuture<T> addQuery(java.lang.String name)
addQuery
in interface IRequiredServicesFeature
name
- The name of the required service declaration.public <T> ISubscriptionIntermediateFuture<T> addQuery(java.lang.Class<T> type)
addQuery
in interface IRequiredServicesFeature
type
- The type of the required service declaration.public <T> ISubscriptionIntermediateFuture<T> addQuery(ServiceQuery<T> query)
addQuery
in interface IExternalRequiredServicesFeature
query
- The search query.public RequiredServiceInfo[] getServiceInfos()
getServiceInfos
in interface IInternalRequiredServicesFeature
public ISubscriptionIntermediateFuture<ServiceCallEvent> getServiceEvents()
getServiceEvents
in interface IInternalServiceMonitoringFeature
public void postServiceEvent(ServiceCallEvent event)
postServiceEvent
in interface IInternalServiceMonitoringFeature
public boolean isMonitoring()
isMonitoring
in interface IInternalServiceMonitoringFeature
public <T> T getRawService(java.lang.Class<T> type)
getRawService
in interface IInternalRequiredServicesFeature
public <T> java.util.Collection<T> getRawServices(java.lang.Class<T> type)
getRawServices
in interface IInternalRequiredServicesFeature
public <T> ITerminableFuture<T> resolveService(ServiceQuery<T> query, RequiredServiceInfo info)
resolveService
in interface IInternalRequiredServicesFeature
query
- The search query.info
- Used for required service proxy configuration -> null for no proxy.public <T> T resolveLocalService(ServiceQuery<T> query, RequiredServiceInfo info)
resolveLocalService
in interface IInternalRequiredServicesFeature
query
- The search query.info
- Used for required service proxy configuration -> null for no proxy.public <T> ITerminableIntermediateFuture<T> resolveServices(ServiceQuery<T> query, RequiredServiceInfo info)
resolveServices
in interface IInternalRequiredServicesFeature
query
- The search query.info
- Used for required service proxy configuration -> null for no proxy.public <T> java.util.Collection<T> resolveLocalServices(ServiceQuery<T> query, RequiredServiceInfo info)
resolveLocalServices
in interface IInternalRequiredServicesFeature
query
- The search query.info
- Used for required service proxy configuration -> null for no proxy.public <T> ISubscriptionIntermediateFuture<T> resolveQuery(ServiceQuery<T> query, RequiredServiceInfo info)
resolveQuery
in interface IInternalRequiredServicesFeature
query
- The search query.info
- Used for required service proxy configuration -> null for no proxy.protected <T> ServiceQuery<T> getServiceQuery(RequiredServiceInfo info)
protected <T> RequiredServiceInfo createServiceInfo(ServiceQuery<T> query)
public RequiredServiceInfo getServiceInfo(java.lang.String name)
getServiceInfo
in interface IInternalRequiredServicesFeature
name
- The required service name.protected RequiredServiceInfo getServiceInfo(java.lang.Class<?> type)
type
- The required service type.protected java.lang.Object createServiceProxy(java.lang.Object service, RequiredServiceInfo info)
protected <T> void enhanceQuery(ServiceQuery<T> query, boolean multi)
query
- The query to be enhanced.public boolean isRemote(ServiceQuery<?> query)