Dear all, Can someone help me shed light on the Device Access service? There are a couple of things I do not understand:
1) P. 50-51 of the OSGi Service Compendium R4 gives a example of a driver for a "WidgetDevice" device service. The code of the SerialWidgetDriver class seems to imply that before this class is instantiated, someone else has already registered a WidgetDevice service. Who is this someone else? 2) How does the implementation of the WidgetDevice service "know" which driver to use? The SerialWidgetDriver.attach() method takes a ServiceReference as an argument, so there is no way for the driver to tell (say) WidgetServiceImpl "hi, you can use me to access the serial port now". All I see is that the SerialWidget class provides a serial access service to any bundle in the framework, not just to WidgetServiceImpl. This is odd because it seems to imply that even though SerialWidgetDriver.attach() has been succesfully called, WidgetServiceImpl must still on his own discover a serial access service that it can use. 3) On p. 50, will the addingService() method be called upon instantiation, even though the WidgetDevice service is already registered (usually) when SerialWidget is instantiated? I mean, this is the normal chain of events as I understand it: - The Force registers a WidgetDevice service with its implementation WidgetServiceImpl. - The DriverLocator finds the SerialWidgetDriver, installs it, matches it against WidgetDevice, and calls the attach() method with a service reference to WidgetDevice as argument. - SerialWidget is instantiated, passing a service reference to WidgetDevice to its parent's (ServiceTracker) constructor. - Since WidgetDevice is already registered, nothing else happens and addingService() is not called. And no serial access service is registered by SerialWidget. WidgetDeviceImpl is left hanging in memory space. I'd really appreciate any help some kind soul could offer me on this topic. -- -------------------------------------------------- David Lindelöf Product Developer Adhoco AG Technopark Jagerstrasse 2 8406 Winterhur tel +41-52-203.2903 mob +41-79-415.6641 fax +41-52-203.2904 e-mail [EMAIL PROTECTED] url http://www.adhoco.com weblog http://visnet.ch/smartbuildings/ -------------------------------------------------- Hacker's Law: The belief that enhanced understanding will necessarily stir a nation to action is one of mankind's oldest illusions. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

