Title: Distributed Programming - CORBA
1Distributed Programming - CORBA
- Marc Conrad
- D104 (Park Square Building)
- Marc.Conrad_at_luton.ac.uk
- See also www.perisic.com for CORBA links.
2The Common Object Request Broker Architecture
CORBA
3Today
- Overview
- Acronyms (CORBA, ORB, OMG)
- One more acronym (IDL)
- An extensive example of an IDL to Java mapping
(part one)
4The Common Object Request Broker Architecture
- CORBA is not a programming language but an
architecture. - CORBA is an elegant and sophisticated way to
describe and link the use of objects in a
distributed environment. - The "dirty work", the implementation of the
behavior of the objects is out of the scope of
CORBA.
5The Common Object Request Broker Architecture
- CORBA is in the context of Object Oriented
Programming.
BUT The objects can be located on different
machines all over the world and implemented in a
variety of languages!
6The Common Object Request Broker Architecture
- The Object Request Broker (ORB) is itself an
object which provides the services for accessing
remote objects and transmitting data. - Note that the implementation of the ORB depends
on the specific vendor. The CORBA standard only
defines the interface.
7The Common Object Request Broker Architecture
8The Common Object Request Broker Architecture
- CORBA is a standard which has been devloped by
the OMG, the Object Management Group. - The OMG is the world's largest computer industry
consortium with over 800 members. - See http//cgi.omg.org/cgi-bin/membersearch.pl
9The History of the OMG
- Founded 1989 by eleven companies as non profit
organisation. - Aims on standards for object oriented software
production. - Other projects
- MDA http//www.omg.org/mda/
- UML http//www.omg.org/uml/
- CWM http//www.omg.org/cwm/
10OMG technology
- The framework within which all OMG adopted
technology fits is the OMA the Object
Management Architecture. - So, learning CORBA is also on learning about
Object Oriented technologies from a language
independent view.
11OMG goals
- The goals of the OMG are promotion of the
object-oriented approach to software engineering
and development of a common architectural
framework for writing distributed object-oriented
applications based on interface specifications
for the object in the application.
12OMG - structure
- See http//www.omg.org/news/about/omg_technology_p
lenary.htm - Platform Technology Committee
- This committee is concerned with infrastructure
issues, e.g. the ORB. - Domain Technology Committee
- This committee is concerned with technologies to
support application development,e.g. electronic
commerce.
13The Common Object Request Broker Architecture
- CORBA is a standard which has been developed by
the OMG, the Object Management Group (OMG). - The OMG is the world's largest computer industry
consortium with over 800 members. - See http//cgi.omg.org/cgi-bin/membersearch.pl
14The Common Object Request Broker Architecture
- But Common also means something else
- CORBA is a architecture which has the power to
integrate legacy code written in languages as
Java, C, C, Smalltalk, COBOL, Lisp, Python.
We focus here mainly on Java
15A Collection Of Rather Boring Acronyms.
CORBA
16A Collection Of Rather Bulky Acronyms.
- OMG - Object Management Group
- ORB - Object Request Broker
- IDL - Interface Definition Language
- IOR - Interoperable Object Reference
- POA - Portable Object Adapter
- IIOP - Internet Inter-ORB Protocol
17The Interface Definition Language (IDL)
- The IDL provides a class definition for objects
similar to a C header file or a Java interface. - However IDL does not provide an implementation.
18The CORBA Development Process
- Write some IDL that describes the interfaces to
the object or objects that will be used or
implemented. - Compile the IDL file.
- Identify the IDL compiler generated classes and
interfaces. - Write additional code.
- Run the application.
19IDL and Java
- Warning!
- For simplicity we discuss in this lecture only
the IDL to Java mapping, that means using an IDL
for producing Java classes which are used in a
Java environment. - Other languages which are similarly supported are
C, Lisp, Smalltalk, ...
20IDL Overview.
(diagram Java Programming with CORBA, OMG press,
page 143)
21IDL Example
- module Example
- interface Hello
- string sayHello()
-
-
22IDL Example
- module Example
- interface Hello
- string sayHello()
-
-
This is an example of an IDL which provides one
method, namely hello(). This code is saved in a
file hello.idl
23Understanding the IDL
- OMG IDL is a purely declarative language designed
for specifying programming-language-independent
operational interfaces for distributed
applications. OMG specifies a mapping from IDL to
several different programming languages,
including C, C, Smalltalk, COBOL, Ada, and
Java. When mapped, each statement in OMG IDL is
translated to a corresponding statement in the
programming language of choice. - from http//java.sun.com/j2se/1.3/docs/guide/idl/
tutorial/GSIDL.html
24Understanding the IDL
- You can use the tool idlj (provided by SUN) to
map an IDL interface to Java and implement the
client class. When you map the same IDL to C
and implement the server in that language, the
Java client and C server interoperate through
the ORB as though they were written in the same
language. - from http//java.sun.com/j2se/1.3/docs/guide/idl/
tutorial/GSIDL.html
25IDL Example
- module Example
- interface Hello
- string sayHello()
-
-
A module is a namespace similar to C namespaces
or Java packages It acts as a container for
related interfaces and declarations.
26IDL Example
- module Example
- interface Hello
- string sayHello()
-
-
Declares the application interface of the class.
Similar to C header files or Java interfaces.
27IDL Example
- module Example
- interface Hello
- string sayHello()
-
-
An operation. Operations are mapped to (Java,C,
...) methods.
28Mapping Hello.idl to Java(Here with idlj)
- Go to a command line prompt and type in the
following command idlj -fall
Hello.idl
29Mapping Hello.idl to Java(Here with idlj)
The name of your Compiler. The idlj is offered as
part of the JDK 1.3. Other vendors use other
compiler, e.g. idl2java by VisiBroker
- Go to a command line prompt and type in the
following command idlj -fall
Hello.idl
30Mapping Hello.idl to Java(Here with idlj)
- Go to a command line prompt and type in the
following command idlj -fall
Hello.idl
The name of the IDL file you have specified.
31Mapping Hello.idl to Java(Here with idlj)
This option (specific to idlj) means that files
should be generated both for a server and a
client implementation. (Default Client only)
- Go to a command line prompt and type in the
following command idlj -fall
Hello.idl
32Mapping Hello.idl to Java(Here with idlj)
- The command idlj -fall Hello.idl produces 6
files
33Mapping Hello.idl to Java(Here with idlj)
- The command idlj -fall Hello.idl produces 6
files
34Mapping Hello.idl to Java(Here with idlj)
- The command idlj -fall Hello.idl produces 6
files - _HelloImplBase.java
- _HelloStub.java
- Hello.java
- HelloHelper.java
- HelloHolder.java
- HelloOperations.java
35Mapping Hello.idl to Java(Here with idlj)
- This abstract class is the server skeleton,
providing basic CORBA functionality for the
server. It implements the Hello.java interface.
The server class HelloServant extends
_HelloImplBase.
- _HelloImplBase.java
- _HelloStub.java
- Hello.java
- HelloHelper.java
- HelloHolder.java
- HelloOperations.java
36Mapping Hello.idl to Java(Here with idlj)
- This class is the client stub, providing CORBA
functionality for the client. It implements the
Hello.java interface
- _HelloImplBase.java
- _HelloStub.java
- Hello.java
- HelloHelper.java
- HelloHolder.java
- HelloOperations.java
37Mapping Hello.idl to Java(Here with idlj)
- This signature interface contains the Java
version of our IDL interface. The Hello.java
interface extends org.omg.CORBA.Object, providing
standard CORBA object functionality.
- _HelloImplBase.java
- _HelloStub.java
- Hello.java
- HelloHelper.java
- HelloHolder.java
- HelloOperations.java
38Mapping Hello.idl to Java(Here with idlj)
- This operations interface contains the single
method sayHello(). The IDL-to-Java mapping puts
all of the operations defined on the IDL
interface into this file.
- _HelloImplBase.java
- _HelloStub.java
- Hello.java
- HelloHelper.java
- HelloHolder.java
- HelloOperations.java
39Mapping Hello.idl to Java(Here with idlj)
- This final class provides auxiliary
functionality, notably the narrow() method
required to cast CORBA object references to their
proper types.
- _HelloImplBase.java
- _HelloStub.java
- Hello.java
- HelloHelper.java
- HelloHolder.java
- HelloOperations.java
40Mapping Hello.idl to Java(Here with idlj)
- This final class holds a public instance member
of type Hello. It provides operations for out and
inout arguments, which CORBA allows, but which do
not map easily to Java's semantics. - Note that CORBA allows call-by-value method
parameters which are not directly available in
Java.
- _HelloImplBase.java
- _HelloStub.java
- Hello.java
- HelloHelper.java
- HelloHolder.java
- HelloOperations.java