Transcript JINI

JINI
Java Intelligent Network Infra-structure
Gijung Yun
© Realtime Embedded Systems Laboratory
Inha University
JINI
Contents

Introduction
–



Vision and Charicteristic
Jini Environment
Jini Infrastructure
Jini Architecture
1.
3.
5.
7.
RMI
Leasing
Transaction
Entry
© 2002, Gijung Yun, RESL, Inha University
2. Discovery, join and lookup
4. Events
6. Services
8. Security
Page : 2
JINI
Introduction

Jini Goals
–
–
–
–
–
Network plug and work
Enable spontaneous networking
Promote service-based architecture
Simplicity
Resources can be implemented as either ha
rdware devices, software programs, or a co
mbination of the two.
© 2002, Gijung Yun, RESL, Inha University
Page : 3
JINI
© 2002, Gijung Yun, RESL, Inha University
Page : 4
JINI

관련 기술
– UPnP

MS, Compaq, Intel, Philips…
– HAVi


Sony, Philips, Samsung, Sun…
가정내 AV기기를 접속하는 기술
© 2002, Gijung Yun, RESL, Inha University
Page : 5
JINI

Characteristic
– 100% Pure Java
– Collection of API’s and Protocols



Infrastructure
 Built on RMI
 Discovery, Join and Service Protocols
 Lookup Service
Programming Model
 Leasing Interface
 Event and Notification Interfaces
 Transaction Interfaces
Services
 Fundamental entity of Jini
– Reference Implementations Supplied
© 2002, Gijung Yun, RESL, Inha University
Page : 6
JINI
Jini Environment


Java 2 compatible VM
Network of reasonable speed
– Multicast support preferable
– Initial support for TCP/IP only

Class file server
– HTTP most commonly used

Dynamic address allocation
– DHCP

Devices should have some memory and CPU
– Can use a ‘proxy’ as an alternative
© 2002, Gijung Yun, RESL, Inha University
Page : 7
JINI
Jini Infrastructure
It is a set of software layers that together create a federation
of computer devices and services
Directory Services
JavaSpaces
Jini
RMI
Boot, Discover, Join
Java VM
Windows
© 2002, Gijung Yun, RESL, Inha University
Unix
Other OS
or Devices
Page : 8
JINI
Jini Architecture






RMI
Discovery, Join & Lookup
Leasing
Events
Transactions
Services
© 2002, Gijung Yun, RESL, Inha University
Page : 9
JINI
RMI


Remote Method Invocation
Object-Oriented RPC
– Similar to CORBA

Distinguished by ability to parse objects
by value
© 2002, Gijung Yun, RESL, Inha University
Page : 10
JINI
Discovery, Join and Lookup

Discovery
– Find a Lookup Service



Multicast UDP for nearby Lookup services
Unicast TCP for known Lookup services
Join
– Used by services to register with a Lookup
Service
– Registration Utility Classes


LookupDiscover for multicast discovery
LookupLocator for unicast discovery
© 2002, Gijung Yun, RESL, Inha University
Page : 11
JINI

Lookup
– Repository of available services
– Stores each service as Java objects
– Clients and services use to request a
service type from a Lookup service


Search by type(Java Interface), not name
Closer to CORBA Trader service than CORBA
Naming service
© 2002, Gijung Yun, RESL, Inha University
Page : 12
JINI
Service
Provider
Discovery and Join
J
512 byte
Discovery
Multicast
RMI
Join Upload
Reference
Jini Lookup
Service
© 2002, Gijung Yun, RESL, Inha University
J
출처: Sun
Page : 13
JINI
Service
Provider
Lookup
J
Service
Consumer
J
Discovery
RMI
Reference
Jini Lookup
Service
© 2002, Gijung Yun, RESL, Inha University
J
Download
Lookup
출처: Sun
Page : 14
JINI
Request Message
(sent via UDP multicast)
Discoverer
Lookup
Service
Response Message
(sent via TCP unicast)
© 2002, Gijung Yun, RESL, Inha University
Announcement Message
(sent via UDP multicast)
Discoverer
Request Message
(sent via TCP unicast)Lookup
Service
Response Message
(sent via TCP unicast)
Page : 15
JINI
Request packet format
Vers
<int>
Port
<int>
Where the discoverer wants replies
Sent to
Group
Len
<int>
Group 1 Group 2
<string> <string>
Heard
Len
<int>
Heard 1 Heard 2
<svc id> <svc id>
© 2002, Gijung Yun, RESL, Inha University
…
Desired groups
(length == 0  all)
…
Known Lookup
Services
Page : 16
JINI
Announcement packet format
Vers
<int>
Host
<string>
Group
Len
<int>
Group 1 Group 2
<string> <string>
© 2002, Gijung Yun, RESL, Inha University
Port
<int>
My Id
<svc id>
Service information
(header)
…
Groups that I am a
member of
Page : 17
JINI
Lookup Services
Maps interfaces indicating the functionality provided by a
service to sets of objects that implement the service
Object
Print
Store
Service must be serialisable
and implement Entry
Copier
Printer
Fax
Canon
LBP-1260 J
© 2002, Gijung Yun, RESL, Inha University
J
J
BJ-100
HP
BJC-70
출처: Sun
Page : 18
JINI


May be federated with other lookup
services
Lookup service interface provides:
– Registration, Access, Search, Removal
© 2002, Gijung Yun, RESL, Inha University
Page : 19
JINI

Network Issue
– IP-based
– Request Packet size limitation
(512Byte)
– Limiting the scope of multicast

TTL ( recommend 15 )
© 2002, Gijung Yun, RESL, Inha University
Page : 20
JINI
Distributed Leasing

A form of Distributed ‘Garbage
Collection’
– Enables stability and resilience


Service is ‘loaned’ to a client for a
certain period of time
Delegation of Lease Renewal
– Allows clients/services to delegate lease
renewal to a third party object
© 2002, Gijung Yun, RESL, Inha University
Page : 21
JINI

Attribute Modification
– If a service is asked to change the set of att
ributes with which it registers itself,
– it saves the changed set in a persistent
store, then performs the requested change
at each lookup service with which it is regis
tered.
© 2002, Gijung Yun, RESL, Inha University
Page : 22
JINI

Registering and Unregistering with Look
up Services
– register with lookup service


adds that lookup service to the persistent set of
lookup services it should join,
and then registers itself with that lookup service.
– unregister from lookup service


service is in the persistent set of lookup services
to join, it should be removed from that set.
the service cancels the leases for all entries it
maintains at that lookup service.
© 2002, Gijung Yun, RESL, Inha University
Page : 23
JINI

join a group
– it adds the name of that group to the
persistent set of groups to join,
– and either starts or continues to perform m
ulticast discovery using this augmented gro
up.
© 2002, Gijung Yun, RESL, Inha University
Page : 24
JINI

leaving a group
– It removes that group from the persistent set of
groups to join.
– It removes all lookup services that match only that
group in the set of groups it is interested in from
the set it has discovered using multicast discovery,
and unregisters from those lookup services.
– It either continues to perform multicast discovery
with the reduced set of groups or, if the set has
been reduced to empty, ceases multicast discovery.
© 2002, Gijung Yun, RESL, Inha University
Page : 25
JINI
Distributed Events

Extends the standard Java event model
– Adds features to provide resilience and
determination in a distributed environment




Registration for event notifications is lease based
Unique event identifiers assigned to every event supplier
Event sequence numbers assigned to every event
Event types
– Marshaled Object enables:



Store-and-forward
Notification filter
Notification MailBox
© 2002, Gijung Yun, RESL, Inha University
Page : 26
JINI
Transactions

Set of Interfaces that support the
implementation of a two-phase commit
protocol
– Designed to be lightweight


Left to developer to implement as much (or as little) of
the transactional semantics as they need
Lease based - transaction will fail if not completed within
leased period
– Supports distributed transactions
– Sample Implementation supplied in Jini distribution
© 2002, Gijung Yun, RESL, Inha University
Page : 27
JINI
출처: Sun
© 2002, Gijung Yun, RESL, Inha University
Page : 28
JINI
Services


Services are defined by their interface
Services must:
– Discover and register with a lookup service(s)
– Maintain the following across failures:




ServiceID(128bit) assigned by a lookup service
The service attributes that define its lookup entry
The group(s) the service participates in
Specific lookup services it must participate in
– Maintain all leases with lookup services they have
registered with

Utility Classes provided to manage these
responsibilities
© 2002, Gijung Yun, RESL, Inha University
Page : 29
JINI

Using a Service
– Communication is between service and its
proxy
– Independent of wire protocol
– Protocol can change without affecting client
– RMI semantics core to functionality
© 2002, Gijung Yun, RESL, Inha University
Page : 30
JINI
Entry





Typed set of objects, for matching
Provides extra information about services
A service may have any number of entries
Clients request services by class and/or by
entries, using a simple matching system
Drawback:
– relational operators such as < and != are not supp
orted
© 2002, Gijung Yun, RESL, Inha University
Page : 31
JINI

There are some convenience subclasses of Entry:
– Address: the address of the physical component of a se
rvice.
– Location: the location of the physical component of a s
ervice. It can be used alone in a small, local organizati
on.
– Comment: a free-form comment about the service.
– Name: name(s) of the service as seen by users.
– ServiceInfo: generic information about a service. Includ
es the name of the manufacturer, the product, and th
e vendor.
– ServiceType: human-oriented information about the "ty
pe" of a service. This is not related to its data or class
types.
– Status: the base class from which other status-related
entry classes may be derived.
© 2002, Gijung Yun, RESL, Inha University
Page : 32
JINI
Security



The design of the security model for Jini
t
echnology is built on the twin notions of a
principal and an access control list.
Jini services are accessed on behalf of some
entity—the principal—which generally traces b
ack to a particular user of the system.
Whether access to a service is allowed depend
s on the contents of an access control list that
is associated with the object (entity).
© 2002, Gijung Yun, RESL, Inha University
Page : 33
JINI
The Sun Community Source License
(SCSL)

Three Levels of Participation
– Research and Education


Source code freely available
Can be used in any way other than deployment
– Internal Deployment

Deployed code must pass a compatibility test
– Commercialisation



Source code available with Jini trademark for a branding
fee
Branding fee covers cost of trademark protection and
compatibility testing
Low cost fee is based on either annual fee or royalty per
device/service sold - whichever is the lower
© 2002, Gijung Yun, RESL, Inha University
Page : 34
JINI
Summary

Jini limitations
– TCP/IP, multicast, Java RMI, Java 2 VM

Jini philosophy is useful
© 2002, Gijung Yun, RESL, Inha University
Page : 35
JINI
Reference

Web Sites
– http://www.jini.org/
– http://java.sun.com/jini
– http://java.sun.com/products
/javaspaces
© 2002, Gijung Yun, RESL, Inha University
Page : 36