Class XmlDocumentBundleTracker<T>

  • Type Parameters:
    T - the result type of the conversion
    All Implemented Interfaces:
    org.osgi.util.tracker.BundleTrackerCustomizer<org.osgi.framework.Bundle>

    public class XmlDocumentBundleTracker<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
    • Constructor Detail

      • XmlDocumentBundleTracker

        public XmlDocumentBundleTracker​(org.osgi.framework.BundleContext bundleContext,
                                        String xmlDirectory,
                                        XmlDocumentReader<T> xmlDocumentTypeReader,
                                        XmlDocumentProviderFactory<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 Detail

      • 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​(org.osgi.framework.Bundle bundle,
                                                            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​(org.osgi.framework.Bundle bundle,
                                        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>