1 / 16

OmniORB

OmniORB. An Introduction. Michael E. Kounavis Dept. of Electrical Engineering Columbia University http://comet.columbia.edu/~mk mk@comet.columbia.edu. TUTORIAL 2. 15 October, 1998. OMA. Application Interfaces. Domain Interfaces. Common Facilities. ORB. Object Services. CORBA.

renate
Download Presentation

OmniORB

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. OmniORB An Introduction Michael E. Kounavis Dept. of Electrical Engineering Columbia University http://comet.columbia.edu/~mk mk@comet.columbia.edu TUTORIAL 2 15 October, 1998

  2. OMA Application Interfaces Domain Interfaces Common Facilities ORB Object Services

  3. CORBA client Object implementation DSI IDL Skel. DII IDL stub ORB Intf OA ORB core

  4. OmniORB • CORBA2 compliant • multithreaded • Supports unique IDL to C++ mappings • but • persistent severs only • no DSI, DII • no IR

  5. Building a distributed system application • Define the object interface in IDL • use the IDL compiler to generate stub code • provide the object implementation • write the client code

  6. A simple IDL file interface Echo { string echoString(in string mesg); }; • compile with omniidl2 • generates a c++ header file and a C++ source file • echo.hh • echoSK.cc this is the skeleton file!

  7. What does echo.hh contain? (I) class Echo; typedef Echo* Echo_ptr; class Echo: public virtual omniObject, public virtual CORBA::Object { public: virtual char * echoString ( const char * mesg ) = 0; static Echo_ptr _nil(); static Echo_ptr _duplicate(Echo_ptr); static Echo_ptr _narrow(CORBA::Object_ptr); // . . . };

  8. What does echo.hh contain? (II) • Echo_ptr is an object reference to the object Echo • Use _nil(), is_nil(), _duplicate(), _narrow(), _is_equivalent() to manipulate object references • Don’t use operators such as (void *), = , == etc. for object references • Object references should be explicitly release with CORBA::release operation • Echo_var variables are automatically released though. • Interchanging Echo_ptr and Echo_var is valid, although casting might be needed;

  9. What does the Skeleton contain? (I) Class _sk_Echo : public virtual Echo { public: _sk_Echo(const omniORB::objectKey& k); virtual char * echoString (const char * mesg) = 0; Echo_ptr _this(); void _obj_is_ready(BOA_ptr); void _dispose(); BOA_ptr _boa(); OmniORB::objectKey _key(); // . . . };

  10. What does the Skeleton contain? (II) • _sk_Echo is an abstract class • through the abstract function echoString() the implementation class provides the implementation for the echoString Operation. • _this() returns an objct reference for the target object • _obj_is _ready tells the BOA that the object is ready to serve • _dispose tells the BOA to dispose the object • _boa returns a reference to the BOA that serves the object • _key identifies the object

  11. Providing an object implementation • class Echo_i : public virtual _sk_Echo { public Echo_i() {} virtual ~Echo_i() {} virtual char (* echiString(const char *mesg); }; char* Echo_i::echoString(const char *mesg) { char *p = CORBA::string_dup(mesg); return p; } • The implementation class Echo_i inherits from the skeleton

  12. Writing the client void hello (CORBA::Object_ptr obj) { Echo_var e = Echo::_narrow(obj); if (CORBA::is_nil(e)) { cerr << “hello cannot invoke a nil object” << endl; return; } CORBA::String_var src = (const char*) “Hello!” CORBA::String_var dest; dest = e->echoString(src); } • It is straightforward!

  13. Writing the Server • First get a reference to ORB and BOA CORBA::ORB_ptr orb = CORBA::ORB_init(argc, argv, “omniORB2”); CORBA::ORB_ptr boa = orb->BOA_init(argc, argv, “omniORB2_BOA”); • Instantiate the implementation object Echo_i *my_obj = new Echo_i(); myobj->_obj_is_ready(boa); • Get an object reference (in order to bind to a name) Echo_var myobjRef = my_obj->_this(); • Call impl_is_ready() boa->impl_is_ready();

  14. How does the client get the target object reference? • Via stringified form • Via naming service • OmniNames • centralized not distributed • OmniNames • Name database structured as a tree • Root is for the Naming Service object itself

  15. References • Sai-Lai Lo “The omniORB2 version 2.5 User’s Guide”, Olivetti and Oracle research laboratory, Feb. 1998 Chapter 2, “The Basics” (required) • Steve Vinosky “CORBA, Integrating Diverse Applications within Heterogeneous Distributed Environments”, IONA Technologies (recommended)

  16. Homework • IDL for the server is given: • interface CookieServer { string getCookie(in string email); // returns the cookie string testCookie(in string email, in string cookie); // returns the response }; • Date posted: 10/16/98 • Date due: 10/27/98

More Related