Jini: A
Dream or Reality
by Vix! October 16, 1999
Click, Laugh and Enjoy @
www.sallini.com
Based on the
Java programming language, a new technology named
Jini enables Java-based hardware and software
devices to talk and work with other devices merely by
plugging into the network, according to Sun Microsystems,
Inc.
This spontaneous
networking Sun proclaimed, will require no
configuration, driver installation, or device
installation.
Jini
consists of a small piece of Java code that links Java
Virtual Machines in every device on a network. As each
device joins the network, it announces its
presence and offers its services to the other devices.
When the networked devices need to perform a task, they
can look up services available from other
devices and use them without pre-configuration or driver
installation.
Lets
look at Jini from a practical perspective. Here we will
give you an objective view of this subjective technology.
Nomenclature
It is important
to understand the buzzwords used so that confusion is
avoided. Here are some of the terms used in talking about
Jini:
- Federation:
A federation consists of a group of devices (like
printers, hard disks, and so on) and software
programs (any program that is compiled down to
Java bytecode) that form a single, dynamic,
distributed system.
- Resource: The
devices and programs within a federation are
called resources.
- Service: A
resource offers a service. A service can be
storage, communication, computation, or anything
that a resource can do. For example, printers
will offer a print service; pagers will offer a
paging service; encryption libraries will offer
an encryption service.
Architecture
and Implementation
A Jini
system consists of three main components that are
described below:
1 - Infrastructure:
The Jini infrastructure
consists of the base software required to build a Jini
federation. The base software is:
- 1.2 JVM (Java
Virtual Machine): the software required to run
any Java program.
- Extended RMI (Remote
Method Invocation): an enhanced version of RMI
for Jini.
- Lookup service:
this essentially is the database for available
services in the federation. Resources find
services in the federation using the lookup
service. The entries in this lookup database are
Java interfaces.
- Discovery service:
this service allows discovery of resources
plugged into the federation.
Once discovered, the
resource will register its services with the
lookup service.
- Distributed
security: a security framework extended for
distributed systems. It is built on top of Javas
built-in security mechanisms.
2 - Programming Model:
These are
rules, specifications, and suggestions on how to write a
Jini service. Jini services make use of the following
concepts:
- Distributed leasing:
provides a time-based model for activating and
freeing services and resources.
- Transactions: allow
wrapping of multiple operations on multiple
services into a single unit of work that either
completely succeeds or is rolled back.
- Distributed events:
is a notification mechanism between services and
resources that stretches beyond machine
boundaries.
3 - Services:
These are
hand-coded using the programming model. They can be
programmed to do any task suitable of the resource.
These
services are mobile and intelligent moving from machine
to machine executing where and when required. A printer
could download a service that filters documents for
obscene language and run it, or could simply have that
service run on the remote machine and pass the result
back to the printer.
Invoking
services programmatically, requires first querying the
lookup service for a particular interface, downloading
the implementation of the interface, and invoking its
methods.
Functionality
Lets
take a look at what exactly happens when I plug in my
brand new Jini-enabled printer?
- The printer
broadcasts a discovery packet on a well-known
port. The packet contains just enough information
to contact the printer.
- The lookup service
running somewhere on the network listens on the
well-known port and receives the packet. It
registers the information about the printer.
- The lookup service
replies to the printer with its location. With
this, discovery is complete.
- The printer is now
ready to join the network. It adds
each of its services to the lookup service.
- All resources are
now ready to use the printer, and the printer too
is ready to use other resources
on the network.
What
happens when a resource in the federation needs to use
the printer service?
- The resource first
queries the lookup service for a particular
interface for accessing the printers
services.
- If the interface is
present in the lookup service, the client proxy
for the print service is returned
to the resource.
- The resource
invokes methods of the client proxy interface.
These methods in turn activate the
printer
according to which methods were called.
Using
similar logic, the printer can access services offered by
other resources in the federation.
Conclusion
Jini comes
from some of the best minds in distributed computing
today. If this technology does succeed and gain
acceptance, it surely will change the way we use devices
and networks. The whole network would just become an
ocean of services where each device would become
available as soon as it is plugged into the network.
That is only if everything goes according to plan. When
Java was unveiled, Sun vowed that Javas write
once, run anywhere premise would usher the era of
cross-platform computing free of proprietary technology.
Three years later, the obstacles (from Microsoft) to this
programming nirvana remain, and only the most diehard
Java programmers believe a single version of the language
will emerge.
|