The goal of this tutorial is to teach the use of service properties for advertising particular characteristics of an exported service, and the use of service filters to select the particular characteristics of an imported service.
Service properties are a useful way for a bundle to distinguish the services it registers from services of the same type that are registered by other bundles. Also, by registering service properties a service implementation is able to provided additional information without requiring the service interface to be changed to support a query API.
For a bundle that wishes to import a service, being able to select the particular registered service based on an LDAP filter is simpler than having to acquire every service of a particular type and query them via an API. An LDAP filter can be arbitrarily complicated and SAT ensures that it is applied whenever they change or when the registered services are changed or modify their registered service properties.
After completing this tutorial you will have an understanding of how to register exported services with properties, and how to acquire imported services using an LDAP filter.
Before you start this tutorial you should have:
The diagram on the right shows the topology of the tutorial application.
VendorService is now registered with a property that
describes the spiciness of the food that it sells.
VendorService with a spiciness property of
10.
VendorService with a spiciness property of
3.
VendorService that has a
registered spiciness property of less than or equal
to 8.
This tutorial consists of the following steps:
VendorService with
properties, as well as by bundles that import a
VendorService using an LDAP filter.
VendorService with a service property that describes
its spiciness.
VendorService with a service property that describes
its spiciness.
VendorService using an LDAP
filter that specifies a spiciness property.
The source projects for this tutorial are available as a zip file that may be extracted into the file system and imported into your Eclipse workspace.
Copyright © 2001, 2008 IBM Corporation and others. All Rights Reserved.