Package org.apache.sling.commons.osgi
Class SortingServiceTracker<T>
- java.lang.Object
-
- org.osgi.util.tracker.ServiceTracker<T,T>
-
- org.apache.sling.commons.osgi.SortingServiceTracker<T>
-
- All Implemented Interfaces:
ServiceTrackerCustomizer<T,T>
public class SortingServiceTracker<T> extends ServiceTracker<T,T>
Implementation providing a sorted list of services by service ranking.
-
-
Constructor Summary
Constructors Constructor Description SortingServiceTracker(BundleContext context, java.lang.String clazz)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
addingService(ServiceReference<T> reference)
java.util.List<ServiceReference<T>>
getSortedServiceReferences()
Return a sorted list of the services references.java.util.List<T>
getSortedServices()
Return a sorted list of the services.void
modifiedService(ServiceReference<T> reference, T service)
void
removedService(ServiceReference<T> reference, T service)
-
Methods inherited from class org.osgi.util.tracker.ServiceTracker
close, getService, getService, getServiceReference, getServiceReferences, getServices, getServices, getTracked, getTrackingCount, isEmpty, open, open, remove, size, waitForService
-
-
-
-
Constructor Detail
-
SortingServiceTracker
public SortingServiceTracker(BundleContext context, java.lang.String clazz)
Constructor- Parameters:
context
- Bundle contextclazz
- Class
-
-
Method Detail
-
removedService
public void removedService(ServiceReference<T> reference, T service)
- Specified by:
removedService
in interfaceServiceTrackerCustomizer<T,T>
- Overrides:
removedService
in classServiceTracker<T,T>
- See Also:
ServiceTracker.removedService(org.osgi.framework.ServiceReference, java.lang.Object)
-
modifiedService
public void modifiedService(ServiceReference<T> reference, T service)
- Specified by:
modifiedService
in interfaceServiceTrackerCustomizer<T,T>
- Overrides:
modifiedService
in classServiceTracker<T,T>
- See Also:
ServiceTrackerCustomizer.modifiedService(org.osgi.framework.ServiceReference, java.lang.Object)
-
addingService
public T addingService(ServiceReference<T> reference)
- Specified by:
addingService
in interfaceServiceTrackerCustomizer<T,T>
- Overrides:
addingService
in classServiceTracker<T,T>
- See Also:
ServiceTrackerCustomizer.addingService(org.osgi.framework.ServiceReference)
-
getSortedServices
public java.util.List<T> getSortedServices()
Return a sorted list of the services.- Returns:
- Service list
-
getSortedServiceReferences
public java.util.List<ServiceReference<T>> getSortedServiceReferences()
Return a sorted list of the services references.- Returns:
- Service list
-
-