Vous êtes sur la page 1sur 18

‫‪CORBA‬‬

‫إعداد‪ :‬م‪ .‬قم‪ .‬أبي سلوم‬


?What is CORBA
• Common Object Request Broker Architecture

• A specification for creating and using distributed objects

• Enable the development of code that is independent


of
o Hardware devices
o Operating System
o Network protocols
o Programming languages

2
CORBA Architecture
Object Request Broker
• It is a mechanism for invoking operations on an object in
a different process
• It is Responsible for:
o Object location transparency
• Find the object implementation for the request
o Object activation
• Prepare the object implementation to receive the
request
o Communication
• Communicate the data making up the request

4
Interface Definition Language (1)

• A CORBA object is specified with interface.

• The interface is Independent of any particular language and


compiler.

• This independence because the interface is defined in an


IDL file that is a public application programming interface
(API) )

• CORBA defines mappings from IDL to many programming


languages
5
Interface Definition Language (2)
The role of IDL

Client Side Server Side

C COBOL

++C C
IDL IDL

IDL IDL
COBOL Ada
IDL IDL
ORB ORB
IDL IDL

Ada Small
IDL IDL talk
IDL IDL

Java ++C

More More

6
IDL Compiler

IDL
1. Define objects using
IDL Definitions
2. Run IDL file through
IDL compiler
3. Compiler uses
language mappings IDL
to generate
programming Compiler
language specific
stubs and skeletons

Stubs Skeletons
Servant,POA
• Servant is an object written in a programming language
that implements an IDL interface.

• Portable Object Adapter(POA) is a contaier


o remote objects lives in POA
o service provided by a POA is applied to the servants
within that POA.
IDL Structure (Data Types)
• IDL Supports a rich variety of data types

• Primitive:
float, double, long, short (signed, unsigned), char,long
long, boolean, octet

• Complex :
arrays, sequences, structures

Copyright (c) Qusay H. Mahmoud 9


IDL Structure (Modules)

• A module is analogous to a package in Java

• Example:

module Bank {
//body
};

10
IDL Structure (Interfaces)
• An IDL interface is the definition of an object

• IDL interfaces are analogous to Java interfaces

• An interface declares the operations that the CORBA


object supports and its attributes

interface Account {
//attributes
// operations
};
11
IDL Structure (Attributes)

• An attribute can be readonly or read-write

interface Account {
read-write attribute string name;
readonly attribute long accountNumber;
};

Copyright (c) Qusay H. Mahmoud 12


IDL Structure (Operations)
• They have a return type and parameters

• Parameters are flagged as:


o in: parameter is passed from client to server
o out: parameter is passed from server to client
o inout: parameter is passed in both directions

• Example

void add(in long a, in long b, out long sum);

13
IDL Structure (Exceptions)

• IDL supports user-defined exceptions

exception InsufficientFunds {
System.out.println(“exception”);
};
void withdraw(in unsigned long
amount)
raises (InsufficientFunds);
};

Copyright (c) Qusay H. Mahmoud 14


CORBA services
• CORBA includes specifications for services that may be
required by distributed objects

• The service themselves are provided and accessed as


CORBA remote objects

• Examples
o Naming service
o Security service
o Persistent object service (POS)

-
Name Service
• construct sub name context under a root naming context.

• Objects within NameContext are composed of


NameComponent arrays.

• used service to bind and discover objects according to


specified names.
Comparison : RMI and CORBA (II)
• Both provide a framework for developing distributed applications
• Both provides tools to generate stubs and skeletons for
application
o RMI use RMI compiler (rmic) and CORBA use various
compilers (eg. idlj for java)
• Both provide name service to register and discover service by
name
• RMI is designed only for Java and only works under JVM
(exception: RMI-IIOP)
• CORBA is designed to work with multiple languages and
platforms
THE END

Vous aimerez peut-être aussi