R-OSGi ServiceUI

Generally, a certain amount of common knowledge is required for a client to connect to a service. In common systems, the client has to know at least the service API and the meaning of the provided methods. R-OSGi allows to access services in a way similar to the Jini ServiceUI. Services can additionally register a presentation that is displayed on client devices that have a ServiceUI service running and that have decided to fetch the service. These presentations can be used to give the user direct access to the service without knowing the interface and the semantics of the provided methods.

Attaching a Presentation to an R-OSGi Service

A valid presentation for an R-OSGi service has to implement the interface

public interface ServiceUIComponent {

	void initComponent(Object serviceObject, BundleContext context);

	Panel getPanel();

and registeres the name of the presentation class as additional property ServiceUIComponent.PRESENTATION_PROPERTY.



Hashtable attributes = new Hashtable();
attributes.put(RemoteOSGiService.PRESENTATION, RobotUI.class.getName());
reg = context.registerService(RobotDevice.class.getName(), new RobotDeviceImpl(simulated), attributes);            


The presentation class is automatically injected into the client-generated proxy bundle including all (named and anonymous) inner classes. ServiceUI clients display the presentation if the user connects to the service. The user can switch between presentations of multiple services. Presentations are unique to the service providing host; it is possible to connect to the same service running on multiple hosts.

Configuring a ServiceUI Client

Simply download the ServiceUI bundle and install it. Service discovery starts immediately, all R-OSGi services that are reachable are displayed in the choice widget at the bottom of the GUI. Selecting one of the discovered services causes R-OSGi to establish a connection to the service and check for an attached presentation. The choice widget at the top of the GUI is used to switch between the presentations of connected services.