The Jini Technology Lookup Service - PowerPoint PPT Presentation

1 / 33
About This Presentation
Title:

The Jini Technology Lookup Service

Description:

Services and clients find a lookup service using the discovery protocol ... 'Printer or Copier' Complex Queries. Technique 1. Change ranges and ors to wildcards ... – PowerPoint PPT presentation

Number of Views:53
Avg rating:3.0/5.0
Slides: 34
Provided by: alec2
Category:

less

Transcript and Presenter's Notes

Title: The Jini Technology Lookup Service


1
The Jini Technology Lookup Service
2
How Does It Work
  • Services and clients find a lookup service using
    the discovery protocol
  • Services advertise themselves by registering with
    the lookup service
  • Clients query the lookup service to find the
    services they need
  • Peer-to peer communication between client and
    service after that

3
Discovery/Join and Lookup Protocols
Figure 1 Discovery
4
Discovery/Join and Lookup Protocols
Figure 2 Join
5
Discovery/Join and Lookup Protocols
Figure 3 Lookup
6
Discovery/Join and Lookup Protocols
Figure 4 Service Invocation
7
Discovery and Join
  • How does a client or service find lookup services
  • How does a service join a lookup service
  • How does a client know which ones to do lookups in

8
Initial Discovery
  • Performed by both clients and services
  • Send multicast request packet
  • Groups you are looking for
  • Host and TCP port to use contact you
  • Waiting for lookup services to connect back
  • Download lookup services proxy object
  • Register with or do lookup in

9
Lookup Service
  • Network service
  • For finding other network services
  • Workgroup-scale, not the entire Internet
  • Not a naming or directory service
  • Focus is on types, not names
  • Yellow pages, not white pages
  • Both programmatic and end-user access

10
Lookup Service 101
  • Each service registers its proxy object
  • Client does lookup by interface type
  • Instance of semantics
  • API uses java.lang.Class instances, not strings
  • Client gets proxy object back
  • Needed classes are automatically downloaded
  • Proxy communicates with remote service

11
Service Type Matching
  • Can match on any type
  • Interface or concrete class
  • Including super interface or superclass
  • Can get subinterface or subclass back
  • Java.lang.Object match everything
  • Can match using multiple types

12
Service Type Matching
  • I want a combination TV/VCR
  • org.Ce.TV AND org.Ce.VCR
  • Yellow pages
  • Automatic placement in all categories
  • Base class and all interfaces
  • All superclasses and superinterfaces

13
Attributes
  • Service can also register with attributes
  • Attributes allow further discrimination between
    services of the same type
  • Lookup support matching on
  • Just service types
  • Just attributes
  • Combinations

14
Example Generic Attributes
  • Name
  • Location
  • Manufacturer
  • Model

15
Example Printer Attributes (1)
  • Monochrome or color
  • Resolution
  • Speed
  • Paper size

16
Attribute Characteristics
  • Some are defined by service itself
  • e.g., manufacturer, model, resolution
  • Some are defined by administrator
  • e.g., Name, location
  • Attributes can have multiple values

17
Example Printer Attributes (2)
  • Printer supports these combinations
  • Monochrome, 600 dpi, 10 ppm
  • Monochrome, 300 dpi, 15 ppm
  • Color, 300 dpi, 5 ppm
  • For each combination, printer supports
  • Letter
  • Legal
  • Envelope

18
Attribute Representation
  • Each attribute is a public field of a class
  • Attribute name field name
  • Attribute type field type
  • Each class defines an attribute set
  • Co-dependent attributes in the same class
  • Orthogonal attributes in different classes
  • Each service has set of attribute sets
  • Instances of multiple classes
  • Multiple instances of the same class

19
Example Printer Attribute (3)
  • PrintEnginecolor false, dpi 600, ppm 10
  • PrintEnginecolor false, dpi 300, ppm 15
  • PrintEnginecolor false, dpi 300, ppm 5
  • PaperSizesize PaperType.Letter
  • PaperSizesize PaperType.Legal
  • PaperSizesize PaperType.Envelope
  • Locationfloor 3, room 1234, building
    A1
  • Namename rainbow

20
Attribute Set Matching
  • Match on attribute set class
  • Including superclasses
  • Match on attribute values (fields)
  • Exact value match only
  • java.rmi.MarshalledObject.equals
  • Template is just an attribute set instance
  • Null field match any value (wildcard)

21
Matching Examples
  • template PrintEnginecolor false, dpi null,
  • ppm null
  • matches PrintEnginecolor false, dpi 600, ppm
    10
  • and PrintEnginecolor false, dpi 300, ppm
    15

22
Matching Examples
  • template PrintAttrs
  • matches PrintEnginecolor true, dpi 300,
  • ppm 5
  • and PageSizesize Legal

23
Service Registration
  • Service registers by providing
  • Service id
  • Every service has a universally unique id
  • Lookup service will assign one if requested
  • Proxy object
  • Zero or more attribute sets

24
Service Registration
  • public class ServiceItem implements
  • java.io.Serializable
  • public ServiceID serviceID
  • public Object service
  • public Entry attributeSets

25
Service Template
  • Service template contains
  • Optional service id
  • Null is wildcard match any
  • Zero or more service types
  • Zero or more attribute set templates
  • Null fields are wildcards match any

26
Service Template
  • public class ServiceTemplate implements
  • java.io.Serializable
  • public ServiceID serviceID
  • public Class serviceTypes
  • public Entry attributeSetTemplates

27
Template Matching
  • Service registration matches template if
  • Service id matches, and
  • Proxy is instance of each service type, and
  • For each attribute set template
  • Service has a matching attribute set

28
Example Queries
  • Any service named rainbow
  • Any Printer named rainbow in A1
  • Any color envelope Printer
  • All services on floor 3

29
Complex Queries
  • Between 300 and 600 dpi
  • On floor 1, 3, or 7
  • Letter or Legal
  • Printer or Copier

30
Complex Queries
  • Technique 1
  • Change ranges and ors to wildcards
  • Do single template-based lookup
  • Then do finer-grained match locally
  • Technique 2
  • Query for actual values in ranges and ors
  • Do multiple lookups

31
Attribute Modification
  • Can only be done by service itself
  • Allows service to control policy
  • Internal state changes
  • Administrative interfaces
  • Service is responsible for persistent storage
  • Add, modify, delete, replace all
  • Attributes should change infrequently
  • Primary search keys
  • Query service directly for very dynamic state

32
Lookup Groups
  • Each lookup service is configured with s set of
    group names
  • Is in (is a member of) each group
  • Each service is configured with a set of group
    names
  • Registers with all lookup services in any of
    those groups
  • Each client is configured with a set of group
    names
  • Uses lookup service in any of those groups

33
Summary
  • Service perspective
  • Register with desired attributes
  • Keep renewing registration lease
  • Add, modify, delete attributes as desired
  • Client perspective
  • Lookup any 1 of
  • Get just proxy object
  • Lookup to N of
  • Get proxies attributes, and service IDS
Write a Comment
User Comments (0)
About PowerShow.com