Class AbstractServiceBundleTracker

java.lang.Object
org.osgi.util.tracker.BundleTracker<org.osgi.framework.Bundle>
org.openhab.core.service.AbstractServiceBundleTracker
All Implemented Interfaces:
ReadyService.ReadyTracker, org.osgi.util.tracker.BundleTrackerCustomizer<org.osgi.framework.Bundle>

@NonNullByDefault public abstract class AbstractServiceBundleTracker extends org.osgi.util.tracker.BundleTracker<org.osgi.framework.Bundle> implements ReadyService.ReadyTracker
The AbstractServiceBundleTracker tracks a set of bundles (selected isRelevantBundle(Bundle) and sets the readyMarker when all registered bundles are active
Author:
Jan N. Klug - Initial contribution
  • Field Summary

    Fields inherited from class org.osgi.util.tracker.BundleTracker

    context
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractServiceBundleTracker(ReadyService readyService, org.osgi.framework.BundleContext bc, ReadyMarker readyMarker)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.osgi.framework.Bundle
    addingBundle(org.osgi.framework.Bundle bundle, @Nullable org.osgi.framework.BundleEvent event)
     
    void
     
    protected abstract boolean
    isRelevantBundle(org.osgi.framework.Bundle bundle)
    Decide if a bundle should be tracked by this bundle tracker
    void
    modifiedBundle(org.osgi.framework.Bundle bundle, @Nullable org.osgi.framework.BundleEvent event, org.osgi.framework.Bundle object)
     
    void
    Gets called when a new ReadyMarker was registered as being "ready".
    void
    Gets called when a ReadyMarker was unregistered.
    void
    removedBundle(org.osgi.framework.Bundle bundle, @Nullable org.osgi.framework.BundleEvent event, org.osgi.framework.Bundle object)
     

    Methods inherited from class org.osgi.util.tracker.BundleTracker

    close, getBundles, getObject, getTracked, getTrackingCount, isEmpty, open, remove, size

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractServiceBundleTracker

      public AbstractServiceBundleTracker(ReadyService readyService, org.osgi.framework.BundleContext bc, ReadyMarker readyMarker)
  • Method Details

    • deactivate

      public void deactivate() throws Exception
      Throws:
      Exception
    • addingBundle

      public org.osgi.framework.Bundle addingBundle(@NonNullByDefault({}) org.osgi.framework.Bundle bundle, @Nullable org.osgi.framework.BundleEvent event)
      Specified by:
      addingBundle in interface org.osgi.util.tracker.BundleTrackerCustomizer<org.osgi.framework.Bundle>
      Overrides:
      addingBundle in class org.osgi.util.tracker.BundleTracker<org.osgi.framework.Bundle>
    • modifiedBundle

      public void modifiedBundle(@NonNullByDefault({}) org.osgi.framework.Bundle bundle, @Nullable org.osgi.framework.BundleEvent event, @NonNullByDefault({}) org.osgi.framework.Bundle object)
      Specified by:
      modifiedBundle in interface org.osgi.util.tracker.BundleTrackerCustomizer<org.osgi.framework.Bundle>
      Overrides:
      modifiedBundle in class org.osgi.util.tracker.BundleTracker<org.osgi.framework.Bundle>
    • removedBundle

      public void removedBundle(@NonNullByDefault({}) org.osgi.framework.Bundle bundle, @Nullable org.osgi.framework.BundleEvent event, @NonNullByDefault({}) org.osgi.framework.Bundle object)
      Specified by:
      removedBundle in interface org.osgi.util.tracker.BundleTrackerCustomizer<org.osgi.framework.Bundle>
      Overrides:
      removedBundle in class org.osgi.util.tracker.BundleTracker<org.osgi.framework.Bundle>
    • onReadyMarkerAdded

      public void onReadyMarkerAdded(ReadyMarker readyMarker)
      Description copied from interface: ReadyService.ReadyTracker
      Gets called when a new ReadyMarker was registered as being "ready".
      Specified by:
      onReadyMarkerAdded in interface ReadyService.ReadyTracker
    • onReadyMarkerRemoved

      public void onReadyMarkerRemoved(ReadyMarker readyMarker)
      Description copied from interface: ReadyService.ReadyTracker
      Gets called when a ReadyMarker was unregistered.
      Specified by:
      onReadyMarkerRemoved in interface ReadyService.ReadyTracker
    • isRelevantBundle

      protected abstract boolean isRelevantBundle(org.osgi.framework.Bundle bundle)
      Decide if a bundle should be tracked by this bundle tracker
      Parameters:
      bundle - the bundle
      Returns:
      true if the bundle should be considered, false otherwise