Class XmlDocumentBundleTracker<T>

java.lang.Object
org.osgi.util.tracker.BundleTracker<org.osgi.framework.Bundle>
org.openhab.core.config.core.xml.osgi.XmlDocumentBundleTracker<T>
Type Parameters:
T - the result type of the conversion
All Implemented Interfaces:
org.osgi.util.tracker.BundleTrackerCustomizer<org.osgi.framework.Bundle>

@NonNullByDefault public class XmlDocumentBundleTracker<@NonNull T> extends org.osgi.util.tracker.BundleTracker<org.osgi.framework.Bundle>
The XmlDocumentBundleTracker tracks files in the specified XML folder of modules and tries to parse them as XML file with the specified XmlDocumentReader. Any converted XML files are assigned to its according bundle and added to an XmlDocumentProvider for further processing. For each module an own XmlDocumentProvider is created by using the specified XmlDocumentProviderFactory.
Author:
Michael Grammling - Initial contribution, Benedikt Niehues - Changed resource handling so that resources can be patched by fragments., Simon Kaufmann - Tracking of remaining bundles, Markus Rathgeb - Harden the usage
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

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

    context
  • Constructor Summary

    Constructors
    Constructor
    Description
    XmlDocumentBundleTracker(org.osgi.framework.BundleContext bundleContext, String xmlDirectory, XmlDocumentReader<@NonNull T> xmlDocumentTypeReader, XmlDocumentProviderFactory<@NonNull T> xmlDocumentProviderFactory, String readyMarkerKey, ReadyService readyService)
    Creates a new instance of this class with the specified parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    final org.osgi.framework.Bundle
    addingBundle(org.osgi.framework.Bundle bundle, org.osgi.framework.BundleEvent event)
     
    final void
     
    final void
     
    final void
    removedBundle(org.osgi.framework.Bundle bundle, org.osgi.framework.BundleEvent event, org.osgi.framework.Bundle object)
     
     

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

    getBundles, getObject, getTracked, getTrackingCount, isEmpty, modifiedBundle, remove, size

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • XmlDocumentBundleTracker

      public XmlDocumentBundleTracker(org.osgi.framework.BundleContext bundleContext, String xmlDirectory, XmlDocumentReader<@NonNull T> xmlDocumentTypeReader, XmlDocumentProviderFactory<@NonNull T> xmlDocumentProviderFactory, String readyMarkerKey, ReadyService readyService) throws IllegalArgumentException
      Creates a new instance of this class with the specified parameters.
      Parameters:
      bundleContext - the bundle context to be used for tracking bundles (must not be null)
      xmlDirectory - the directory to search for XML files (must neither be null, nor empty)
      xmlDocumentTypeReader - the XML converter to be used (must not be null)
      xmlDocumentProviderFactory - the result object processor to be used (must not be null)
      readyMarkerKey - the key to use for registering ReadyMarkers
      Throws:
      IllegalArgumentException - if any of the arguments is null
  • Method Details

    • open

      public final void open()
      Overrides:
      open in class org.osgi.util.tracker.BundleTracker<org.osgi.framework.Bundle>
    • close

      public final void close()
      Overrides:
      close in class org.osgi.util.tracker.BundleTracker<org.osgi.framework.Bundle>
    • addingBundle

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

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

      public String toString()
      Overrides:
      toString in class Object