1 / 120

CORBA and Java

CORBA and Java. by Alex Chaffee alex@jguru.com http://www.jguru.com/ Java online resources http://www.purpletech.com/ Java training and consulting. Abstract.

Pat_Xavi
Download Presentation

CORBA and Java

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. CORBA and Java • by Alex Chaffee • alex@jguru.com • http://www.jguru.com/ • Java online resources • http://www.purpletech.com/ • Java training and consulting Copyright © 1998 Purple Technology, Inc.

  2. Abstract • CORBA loves Java! CORBA provides a platform-independent, language-independent way to write applications that can invoke objects that live across the room or across the planet. Java is an object-oriented language that's ideal for writing the clients and servers living on the Object Bus. In this session, we examine the ways they interoperate programmatically, as we walk you step-by-step from a CORBA IDL, to a server and client both written in Java, running on top of a 100%-Java ORB. We also discuss the relationship between CORBA and RMI, and discuss some of the real-world issues involved in deploying a CORBA-based application. Recommended: some knowledge of CORBA, ability to read Java source code. Copyright © 1998 Purple Technology, Inc.

  3. Introduction • Purple Technology • http://www.purpletech.com • Java Training and Consulting • Alex Chaffee • Creator of Gamelan • Cool Java Dude Copyright © 1998 Purple Technology, Inc.

  4. Part I: CORBA Overview Copyright © 1998 Purple Technology, Inc.

  5. What is CORBA? • Common Object Request Broker Architecture • Communication infrastructure for distributed objects • Allows a heterogeneous, distributed collection of objects to collaborate transparently Copyright © 1998 Purple Technology, Inc.

  6. What is CORBA good for? • Developing distributed applications • Locating remote objects on a network • Sending messages to those objects • Common interface for transactions, security, etc. • CORBA Services (more later) Copyright © 1998 Purple Technology, Inc.

  7. Why Distributed Applications? • Data is distributed • Administrative and ownership reasons • Heterogeneous systems • Shared by multiple applications • Scalability Copyright © 1998 Purple Technology, Inc.

  8. Why Distributed Applications? • Computation is distributed • Scalability: multiprocessing • Take computation to data • Heterogeneous architectures • Users are distributed • Multiple users interacting and communicating via distributed applications Copyright © 1998 Purple Technology, Inc.

  9. Distributed Object Systems • All entities are modeled as objects • Systems support location transparency • Interfaces, not implementations, define objects • Good distributed object systems are open, federated systems Copyright © 1998 Purple Technology, Inc.

  10. What is the OMG? • Designers of CORBA • Consortium of 700+ companies • Not including Microsoft • Members: • platform vendors • database vendors • software tool developers • corporate developers • software application vendors Copyright © 1998 Purple Technology, Inc.

  11. It’s Just A Spec • Has never been fully implemented • Probably never will be • Industry moves quickly and spec has to keep up • Interoperability vs. portability • Pass-by-value Copyright © 1998 Purple Technology, Inc.

  12. Basic CORBA Architecture Server Client response request ORB ORB “Object Bus” Copyright © 1998 Purple Technology, Inc.

  13. CORBA Objects • Examples • Service • Client • Component • Business object • CORBA objects approach universal accessibility • Any Language • Any Host on network • Any Platform Copyright © 1998 Purple Technology, Inc.

  14. CORBA Elements • 1. ORB • 2. CORBA Services • 3. CORBA Facilities • 4. Application Objects Copyright © 1998 Purple Technology, Inc.

  15. ORB • Object Request Broker • “Object Bus” • Handles all communication among objects • Each host (machine) has its own ORB • ORBs know how to talk to each other • ORB also provides basic services to client Copyright © 1998 Purple Technology, Inc.

  16. ORB Responsibilities • Find the object implementation for the request • Prepare the object implementation to receive the request • Communicate the data making up the request • Retrieve results of request Copyright © 1998 Purple Technology, Inc.

  17. Network of ORBs • There’s an ORB on the server too • ORB receives request Copyright © 1998 Purple Technology, Inc.

  18. IIOP • Internet Inter-Orb Protocol • Network or “wire” protocol • Works across TCP/IP (the Internet protocol) Copyright © 1998 Purple Technology, Inc.

  19. ORB Features • Method invocations • Static and Dynamic • Remote objects or CORBA services • High-level language bindings • Use your favorite language; ORB translates • Self-describing • Provides metadata for all objects and services Copyright © 1998 Purple Technology, Inc.

  20. ORB Features • Local or remote • Same API wherever target object lives • Preserves context • Distributed security and transactions • Coexistence with legacy code • Just provide a wrapper object Copyright © 1998 Purple Technology, Inc.

  21. What is an ORB really? • Not a separate process • Library code that executes in-process • Listens to TCP ports for connections • One port per local object • Opens TCP sockets to other objects • N ports per remote machine Copyright © 1998 Purple Technology, Inc.

  22. IDL • Interface Definition Language • Defines protocol to access objects • Like a contract • Well-specified • Language-independent Copyright © 1998 Purple Technology, Inc.

  23. IDL Example module Calc { interface Adder { long add(in long x, in long y); } } • Defines an object called Adder with a method called add Copyright © 1998 Purple Technology, Inc.

  24. Stubs and Skeletons • Stub • lives on client • pretends to be remote object • Skeleton • lives on server • receives requests from stub • talks to true remote object • delivers response to stub Copyright © 1997 Alex Chaffee

  25. Stubs and Skeletons (Fig.) Client Host Machine Server Host Machine Client Object Remote Object Stub Skeleton IIOP ORB ORB Copyright © 1997 Alex Chaffee

  26. Client vs. Server • in CORBA, a client is a client relative to a particular object • i.e. an object with a reference to a “server” object • A client may also act as a server • If it has an IDL and stubs and skeletons • Technically, a CORBA server contains one or more CORBA objects Copyright © 1998 Purple Technology, Inc.

  27. Different Meanings of “Server” • Host machine • Program running on host machine • CORBA object running inside program • has IDL, stub, skeleton • Sometimes called a Servant Copyright © 1998 Purple Technology, Inc.

  28. Stubs and Skeletons -> Platform Independence • Client code has no knowledge of the implementation of the object or which ORB is used to access the implementation. Copyright © 1998 Purple Technology, Inc.

  29. CORBA Services • APIs for low-level, common tasks • Life Cycle Service • creating, copying, moving, removing objects • Naming Service • Register objects with a name • Look up objects by name Copyright © 1998 Purple Technology, Inc.

  30. CORBA Services • Concurrency Control Service • Obtain and release exclusive locks • Transaction Service • Two-phase commit coordination • Supports nested transactions • Persistence Service • Storing objects in a variety of databases • RDBMS, OODBMS, file systems Copyright © 1998 Purple Technology, Inc.

  31. CORBA Services • Security Service • Authentication, ACLs, encryption, etc. • Event Service • Uncoupled notifications Copyright © 1998 Purple Technology, Inc.

  32. CORBA Services • Relationship • Externalization • Query • Licensing • Properties • Time • Trader • Collection • … and so on… • See what I mean about it never being implemented? Copyright © 1998 Purple Technology, Inc.

  33. CORBA Facilities • Frameworks for specialized applications • Distributed Document Component Facility • OpenDoc • In progress: • Agents • Business Objects • Internationalization Copyright © 1998 Purple Technology, Inc.

  34. ORB ORB ORB ORB N-Tier Design with CORBA Storage “Tier” DB ORB ORB DB Data Object ORB TP Monitor ORB ORB Service “Tier” Business Object Tier Client Tier Copyright © 1998 Purple Technology, Inc. (after diagram in Orfali et al.)

  35. User Interface Tier Business Logic Tier Data Storage Tier Can use CORBA objects in each tier Three Tiers Copyright © 1998 Purple Technology, Inc.

  36. Part II: Java IDL - Using CORBA from Java Copyright © 1998 Purple Technology, Inc.

  37. Java CORBA Products • The Java 2 ORB • VisiBroker for Java • OrbixWeb • Netscape Communicator • Various free or shareware ORBs Copyright © 1998 Purple Technology, Inc.

  38. Java IDL • Should be named “Java CORBA” • More than just IDL • Full (?) implementation of CORBA in 100% Java • Three Parts • ORB • Naming Service • idltojava compiler • Ships with JDK 1.2 Copyright © 1998 Purple Technology, Inc.

  39. Transparent API • JavaIDL turns IDL into direct method calls • Easy to program • Clients have no knowledge of implementation • Highly portable Copyright © 1998 Purple Technology, Inc.

  40. The Java ORB • 100% Java • Generic • Allows Java IDL applications to run either as stand-alone Java applications, or as applets within Java-enabled browsers • Uses IIOP Copyright © 1998 Purple Technology, Inc.

  41. Other Java ORBs • Visigenic (Inprise) VisiBroker • Netscape Communicator • Oracle Web Server 3.0 • Free download • Iona OrbixWeb Copyright © 1998 Purple Technology, Inc.

  42. IDL to Java Mapping • Defined by OMG • Translates IDL concepts into Java language constructs • Everything is accessible by writing normal-looking Java code Copyright © 1998 Purple Technology, Inc.

  43. IDL to Java Type Mapping IDL Type boolean char / wchar octet short / unsigned short long / unsigned long long long / unsigned long long float double string / wstring Java Type boolean char byte short int long float double String Copyright © 1998 Purple Technology, Inc.

  44. IDL vs. Java vs. C++ concepts IDLJavaC++ module package namespace interface interface abstract class operation method member function attribute pair of pair of methods functions Copyright © 1998 Purple Technology, Inc.

  45. IDL Modules • Map to Java packages • Unfortunately, it has the root level name of the module • Clutters up your package hierarchy • e.g. module Calc -> • package Calc • interface Calc.Adder • not package ORG.omg.CORBA.modules.Calc Copyright © 1998 Purple Technology, Inc.

  46. IDL Interfaces • Map to Java interfaces Copyright © 1998 Purple Technology, Inc.

  47. IDL Operations • Map to Java methods Copyright © 1998 Purple Technology, Inc.

  48. IDL Attributes • Map to pair of functions • IDL • string name; • Java • public void name(String val); • public String name(); • Yes, it looks stupid. Sorry. Copyright © 1998 Purple Technology, Inc.

  49. idltojava • Development tool • Automatically generates java stubs, skeletons, helpers, holders, ... • Generates stubs for specific remote interfaces Copyright © 1998 Purple Technology, Inc.

  50. Stubs • Java objects call stub methods • Stubs communicate with CORBA objects • and vice versa • Transparent integration Copyright © 1998 Purple Technology, Inc.

More Related