Introduction to CORBA Introduction CORBA Common Object Request

  • Slides: 55
Download presentation
Introduction to CORBA

Introduction to CORBA

Introduction - CORBA (Common Object Request Broker Architecture) is a standard that enables an

Introduction - CORBA (Common Object Request Broker Architecture) is a standard that enables an object written in one programming language, running on one platform to interact with objects across the network that are written in other programming languages and running on other platforms. - For example, a client object written in C++ and running under Windows can communicate with an object on a remote machine written in Java running under UNIX. 2

OMG The CORBA specification was developed by the Object Management Group (OMG). The OMG

OMG The CORBA specification was developed by the Object Management Group (OMG). The OMG is an international, not-for-profit group consisting of approximately 800 companies and organizations defining standards for distributed object computing CORBA is only one of the specifications they develop. They are also behind other key object oriented standards such as UML (Unified Modeling Language). 3

History - The OMG was established in 1988 and the initial CORBA specification came

History - The OMG was established in 1988 and the initial CORBA specification came out in 1992. Over the past 10 years significant revisions have taken place. - Version 2. 0, which defined a common protocol for specifying how implementations from different vendors can communicate, was released in the midnineties. - The current version of CORBA is 3. 0, which introduced the CORBA Component Model. 4

Specification vs. Implementation CORBA, as defined by the OMG, is a standard or specification

Specification vs. Implementation CORBA, as defined by the OMG, is a standard or specification and not a particular piece of software. CORBA 3. 0 is actually a suite of 10 standards, each defining aspects of a CORBA implementation. Several implementations of the CORBA standard exist. Among the most widely used are IBM’s SOM (a. k. a. SOMobjects) and DSOM architectures. There also free implementations available for general use. 5

CORBA Integrations - An implementation of CORBA has been integrated into Netscape browsers. -

CORBA Integrations - An implementation of CORBA has been integrated into Netscape browsers. - CORBA has been built into Netscape ONE (Open Network Environment) - Netscape’s application environment based on open internet standards. - The Enterprise Edition of IBM’s Web. Sphere (a software platform to help build and deploy high performance web sites) integrates CORBA (as well as Enterprise Java Beans) to build highly transactional, high-volume e-business applications 6

Standard Call and Return

Standard Call and Return

CORBA Architecture

CORBA Architecture

Three-tier CORBA Architecture

Three-tier CORBA Architecture

The Primary Elements • IDL – Interface Definition Language • Client / Server CORBA

The Primary Elements • IDL – Interface Definition Language • Client / Server CORBA Objects – Abstract objects based upon a concrete implementation • ORBs – Object Request Brokers • GIOP / IIOP – General and Internet Inter-Object Protocols 10

Interface Definition Language • Defines public interface for any CORBA server. • C++ like

Interface Definition Language • Defines public interface for any CORBA server. • C++ like syntax • Client and Server implemented based on compilation of the same IDL (usually) • OMG has defined mappings for: – C, C++, Java, COBOL, Smalltalk, ADA, Lisp, Python, and IDLscript 11

Highlighted IDL Features • • • Pass by reference and by value In, out,

Highlighted IDL Features • • • Pass by reference and by value In, out, and inout parameters Inheritance Throwing of exceptions The Any Type Callbacks – Enables Peer-to-Peer Object Communication. • Also supports: – structs, unions, enumerations, all c++ scalars, arrays, sequences, octets, strings, constants, and typedefs. 12

Steps to Write a CORBA Object in Java

Steps to Write a CORBA Object in Java

Client / Server CORBA Objects

Client / Server CORBA Objects

Client / Server CORBA Objects Cont. • Abstract – Do not have their own

Client / Server CORBA Objects Cont. • Abstract – Do not have their own implementation. The elements of a CORBA object (interface, implementation, and location) are held rendered via other elements. • Implemented via a Servant – A servant is a block of code (usually an instance of a class) which implements the public interface of the CORBA object. Depending on the server policies, there may or may not be multiple instances of the servant and it may or may not be multi -threaded. • Configured in code or at server startup – Unlike COM+ and EJB the policies for a CORBA object which control things such as Security, threading, and persistence are not console configurable 15

Object Request Brokers (Orbs) • Responsible for all communication – Locating objects • Implementation

Object Request Brokers (Orbs) • Responsible for all communication – Locating objects • Implementation specific • Known IOR(Inter-Object Reference) • Naming and Trading Services( DSN-like) – Transferring invocations and return values – Notifying other ORBs of hosted Objects • Must be able to communicate IDL invocations via IIOP • If an ORB is OMG compliant, then it is interoperable with all other OMG compliant ORBs 16

Additional ORB Services • Interface Repository – A Database of all of the IDL

Additional ORB Services • Interface Repository – A Database of all of the IDL for compiled objects running on the ORB • Implementation Repository – A Database containing policy information and the implementation details for the CORBA objects running on the ORB • Load Balancing • Fail-over support (대체동작 지원) • Security 17

Advantages • Maturity: feature-rich, diverse capabilities(Tx, security) • • • Open Standard Wide platform

Advantages • Maturity: feature-rich, diverse capabilities(Tx, security) • • • Open Standard Wide platform support Wide language support Efficiency Scalability 18

Drawbacks • Lower Level than COM+/. NET/EJB • Steeper Learning Curve than other solutions.

Drawbacks • Lower Level than COM+/. NET/EJB • Steeper Learning Curve than other solutions. • Firewall unfriendly • Regared as complicated • No standard to get the initial reference for the naming services. 19

Object Management Architecture(OMA) • Center of all the activity undertaken by OMG • OMA

Object Management Architecture(OMA) • Center of all the activity undertaken by OMG • OMA specifies a range of architectural entities surrounding the core ORB, which is CORBA proper • Detailed specifications for each component and interface category is populated in OMA reference Model 20

OMA Reference Model

OMA Reference Model

CORBA Services • CORBA Services provides basic functionality, similar to the services that system

CORBA Services • CORBA Services provides basic functionality, similar to the services that system library calls do in UNIX. Functions includes creating objects, controlling access to objects, keeping track of relocated objects and to consistently maintain relationship between objects. 22

Horizontal CORBA Facilities • Horizontal CORBA Facilities sit between the CORBA services and Application

Horizontal CORBA Facilities • Horizontal CORBA Facilities sit between the CORBA services and Application objects. • User-interface, information management, system management, and task management. • The Horizontal Common Facilities are those facilities that are used by most systems. • the Printing Facilities, the Secure Time Facilities, the Internationalization Facilities, and Mobile Agent Facilities. 23

Domain(Vertical) CORBA Facilities • facilities that are specific to particular domains or industries, rather

Domain(Vertical) CORBA Facilities • facilities that are specific to particular domains or industries, rather than widely applicable. • Define a standard interfaces for standard objects shared by companies within a specific vertical market(e. g. healthcare, manufacturing, finance). Now nine industries have their own OMG task force. 24

Agent • An agent is a computer program that acts autonomously on behalf of

Agent • An agent is a computer program that acts autonomously on behalf of a person or organization. Currently, most agents are programmed in an interpreted language (for example, Tcl and Java) for portability. • A stationary agent executes only on the system where it begins execution • A mobile agent is not bound to the system where it begins execution. It has the unique ability to transport itself from one system in a network to another

Application Objects • Topmost part of the OMA hierarchy. • Provide access to application

Application Objects • Topmost part of the OMA hierarchy. • Provide access to application objects that can invoke methods on remote objects through ORB. Application is built from a large number of basic object classes, new classes can be generated or specified provided by CORBA services. • Standardization is not required. 26

Three Benefits of using OMA 1. Coding is quicker, so application can be deployed

Three Benefits of using OMA 1. Coding is quicker, so application can be deployed sooner 2. Applications designed around discrete services have better architecture 3. Many OMA implementations have enterprise characteristics built in: they’re robust, and they scale. 27

CORBA vs. DCOM • DCOM supports an object-oriented model, but differs substantially from classical

CORBA vs. DCOM • DCOM supports an object-oriented model, but differs substantially from classical OO models. DCOM object provides services through one or more distinct interfaces. • DCOM is lack of polymorphism, instead, it constructs application from binary components. 28

CORBA vs. DCOM • The major difference is CORBA is an open specification. DCOM

CORBA vs. DCOM • The major difference is CORBA is an open specification. DCOM has the potential to evolve at a faster rate than CORBA because the politics will be simpler. • CORBA can be deployed far more widely than DCOM and runs in most current OS environment, while DCOM is running almost exclusively in the Windows environment. 29

CORBA vs. JAVA/RMI • Some overlap between these two, both provide a viable means

CORBA vs. JAVA/RMI • Some overlap between these two, both provide a viable means of building distributed applications. • CORBA is concerned with interfaces between objects and applications modeled as objects, Java is primarily concerned with the implementation of these objects. 30

CORBA vs. JAVA/RMI • JAVA/RMI systems fall short of seamless integration because of their

CORBA vs. JAVA/RMI • JAVA/RMI systems fall short of seamless integration because of their interoperability requirements with other languages. • JAVA/RMI system assumes the homogeneous environment of the JVM, which can only take advantage of Java Object Model. • Coexistence between CORBA and Java 31

The Future of CORBA • Much easier for developers to build and run client/server

The Future of CORBA • Much easier for developers to build and run client/server applications written in different languages using the IDL interface • Compute-domain benefits – Functionality the same as if written to sockets or some other RPC device • Business-domain benefits – Allows rapid development of full service website 32

Companies Using CORBA Today • AT&T – Late 1990’s developed 20 to 40 systems

Companies Using CORBA Today • AT&T – Late 1990’s developed 20 to 40 systems using CORBA for both internal and external access – Are certain development time for future projects will be greatly reduced by building reusable frameworks with the OMG • The Weather Channel – Used CORBA and Linux – System is reliable, low maintenance, offers data logging – Cut software development time from months to weeks 33

Companies Using CORBA Today • Raytheon Company – Needed to update its complex real-time

Companies Using CORBA Today • Raytheon Company – Needed to update its complex real-time distributed system – Built new system using C++ and CORBA – Ready to build next generation system 34

Companies with Plans to Develop Using CORBA • Chase Manhattan Bank – Plans to

Companies with Plans to Develop Using CORBA • Chase Manhattan Bank – Plans to develop wholesale banking service – Will use CORBA and Java-based middleware – Further plans to introduce Java-based mortgage application service as well as integration with third-party applications possibly by year’s end • Nokia Telecommunications – Combining use of Orbix and CORBA to continue enhancing products and manage value added services based on a common architecture. 35

NOKIA “Nokia’s decision [to use CORBA] highlights the continuing adoption of CORBA and is

NOKIA “Nokia’s decision [to use CORBA] highlights the continuing adoption of CORBA and is recognition of the fast, effective, scaleable and open approach to the development of powerful, intelligent, mission-critical network services that CORBA offers. ” Colin Newman, VP Marketing at IONA (Developers of the Orbix ORB) 36

References • www. oma. org • www. corba. org • developer. java. sun. com/devel

References • www. oma. org • www. corba. org • developer. java. sun. com/devel oper/ online. Training/corba 37

CORBA IDL language • Different from C++ in several additional commonly used keywords –

CORBA IDL language • Different from C++ in several additional commonly used keywords – – – – – interface module any attribute in, out, inout readonly oneway raises exception context

IDL structure • Modules – Similar to packages in Java – Define the naming

IDL structure • Modules – Similar to packages in Java – Define the naming scope • Interfaces – Inheritance • interface B: A{ }; – Multiple inheritance allowed • interface Z: B, C { }; • Structs • Typedefs

CORBA IDL struct Rectangle{ 1 long width; long height; long x; long y; };

CORBA IDL struct Rectangle{ 1 long width; long height; long x; long y; }; struct Graphical. Object { 2 string type; Rectangle enclosing; boolean is. Filled; }; interface Shape { 3 long get. Version() ; Graphical. Object get. All. State() ; // returns state of the Graphical. Object }; typedef sequence <Shape, 100> All; 4 interface Shape. List { 5 exception Full. Exception{ }; 6 Shape new. Shape(in Graphical. Object g) raises (Full. Exception); 7 All all. Shapes(); // returns sequence of remote object references long get. Version() ; }; 8

IDL module Whiteboard { struct Rectangle{. . . } ; struct Graphical. Object {.

IDL module Whiteboard { struct Rectangle{. . . } ; struct Graphical. Object {. . . }; interface Shape {. . . }; typedef sequence <Shape, 100> All; interface Shape. List {. . . }; };

CORBA IDL • struct is used to represent complex data structures – C compatible

CORBA IDL • struct is used to represent complex data structures – C compatible – Can also be compiled to OO class – No method defined • in, out, inout – in: it’s a input parameter transferred from client to server – out: it’s an output parameter returned from server to client, the return value will be treated as an output parameter. Set to void if no output parameter – inout: both, seldom used • Interface is similar to Java interface – Only a set of methods defined – Can be compiled to Java interface as shown below public interface Shape. List extends org. omg. CORBA. Object { Shape new. Shape(Graphical. Object g) throws Shape. List. Package. Full. Exception; Shape[] all. Shapes(); int get. Version(); }

Data representation in IDL • Primitives – 15 primitive types – Short (16 -bit),

Data representation in IDL • Primitives – 15 primitive types – Short (16 -bit), long (32 -bit), unsigned short, unsigned long, float (32 -bit), double (64 -bit), char, boolean (TRUE/FALSE), octet (8 -bit) and any (which can represent any primitive or constructed type) • Complex data – Array, sequence, string, record (struct), enumerated, union • object – CORBA object reference – Is the common supertype of all of IDL interface types such as Shape and Shape. List in previous example

IDL constructed types – 1 Type Examples Use sequence typedef sequence <Shape, 100> All;

IDL constructed types – 1 Type Examples Use sequence typedef sequence <Shape, 100> All; Defines a type for a variable-length string array typedef sequence <Shape> All bounded and unbounded sequences of Shapes String name; typedef string<8> Small. String; unboundedand bounded sequences of characters sequence of elements of a specified IDL type. An upper bound on the length may be specified. Defines a sequences of characters, terminated by the null character. An upper bound on the length may be specified. typedef octet unique. Id[12]; Defines a type for a multi-dimensional typedef Graphical. Object GO[10][8] fixed-length sequence of elements of a specified IDL type. this figure continues on the next slide

IDL constructed types – 2 Type Examples Use record struct Graphical. Object { string

IDL constructed types – 2 Type Examples Use record struct Graphical. Object { string type; Rectangle enclosing; boolean is. Filled; }; Defines a type for a record containing a group of related entities. Structs are passed by value in arguments and results. enumerated enum Rand (Exp, Number, Name); The enumerated type in IDL maps a type name onto a small set of integer values. union Exp switch (Rand) { The IDL discriminated union allows case Exp: string vote; one of a given set of types to be passed case Number: long n; as an argument. The header is parameterized by an enum , which case Name: string s; specifies which member is in use. };

IDL methods • General format – [oneway] <return_type> <method_name> ([parameter 1, …, parameter. L])

IDL methods • General format – [oneway] <return_type> <method_name> ([parameter 1, …, parameter. L]) [raises (except 1, …, except. N)] [context (name 1, …, name. M)] • Tags – Oneway: non-blocked – In, out, inout – Raise-exception: throws user defined exceptions • Exception can be empty, or have variables – exception Full. Exception{ Graphical. Object g; } – Context: supply properties mappings (from string names to string values)

Parameter passing in CORBA • Pass By Reference – Any parameter whose type is

Parameter passing in CORBA • Pass By Reference – Any parameter whose type is specified by the IDL interface, is a reference to a CORBA object and the value of a remote object reference is passed • Pass By Value – Arguments of primitive and constructed types are copied and sent to the recipient – On arrival, a new value is created in the recipient’s process (new memory allocation).

Example CORBA Application: Hello World • Implementations (Java IDL) – Server program • •

Example CORBA Application: Hello World • Implementations (Java IDL) – Server program • • Write Hello. World. idl Generate classes from Hello. World. idl Implement the Servant class Implement a Server class – Client program • Write a simple Client with main to lookup Hello. World Service and invoke the methods

Write IDL definition Hello. World. idl module cs 652{ module corba{ module server {

Write IDL definition Hello. World. idl module cs 652{ module corba{ module server { interface Hello. World. Service{ string say. Hello(in string who); }; };

Generate Java classes • Command Line tool idlj -fall Hello. World. idl • Use

Generate Java classes • Command Line tool idlj -fall Hello. World. idl • Use idlj on CORBA IDL interface and generates the following items – The equivalent Java interface: Hello. World. Service. java – The Portable Object Adapter (POA) abstract class Hello. World. Service. POA. java (since J 2 SE 1. 4) for Servant class to extend – The proxy class for client stub, _Hello. World. Service. Stub. java – Classes called helpers and holders, one for each of the types defined in the IDL interface • Helper contains the narrow method, which is used to cast down from a given object reference to the class to which it belongs • Holder deals with out and inout arguments, which cannot be mapped directly in Java – Java classes corresponding to each of the structs defined within the IDL interface (not available for Hello. World example)

Implement the Servant Hello. World. Service. Impl. java public class Hello. World. Service. Impl

Implement the Servant Hello. World. Service. Impl. java public class Hello. World. Service. Impl extends Hello. World. Service. POA { public Hello. World. Service. Impl() { super(); } public String say. Hello(String who) { return "Hello "+who+" from your friend CORBA server : -)"; } }

Implement CORBA Server public class Hello. World. Server { public static void main(String[] args)

Implement CORBA Server public class Hello. World. Server { public static void main(String[] args) { try{ // create and initialize the ORB orb = ORB. init(args, null); // get reference to rootpoa & activate the POAManager POA rootpoa = POAHelper. narrow(orb. resolve_initial_references("Root. POA")); rootpoa. the_POAManager(). activate(); // create servant and get the CORBA reference of it Hello. World. Service. Impl hello. World. Impl = new Hello. World. Service. Impl(); org. omg. CORBA. Object ref = rootpoa. servant_to_reference(hello. World. Impl); Hello. World. Service hello. World. Service = Hello. World. Service. Helper. narrow(ref); // get the root naming context and narrow it to the Naming. Context. Ext object org. omg. CORBA. Object obj. Ref = orb. resolve_initial_references("Name. Service"); Naming. Context. Ext nc. Ref = Naming. Context. Ext. Helper. narrow(obj. Ref); // bind the Object Reference in Naming Name. Component path[] = nc. Ref. to_name("Hello. World. Service"); nc. Ref. rebind(path, hello. World. Service); // wait for invocations from clients orb. run(); } catch (Exception e) {} } }

Commands explanation • activate: make the object enabled in CORBA • servant_to_reference: get the

Commands explanation • activate: make the object enabled in CORBA • servant_to_reference: get the object reference from the servant class • resolve_initial_references: first lookup of POA • narrow: cast CORBA object reference to the preferred class • to_name: convert between string value and name component path • rebind: bind and rebind the object reference to the naming service

Example CORBA client program package cs 652. corba. client; import org. omg. Cos. Naming.

Example CORBA client program package cs 652. corba. client; import org. omg. Cos. Naming. *; import org. omg. Cos. Naming. Context. Package. *; import org. omg. CORBA. *; public class Hello. World. Client { public static void main(String[] args) { try{ // create and initialize the ORB orb = ORB. init(args, null); // get the root naming context org. omg. CORBA. Object obj. Ref = orb. resolve_initial_references("Name. Service"); // Use Naming. Context. Ext instead of Naming. Context, part of the Interoperable naming Service. Naming. Context. Ext nc. Ref = Naming. Context. Ext. Helper. narrow(obj. Ref); // resolve the Object Reference in Naming Hello. World. Service hello. World = Hello. World. Service. Helper. narrow(nc. Ref. resolve_str("Hello. World. Service")); } } System. out. println(hello. World. say. Hello("Raj")); }catch(Exception e){}

Run it • Run the Object Request Broker Daemon (usedby clients for look up

Run it • Run the Object Request Broker Daemon (usedby clients for look up and object invocation on servers) – orbd -ORBInitial. Port 10000 & • Run the server – java cs 652. corba. server. Hello. World. Server -ORBInitial. Port 10000 & • Run the client – java cs 652. corba. client. Hello. World. Client -ORBInitial. Host localhost -ORBInitial. Port 10000