Week 3 Intro to Distributed Object Programming - PowerPoint PPT Presentation

1 / 37
About This Presentation
Title:

Week 3 Intro to Distributed Object Programming

Description:

package soccer; interface Team extends Remote { public: String name() throws RemoteException; ... void transfer(Player p) throws RemoteException; Club makes ... – PowerPoint PPT presentation

Number of Views:20
Avg rating:3.0/5.0
Slides: 38
Provided by: wolfgang95
Category:

less

Transcript and Presenter's Notes

Title: Week 3 Intro to Distributed Object Programming


1
Week 3Intro to Distributed Object Programming
2
Outline
  • Revision - Distributed Systems
  • CORBA
  • CORBA Object Model
  • CORBA Interface Definition Language
  • CORBA Architecture
  • And for a brief comparison.RMI
  • Java (RMI) Object Model
  • Interface Definition in Java
  • RMI Architecture

3
What is a Distributed System?
4
What is a Distributed System?
5
What is a Distributed System?
  • A distributed system is a collection of
    autonomous hosts that that are connected through
    a computer network. Each host executes components
    and operates a distribution middleware, which
    enables the components to coordinate their
    activities in such a way that users perceive the
    system as a single, integrated computing facility.

6
Middleware Examples
  • Transaction-oriented
  • IBM CICS
  • BEA Tuxedo
  • IBM Encina
  • Microsoft Transaction Server
  • Message-oriented
  • Microsoft Message Queue
  • TIBCO Rendezvous
  • IBM MQ Series
  • Procedural
  • Sun ONC
  • Linux RPCs
  • OSF DCE
  • Object-oriented
  • OMG CORBA
  • Sun Java/RMI
  • Microsoft COM
  • Sun Enterprise Java Beans

7
Centralized System Characteristics
  • One component with non-autonomous parts
  • Component shared by users all the time
  • All resources accessible
  • Software runs in a single process
  • Single Point of control
  • Single Point of failure

8
Distributed System Characteristics
  • Multiple autonomous components
  • Components are not shared by all users
  • Resources may not be accessible
  • Software runs in concurrent processes on
    different processors
  • Multiple Points of control
  • Multiple Points of failure

9
CORBA
10
Who is the OMG?
  • Non-profit organization with HQ in the US,
    representatives worldwide.
  • Founded April 1989.
  • More than 800 members.
  • Dedicated to creating and popularizing
    object-oriented industry standards for
    application integration, e.g.
  • CORBA
  • ODMG
  • UML

11
Goal of CORBA
  • Support distributed and heterogeneous object
    request in a way transparent to users and
    application programmers
  • Facilitate the integration of new components with
    legacy components
  • Open standard that can be used free of charge
  • Based on wide industry consensus

12
Object Management Architecture
Application Objects
CORBA facilities
Domain Interfaces
Object Request Broker
CORBAservices
13
Object Model and Interface Definition
  • Objects
  • Types
  • Modules
  • Attributes
  • Operations
  • Requests
  • Exceptions
  • Subtypes

14
OMG Interface Definition Language
  • Language for expressing all concepts of the CORBA
    object model
  • OMG/IDL is
  • programming-language independent
  • oriented towards C
  • not computationally complete
  • Different programming language bindings are
    available
  • Many changes from version 2.2 to 2.3 and 3.0

15
Basic Example
Clients hold references to objects
Server Process
Client
Obj1
Client
Obj2
Client
16
CORBA Object Model Objects
  • Each object has one identifier that is unique
    within an ORB
  • like a phone number
  • Multiple clients can hold references to same and
    different objects
  • References support location transparency
  • machine/process transparency
  • Object references are persistent
  • stored and retrieved from disk

17
CORBA Object Model Types
  • typedef struct _Address
  • string street
  • string postcode
  • string city
  • Address
  • typedef sequenceltAddressgt AddressList
  • interface Customer ...

18
CORBA Object Model Modules
module MyOrg typedef struct _Address
string street string postcode string city
Address module People typedef struct
_Address string flat_number string
street string postcode string city
string country Address
19
CORBA Object Model Attributes
interface Customer typedef sequenceltCustomergt
CustList interface Supplier typedef
sequenceltSuppliergt SuppList interface E-Org
readonly attribute string name attribute
CustList customers attribute SuppList
suppliers ...
20
CORBA Object Model Operations
  • interface Org
  • ...
  • void getStockPrice(in Date d)
  • string printDetails()

21
CORBA Object Model Requests
  • Requests are defined by client objects
  • Request consist of
  • Reference of server object
  • Name of requested operation
  • Actual request parameters
  • Request is executed synchronously
  • Org myOrgObj
  • //Initialize myOrgObj to refer to a remote //Org
    object - more later
  • myOrgObj-gtprintDetails()

22
Parameter Passing
  • Rules govern how in and out parameters are passed
    (more later..)
  • Until CORBA 2.3, CORBA objects can only be passed
    by reference, not value
  • ie a reference to a remote object as a parameter
  • need to manually deconstruct and construct an
    object by defining a struct to hold the objects
    data
  • Value Types now support passing objects by value
  • This course wont cover value types...

23
CORBA Object Model Exceptions
  • Generic Exceptions (e.g. network down, invalid
    object reference, out of memory)
  • Type-specific Exceptions

exception OutOfStocksequenceltDategt since
interface Org ... short order(in Date d, in
Stock s) raises(OutOfStock)
Operations declare exceptions they raise
24
CORBA Object Model Subtypes
interface Organization readonly attribute
string name interface OpUnit Organization
exception NotEnoughCash readonly
attribute short noOfStaff readonly attribute
Address location void transfer(in Cash p)
raises NotEnoughCash
25
Architecture
26
Java/RMI
27
Goals of RMI
  • In Java 1.0 object communication confined to
    objects in one Virtual Machine
  • Remote Method Invocation (RMI) supports
    communication between different VMs, potentially
    across the network
  • Provide tight integration with Java
  • Minimize changes to Java language/VM
  • Work in homogeneous environment

28
Java Object Model
  • Interfaces and Remote Objects
  • Classes
  • Attributes
  • Operations
  • Exceptions
  • Inheritance

29
Java Interfaces and Remote Objects
  • Java already includes the concept of interfaces
  • RMI does not have a separate interface definition
    language
  • Pre-defined interface Remote
  • Remote interfaces extend Remote
  • Remote classes implement remote interfaces
  • Remote objects are instances of remote classes

30
Java Remote Interface Example
package soccer interface Team extends Remote
public String name() throws RemoteException
Trainer coached_by() throws RemoteException
Club belongs_to() throws RemoteException
Players players() throws RemoteException void
bookGoalies(Date d) throws RemoteException void
print() throws RemoteException
31
Attributes
  • RMI does not attributes
  • Attributes must be represented as set and get
    operations by the designer
  • Example

interface Club extends Organization, Remote
public int noOfMembers() throws
RemoteException Address location() throws
RemoteException Team teams() throws
RemoteException Trainer trainers() throws
RemoteException ...
32
Combining Classes and Remote Interfaces
interface Organization private String
name() RemoteException class Address
public String street String postcode
String city interface Club extends
Organization, Remote public int
noOfMembers() throws RemoteException Address
location() throws RemoteException Team
teams() throws RemoteException Trainer
trainers() throws RemoteException void
transfer(Player p) throws RemoteException
33
Parameter Passing
  • Atomic types are passed by value
  • Remote objects are passed by reference
  • Non-Remote objects are passed by value

class Address public String street
String postcode String city interface Club
extends Organization, Remote public Address
location() throws RemoteException ...
34
Exception
  • Pre-Defined Exception RemoteException
  • Type-Specific Exceptions
  • Example

class PlayerBooked extends Exception
interface Team extends Remote public
... void bookGoalies(Date d) throws
RemoteException, PlayerBooked ...
35
Architecture
Server
Client
Registry
Activation
Stub
Skeleton
Interfaces
Interfaces
RMI Runtime (
rmid
,rmiregistry
)
36
Activation in Java
Java VM
Stub
Java VM
2
1
2 create object
Faulting
in VM
Reference
Live
Activa-
3 pass
ref
tion ID
object ref
AG
AG
1
2
Activator
1 activate
Activation Descriptors
ActGroup

ClassName

URL

Init
AG
Team
www.bvb.de/
1
AG
Player
www.bvb.de/
2
AG
Player
www.bvb.de/
2
4 update
AG
Player
www.bvb.de/
2
live ref
Client Host
Host
www.bvb.de
37
Key Points
  • CORBA, COM and RMI
  • enable objects to request operation execution
    from server objects on remote hosts
  • identify server objects by object references
  • distinguish between interface and implementation
  • treat attributes as operations
  • provide mechanisms to deal with failures
  • have statically typed object models
  • compile stubs from their IDLs
  • support on-demand activation
Write a Comment
User Comments (0)
About PowerShow.com