1 / 134

Distributed Programming - CORBA

Distributed Programming - CORBA. Marc Conrad D104 (Park Square Building) Marc.Conrad@luton.ac.uk See also www.perisic.com for CORBA links. The Common Object Request Broker Architecture. CORBA. PART I – CORBA and the OMG.

fideln
Download Presentation

Distributed Programming - CORBA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Distributed Programming - CORBA • Marc Conrad • D104 (Park Square Building) • Marc.Conrad@luton.ac.uk • See also www.perisic.com for CORBA links. Marc Conrad - University of Luton

  2. The Common Object Request Broker Architecture CORBA Marc Conrad - University of Luton

  3. PART I – CORBA and the OMG Explaining the meaning of the acronym CORBA and the role of the OMG for CORBA. Marc Conrad - University of Luton

  4. The 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. Marc Conrad - University of Luton

  5. The Common Object Request BrokerArchitecture • 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! Marc Conrad - University of Luton

  6. The 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. Marc Conrad - University of Luton

  7. The Common Object Request Broker Architecture Marc Conrad - University of Luton

  8. The Common Object Request BrokerArchitecture • 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 Marc Conrad - University of Luton

  9. The 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/ Marc Conrad - University of Luton

  10. OMG 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. Marc Conrad - University of Luton

  11. OMG 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. Marc Conrad - University of Luton

  12. OMG - structure • See http://www.omg.org/news/about/omg_technology_plenary.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. Marc Conrad - University of Luton

  13. The Common Object Request BrokerArchitecture • 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 Marc Conrad - University of Luton

  14. The Common Object Request BrokerArchitecture • 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 Marc Conrad - University of Luton

  15. A Collection Of Rather Boring Acronyms. CORBA Marc Conrad - University of Luton

  16. A 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 Marc Conrad - University of Luton

  17. PART II - An example CORBA implementation or: CORBA says "Hello World" (and a first glance at IDL) Marc Conrad - University of Luton

  18. The 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. Marc Conrad - University of Luton

  19. The 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. Marc Conrad - University of Luton

  20. IDL 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, ... Marc Conrad - University of Luton

  21. IDL Overview. (diagram: Java Programming with CORBA, OMG press, page 143) Marc Conrad - University of Luton

  22. IDL Example module Example { interface Hello { string sayHello(); }; }; Marc Conrad - University of Luton

  23. IDL Example module Example { interface Hello { string sayHello(); }; }; This is an example of an IDL which provides one method, namely sayHello(). This code is saved in a file hello.idl Marc Conrad - University of Luton

  24. Understanding 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 Marc Conrad - University of Luton

  25. Understanding 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 Marc Conrad - University of Luton

  26. IDL 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. Marc Conrad - University of Luton

  27. IDL Example module Example { interface Hello { string sayHello(); }; }; Declares the application interface of the class. Similar to C++ header files or Java interfaces. Marc Conrad - University of Luton

  28. IDL Example module Example { interface Hello { string sayHello(); }; }; An operation. Operations are mapped to (Java,C++, ...) methods. Marc Conrad - University of Luton

  29. Mapping Hello.idl to Java(Here: with idlj) • Go to a command line prompt and type in the following command:idlj -fall Hello.idl Marc Conrad - University of Luton

  30. Mapping 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 Marc Conrad - University of Luton

  31. Mapping 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. Marc Conrad - University of Luton

  32. Mapping 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 Marc Conrad - University of Luton

  33. Mapping Hello.idl to Java(Here: with idlj) • The command idlj -fall Hello.idl produces 6 files: Marc Conrad - University of Luton

  34. Mapping Hello.idl to Java(Here: with idlj) • The command idlj -fall Hello.idl produces 6 files: Marc Conrad - University of Luton

  35. Mapping 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 Marc Conrad - University of Luton

  36. _HelloImplBase.java _HelloStub.java Hello.java HelloHelper.java HelloHolder.java HelloOperations.java 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. Mapping Hello.idl to Java(Here: with idlj) Marc Conrad - University of Luton

  37. _HelloImplBase.java _HelloStub.java Hello.java HelloHelper.java HelloHolder.java HelloOperations.java This class is the client stub, providing CORBA functionality for the client. It implements the Hello.java interface Mapping Hello.idl to Java(Here: with idlj) Marc Conrad - University of Luton

  38. _HelloImplBase.java _HelloStub.java Hello.java HelloHelper.java HelloHolder.java HelloOperations.java 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. Mapping Hello.idl to Java(Here: with idlj) Marc Conrad - University of Luton

  39. _HelloImplBase.java _HelloStub.java Hello.java HelloHelper.java HelloHolder.java HelloOperations.java 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. Mapping Hello.idl to Java(Here: with idlj) Marc Conrad - University of Luton

  40. _HelloImplBase.java _HelloStub.java Hello.java HelloHelper.java HelloHolder.java HelloOperations.java This final class provides auxiliary functionality, notably the narrow() method required to cast CORBA object references to their proper types. Mapping Hello.idl to Java(Here: with idlj) Marc Conrad - University of Luton

  41. _HelloImplBase.java _HelloStub.java Hello.java HelloHelper.java HelloHolder.java HelloOperations.java 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. Mapping Hello.idl to Java(Here: with idlj) Marc Conrad - University of Luton

  42. Writing the Server. • For the implementation of the Server we have to implement two classes: • The Servant, i.e. the object which has been specified by the Hello.idl • The Server itself, i.e. the program running in the background which reacts on client requests. Marc Conrad - University of Luton

  43. import Example.*; public class HelloServant extends _HelloImplBase { public String sayHello() { return "\nHello world !!\n"; } } Writing the Servant Marc Conrad - University of Luton

  44. import Example.*; public class HelloServant extends _HelloImplBase { public String sayHello() { return "\nHello world !!\n"; } } Makes the classes accessible which have been generated by the idlj compiler. Writing the Servant Marc Conrad - University of Luton

  45. import Example.*; public class HelloServant extends _HelloImplBase { public String sayHello() { return "\nHello world !!\n"; } } Note that _HelloImplBase is one of the classes which has been generated by idlj -fall. Writing the Servant Marc Conrad - University of Luton

  46. import Example.*; public class HelloServant extends _HelloImplBase { public String sayHello() { return "\nHello world !!\n"; } } This class extends _HelloImplBase, that means it has to implement the interface provided by _HelloImplBase, which has been produced by Hello.idl via idlj. Writing the Servant Marc Conrad - University of Luton

  47. import Example.*; public class HelloServant extends _HelloImplBase { public String sayHello() { return "\nHello world !!\n"; } } This was the file Hello.idl: module Example { interface Hello { string sayHello(); }; }; Writing the Servant Marc Conrad - University of Luton

  48. import Example.*; public class HelloServantextends _HelloImplBase { public String sayHello() { return "\nHello world !!\n"; } } This was the file Hello.idl: Example { interface Hello { string sayHello(); }; }; Writing the Servant Marc Conrad - University of Luton

  49. import Example.*; public class HelloServant extends _HelloImplBase { public String sayHello() { return "\nHello world !!\n"; } } This was the file Hello.idl: Example { interface Hello { string sayHello(); }; }; Writing the Servant Marc Conrad - University of Luton

  50. import Example.*; public class HelloServant extends _HelloImplBase { public String sayHello() { return "\nHello world !!\n"; } } This was the file Hello.idl: Example { interface Hello { string sayHello(); }; }; Writing the Servant Marc Conrad - University of Luton

More Related