JINI – 2002 AND BEYOND…
Download
Report
Transcript JINI – 2002 AND BEYOND…
JINI – 2002 AND BEYOND…
Presented by – Gal Bernstein
Article review by –
Mark Stang & Stephen Whinston
Thursday , 3/1/2002
Enterprise Computing with Jini Technology
Enterprise Computing with Jini Technology
1.Enterprise vs. Embedded Systems
2.The J2EE Platform
3.Jini – The Final Frontier...
4.Jini Advantages
5.How Jini Technology Works
6.Enterprise Application Example
7.Coffee & Cake
1.Enterprise vs. Embedded
Embedded systems are machines that contain a microprocessor,
and do a specific task or job.
Examples to embedded systems are cell-phones, micro-wave ovens,
navigation computers etc.
Enterprise systems are systems that contain multiple components
and run on various (may be remote) machines, with or without
central command.
These are large systems in which the work is distributed among a
number of machines, each doing it’s part.
Examples to enterprise systems are payroll managing systems.
2.The J2EE Platform
The JAVA 2 ENTERPRISE EDITION
Components
Servlets
EJB – Enterprise Java Beans
JDBC
Services
JNDI
JMS
JTS
The J2EE Platform(cont.)
Components
Servlets
Servlets are modules of Java code that run in a server application
(hence the name "Servlets", similar to "Applets" on the client side)
to answer client requests.
Extend javax.servlet.
Used widely in web applications
The J2EE Platform(cont.)
EJB – Enterprise Java Beans
Written in Java, an enterprise bean is a server-side component that
encapsulates the business logic of an application. The business logic
is the code that fulfills the purpose of the application. In an inventory
control application, for example, the enterprise beans might implement
the business logic in methods called checkInventoryLevel and
orderProduct. By invoking these methods, remote clients can access
The inventory services provided by the application.
Benefits - First, because the EJB container provides system-level
services to enterprise beans, the bean developer can
concentrate on solving business problems. The EJB
container--not the bean developer--is responsible for
system-level services such as transaction managemen
and security authorization.
The J2EE Platform(cont.)
-Second, because the beans--and not the clients--contain the
application's business logic, the client developer can focus on
the presentation of the client. The client developer does not
have to code the routines that implement business rules or
access databases. As a result, the clients are thinner, a benefit
that is particularly important for clients that run on small
devices.
-Third, because enterprise beans are portable components,
the application assembler can build new applications from
existing beans. These applications can run on any compliant
J2EE server.
The J2EE Platform(cont.)
When To Use?
When the application has any of these requirements:
-The application must be scalable. To accommodate a
growing number of users, you may need to distribute
application's components across multiple machines. N
only can the enterprise beans of an application run on
different machines, but their location will remain
transparent to the clients.
-Transactions are required to ensure data integrity.
Enterprise beans support transactions, the mechanism
manage the concurrent access of shared objects.
-The application will have a variety of clients. With just
few lines of code, remote clients can easily locate ent
beans. These clients can be thin, various, and numer
The J2EE Platform(cont.)
What Are The Java Beans Types :
a)Session
Performs a task for a client.
b)Entity
Represents a business entity object
that exists in persistent storage.
c)Message-Driven
Acts as a listener for the Java
Message Service API, processing
messages asynchronously.
The J2EE Platform(cont.)
JDBC
The JDBC API consists of a set of classes and interfaces written in Java
that provide a standard API for tool/database developers and makes it
possible to write industrial strength database applications using an
all-Java API.
The value of the JDBC API is that an application can access virtually
any data source and run on any platform with a Java Virtual Machine.
The combination of the Java platform and the JDBC API lets a
programmer write once and run anywhere!
What is needed is a way for Java applications to talk to a variety of
different data sources. JDBC is the mechanism for doing just this!
The J2EE Platform(cont.)
In simplest terms, a JDBC technology-based driver ("JDBC driver")
makes it possible to do three things :
1. Establish a connection with a data source.
2. Send queries and update statements to the data source.
3. Process the results.
The J2EE Platform(cont.)
Services
JNDI – Java Naming Directory Interface.
A fundamental facility in any computing system is the naming service
-- the means by which names are associated with objects and objects
are found based on their names.
A naming service's primary function is to map people-friendly names
to objects, such as addresses, identifiers, or objects typically used by
computer programs.
For example, the Internet Domain Name System (DNS) maps
machine names (such as www.sun.com) to IP addresses
(such as 192.9.48.5).
The javax.naming.directory package extends the javax.naming
package to provide functionality for accessing directory services in
addition to naming services
The J2EE Platform(cont.)
This package allows applications to retrieve attributes associated with
objects stored in the directory and to search for objects using specified
attributes.
The Java Naming and Directory Interface(JNDI) is an application
programming interface (API) that provides naming and directory
functionality to applications written using Java.
The JNDI architecture consists of an API and a service provider interface
(SPI). Java applications use the
JNDI API to access a variety of
naming and directory services.
The SPI enables a variety of
naming and directory services to
be plugged in transparently,
thereby allowing the Java
application using the JNDI
API to access their services.
The J2EE Platform(cont.)
JMS – Java Messaging Services.
Messaging is a method of communication between software components
or applications.
The Java Message Service is a Java API that allows applications to
create, send, receive, and read messages.
The JMS API defines a common set of interfaces and associated
semantics that allow programs written Java to communicate with
other messaging implementations.
The JMS API minimizes the set of concepts a programmer must learn to
use messaging products, but provides enough features to support
sophisticated messaging applications.
The JMS API enables communication that is :
Asynchronous: A JMS provider can deliver messages to a client
as they arrive.
Reliable: The JMS API can ensure that a message is delivered
once and only once.
The J2EE Platform(cont.)
An enterprise application provider is likely to choose a messaging API
over a tightly coupled API (such as RPC) when:
-The provider wants the components not to depend on information
about other components' interfaces, so that components can be easily
replaced.
-The provider wants the application to run whether or not all
components are up and running simultaneously.
-The application business model allows a component to send
information to another and continue to operate without receiving
an immediate response.
For example, components of an enterprise application for an
automobile manufacturer can use the JMS API in situations like these:
-The inventory component can send a message to the factory
component when the inventory level for a product goes below a
certain level, so the factory can make more cars.
The J2EE Platform(cont.)
-The factory component can send a message to the parts components
so that the factory can assemble the parts it needs.
-The parts components in turn can send messages to their own
inventory and order components to update their inventories and
order new parts from suppliers.
-Both the factory and parts components can send messages to the
accounting component to update their budget numbers.
-The business can publish updated catalog items to its sales force.
The J2EE Platform(cont.)
JTS – Java Transaction service
A typical enterprise application accesses and stores information in one
or more databases. Because this information is critical for business
operations, it must be accurate, current, and reliable. Data integrity
would be lost if multiple programs were allowed to simultaneously
update the same information. Also, it would be lost if a system that
failed while processing a business transaction were to leave the affected
data only partially updated. By preventing both of these scenarios,
software transactions ensure data integrity. Transactions control the
concurrent access of data by multiple programs. In the event of a system
failure, transactions make sure that after recovery the data will be in a
consistent state.
To emulate a business transaction, a program may need to perform
several steps. A financial program, for example, might transfer funds
from a checking account to a savings account with the steps listed in
the following pseudo-code :
The J2EE Platform(cont.)
begin transaction
debit checking account
credit savings account
update history log
commit transaction
Either all three of these steps must complete, or none of them at all.
Otherwise, data integrity is lost. Because the steps within a transaction
are a unified whole, a transaction is often defined as an indivisible
unit of work.
A transaction can end in two ways: with a commit or a rollback.
When a transaction commits, the data modifications made by its
statements are saved. If a statement within a transaction fails, the
transaction rolls back, undoing the effects of all statements in the
transaction.
3.Jini –The Final Frontier…
Jini technology gives networks devices self-configuration and
self-management capabilities : it lets devices communicate
immediately on a network without human intervention.
Self-healing : devices that leave the network for any
reason , do not effect the remaining devices’ operation.
A Jini client that loses contact with a server can recover and
continue processing.
Jini technology true promise is for enterprise systems – all
because of those unique abilities that can extend beyond
embedded systems .
4.Jini Advantages
Reliability
Scalability
Maintenance & Administration
Security
Jini Advantages (cont.)
Reliability –how well does a device or network performs in
the presence of disturbances.
Processes start and stop, they crash, someone
might intentionally (or not) shut them down,
the machine might crash or fail…
NO PROBLEM – Jini can handle these events because it
expects devices to randomly move in and out
of the network. Jini parallels the internet communication
and re-routes the connection letting the client move on.
This is built in the Jini system – without that the
application program must handle those tasks – major
“bummer” for the programmer.
Jini Advantages (cont.)
Scalability –how much does it cost to add an attribute to a system
vs. the benefit of that attribute.
Adding services, gives a Jini client more choice in the
devices he can ‘talk’ with. This, in fact, increases the
systems’ reliability.
Jini networks have no central control – the whole system
actually manages itself.
Jini (unlike the internet) thrives in the wild :
it dynamically discovers the requested services.
Jini networks are designed to exist in a fluid environment – thus making
the system more scalable.
Jini Advantages (cont.)
Maintenance & Administration – how convenient is it to maintain the
system alive (keep it running).
Jini knows to find the components of the application,
thus making the source hidden from the client.
What to do when a machine goes down?
-back up machine with the same IP.
-hot fail-over
NO WORRIES – if a Jini server fails, a Jini client automatically
contacts another instance of the service and moves on
with his life.
Jini Advantages (cont.)
Security – a critical component in an enterprise-computing environment.
The goal is preventing unknown clients from accessing
protected services.
Jini can even prevent remote clients from seeing what
services the network offers.
1.Viruses
Jini servers provide a client the interface with which it can
access code residing on the server. This code is typically
not mobile. Virus code is.
In the Jini environment, before code is moved to another
machine, it must satisfy the client’s security policy.This
should allow downloading only from trusted machines, and
its up to the system administrator to monitor and define
that. All system must achieve balance between perfect
security and the ability to use network resources.
Jini Advantages (cont.)
2.Rouge Services
What if lookup servers send clients to the wrong places?
A lookup server has no way of validating if the service
that was just added himself, is actually who it claims to be..
“Bad“ servers can hijack clients and interfere with the system's
normal behavior.
This issue is still undergoing research!! – not all is perfect…
5.How Jini Technology Works
Jini software runs on top of a Java virtual-machine and will
work in any IP-based network of machines with Java VMs.
Jini technology presupposes the existence of network connecting
devices; Jini-enabled devices communicate with each other over
this network.
A Jini network contains communities, or federations, or clients and
servers. A Jini service joins a federation to share its service with
clients. A Jini client joins a federation to gain access to services.
Federations are dynamic constructs, appearing and disappearing based
on the demands of Jini devices.
Here we’ll talk about :
Service-based model.
Transferring executable code.
JavaSpaces service.
How Jini Technology Works (cont.)
Service-based model
Services can be storage devices, software components,
printer, home stereo, satellite navigating systems etc. Any thing
programmers can abstract through software.
Services can be clients of another jini device, and, through
that, a client can build complete distributed applications.
A lookup service keeps a map between a service and his attributes.
Lookup servers match services demanded by clients to the ones
advertised using those attributes.
A Jini service can join multiple lookup servers!
This increases reliability and distribution. That’s excellent
for enterprise systems : a big work can be broken into pieces
and calculated in remote machines, thus making it faster
and easier.(a transaction will work here – well see
that later).
How Jini Technology Works (cont.)
Transferring executable code
Jini devices transfer executable code (similar to Java applets
on Web browsers). Here, the client only receives the interface,
while the work is done on the server side. The server teaches the
client how to communicate with it.
A client leases a resource for a limited time (can be renewed).
Resources can be exclusive or not.
In a distributed system, transactions are vital – all or nothing.
Calculations ran on different and/or remote machines must be
monitored in such a manner, that a full scale operation will be
completed if and only if the whole sequence was completed
successfully.
Transactions ensure consistency across the network, and Jini
supports that – especially two-phase commits that ensures
different servers carry out operations consistently.
How Jini Technology Works (cont.)
With networked computers , its difficult for one
machine to find out the state of another.Event
notification allows computers to notify listeners
(typically other computers on the network) of
certain events. This is a simple example of
coordinating between different computers.
How Jini Technology Works (cont.)
JavaSpaces service.
JavaSpaces is a Jini service that builds and maintains a database
of Java objects : it allows storage and retrieval of objects via
standard lookup.
Doesn’t have primary key.
No need to create a table.
Lookup through name and attributes.
Relational databases operate on the C R U D interface.
Create
Delete
Read
Update
How Jini Technology Works (cont.)
In JavaSpaces those actions mapped as followed:
write – performs the create and update operations.
read – returns a copy of an object.
take – combines read and delete.
JavaSpaces also supports notify, which lets a program know when
an object that matches some criteria has been written into the
system.
A client can take an object (thus locking it),and a transaction
keeps track that if it’s not successful (the client dies), the
object will re-appear in the space (no locks and the admin can rest).
Clients (applications) use the read operation to put objects onto
the JavaSpace , use it for various calculations, and return it
home safely using the read operation again.
6.Enterprise Application Example
A License Server
A License Server
Managing software licenses is a very annoying problem.
Many, many very skilled programmers have tried over the
years to outsmart the cunning problem, and failed!!!
A new solution to this old-age problem is the license
server, which ensures that no more than the legally allowed
number of copies is in use at any one time.Using a license
server, any user can install an application and there is no
limit to the number of copies of an application an enterprise
has. Rather, the number of licenses is the limiting factor.
But when a user starts the application, the software
connects over the network to the license server and receives
a license from the pool of available licenses for that particular
application. Of course, to run successfully in that environment,
the application must be specially written to be license-server
-aware. In other words, it must understand how to connect
A License Server (cont.)
to the license server and authenticate the user.
The process of license authentication continues until all the
licenses are reserved. When other users attempt to run the
application, the license server advises them that they can
either purchase more licenses or, ask another user to stop
using the software. When a user exits the application, it
releases the reserved license from the license server, allowing
another user to access the application.
Even though license servers have been met with some
success, they posses their own unique set of problems .
First, if a user has an application open, it doesn’t mean he is
actually uses it. – The reservation however, remains. Second,
sometimes a reservation is never returned due to a machine
failure. – The reservation again, remains. Third, making an
application license-server-aware requires more work (for the
programmer , not his boss). Additionally, if something happens
A License Server (cont.)
to the license server machine, more change is needed on the
client side, and unless the client knows the address of another
license server – he is stuck!
Implementing a license server with Jini, could eliminate
some of the problems. In this case, the application will rely
on the lease concept. Leases are temporary, and if a client
doesn’t renew it – he’s out and the license is free (even in the
event of power failure, machine crash or leaving for miluim).
The Jini based license server can represent the licenses with
cookies - leased to a client for a limited time.
The last type of problems can also benefit from Jini. If a
license server is well written, there would be a few license
servers running simultaneously (connected among them selves).
If a license server moves to another location (or even burns
down), it doesn’t matter, the Jini technology is selfconfiguring thus the address isn’t important. A Jini client
A License Server (cont.)
that looses contact with his license server, could
automatically search the network for another such service.
A Jini based license server entails changes to applications.
But, the outcome is a more robust, efficient and effective
service.
Hurray!!! Jini rules!!!
7.Coffee & Cake
Available now at the 1st floor, building 30 at
CoffeeToGo – special prices for CS students.
ENJOY!!!