Class MultiPropertyFilterIndex

java.lang.Object
org.apache.felix.dm.impl.index.multiproperty.MultiPropertyFilterIndex
All Implemented Interfaces:
FilterIndex, ServiceTrackerCustomizer

public class MultiPropertyFilterIndex extends Object implements FilterIndex, ServiceTrackerCustomizer
Author:
Felix Project Team
  • Constructor Details

    • MultiPropertyFilterIndex

      public MultiPropertyFilterIndex(String configString)
  • Method Details

    • isApplicable

      public boolean isApplicable(String clazz, String filterString)
      Description copied from interface: FilterIndex
      Determines if the combination of class and filter is applicable for this filter index.
      Specified by:
      isApplicable in interface FilterIndex
    • isApplicable

      public boolean isApplicable(org.osgi.framework.ServiceReference ref)
    • getProperties

      protected Collection<Property> getProperties()
    • createKeyFromFilter

      protected MultiPropertyKey createKeyFromFilter(String clazz, String filterString)
    • createKeys

      public List<MultiPropertyKey> createKeys(org.osgi.framework.ServiceReference reference)
    • toKey

      protected MultiPropertyKey toKey(String key, List<String> values)
    • toKey

      protected MultiPropertyKey toKey(String key, Object value)
    • addingService

      public Object addingService(org.osgi.framework.ServiceReference reference)
      Description copied from interface: ServiceTrackerCustomizer
      A service is being added to the ServiceTracker.

      This method is called before a service which matched the search parameters of the ServiceTracker is added to the ServiceTracker. This method should return the service object to be tracked for the specified ServiceReference. The returned service object is stored in the ServiceTracker and is available from the getService and getServices methods.

      Specified by:
      addingService in interface ServiceTrackerCustomizer
      Parameters:
      reference - The reference to the service being added to the ServiceTracker.
      Returns:
      The service object to be tracked for the specified referenced service or null if the specified referenced service should not be tracked.
    • addedService

      public void addedService(org.osgi.framework.ServiceReference reference, Object service)
      Description copied from interface: ServiceTrackerCustomizer
      marrs: A service has been added to the ServiceTracker.
      Specified by:
      addedService in interface ServiceTrackerCustomizer
    • modifiedService

      public void modifiedService(org.osgi.framework.ServiceReference reference, Object service)
      Description copied from interface: ServiceTrackerCustomizer
      A service tracked by the ServiceTracker has been modified.

      This method is called when a service being tracked by the ServiceTracker has had it properties modified.

      Specified by:
      modifiedService in interface ServiceTrackerCustomizer
      Parameters:
      reference - The reference to the service that has been modified.
      service - The service object for the specified referenced service.
    • removedService

      public void removedService(org.osgi.framework.ServiceReference reference, Object service)
      Description copied from interface: ServiceTrackerCustomizer
      A service tracked by the ServiceTracker has been removed.

      This method is called after a service is no longer being tracked by the ServiceTracker.

      Specified by:
      removedService in interface ServiceTrackerCustomizer
      Parameters:
      reference - The reference to the service that has been removed.
      service - The service object for the specified referenced service.
    • handleServiceAdd

      protected void handleServiceAdd(org.osgi.framework.ServiceReference reference)
    • handleServicePropertiesChange

      protected void handleServicePropertiesChange(org.osgi.framework.ServiceReference reference)
    • handleServiceRemove

      protected void handleServiceRemove(org.osgi.framework.ServiceReference reference)
    • shouldBeIndexed

      protected boolean shouldBeIndexed(org.osgi.framework.ServiceReference reference)
    • open

      public void open(org.osgi.framework.BundleContext context)
      Description copied from interface: FilterIndex
      Opens this filter index.
      Specified by:
      open in interface FilterIndex
    • close

      public void close()
      Description copied from interface: FilterIndex
      Closes this filter index.
      Specified by:
      close in interface FilterIndex
    • getAllServiceReferences

      public List<org.osgi.framework.ServiceReference> getAllServiceReferences(String clazz, String filter)
      Description copied from interface: FilterIndex
      Returns all service references that match the specified class and filter. Never returns null.
      Specified by:
      getAllServiceReferences in interface FilterIndex
    • serviceChanged

      public void serviceChanged(org.osgi.framework.ServiceEvent event)
      Description copied from interface: FilterIndex
      Invoked whenever a service event occurs.
      Specified by:
      serviceChanged in interface FilterIndex
    • addServiceListener

      public void addServiceListener(org.osgi.framework.ServiceListener listener, String filter)
      Description copied from interface: FilterIndex
      Adds a service listener to this filter index.
      Specified by:
      addServiceListener in interface FilterIndex
    • removeServiceListener

      public void removeServiceListener(org.osgi.framework.ServiceListener listener)
      Description copied from interface: FilterIndex
      Removes a service listener from this filter index. If the listener is not present in the filter index, this method does nothing.
      Specified by:
      removeServiceListener in interface FilterIndex
    • getServiceListeners

      protected Collection<org.osgi.framework.ServiceListener> getServiceListeners()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • swappedService

      public void swappedService(org.osgi.framework.ServiceReference reference, Object service, org.osgi.framework.ServiceReference newReference, Object newService)
      Description copied from interface: ServiceTrackerCustomizer
      A service tracked by the ServiceTracker has an aspect service added or removed for a tracked service.

      This method is called when an aspect service has been either added or removed for a tracked service. This method will only be called when there's a new highest ranked service as result of adding or removal of the aspect service. In this case the previously highest ranked service is 'swapped' for the new highest ranked service ensuring the client always gets the highest ranked aspect.

      Specified by:
      swappedService in interface ServiceTrackerCustomizer
      Parameters:
      reference - The reference for the old highest ranked service.
      service - The service object for the old highest ranked service.
      newReference - The reference to the new highest ranked service.
      newService - The service object for the new highest ranked service.