public final class ServiceBindings extends Object implements BindingPublisher
Binding
s from the OSGi service registry.Constructor and Description |
---|
ServiceBindings(org.osgi.framework.BundleContext context)
Creates new publisher of service bindings, using the given OSGi
BundleContext to track services.Uses default allow/ignore settings and assigns any published services the lowest possible ranking. |
ServiceBindings(org.osgi.framework.BundleContext context,
String allow,
String ignore,
int maxRank)
Creates new publisher of service bindings, using the given OSGi
BundleContext to track services.The globbed patterns control whether tracking requests for particular types are allowed or ignored. Any published bindings are ranked according to their service ranking (up to the given maximum). |
Modifier and Type | Method and Description |
---|---|
static String |
defaultAllow() |
static String |
defaultIgnore() |
int |
maxBindingRank()
Estimates the maximum rank this publisher may assign to a
Binding . |
<T> void |
subscribe(BindingSubscriber<T> subscriber)
Subscribes the given
BindingSubscriber to receive Binding s. |
<T> void |
unsubscribe(BindingSubscriber<T> subscriber)
Stops the given
BindingSubscriber from receiving Binding s. |
public ServiceBindings(org.osgi.framework.BundleContext context, String allow, String ignore, int maxRank)
BundleContext
to track services.context
- The tracking contextallow
- Globbed pattern of packages/types to allowignore
- Globbed pattern of packages/types to ignoremaxRank
- Maximum binding rankpublic ServiceBindings(org.osgi.framework.BundleContext context)
BundleContext
to track services.context
- The tracking contextpublic static String defaultAllow()
org.eclipse.sisu.osgi.ServiceBindings.allow} system property
public static String defaultIgnore()
org.eclipse.sisu.osgi.ServiceBindings.ignore} system property
public <T> void subscribe(BindingSubscriber<T> subscriber)
BindingPublisher
BindingSubscriber
to receive Binding
s.subscribe
in interface BindingPublisher
subscriber
- The subscriberpublic <T> void unsubscribe(BindingSubscriber<T> subscriber)
BindingPublisher
BindingSubscriber
from receiving Binding
s.unsubscribe
in interface BindingPublisher
subscriber
- The subscriberpublic int maxBindingRank()
BindingPublisher
Binding
.maxBindingRank
in interface BindingPublisher
Copyright © 2022. All rights reserved.