Wizard API updated!
Tim Boudreau has released a new version of the Swing Wizard library (version 0.997) that fixes the WizardException bug reported in JavaWorld's recent Open Source Java Project profile. The article's examples have been reworked to test out the new, improved WizardException. Thanks, Tim, for this helpful fix!
Open Source Java Projects: The Wizard API

Newsletter sign-up

Sign up for our technology specific newsletters.

Enterprise Java
View all newsletters

Email Address:

Browse user interfaces for Jini services

Build a JFC-based application for browsing and launching Jini services

In October 1999, JavaWorld columnist Bill Venners first introduced readers to a working draft of the ServiceUI specification for attaching user interfaces to Jini services. In the year and a half since then, the ServiceUI project at Jini.org, largely due to Venners's efforts, has released a 1.0 specification and reference implementation.

In this article, I'll explain how to attach an interface to a simple Jini service, and then walk you through building an application to browse those services using Swing components and the ServiceUI framework.

Project requirements

Before starting any development project, it's important to define what you're trying to build. If you're learning to program on your own, that may only consist of notes on scraps of paper. If you're a developer working within a team, however, that often entails rigorous documentation garnered from multiple whiteboard-intensive meetings. Here I'll briefly describe our goals for the project and the tasks ahead of us.

The Time service

The Jini service Time is intended to demonstrate how to attach a graphical user interface (GUI) to a service. The service itself will be extremely simple: it's sole purpose is to provide a way to retrieve the current time and date.

The GUI attached to that service should provide a time display retrieved from the service, and a way for the user to update the display.

The Jini TaskBar

A Jini service with a user interface is useless if you have no way to view the UI. To that end, we'll design an application that can discover Jini services on the network and display associated UIs. While finding network services involves a certain amount of complexity, the application should try to hide that complexity from the user. Therefore, we'll model our application after one of the most common application browsing and launching systems: the TaskBar.

Getting started

Before we get too far along in the development process, you should first make sure that your development environment is properly set up. While Jini is compatible with J2SE 1.2.2 and above, I recommend using JDK 1.3 from Sun on either Linux or Windows 2000.

You'll also need the Jini Technology Starter Kit 1.1. We'll be using the jini-core.jar and jini-ext.jar libraries for development. In addition, you'll need a Jini lookup server somewhere on your network.

Finally, our project will use the ServiceUI 1.0 API from the Jini.org community, as well as a utility class from the Jini-Tools project. Check out the Resources section for locations of these items.

TimeService interface

The most important component of any Jini service is its interface. The interface provides a layer of abstraction, under which services can choose varying implementations, while clients only need to know how to operate on an instance of the interface.

Designing truly generic service interfaces is not a simple matter. As a rule of thumb, check first with the Jini.org community to see if others have crafted an interface that suits your needs. If they have not, you may want to start a community project, working with others to craft a pseudostandard interface or set of interfaces that provide a generic API for services such as yours. There may be times when a proprietary interface is the best course of action, but if you plan to introduce a service that others could use, keep the community in mind.

1 | 2 | 3 | 4 | 5 |  Next >
Resources