Previous Topic

Next Topic

Book Contents

Book Index

Wire Admin Service

The goal of the OSGi Wire Admin Service is to enable services that generate some sort of data to send it to the services interested in the same data.

Overview

The data can be updated dynamically so that the interested services can receive the new values regularly. The Wire Admin Service provides configuration data (in the OSGi Configuration Admin Service) through which new virtual connections (known as wires) can be established when a new service needs to receive the data output. Useless wires can easily be removed. The main advantage of using the Wire Admin service is that it decreases the need for wired bundles to have context-specific knowledge about the opposite party. They never need to communicate with each other directly but through the Wire Admin Service.

A typical data-producing service can be, for example, one that represents some physical device. It produces information about its current status. Typical data-consumers can be detectors, gauges, user interfaces, etc.

Each service which is supposed to produce some data output is referred to as producer. A producer must register the org.osgi.service.wireadmin.Producer interface. Details about creating producers and working with them are available in the Creating a Producer Service guide.

The service which is supposed to consume the produced data is called consumer. A consumer must be registered under the org.osgi.service.wireadmin.Consumer interface. A consumer for some data type can also be a producer for another data type. More information about consumers is available in Creating a Consumer Service guide.

In the most common case, there should be a separate producer/consumer couple for each type of transferred information. However, when there are too many data flows to be handled, it is possible for a producer to be responsible for the generation of several data types, and for a consumer to receive more than one information type. These are called composite producer and composite consumer respectively. They are described in more details in Creating Composite Producers and/or Consumers guide.

Data type does not mean the Java object class of the transferred information! Data type refers to the logical description of the information, for example: door lock status, camera status, etc. The Java object classes that wrap the data are known as flavors.

The wire between a consumer and producer couple is represented by an org.osgi.service.wireadmin.Wire object, created by the Wire Admin. A wire is never opened automatically but when the user explicitly requests it (refer to Creating Wires for details). More than one wire may be opened between a producer/consumer couple. By default, the data sent across the wire is filtered by the Wire object itself. Filtering in this case implies the rate at which new data will be delivered (there could be time-based and value-based filters with LDAP syntax). The filtering can also be handled by the producer itself. In such case, the Wire object does not perform any filtering. Both filtering ways are described in the Filtering the Data Output guide.

All wires are managed by the Wire Admin service. It is the sole party that can create, delete or update wires. Producers and consumers do not have the right to manage wires.

Producers, consumers and wires can have different registration properties which distinguish them and allow them to be obtained through LDAP filtering. These properties are defined as constants in org.osgi.service.wireadmin.WireConstants. In addition, both consumers and producers must have the org.osgi.framework.Constants.SERVICE_PID ("service.pid") property.

Registering Bundle

The service is registered by OSGi Wire Admin Bundle.