public boolean addingService(ServiceReference reference) {
return DependencyProperties.match(reference, m_dependency);
}
public void addedService(ServiceReference reference) {
ServiceRankingInterceptor interceptor = (ServiceRankingInterceptor) m_rankingInterceptorTracker
.getService(reference);
if (interceptor != null) {
setRankingInterceptor(interceptor);
} else {
m_dependency.getComponentInstance().getFactory().getLogger().log(Log.ERROR,
"Cannot retrieve the interceptor object from service reference " + reference
.getProperty(Constants.SERVICE_ID) + " - " + reference.getProperty
(Factory.INSTANCE_NAME_PROPERTY));
}
}
public void modifiedService(ServiceReference reference, Object service) {
// Not supported yet.
// TODO it would be nice to support the modification of the interceptor TARGET property.
}
public void removedService(ServiceReference reference, Object service) {
if (service == m_rankingInterceptor) {
m_rankingInterceptor.close(m_dependency);
// Do we have another one ?
ServiceReference anotherReference = m_rankingInterceptorTracker.getServiceReference();
if (anotherReference != null) {
ServiceRankingInterceptor interceptor = (ServiceRankingInterceptor) m_rankingInterceptorTracker
.getService(anotherReference);
if (interceptor != null) setRankingInterceptor(interceptor);
} else if (m_comparator != null) {
// If we have a comparator, we restore the comparator.
setComparator(m_comparator);