Turning from the print client's point of view to the print service provider's point of view, below is an example code fragment showing how a Jini Print Service instance might set up its service registration (class net.jini.core.lookup.ServiceItem) to go into the Jini Lookup Service (JLUS). The general scheme is described in package net.jini.print.lookup. This code shows how to realize the lookup scheme for a particular printer, the one (hypothetically) located in U.S. President Bill Clinton's office, which happens to be a (fictitious) PaperEater 440 printer made by the (imaginary) Papyrophagus Corporation.
The service registration comprises three things: the service ID, the service proxy object, and the service attributes. Line 47 obtains a reference to the Jini Print Service instance's service ID. According to the rules of good Jini citizenship, the print service got the service ID from some JLUS the first time the print service ever registered, and the print service saved its assigned service ID in persistent storage for use in all subsequent registrations. (The details are not shown here.)
Line 48 obtains a reference to the Jini Print Service instance's service proxy object. (Again, the details are not shown here.) The service proxy object mandatorily implements interface PrintService. The service proxy object may also implement other PrintService subinterfaces if the printer supports the corresponding capabilities. For this example, the optional capabilities are not supported.
Line 49 creates an array of service attributes (which are subclasses of class net.jini.core.entry.Entry) following the requirements in package net.jini.print.lookup. There are three categories of service attributes: general attributes, supported doc flavors, and supported printing attributes.
Lines 51-92 set up the general attributes. These include a mandatory PrinterDescriptionEntry with the following characteristics:
http://billsprinter.
http://www.papyrophagus.com/support/papereater440/.
The general attributes also include the print service's address, location, name, service info, and comment stored in the appropriate standard Jini Entry classes from package net.jini.lookup.entry; these service attributes are optional.
Lines 94-109 set up the supported doc flavors. This Jini Print Service instance happens to support plain text, HTML, and PostScript documents. It can obtain them from an input stream and from a URL. It supports plain text and HTML encoded in the default, US-ASCII, and UTF-8 character sets. This Jini Print Service instance also supports printing plain text Unicode strings and renderable images. Support for plain text from an input stream and for renderable images is mandatory; this printer additionally supports the HTML and PostScript MIME types and the String and URL print data representation classes. For each supported doc flavor, one instance of class FlavorEntry wrapping the doc flavor goes into the service registration.
Lines 111-135 set up the supported printing attributes, each wrapped in an AttributeEntry (or a MediaEntry for a supported Media attribute). This Jini Print Service instance happens to support the following printing attributes:
Finally, lines 136-137
bundle the previously set up service ID, service proxy object, and service attributes
into a service item (class net.jini.core.lookup.ServiceItem)
that can be passed to a JLUS's register() method.
DRAFT STANDARD VERSION 1.0 (23-MAY-2000)