|
|
|
Sponsored Link •
|
|
Advertisement
|
Summary
In this article, I look at ways Jini clients can search for desired services in the Jini lookup service. I describe both the flexibility of the lookup service as well as its inherent limitations. I proposes a way that theServiceRegistrarinterface could evolve, and describes the Jini team's response.
The Jini lookup service, the central component of Jini's runtime infrastructure, offers Jini clients a flexible and powerful way to find Jini services. It enables service providers to advertise their services and enables clients to locate and enlist the help of those services.
To interact with the lookup service, the client must first obtain a
a service registrar object via discovery, a
network-level protocol used by Jini's runtime infrastructure. Discovery
enables clients and services to locate lookup services. (For more
information on discovery, see Resources.) The
service registrar object, which implements the
net.jini.core.lookup.ServiceRegistrar interface, enables
the client to interact with the lookup service. To find desired services,
clients build a
ServiceTemplate, an instance of class
net.jini.core.lookup.ServiceTemplate, and pass it to one of
two
lookup() methods declared in the ServiceRegistrar
interface.
Each lookup() method sends the service template to the
lookup service, which performs the query and returns zero to many
matching service objects to the client.
In general, a client looks up a service by Java type, usually
an interface. For example, if a client needed to use a printer, it
would compose a service template that included a Class object
for a well-known interface to printer services. All printer services
would implement this well-known interface. The lookup service would
return a service object (or objects) that implemented this interface.
You could include attributes in the service template to narrow the number
of matches for such a type-based search. The client would use the
printer service by invoking on the service object methods declared in
the well-known interface.
|
Sponsored Links
|