Common Object Request Broker Architecture (CORBA) CS-328.

22
Common Object Request Broker Architecture (CORBA) CS-328

Transcript of Common Object Request Broker Architecture (CORBA) CS-328.

Page 1: Common Object Request Broker Architecture (CORBA) CS-328.

Common Object Request Broker Architecture (CORBA)

CS-328

Page 2: Common Object Request Broker Architecture (CORBA) CS-328.

What is CORBA

• Specification for a standard O-O architecture for applications

• 1990 - Object Management Group publishes “Object Management Architecture Guide”

• 1991 - Common Object Request Broker Architectural Specification

Page 3: Common Object Request Broker Architecture (CORBA) CS-328.

CORBA’s Goal

• Integrate existing mainframe applications with desktop based tools– Access distributed information and resources from within desktop

tools

– Make existing business data available as network resources

– Augment desktop applications with custom functions and capabilities for a particular business

– Change and evolve network based systems to reflect new topologies or resources

Page 4: Common Object Request Broker Architecture (CORBA) CS-328.

Distributed Computing

• Two or more pieces of software sharing information– could be on same machine

– could be on different machines on same network

– could be on different machines on different networks

• based on client/server concepts

• Benefits:– sharing of scarce resources

– load balancing

– run applications on most appriate hardware

• Existing Mechanisms - RMI, RPC, Corba, network APIs

Page 5: Common Object Request Broker Architecture (CORBA) CS-328.

Distributed Object Computing

• Marriage of Distributed Computing with an Object Model

• Uses a broker to handle messages requests between clients and servers– broker can choose server that best fits needs of client

– allows separation of interface and implementation

– allows building block approach to development and evolution

Page 6: Common Object Request Broker Architecture (CORBA) CS-328.

Object Model

• Provides:– Abstraction

• group objects and focus on their similarities

– Encapsulation• hide implementation details from the services provided

– Inheritance• ability to pass along (object-to-object) capabilities and behaviors

– Polymorphism• ability to substitute objects with matching interfaces at run time

Page 7: Common Object Request Broker Architecture (CORBA) CS-328.

Object Management Architecture

Application

Objects

Common

Facilities

Object Request

Broker

Object

Services

Page 8: Common Object Request Broker Architecture (CORBA) CS-328.

What does the ORB do?

• The ORB provides a communications hub for all objects– analogous to a hardware bus

• Provides object services– creation, access control and object tracking

• Common Facilities– db access, printing, synchronization, document

management

Page 9: Common Object Request Broker Architecture (CORBA) CS-328.

CORBA Object Communications

• CORBA Objects communicate via their interfaces

• Interfaces are defined using Interface Definition Language

– Language independent

• Designed to be language agnostic

– Directly maps most common data types

• There are some datatype mapping problems, especially when using different languages for the client and server.

Page 10: Common Object Request Broker Architecture (CORBA) CS-328.

CORBA Object Communications

Object A Object B

Interface Interface

IIOP

Page 11: Common Object Request Broker Architecture (CORBA) CS-328.

Conceptually ...

Client

Client

Client

Server

Server

Server

ORB

Page 12: Common Object Request Broker Architecture (CORBA) CS-328.

What happens...

• Server objects register their methods with the orb naming service

• Client binds to the orb naming server for a server object method

• Naming service return location of server object and disconnects

• Client connects to server at returned location

Page 13: Common Object Request Broker Architecture (CORBA) CS-328.

Really though...

Client

Client

Client

Server

Server

Server

ORB

Services

Registration

1

2

3

Page 14: Common Object Request Broker Architecture (CORBA) CS-328.

3-Tier Client Server

Client

Client

Client

Server DB

Sockets

JavaIDL

JavaRMIJDBC

Native

Page 15: Common Object Request Broker Architecture (CORBA) CS-328.

3-Tier Advantages

• Server can manage database connections efficiently

• Client can focus on presentation

• Server can preformat data for client and focus on business logic

• Running server on high performance hardware can improve perceived performance

Page 16: Common Object Request Broker Architecture (CORBA) CS-328.

Interface Definition Language

• In Java we cannot separate a class’s definition from its implementations as we can in C++– Header files– Implementation files

• CORBA allows the separation of definition and implementation

Page 17: Common Object Request Broker Architecture (CORBA) CS-328.

IDL (more)

• CORBA uses IDL for defining interfaces between clients and servers

• ORB Vendors provide specific IDL compilers for supported languages– create target language stubs and skeletonsfor

building CORBA clients and servers• C, C++, Smalltalk, Java, COBOL …

Page 18: Common Object Request Broker Architecture (CORBA) CS-328.

IDL/Java type mapping

• due to differences in heritage IDL and Java types don’t have a 1 to 1 mapping:

long Java int

short Java short

float Java float

double Java double

char Java char

boolean Java boolean

octet java byte

string java.lang.String

any Special type consisting of any of the above

Page 19: Common Object Request Broker Architecture (CORBA) CS-328.

an IDL interface

• ex.

interface Cooler {

int getHotWaterLevel();

int getWarnWaterLevel();

int getColdWaterLevel();

exception NoMoreWaterException { };

int getHotWater() throws NoMoreWaterException;

int getWarmWater() throws NoMoreWaterException;

int getColdWater() throws NoMoreWaterException;

}

Page 20: Common Object Request Broker Architecture (CORBA) CS-328.

Compiling the IDL

• Compiling the IDL using the javatoidl compiler will produce six classes:– CoolerRef

– CoolerHolder

– CoolerOperations

– CoolerStub

– CoolerServant

– CoolerSkeleton

Page 21: Common Object Request Broker Architecture (CORBA) CS-328.

The ORB• What is it that the ORB does ?

– Object location• Location transparency

– Object communications• Marshalls and unmarshalls parameter and results data

– Services• Object Life Cycle Management• Naming• Event decoupling• Relationship management• Externalization• Transaction management• Concurrency control• Property management• Trader – locating objects based on properties• Object query

Page 22: Common Object Request Broker Architecture (CORBA) CS-328.

OEM Orb Info• The Borland VisiBroker Orb is built into Netscape Communicator 4.x

but can be purchased seperately– CORBA 3.0 Compliant

– Language support – C++, Java, .NET (C++ and C#)

• Orbix & Orbacus (Progress Software (previously Iona Technologies)

– CORBA 2.6 Compliant

– Language support - C, C++, Java, COBOL, Smalltalk, Ada, PL/1, Lisp, Python and IDLscript. In additionally mappings for Perl, Objective-C, Oberon, Eiffel, Modula3, Scheme, and Tcl.

• J2SE - org.omg.CORBA ( in the JDK) since JDK 1.3) – Provides the mapping of the OMG CORBA APIs to the JavaTM

programming language, including the class ORB• class ORB is implemented such that a programmer can use it as a fully-

functional Object Request Broker (ORB).