public class RequiredServicesComponentFeature extends AbstractComponentFeature implements IRequiredServicesFeature
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,IRequiredServiceFetcher> |
reqservicefetchers
The service fetch method table (name -> fetcher).
|
protected java.util.Map<java.lang.String,RequiredServiceInfo> |
requiredserviceinfos
The required service infos.
|
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,
java.lang.String scope,
IAsyncFilter<T> filter)
Add a service query to the registry.
|
protected void |
addRequiredServiceInfos(RequiredServiceInfo[] requiredservices)
Add required services for a given prefix.
|
IRequiredServiceFetcher |
createServiceFetcher(java.lang.String name)
Create a service fetcher.
|
IComponentIdentifier |
getId()
Get the globally unique id of the provider.
|
<T> T |
getLastRequiredService(java.lang.String name)
Get the result of the last search.
|
<T> java.util.Collection<T> |
getLastRequiredServices(java.lang.String name)
Get the result of the last search.
|
<T> T |
getMultiService(java.lang.String reqname,
java.lang.Class<T> multitype)
Get a multi service.
|
protected <T> IFuture<T> |
getRequiredService(RequiredServiceInfo info,
RequiredServiceBinding binding,
boolean rebind,
IAsyncFilter<T> filter)
Get a required service.
|
<T> IFuture<T> |
getRequiredService(java.lang.String name)
Get a required service of a given name.
|
<T> IFuture<T> |
getRequiredService(java.lang.String name,
boolean rebind)
Get a required service.
|
<T> IFuture<T> |
getRequiredService(java.lang.String name,
boolean rebind,
IAsyncFilter<T> filter)
Get a required service.
|
<T> IFuture<T> |
getRequiredService(java.lang.String name,
boolean rebind,
java.lang.String... tags)
Get a required service using tags.
|
protected IRequiredServiceFetcher |
getRequiredServiceFetcher(java.lang.String name)
Get a required service fetcher.
|
RequiredServiceInfo |
getRequiredServiceInfo(java.lang.String name)
Get a required service info.
|
RequiredServiceInfo[] |
getRequiredServiceInfos()
Get the required services.
|
protected <T> ITerminableIntermediateFuture<T> |
getRequiredServices(RequiredServiceInfo info,
RequiredServiceBinding binding,
boolean rebind,
IAsyncFilter<T> filter)
Get required services.
|
<T> ITerminableIntermediateFuture<T> |
getRequiredServices(java.lang.String name)
Get a required services of a given name.
|
<T> ITerminableIntermediateFuture<T> |
getRequiredServices(java.lang.String name,
boolean rebind)
Get a required services.
|
<T> ITerminableIntermediateFuture<T> |
getRequiredServices(java.lang.String name,
boolean rebind,
IAsyncFilter<T> filter)
Get a required services.
|
<T> ITerminableIntermediateFuture<T> |
getRequiredServices(java.lang.String name,
boolean rebind,
java.lang.String... tags)
Get a required services using tags.
|
boolean |
hasUserBody()
Check if the feature potentially executed user code in body.
|
IFuture<java.lang.Void> |
init()
Init the required services
|
<T> IFuture<T> |
searchService(java.lang.Class<T> type)
Get one service of a type.
|
<T> IFuture<T> |
searchService(java.lang.Class<T> type,
IComponentIdentifier cid)
Get one service of a type from a specific component.
|
<T> IFuture<T> |
searchService(java.lang.Class<T> type,
java.lang.String scope)
Get one service of a type.
|
<T> ITerminableIntermediateFuture<T> |
searchServices(java.lang.Class<T> type)
Get all services of a type.
|
<T> ITerminableIntermediateFuture<T> |
searchServices(java.lang.Class<T> type,
java.lang.String scope)
Get all services of a type.
|
void |
setRequiredServiceInfos(RequiredServiceInfo[] requiredservices)
Set the required services.
|
IFuture<java.lang.Void> |
shutdown()
Called when the feature is shutdowned.
|
protected java.util.Map<java.lang.String,IRequiredServiceFetcher> reqservicefetchers
protected java.util.Map<java.lang.String,RequiredServiceInfo> requiredserviceinfos
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 RequiredServiceInfo getRequiredServiceInfo(java.lang.String name)
getRequiredServiceInfo
in interface IRequiredServicesFeature
name
- The name.public RequiredServiceInfo[] getRequiredServiceInfos()
getRequiredServiceInfos
in interface IRequiredServicesFeature
public void setRequiredServiceInfos(RequiredServiceInfo[] requiredservices)
required
- services The required services to set.public <T> IFuture<T> getRequiredService(java.lang.String name)
getRequiredService
in interface IRequiredServicesFeature
name
- The service name.public <T> ITerminableIntermediateFuture<T> getRequiredServices(java.lang.String name)
getRequiredServices
in interface IRequiredServicesFeature
name
- The services name.public <T> IFuture<T> getRequiredService(java.lang.String name, boolean rebind)
getRequiredService
in interface IRequiredServicesFeature
name
- The required service name.rebind
- If false caches results.public <T> ITerminableIntermediateFuture<T> getRequiredServices(java.lang.String name, boolean rebind)
getRequiredServices
in interface IRequiredServicesFeature
name
- The required service name.rebind
- If false caches results.public <T> ITerminableIntermediateFuture<T> getRequiredServices(java.lang.String name, boolean rebind, IAsyncFilter<T> filter)
getRequiredServices
in interface IRequiredServicesFeature
name
- The required service name.rebind
- If false caches results.public <T> IFuture<T> getRequiredService(java.lang.String name, boolean rebind, java.lang.String... tags)
getRequiredService
in interface IRequiredServicesFeature
name
- The required service name.rebind
- If false caches results.tags
- The service tags.public <T> ITerminableIntermediateFuture<T> getRequiredServices(java.lang.String name, boolean rebind, java.lang.String... tags)
getRequiredServices
in interface IRequiredServicesFeature
name
- The required service name.rebind
- If false caches results.tags
- The service tags.public <T> T getMultiService(java.lang.String reqname, java.lang.Class<T> multitype)
reqname
- The required service name.multitype
- The interface of the multi service.protected <T> IFuture<T> getRequiredService(RequiredServiceInfo info, RequiredServiceBinding binding, boolean rebind, IAsyncFilter<T> filter)
protected <T> ITerminableIntermediateFuture<T> getRequiredServices(RequiredServiceInfo info, RequiredServiceBinding binding, boolean rebind, IAsyncFilter<T> filter)
public <T> IFuture<T> getRequiredService(java.lang.String name, boolean rebind, IAsyncFilter<T> filter)
getRequiredService
in interface IRequiredServicesFeature
name
- The required service name.rebind
- If false caches results.public <T> T getLastRequiredService(java.lang.String name)
getLastRequiredService
in interface IRequiredServicesFeature
name
- The required service name.public <T> java.util.Collection<T> getLastRequiredServices(java.lang.String name)
getLastRequiredServices
in interface IRequiredServicesFeature
name
- The required services name.public <T> IFuture<T> searchService(java.lang.Class<T> type)
searchService
in interface IRequiredServicesFeature
type
- The class.public <T> IFuture<T> searchService(java.lang.Class<T> type, java.lang.String scope)
searchService
in interface IRequiredServicesFeature
type
- The class.public <T> ITerminableIntermediateFuture<T> searchServices(java.lang.Class<T> type)
searchServices
in interface IRequiredServicesFeature
type
- The class.public <T> ITerminableIntermediateFuture<T> searchServices(java.lang.Class<T> type, java.lang.String scope)
searchServices
in interface IRequiredServicesFeature
type
- The class.public <T> IFuture<T> searchService(java.lang.Class<T> type, IComponentIdentifier cid)
searchService
in interface IRequiredServicesFeature
type
- The class.cid
- The component identifier of the target component.protected IRequiredServiceFetcher getRequiredServiceFetcher(java.lang.String name)
name
- The required service name.public IRequiredServiceFetcher createServiceFetcher(java.lang.String name)
public IComponentIdentifier getId()
public <T> ISubscriptionIntermediateFuture<T> addQuery(java.lang.Class<T> type, java.lang.String scope, IAsyncFilter<T> filter)
addQuery
in interface IRequiredServicesFeature
type
- The service type.scope
- The scope.filter
- The filter.