public abstract class BaseTracker<S> extends org.osgi.util.tracker.ServiceTracker<S,ConfigurationMap<?>>
BaseTracker is the base class for tracking
ManagedService and ManagedServiceFactory
services. It maps their ServiceRegistration to the
ConfigurationMap mapping their service PIDs to provided
configuration.| Modifier and Type | Field and Description |
|---|---|
protected ConfigurationManager |
cm |
| Modifier | Constructor and Description |
|---|---|
protected |
BaseTracker(ConfigurationManager cm,
boolean managedServiceFactory) |
| Modifier and Type | Method and Description |
|---|---|
ConfigurationMap<?> |
addingService(org.osgi.framework.ServiceReference<S> reference) |
protected abstract ConfigurationMap<?> |
createConfigurationMap(java.lang.String[] pids) |
protected java.security.AccessControlContext |
getAccessControlContext(java.lang.Object ref) |
protected java.util.Dictionary |
getProperties(java.util.Dictionary<java.lang.String,?> rawProperties,
org.osgi.framework.ServiceReference service,
java.lang.String configPid,
java.lang.String factoryPid) |
protected S |
getRealService(org.osgi.framework.ServiceReference<S> reference) |
abstract java.lang.String |
getServicePid(org.osgi.framework.ServiceReference<S> service,
TargetedPID pid)
Returns the String to be used as the PID of the service PID for the
pid retrieved from the configuration. |
java.util.List<org.osgi.framework.ServiceReference<S>> |
getServices(TargetedPID pid) |
protected void |
handleCallBackError(java.lang.Throwable error,
org.osgi.framework.ServiceReference target,
TargetedPID pid) |
void |
modifiedService(org.osgi.framework.ServiceReference<S> reference,
ConfigurationMap<?> service) |
abstract void |
provideConfiguration(org.osgi.framework.ServiceReference<S> service,
TargetedPID configPid,
TargetedPID factoryPid,
java.util.Dictionary<java.lang.String,?> properties,
long revision,
ConfigurationMap<?> configurationMap)
Updates the given service with the provided configuration.
|
abstract void |
removeConfiguration(org.osgi.framework.ServiceReference<S> service,
TargetedPID configPid,
TargetedPID factoryPid)
Remove the configuration indicated by the
configPid from
the service. |
void |
removedService(org.osgi.framework.ServiceReference<S> reference,
ConfigurationMap<?> service) |
protected void |
ungetRealService(org.osgi.framework.ServiceReference<S> reference) |
protected final ConfigurationManager cm
protected BaseTracker(ConfigurationManager cm, boolean managedServiceFactory)
public ConfigurationMap<?> addingService(org.osgi.framework.ServiceReference<S> reference)
addingService in interface org.osgi.util.tracker.ServiceTrackerCustomizer<S,ConfigurationMap<?>>addingService in class org.osgi.util.tracker.ServiceTracker<S,ConfigurationMap<?>>public void modifiedService(org.osgi.framework.ServiceReference<S> reference, ConfigurationMap<?> service)
modifiedService in interface org.osgi.util.tracker.ServiceTrackerCustomizer<S,ConfigurationMap<?>>modifiedService in class org.osgi.util.tracker.ServiceTracker<S,ConfigurationMap<?>>public void removedService(org.osgi.framework.ServiceReference<S> reference, ConfigurationMap<?> service)
removedService in interface org.osgi.util.tracker.ServiceTrackerCustomizer<S,ConfigurationMap<?>>removedService in class org.osgi.util.tracker.ServiceTracker<S,ConfigurationMap<?>>public final java.util.List<org.osgi.framework.ServiceReference<S>> getServices(TargetedPID pid)
protected abstract ConfigurationMap<?> createConfigurationMap(java.lang.String[] pids)
public abstract java.lang.String getServicePid(org.osgi.framework.ServiceReference<S> service, TargetedPID pid)
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.
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 abstract void provideConfiguration(org.osgi.framework.ServiceReference<S> service, TargetedPID configPid, TargetedPID factoryPid, java.util.Dictionary<java.lang.String,?> properties, long revision, ConfigurationMap<?> configurationMap)
See the implementations of this method for more information.
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.configurationMap - The PID to configuration map for PIDs
used by the service to updateManagedServiceTracker.provideConfiguration(ServiceReference, TargetedPID, TargetedPID, Dictionary, long, ConfigurationMap),
ManagedServiceFactoryTracker.provideConfiguration(ServiceReference, TargetedPID, TargetedPID, Dictionary, long, ConfigurationMap)public abstract void removeConfiguration(org.osgi.framework.ServiceReference<S> service, TargetedPID configPid, TargetedPID factoryPid)
configPid from
the service.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.protected final void ungetRealService(org.osgi.framework.ServiceReference<S> reference)
protected final java.util.Dictionary getProperties(java.util.Dictionary<java.lang.String,?> rawProperties,
org.osgi.framework.ServiceReference service,
java.lang.String configPid,
java.lang.String factoryPid)
protected final void handleCallBackError(java.lang.Throwable error,
org.osgi.framework.ServiceReference target,
TargetedPID pid)
protected java.security.AccessControlContext getAccessControlContext(java.lang.Object ref)
Copyright © 2006-2015 The Apache Software Foundation. All Rights Reserved.