public final class

ServiceBindings

extends Object
implements BindingPublisher
java.lang.Object
   ↳ org.eclipse.sisu.osgi.ServiceBindings

Class Overview

On-demand publisher of Bindings from the OSGi service registry.

Summary

Public Constructors
ServiceBindings(BundleContext context, String allow, String ignore, int maxRank)
Creates new publisher of service bindings, using the given OSGi BundleContext to track services.
ServiceBindings(BundleContext context)
Creates new publisher of service bindings, using the given OSGi BundleContext to track services.
Public Methods
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 Bindings.
<T> void unsubscribe(BindingSubscriber<T> subscriber)
Stops the given BindingSubscriber from receiving Bindings.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.eclipse.sisu.inject.BindingPublisher

Public Constructors

public ServiceBindings (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).

Parameters
context The tracking context
allow Globbed pattern of packages/types to allow
ignore Globbed pattern of packages/types to ignore
maxRank Maximum binding rank

public ServiceBindings (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.

Parameters
context The tracking context

Public Methods

public static String defaultAllow ()

Returns
  • Globbed pattern of types to allow
See Also
  • org.eclipse.sisu.osgi.ServiceBindings.allow system property

public static String defaultIgnore ()

Returns
  • Globbed pattern of types to ignore
See Also
  • org.eclipse.sisu.osgi.ServiceBindings.ignore system property

public int maxBindingRank ()

Estimates the maximum rank this publisher may assign to a Binding.

Returns
  • Maximum binding rank

public void subscribe (BindingSubscriber<T> subscriber)

Subscribes the given BindingSubscriber to receive Bindings.

Parameters
subscriber The subscriber

public void unsubscribe (BindingSubscriber<T> subscriber)

Stops the given BindingSubscriber from receiving Bindings.

Parameters
subscriber The subscriber