public class ManagedServiceTracker extends BaseTracker<org.osgi.service.cm.ManagedService>
cm
Constructor and Description |
---|
ManagedServiceTracker(ConfigurationManager cm) |
Modifier and Type | Method and Description |
---|---|
protected ConfigurationMap<?> |
createConfigurationMap(String[] pids) |
String |
getServicePid(org.osgi.framework.ServiceReference<org.osgi.service.cm.ManagedService> service,
TargetedPID pid)
Returns the String to be used as the PID of the service PID for the
pid retrieved from the configuration. |
void |
provideConfiguration(org.osgi.framework.ServiceReference<org.osgi.service.cm.ManagedService> service,
TargetedPID configPid,
TargetedPID factoryPid,
Dictionary<String,?> properties,
long revision,
ConfigurationMap<?> configs)
Provides the given configuration to the managed service.
|
void |
removeConfiguration(org.osgi.framework.ServiceReference<org.osgi.service.cm.ManagedService> service,
TargetedPID configPid,
TargetedPID factoryPid)
Remove the configuration indicated by the
configPid from
the service. |
addingService, getProperties, getRealService, getServices, handleCallBackError, modifiedService, removedService, ungetRealService
public ManagedServiceTracker(ConfigurationManager cm)
protected ConfigurationMap<?> createConfigurationMap(String[] pids)
createConfigurationMap
in class BaseTracker<org.osgi.service.cm.ManagedService>
public String getServicePid(org.osgi.framework.ServiceReference<org.osgi.service.cm.ManagedService> service, TargetedPID pid)
BaseTracker
pid
retrieved from the configuration.
This method will return TargetedPID.getServicePid()
most of
the time except if the service PID used for the consumer's service
registration contains one or more pipe symbols (|). In this case
TargetedPID.getRawPid()
might be returned.
getServicePid
in class BaseTracker<org.osgi.service.cm.ManagedService>
service
- The reference ot the service for which the service
PID is to be returned.pid
- The TargetedPID
for which to return the service
PID.null
if the service does not
respond to the targeted PID at all.public void provideConfiguration(org.osgi.framework.ServiceReference<org.osgi.service.cm.ManagedService> service, TargetedPID configPid, TargetedPID factoryPid, Dictionary<String,?> properties, long revision, ConfigurationMap<?> configs)
Depending on targeted PIDs this configuration may not actually be provided if the service already has more strictly binding configuration from a targeted configuration bound.
If the revision is a negative value, the provided configuration is assigned to the ManagedService in any case without further checks. This allows a replacement configuration for a deleted or invisible configuration to be assigned without first removing the deleted or invisible configuration.
provideConfiguration
in class BaseTracker<org.osgi.service.cm.ManagedService>
service
- The reference to the service to updateconfigPid
- The targeted configuration PIDfactoryPid
- The targeted factory PID or null
for
a non-factory configurationproperties
- The configuration properties, which may be
null
if this is the provisioning call upon
service registration of a ManagedServicerevision
- The configuration revision or -1 if there is no
configuration actually to provide.configs
- The PID to configuration map for PIDs
used by the service to updateprovideConfiguration(ServiceReference, TargetedPID, TargetedPID, Dictionary, long, ConfigurationMap)
,
ManagedServiceFactoryTracker.provideConfiguration(ServiceReference, TargetedPID, TargetedPID, Dictionary, long, ConfigurationMap)
public void removeConfiguration(org.osgi.framework.ServiceReference<org.osgi.service.cm.ManagedService> service, TargetedPID configPid, TargetedPID factoryPid)
BaseTracker
configPid
from
the service.removeConfiguration
in class BaseTracker<org.osgi.service.cm.ManagedService>
service
- The reference to the service from which the
configuration is to be removed.configPid
- The TargetedPID
of the configurationfactoryPid
- The factory PID
of the
configuration. This may be null
for a non-factory
configuration.Copyright © 2006–2017 The Apache Software Foundation. All rights reserved.