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
FieldsFields inherited from class org.osgi.util.tracker.BundleTracker
context -
Constructor Summary
ConstructorsConstructorDescriptionXmlDocumentBundleTracker(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 TypeMethodDescriptionfinal org.osgi.framework.BundleaddingBundle(org.osgi.framework.Bundle bundle, org.osgi.framework.BundleEvent event) final voidclose()final voidopen()final voidremovedBundle(org.osgi.framework.Bundle bundle, org.osgi.framework.BundleEvent event, org.osgi.framework.Bundle object) toString()Methods inherited from class org.osgi.util.tracker.BundleTracker
getBundles, getObject, getTracked, getTrackingCount, isEmpty, modifiedBundle, remove, size
-
Field Details
-
THREAD_POOL_NAME
- See Also:
-
-
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 registeringReadyMarkers- Throws:
IllegalArgumentException- if any of the arguments is null
-
-
Method Details
-
open
public final void open()- Overrides:
openin classorg.osgi.util.tracker.BundleTracker<org.osgi.framework.Bundle>
-
close
public final void close()- Overrides:
closein classorg.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:
addingBundlein interfaceorg.osgi.util.tracker.BundleTrackerCustomizer<T>- Overrides:
addingBundlein classorg.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:
removedBundlein interfaceorg.osgi.util.tracker.BundleTrackerCustomizer<T>- Overrides:
removedBundlein classorg.osgi.util.tracker.BundleTracker<org.osgi.framework.Bundle>
-
toString
-