Open main menu

CDOT Wiki β

Changes

OSGi : Develop Simple Apps

238 bytes added, 23:48, 22 January 2011
no edit summary
1. Look for the service reference in the bundle context:
 
The Framework returns ''ServiceReference'' objects from the ''BundleContext.getServiceReference'' method.
A ''ServiceReference'' object may be shared between bundles and can be used:
1. to examine the properties of the service
2. to get the service object.
 
<b>ServiceReference reference = context.getServiceReference(BookFinder.class.getName());</b>
/** The Framework returns ''ServiceReference'' objects from the ''BundleContext.getServiceReference'' method. A ''ServiceReference'' object may be shared between bundles and can be used: 1. to examine the properties of the service 2. to get the service object. */
2.Look for the service object referenced by the specified ''ServiceReference'' object, namely the ''reference'' variable obtained at the first step. if (reference != null) <b> finderService = (BookFinder) context.getService(reference);</b>