The Service Writer's Toolkit
While the fundamental ideas behind Jini are pretty simple in theory, the practice of building reliable Jini services can often be a bit more complex. Jini service writers have to worry about administration, properly handling crash recovery, and so forth. To make the job worse, many common tasks (such as building lease landlord classes) aren't well documented by the standard Jini API references.
And, over and above these most basic requirements for services, developers also have to worry about issues that are outside the scope of the service code itself. For example, any Jini service will need to make available class bytecodes that can be downloaded by clients. Typically, however, this fundamental task happens completely externally to the program itself--most often, you have to start a separate web server to serve up any downloadable classes. This is a separate administrative task, and makes it difficult to create "all in one" services that are completely turnkey.
The Service Writer's Toolkit is a start at a library of code and interfaces designed to help developers create Jini services more easily. The toolkit available here has its origins in the code examples of the book Core Jini. The version here is significantly expanded and more functional, though. This page contains an overview of the toolkit, as well as links to downloadable code and browsable javadoc documentation.
There are, of course, restrictions on the code you can put in a book. Code that's designed to show up in a printed example has to be optimized for readability and size. While the version of the software that appears in Core Jini is pretty useful, there were other features that I wanted to add but didn't have room for. The code here is a more robust and featureful version of the original toolkit from Core Jini. The version of the toolkit available here is much closer to the code that I use when I write services for Xerox PARC (but without, of course, any protected Xerox intellectual property!)
It's my plan to continue updating this toolkit, independently from the code in the book. Of course, if you find any errors, or want to report fixes, suggestions, comments or complaints, please email me. I'm happy to accept any contributions from the community, and am happy to provide this code to anyone in the community who might find it useful.
(And I suppose I should say that this code is provided under no warranty or guarantees of any kind. If you use it and it works for you great. If your application needs to be absolutely bug-free, don't use this code! You should consider anything you find here to be for educational purposes only.)
Landlordimplementation designed to work with Sun's
LandlordLeaseimplementation. This code uses RMI to communicate with client-side leases and can manage leases on event registrations or other allocated resources.
Currently the documentation on how to use the toolkit is limited to
the javadoc (Core Jini does provide descriptions of many of the
toolkit's classes, though, and these descriptions are largely still
valid for the versions here). For a starting point, take a look
UnicastServiceBackend class. You can extend this
class, overriding a few methods, to produce a new service wrapper for
any RMI-based Jini service. Simply by extending
UnicastServiceBackend you get persistence, administration,
easy class exporting, and so on. If you've hassled with web servers
and codebase, the class exporter code will be of particular interest
to you. Classes are also provided to support service-side lease management.
Once you download the JAR file, unjar it to create the complete SWT directory structure. This will contain javadocs (under the "javadoc" directory), sources (under the "src" directory), and an already-built version of the library, swt.jar (in the "dist" directory). See the README.html file for details on how to use the SWT.
The most current version of the toolkit is timestamped
Wed Mar 27 13:52:27 PST 2002
The OLD version of the Service Writer's Toolkit (version 1) is still available, in case you're not ready to move to version 2 yet. Both source and binaries are available here. This version works only with Jini 1.1 or later.
Special thanks to Iain Shigeoka for comments, feedback, and willingness to subject himself to premature code. :-)
Send any suggestions, additions, whatever, to firstname.lastname@example.org