CORBA Introduction and Programming

Download Report

Transcript CORBA Introduction and Programming

Objektorienteret Netværkskommunikation
(ITONK1)
CORBA Introduction
Outline
• CORBA (part one)
– Introduction & Background
– Architecture
– Session & Presentation layer
• GIOP / IIOP / CDR
– CORBA Interface Definition Language – IDL
– Language mappings
– CORBA development steps
Slide 2 of 24
© Ingeniørhøjskolen i Århus
Who is the OMG?
• OMG: Object Management Group
– http://www.omg.org
•
•
•
•
Non-profit organization
Founded April 1989
More than 800 members
Dedicated to creating and popularizing
object-oriented industry standards for
application integration, e.g.
– CORBA 1.0 (1995) –> CORBA 3.0
– UML 1.1 nov. 97. -> 1.5 (2004)
Slide 3 of 24
© Ingeniørhøjskolen i Århus
Goal of CORBA
• CORBA: Common Object Request Broker Architecture
• 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
– But not much Microsoft support
• Problem with CORBA
– Considered too complex by many
Slide 4 of 24
© Ingeniørhøjskolen i Århus
The specifications
• CORBA is a collection of specifications
• http://www.omg.org/technology/documents/co
rba_spec_catalog.htm
– Common Object Request Broker Architecture
(CORBA/IIOP) (3.0.2)
– CORBA Component Model (3.0)
– Minimum CORBA (1.0)
– Real-Time CORBA (Dynamic Scheduling) (2.0)
– Real-Time CORBA (Static Scheduling) (1.1)
– Many others
– Realted to UML
• UML Profile for CORBA (1.0)
Slide 5 of 24
© Ingeniørhøjskolen i Århus
Object Management Architecture (OMA)
Application
Objects
Domain
Interfaces
CORBA
Facilities
Object Request Broker
CORBA Services
(mandatory)
Slide 6 of 24
© Ingeniørhøjskolen i Århus
CORBA Architecture1
• There are many different vendors and ORB
types
• Many of which do not interoperate
• Must check specification
• OrbBacus from IONA produces both C++ and
Java
• Sun J2SE SDK has only Java-based ORB
• C++ ORB from IONA will work with SUN ORB
as specified
• Many others
– MicoORB, Middcor, TAO, openORB, VisiBroker
Slide 7 of 24
© Ingeniørhøjskolen i Århus
CORBA Architecture 2
Object Implementation
Client
Dynamic
Invocation
Client
Stubs
ORB
Interface
Implementation
Skeletons
Object
Adapter
ORB Core
One standardised interface
One interface per object operation
One interface per object adapter
ORB-dependent interface
Slide 8 of 24
© Ingeniørhøjskolen i Århus
Interoperability Protocols
Applications
Environment
Specific ..
CORBA 2.0
ESIOP
GIOP
IIOP
DOETalk
........
DCE-CIOP
........
Mandatory: provides "out of the box" interoperability
Slide 9 of 24
© Ingeniørhøjskolen i Århus
General Inter-ORB Protocol (GIOP)
• Handles the session & presentation layer
• Defines seven message primitives:
– Request, Reply, Locate Request, Locate Reply,
Cancel request, Close Connection, Message Error
– More simple than JRMP for Java RMI
• Internet Inter-ORB Protocol (IIOP)
– Maps GIOP to TCP/IP
– Provides operations to open and close TCP/IP
connections
– Is required from ORBs for CORBA compliance
– But intra vendor ORB com is not restricted to this
Slide 10 of 24
© Ingeniørhøjskolen i Århus
Common Data Representation (CDR)
• Defined as part of GIOP
• Presentation layer implementation to
support heterogeneity
• Mapping of IDL data types to transport
byte stream
• Encodings of
– primitive types
– constructed types
– interoperable object references
Slide 11 of 24
© Ingeniørhøjskolen i Århus
Recap - motivation for an IDL
• IDL: Interface Definition Language
• Components of distributed systems are
written in different programming
languages
• Programming languages may or may
not have their own object model
• Object models largely vary
• Differences need to be overcome in
order to facilitate integration
Slide 12 of 24
© Ingeniørhøjskolen i Århus
Heterogeneous OO Network
“Object
Wrapping
of non
OO application”
CORBA
Cobol
Database
Server
CORBA
Java
Client
App.1
CORBA
C#
Client
App.2
TCP/IP
Network
CORBA
C++
Client
App.3
DB
Different ORB’s from different vendors, on different operating
systems – and written in different languages = Heterogenity
Slide 13 of 24
© Ingeniørhøjskolen i Århus
CORBA Programming Language Bindings
Smalltalk
C++
Ada-95
IDL
Common
Object
Model
Java
C
.NET
Janeva / Middcor (C#)
Cobol
Slide 14 of 24
© Ingeniørhøjskolen i Århus
Interface Definition Language (IDL)
• Language for expressing all concepts of
the middleware’s object model
• Should be
– programming-language independent
– not computationally complete
• Bindings to different programming
languages are needed
– language bindings are specified by CORBA
Slide 15 of 24
© Ingeniørhøjskolen i Århus
Example UML to IDL mapping
Organization
#name:string
uses
Club
-noOfMembers:int 1
-location:Address
+transfer(p:Player)
1..*
works for
Trainer
-name:string
+train()
1..*
1..*
Team
-name:string
+bookGoalies()
Player
plays in -name:string
1
11..16 -Number:int
+book()
Slide 16 of 24
© Ingeniørhøjskolen i Århus
CORBA Object Model: Types
typedef struct Address {
string street;
string postcode;
Constructed string city;
Atomic
types
};
types
typedef sequence<Address> AddressList;
interface Team { ... };
Object
type
Slide 17 of 24
© Ingeniørhøjskolen i Århus
CORBA Object Model: Modules
Soccer::Address
module Soccer {
typedef struct Address {
string street;
string postcode;
string city;
Modules =
namespaces };
People::Address
};
module People {
typedef struct Address {
string flat_number;
string street;
string postcode;
string city;
string country;
};
};
Slide 18 of 24
© Ingeniørhøjskolen i Århus
CORBA Object Model: Attributes
interface Player;
typedef sequence<Player> PlayerList;
interface Trainer;
typedef sequence<Trainer> TrainerList;
interface Team {
Clients cannot
readonly attribute string name;
change value
attribute TrainerList coached_by;
changeable
attribute Club belongs_to;
attribute PlayerList players;
...
};
Attribute type
Slide 19 of 24
Attribute name
© Ingeniørhøjskolen i Århus
CORBA Object Model: Operations
Parameter kind
Return types
interface Team {
Parameter list
...
void bookGoalies(in Date d);
string print();
};
Parameter type
Parameter name
Operation name
used in requests
Slide 20 of 24
© Ingeniørhøjskolen i Århus
CORBA Object Model: Exceptions
• Generic Exceptions (e.g. network down,
invalid object reference, out of memory)
• Type-specific Exceptions
Exception name
Exception data
exception PlayerBooked{sequence<Date> free;};
interface Team {
void bookGoalies(in Date d) raises(PlayerBooked);
};
Operations declare
exceptions they raise
Slide 21 of 24
© Ingeniørhøjskolen i Århus
CORBA Object Model: Subtypes
Implicit supertype: Object
Inherited by Club
interface Organization {
readonly attribute string name;
Supertype
};
interface Club : Organization {
exception NotInClub{};
readonly attribute short noOfMembers;
readonly attribute Address location;
attribute TeamList teams;
attribute TrainerList trainers;
void transfer(in Player p) raises NotInClub;
};
Slide 22 of 24
© Ingeniørhøjskolen i Århus
Development Steps – CORBA vs RMI & SOAP
CORBA
AXIS
SOAP
Design
J2SE JDK
Java2WSDL
Start with Server
Interface Coding: JAVA
Server Stub
Generation
C++, Java …
Interface
Definition
SOAP: WSDL
RMI: JAVA interface
WSDL2JAVA
CORBA: IDL
RMI: rmic
Server
Coding
Server
Registration
CORBA: IDL
Client Stub
Generation
Client
Coding
RMI: JAVA
C++, Java …
ORB
rmiregistry
Slide 23 of 24
© Ingeniørhøjskolen i Århus
CORBA Client and Server Implementation
Team.idl
Client.cc
Server.cc
IDL-Compiler
Teamcl.hh
Teamsv.hh
Teamcl.cc
Teamsv.cc
C++ Compiler, Linker
C++ Compiler, Linker
Client
included in
generates
reads
Slide 24 of 24
Server
© Ingeniørhøjskolen i Århus