previous chapter table of contents next chapter


A server can announce a number of entry attributes when it registers a service with a lookup service. It does so by preparing an array of Entry objects and passing them into the ServiceItem used in the register() method of the registrar. There is no limitation to the amount of information the server can include about the service, and it is better if the server gives more information than less; in later searches by clients , each entry is treated as though it were OR 'ed with the other entries. In other words, the more entries that are given by the server, the more information is available to clients, and the greater the chance of matching a client's requirements.

For example, suppose we have a coffee machine on the seventh level in room 728 of our building, which is known as both "GP South Building" and "General Purpose South Building." Information such as this, and general information about the coffee machine, can be encapsulated in the convenience classes Location and Comment from the net.jini.lookup.entry package. If this were on our network as a service, it would advertise itself as follows :

 import net.jini.lookup.entry.Location; import net.jini.lookup.entry.Comment; Location loc1 = new Location("7", "728",                              "GP South Building"); Location loc2 = new Location("7", "728",                              "General Purpose South Building"); Comment comment = new Comment("DSTC coffee machine"); Entry[] entries = new Entry[] {loc1, loc2, comment}; ServiceItem item = new ServiceItem(..., ..., entries); registrar.register(item, ...); 

A Programmer[ap]s Guide to Jini Technology
A Programmer[ap]s Guide to Jini Technology
ISBN: 1893115801
Year: 2000
Pages: 189

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net