CS603 Distributed Object Systems - PowerPoint PPT Presentation

About This Presentation
Title:

CS603 Distributed Object Systems

Description:

Trading Publish and find the services an object has to offer ... Creates object that interfaces CORBA to identically declared existing C classes ... – PowerPoint PPT presentation

Number of Views:32
Avg rating:3.0/5.0
Slides: 42
Provided by: clif8
Category:

less

Transcript and Presenter's Notes

Title: CS603 Distributed Object Systems


1
CS603Distributed Object Systems
  • March 27, 2002

2
Distributed Object Systems
  • What are they?
  • CORBA
  • DCOM
  • Java/RMI
  • But what does it mean?
  • RPC for the object crowd
  • With all the tradeoffs/choices/distinctions of
    RPC systems

3
Distributed Objects as RPC
  • Interface Description Language
  • Defines external view of objects
  • Compilers / Precompilers
  • Language extensions
  • Run Time System
  • Directory Services
  • Data Conversion
  • Security / Authentication

4
Distributed Object SystemDistinctions
  • Single language vs. multilingual
  • Cross-lingual?
  • Platform independence
  • True cross-platform communication?
  • Extras
  • Real-time features
  • Fault tolerance
  • Transaction support

5
The Big Three
  • CORBA DCE on steroids
  • Cross-lingual (primarily C, Java)
  • Cross-platform
  • Many features
  • DCOM Microsofts answer
  • Some cross-lingual support (within Microsoft
    world)
  • Windows only
  • Built on DCE RPC and COM
  • Java RMI
  • Single language, tightly integrated

6
CORBA Background
  • Object Management Group
  • Corporate-sponsored standards body
  • Members develop and vote on standards
  • Current specs include UML, CORBA
  • Started April 1989
  • Working groups for extensible specifications
  • RealTime CORBA
  • Fault-Tolerant CORBA
  • Embedded CORBA
  • Many more

7
CORBA Basics(Thanks to Doug Schmidt, Andrew
Tannenbaum, and OMG for figures)
  • Object Request Broker
  • Object Services
  • Naming, Trading (property-based location),
    security, etc.
  • Common Facilities
  • General interfaces, e.g., OpenDoc
  • Domain interfaces Standards
  • Application interfaces IDL specifications for a
    particular application

8
ORB Architecture
9
CORBA IDL
  • Syntactic description of objects
  • Single Interface Definition Language
  • Compiles to multiple binary interfacesC, C,
    Java, Smalltalk, Ada, COBOL, ?
  • Assign Repository Identifier
  • Register interface in interface repository
  • Generate Proxy
  • Client-side stub
  • Marshals invocation request
  • Unmarshals result
  • Also Dynamic Invocation Interface
  • Invoke object when interface not known until
    runtime

10
Key ORB facilities
  • Manipulate object references
  • Marshal/Unmarshal
  • Comparison
  • Service Discovery
  • By name
  • By property
  • Interface repository and Implementation
    repository
  • ORB/Proxy interface can be vendor specific

11
Interfaces
12
Invocation Models
  • Default Synchronous Semantics
  • Block for response
  • Exception on failure
  • At-most-once semantics
  • One-Way Request
  • No response needed/possible
  • Non-blocking
  • Best effort semantics
  • Deferred Synchronous
  • Caller can continue and later wait for result

13
Naming
  • Object reference
  • Language independent pointer
  • POA Adaptor to make server-side code accessible
    to client

14
Indirect Binding
15
Message passing models
  • Events
  • No guarantees
  • No persistence
  • Notification
  • Events with filtering

16
Persistent Communications
  • Callback model
  • Client provides object that is called with result
  • Polling Model
  • Client polls for results
  • Messages Stored by ORB

17
Processes
  • Client and Server distinct
  • Client processes are simple
  • Server potentially complex
  • Agent processes
  • Interface to external agent system

18
Common Services
  • Collection service
  • List/queue/etc. objects
  • Iterator, get methods
  • Class library for CORBA
  • Query service
  • Construct collections searchable through
    declarative query language
  • Concurrency control service
  • Locking mechanisms
  • Transaction service

19
Services The Full List
  • Collection Grouping objects into lists, queue,
    sets, etc.
  • Query Querying collections of objects in a
    declarative manner
  • Concurrency Allow concurrent access to shared
    objects
  • Transaction Flat and nested transactions on
    method calls over multiple objects
  • Event Asynchronous communication through events
  • Notification Event-based asynchronous
    communication
  • Externalization Marshaling and unmarshaling of
    objects
  • Life cycle Creation, deletion, copying, and
    moving of objects
  • Licensing Attaching a license to an object
  • Naming Systemwide naming of objects
  • Property Associating (attribute, value) pairs
    with objects
  • Trading Publish and find the services an object
    has to offer
  • Persistence Persistently storing objects
  • Relationship Expressing relationships between
    objects
  • Security Secure channels, authorization, and
    auditing
  • Time Current time within specified error margins

20
Interoperability
  • Multiple ORB vendors
  • Do you have to choose one?
  • General Inter-ORB Protocol
  • Framework without tranport
  • Internet Inter-ORB Protocol on TCP
  • Message Types
  • From client Request, LocateRequest,
    CancelRequest
  • From server Reply, LocateReply
  • Both CloseConnection, MessageError, Fragment

21
CS603CORBA
  • March 29, 2002

22
CORBA Programming
  • Select and install an Object Request Broker
  • More later examples based on ORBIX, C
  • Define the interfaces (IDL)
  • Create classes that implement interfaces
  • Write server function
  • Instantiates classes
  • Registers with ORB
  • Run Server
  • Write and Run Client

23
Ticket OfficeIDL
  • // IDL file ticket.idl
  • typedef float Price
  • struct Place
  • char row
  • unsigned long seat
  • Interface TicketOffice
  • readonly attribute string name
  • readonly attribute unsigned long numberOfSeats
  • Price getPrice (in Place chosenPlace)
  • boolean bookSingleSeat (in Place chosenPlace, in
    string creditCard)

24
Ticket OfficeCompile IDL
  • idl B S ticket.idl // Produces several
    files
  • ticket.hh C headers
  • include ltCORBA.hgt
  • Typedef CORBAFloat Price
  • Struct Place CORBAChar row CORBAULong
    seat
  • Class TicketOffice public virtual CORBAObject
    public
  • Virtual char name() throw (CORBASystemException
    )
  • Class TicketOfficeBOAImpl
  • ticketC.C // stubs for clients
  • ticketS.C // skeleton for server
  • TicketOffice_i.h, .C // Outline of implementation

25
TicketOfficeImplementation Declaration
  • class TicketOffice_i public virtual
    TicketOfficeBOAImpl
  • char m_name
  • Price m-highPrice Price m-lowPrice
  • unsigned char m_avail 1 1 1 1 1 1 1 1
    1
  • public
  • TicketOffice_i (const char theName, const Price
    theHighPrice, const Price theLowPrice)
  • virtual TicketOffice_i()
  • virtual char name() throw (CORBASystemException
    )
  • virtual CORBAULong numberOfSeats()throw
    (CORBASystemException)
  • virtual Price getPrice (const Place
    chosenPlace)throw (CORBASystemException)
  • virtual CORBABoolean bookSingleSeat (const
    Place chosenPlace, const char creditCard) throw
    (CORBASystemException)

26
TicketOfficeImplementation
  • include ticket_i.h
  • TicketOffice_iTicketOffice_i (const char
    theName, const Price theHighPrice, const Price
    theLowPrice) m_highPrice(theHighPrice),
    m_lowPrice (theLowPrice)
  • m_name new charstrlen(theName) 1
  • strcpy(m_name, theName)
  • TicketOffice_iTicketOffice_i()
  • delete m_name
  • char TicketOffice_iname() throw
    (CORBASystemException)
  • return CORBAstring_dup(m_name)
  • CORBAULong TicketOfficenumberOfSeats() throw
    (CORBASystemException)
  • return 9
  • Price TicketOfficegetPrice (const Place
    chosenPlace) throw (CORBASystemException)
  • if (chosePlace.row 1) return m_lowPrice
  • else return m_high_price
  • CORBABoolean TicketOfficebookSingleSeat
    (const Place chosenPlace,const char
    creditCard)throw (CORBASystemException)
  • unsigned long rowIndex chosenPlace.row A
  • if (m_availrowIndexchosePlace.seat)
  • m_availrowIndexchosePlace.seat 0
  • return 1
  • else return 0

27
TicketOfficeServer
  • include ticket_i.h
  • int main()
  • TicketOffice_i myTicketOffice(Loeb, 15.00,
    10.00)
  • CORBAOrbix.impl_is_read(TicketOfficeSrv)
  • Following registers server so it is automatically
    started (or just run a.out)
  • putit TicketOfficeSrv a.out

28
TicketOfficeClient
  • include Ticket.hh
  • int main()
  • TicketOffice_var toVar
  • tovar TicketOffice_bind(TicketOfficeSrv)
  • Place p B, 1
  • if (toVar-gtbookSingleSeat(p, 1234 5678))
  • cout ltlt Seat B1 booked at ltlt toVar-gtname()
    ltlt for ltlttoVar-gtgetPrice(p)
  • else
  • cout ltlt Seat B1 taken

29
CS603CORBA
  • April 1, 2002

30
More on Registering a Server
  • Registration generic (not Orbix-specific)
  • CORBAORB_ptr orb CORBAORB_init(argc, argv,
    Orbix)
  • CORBABOA_ptr boa orb-gtBOA_init (argc, argv,
    Orbix_BOA)
  • boa-gtimpl_is_ready(TicketOfficeSrv)
  • impl_is_ready defaults to waiting forever
  • impl_is_ready(name, ORBAULong timeOut)//
    return if idle for timeOut

31
Wrapping Existing Code
  • TIE approach
  • Creates object that interfaces CORBA to
    identically declared existing C classes
  • Execute DEF_TIE macros to create/bind
  • Multiple inheritance approach
  • CORBA interface implementation inherits
  • BOAImpl
  • Legacy class

32
Finding operationsSimple Binding
  • Simple
  • Optionally specify host
  • Can specify additional information Marker
  • ServermyTicketOffice._marker(Loeb)myTicketOff
    ice._bind(TicketOffice)
  • Clientto_var p to_bind(LoebTicketOffice,
    blitz)

33
Finding OperationsNaming Service
  • Database of bindings name X object ref
  • Naming context Hierarchical structure
  • A name is a sequence
  • typedef sequnceltNameComponentgt Name
  • Struct NameComponent
  • id real name
  • kind application-specific information

34
Finding OperationsNaming Service
  • NamingContext interface
  • Object resolve(in Name n) get object given
    nameraises ( NotFound, CannotProceed,
    InvalidName )
  • Void bind(in Name n, in Object o) -- bind
    object to name
  • Void bind_context(in Name n, in NamingContext nc)
    put name in context
  • CosNaming interface
  • Struct Binding Name binding_name nobject,
    ncontext binding_type
  • Typedef sequenceltBindinggt BindingList
  • Interface NamingContext void list (in unsigned
    long how_many, out BindingList bl, out
    BindingIterator bi)

35
Naming Use
  • Create hierarchy of naming contexts
  • E.g., tourism theatre, hotel,
  • Bind specific name to context
  • tourism.theatre.loeb
  • Resolution Create name and resolve
  • name new CosNamingName(3)
  • name-gtlength(3)
  • name0.id CORBAstring_dup(tourism)
  • name0.kind CORBAstring_dup()
  • name1.id
  • LoebTicketOffices namecontext-gtresolve(name)
  • Also facilities to iterate over or select from
    multiple results

36
More on IDL
  • IDL supports inheritance, multiple inheritance
  • Implementations must do the same
  • Can redefine operations at implementation level
  • Can forward reference / recursive types
  • interface a
  • interface b readonly attribute a a_inst
  • interface a
  • include, define, etc. supported

37
Object References
  • Can pass objects
  • Given class foo, get class foo_ptr (C pointer)
  • Must manually maintain reference counts
  • foo_ptr p2 p1 p2 foo_duplicate(p1)
  • CORBArelease(p2)
  • Class foo_var Automatically maintains reference
    counts
  • Use _ptr for parameters
  • Passing objects Server understands them
  • Parameters defined in IDL
  • Server must have valid implementation (including
    parameters) to invoke them

38
Casting
  • Can assign object reference to object reference
    of parent class
  • Cant use _var for target and _ptr for source
  • Can Narrow Assign object to child
  • child child_class_narrow(parent)

39
Dynamic Invocation(following syntax
ORBIX-specific)
  • Create an on-the fly reference
  • CORBAObject_ptr target // any object
  • CORBARequest r(target, operation)
  • r ltlt CORBAinMode ltlt inparameter ltlt
    CORBAoutMode ltlt outparameter
  • r.invoke()
  • Can use repository to identify name/parameters to
    construct request
  • Only way to make deferred synchronous calls
  • r.send_deferred(), r.poll_response(),
    r.get_response()
  • Also r.send_oneway()

40
Dynamic Skeleton Interface
  • Server equivalent of DII
  • Not required to use DII
  • Intended for gateways
  • Server doesnt understand calls it can process
  • Trusts client/server to generate legal calls
  • Translates to legacy server protocol

41
Security
  • Policy Objects
  • Specify requirements
  • Secure messaging
  • Authentication / signing
  • Trusted host list
  • Security services
  • Know how to implement policy objects
Write a Comment
User Comments (0)
About PowerShow.com