Package org.openhab.core.service
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
ConstructorDescriptionAbstractServiceBundleTracker
(ReadyService readyService, org.osgi.framework.BundleContext bc, ReadyMarker readyMarker) -
Method Summary
Modifier and TypeMethodDescriptionorg.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 trackervoid
modifiedBundle
(org.osgi.framework.Bundle bundle, @Nullable org.osgi.framework.BundleEvent event, org.osgi.framework.Bundle object) void
onReadyMarkerAdded
(ReadyMarker readyMarker) Gets called when a newReadyMarker
was registered as being "ready".void
onReadyMarkerRemoved
(ReadyMarker readyMarker) Gets called when aReadyMarker
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
-
Constructor Details
-
AbstractServiceBundleTracker
public AbstractServiceBundleTracker(ReadyService readyService, org.osgi.framework.BundleContext bc, ReadyMarker readyMarker)
-
-
Method Details
-
deactivate
- 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 interfaceorg.osgi.util.tracker.BundleTrackerCustomizer<org.osgi.framework.Bundle>
- Overrides:
addingBundle
in classorg.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 interfaceorg.osgi.util.tracker.BundleTrackerCustomizer<org.osgi.framework.Bundle>
- Overrides:
modifiedBundle
in classorg.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 interfaceorg.osgi.util.tracker.BundleTrackerCustomizer<org.osgi.framework.Bundle>
- Overrides:
removedBundle
in classorg.osgi.util.tracker.BundleTracker<org.osgi.framework.Bundle>
-
onReadyMarkerAdded
Description copied from interface:ReadyService.ReadyTracker
Gets called when a newReadyMarker
was registered as being "ready".- Specified by:
onReadyMarkerAdded
in interfaceReadyService.ReadyTracker
-
onReadyMarkerRemoved
Description copied from interface:ReadyService.ReadyTracker
Gets called when aReadyMarker
was unregistered.- Specified by:
onReadyMarkerRemoved
in interfaceReadyService.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
-