1 Aniruddha Gokhale Vanderbilt University, Spring 2003 Intro to TAO Programming Study the Hello example in ACE_wrappers/TAO/tests –Show IDL definition,

Slides:



Advertisements
Similar presentations
DISTRIBUTED OBJECTS AND REMOTE INVOCATION
Advertisements

Slides for Chapter 20: CORBA Case Study From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 4, © Addison-Wesley 2005.
Java IDL Callback Object. interface Listener { void message(in string msg); }; interface MessageServer { void register(in Listener lt); };
Slide 1 Objektorienteret Middleware (OOMI) CORBA Programming: Presentation of a simple “Hello World” CORBA client and server application.
C/c++ 4 Yeting Ge.
15-May-15 RMI Remote Method Invocation. 2 “The network is the computer” Consider the following program organization: If the network is the computer, we.
Common Object Request Broker Architecture (CORBA) By: Sunil Gopinath David Watkins.
1 Distributed Systems Distributed Objects & Remote Invocation CORBA Dr. Sunny Jeong. Mr. Colin Zhang With Thanks.
CORBA - Common Object Request Broker Architecture.
Netprog CORBA Intro1 CORBA Common Object Request Broker Architecture Based partially on Notes by D. Hollinger and Java Network Programming and Distributed.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
A First Java ORB Application 1  Object Request Broker (ORB)  This is the object manager in CORBA  Mechanisms for specifying interfaces  Interface Definition.
II. Middleware for Distributed Systems
How Does Remote Method Invocation Work? –Systems that use RMI for communication typically are divided into two categories: clients and servers. A server.
Outline CORBA Programming Elements CORBA Programming Elements Server & Client Basics Server & Client Basics IDL Compiler IDL Compiler CORBA Naming Service.
CORBA Programming Using ACE/TAO
Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.
1 Java Programming II Java Network II (Distributed Objects in Java)
Presentation Outline of Commercial Systems
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
Wireless CORBA Richard Verhoeven. Content Quick Introduction to CORBA Wireless & Mobile Wireless CORBA Test Case Conclusions.
CORBA Celsina Bignoli Enterprise Computing Corporation have similar computing environments: –mixed set of HW platforms –a mixed set.
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Slides for Chapter 8: Distributed.
Components in GNOME 林咸禮. Outline Components in GNOME Why object model ? The uses of CORBA Implementation notes ORBit Programming.
CS 584 Lecture 18 l Assignment » Glenda assignment extended to the Java RMI Deadline » No Java RMI Assignment l Test » Friday, Saturday, Monday.
Cli/Serv.: rmiCORBA/131 Client/Server Distributed Systems v Objectives –introduce rmi and CORBA , Semester 1, RMI and CORBA.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Copyright (c) Qusay H. Mahmoud 1 The Naming Service (Client’s View) A tree-like directory for object references Much like a file system: provides directory.
Slide 1 CORBA Programming: Presentation of a simple “Hello World” CORBA client and server application ITONK1.
Robb Myer CPSC611 Common Object Request Broker Architecture (CORBA) Free Flight Simulation Laboratory NASA Langley Research Center.
Commercial Component Based Design (Part 2) Corba OLE ActiveX This segment prepared and presented by John Champaign
Objekt orienteret Netværkskommunikation CORBA Introduction & CORBA Programming.
Abhishek Bachchan Vishal Patangia
CORBA/IDL Common Object Resource Broker Architecture (CORBA) Interface Definition Language (IDL) Object Management Group (OMG) ( Specification.
CORBA – Command Line CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
ACS Error System APIs: C++ Bogdan Jeram European Southern Observatory July 2005ESO.
MSc Course in Advanced Distributed Systems Session 2.2: Practical CORBA Programming
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
Vakgroep Informatietechnologie - IBCN CORBA & RMI Design of Distributed Software.
 Remote Method Invocation  A true distributed computing application interface for Java, written to provide easy access to objects existing on remote.
Update on CORBA Support for Babel RMI Nanbor Wang and Roopa Pundaleeka Tech-X Corporation Boulder, CO Funded by DOE OASCR SBIR.
CORBA Outline Introduction to CORBA –Basic concepts –IDL Simple Client/Server Example C++ Language Binding Other Issues –IIOP –Exception Handling –CORBA.
Parallel CORBA Objects CORBA May, 22 nd 2000 ARC « Couplage » Christophe René (IRISA/IFSIC)
CORBA – Eclipse CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
CORBA_1/001 Department of Computer Science Southern Illinois University Edwardsville Spring, 2010 Dr. Hiroshi Fujinoki CORBA:
Polymorphism, Dynamic Typing, and Dynamic Binding Copyright © 2012 by Yong-Gu Lee
Server-Side Java Mapping Copyright © ZeroC, Inc. Ice Programming with Java 6. Server-Side Java Mapping.
Server-Side C++ Mapping Copyright © ZeroC, Inc. Ice Programming with C++ 6. Server-Side C++ Mapping.
Remote Method Invocation with Java-RMI
A Quick CCM Example. Tutorial on CCM Introduction A Simple Sender&Receiver Scenario Sender sends out the click-out event to inform the Receiver. Receiver.
Exceptions in C++. Exceptions  Exceptions provide a way to handle the errors generated by our programs by transferring control to functions called handlers.
Java and C++ Transitioning. A simple example public class HelloWorldApp { public static void main(String[] args) { //Display the string. System.out.println("Hello.
Get_gmt 函数在 windows 下的实现 TimeOfDay TimeImpl:: get_gmt() throw(CORBA::SystemException) {time_t time_now=time(0); = time_t time_now=time(NULL); struct tm*
DISTRIBUTED OBJECTS AND REMOTE INVOCATION 1. 2 Topics  Middleware  Remote Method Invocation  Remote Procedure Call.
 Java RMI Distributed Systems IT332. Outline  Introduction to RMI  RMI Architecture  RMI Programming and a Sample Example:  Server-Side RMI programming.
Slide 1 of 15 © Ingeniørhøjskolen i Århus CORBA Programming: Presentation of a simple “Hello World” CORBA client and server application.
// messenger.idl interface Messenger { boolean send_message ( in string user_name, in string subject, inout string message ); };
Distributed Computing in Life Science Research -Presenter: Yijian Yang
IDL Models The Inheritance Model: Using the Inheritance Model, you implement the IDL interface using an implementation class that also extends the compiler-generated.
Presentation 24 Ultra Simple.NET Remoting to CORBA bridge.
CSC 480 Software Engineering Lab 6 – RMI Nov 8, 2002.
Object-Oriented Middleware (OOMI) Locating Distributed Objects Emmerich – Chapter
1 Chapter 8 Scope, Lifetime, and More on Functions CS185/09 - Introduction to Programming Caldwell College.
CSE 332: C++ Exceptions Motivation for C++ Exceptions Void Number:: operator/= (const double denom) { if (denom == 0.0) { // what to do here? } m_value.
Only small steps in CORBA programming – much complexity
Interface Definition Language
Remote Method Invocation
Building a CORBA Server
CS 584 Lecture 18 Assignment Glenda assignment extended to the Java RMI Deadline No Java RMI Assignment Test Friday, Saturday, Monday.
Copyright © 2001 Qusay H. Mahmoud
Presentation transcript:

1 Aniruddha Gokhale Vanderbilt University, Spring 2003 Intro to TAO Programming Study the Hello example in ACE_wrappers/TAO/tests –Show IDL definition, servant, server, and client code –Show some IDL compiler generated code –Show how to compile and run the test Number of examples available under ACE_wrappers/TAO/tests and ACE_wrappers/TAO/examples Understand the IDL->C++ Mapping for memory management issues

2 Aniruddha Gokhale Vanderbilt University, Spring 2003 IDL definition module Test { /// A very simple interface interface Hello { /// Return a simple string string get_string (); /// A method to shutdown the ORB /// This method is used to simplify shutdown process oneway void shutdown (); };

3 Aniruddha Gokhale Vanderbilt University, Spring 2003 IDL Compiler-generated Skeleton Header /* ONLY RELEVANT DETAILS SHOWN */ // module becomes namespace namespace POA_Test { // interface becomes a class class Hello: public PortableServer::ServantBase { public: // returns an object reference. Used for implicit activation ::Test::Hello*_this (); // servant implements this operation virtual char * get_string () throw ((CORBA::SystemException)) = 0; };

4 Aniruddha Gokhale Vanderbilt University, Spring 2003 IDL Compiler-generated Stub Header File /* ONLY RELEVANT DETAILS SHOWN */ // module becomes namespace namespace Test { /* note how this is different */ // declare a smart pointer class Hello_var { /* details not shown */ }; // interface becomes a class class Hello: public virtual CORBA::Object { public: typedef Hello_ptr _ptr_type; typedef Hello_var _var_type; // The static operations. static Hello_ptr _duplicate (Hello_ptr obj); static Hello_ptr _narrow (CORBA::Object_ptr obj);

5 Aniruddha Gokhale Vanderbilt University, Spring 2003 IDL Compiler-generated Stub header file (contd) static Hello_ptr _nil (void) { return (Hello_ptr)0; } // is_a virtual CORBA::Boolean _is_a (const char *type_id); // operation virtual char * get_string() throw ((CORBA::SystemException)); }; // end of class }; // end of namespace

6 Aniruddha Gokhale Vanderbilt University, Spring 2003 Servant Header (Hello.h) // include the skeleton header #include “TestS.h“ // our implementation class Hello: public POA_Hello::Test { public: // ctor Hello (); virtual char * get_string () throw ((CORBA::SystemException)); };

7 Aniruddha Gokhale Vanderbilt University, Spring 2003 Servant Impl (Hello.cpp) #include “Hello.h" // operation Char * Hello::get_string() throw ((CORBA::SystemException)) { return CORBA::string_dup (“Hello There”); }

8 Aniruddha Gokhale Vanderbilt University, Spring 2003 Server Code (server.cpp) #include “Hello.h" int main (int argc, char* argv[]) { try { // initialize the ORB CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "" /* the ORB name, it can be anything! */ ); // Get a reference to the RootPOA CORBA::Object_var poa_object = orb->resolve_initial_references ("RootPOA“);

9 Aniruddha Gokhale Vanderbilt University, Spring 2003 Server Code contd // narrow down to the correct reference PortableServer::POA_var poa = PortableServer::POA::_narrow (poa_object.in ()); // Set a POA Manager PortableServer::POAManager_var poa_manager = poa->the_POAManager (); // Activate the POA Manager (recall the state transition // diagram for POA Manager. By activating we are telling // the POA manager to start accepting requests poa_manager->activate ();

10 Aniruddha Gokhale Vanderbilt University, Spring 2003 Server Code contd // Create the servant Hello hello; // This is not the best way, but for the sake // of simplicity lets have it that way. // Activate it and obtain the object reference Test::Hello_var h = hello._this (); CORBA::String_var ior = orb->object_to_string (h.in ()); // Write the IOR to a file. More sophisticated methods available

11 Aniruddha Gokhale Vanderbilt University, Spring 2003 Server Code contd poa_manager- > activate (); // Run the orb orb->run (); // Destroy the POA, waiting until the destruction terminates poa->destroy (1, 1); orb->destroy (); } // catch any exceptions beyond this }

12 Aniruddha Gokhale Vanderbilt University, Spring 2003 Client code (client.cpp) int main (int argc, char *argv[]) { try { // initialize the ORB CORBA::ORB_var orb = CORBA::init (argc, argv, “”); // Make a CORBA object CORBA::Object_var tmp = orb->string_to_object(ior); // Create an Invocation Object Test::Hello_var hello = Test::Hello::_narrow(tmp.in ()); // Error checking if (CORBA::is_nil (hello.in ()))

13 Aniruddha Gokhale Vanderbilt University, Spring 2003 Client code contd // now invoke a request CORBA::String_var the_string = hello->get_string (); // check return value and print it // Shutdown the server hello->shutdown (); } // put catch clauses here } // end of main

14 Aniruddha Gokhale Vanderbilt University, Spring 2003 Makefile IDL_FILES = Test IDL_SRC = TestC.cpp TestS.cpp BIN = client server SRC = $(addsuffix.cpp, $(BIN) Hello) $(IDL_SRC) CLIENT_OBJS = client.o TestC.o SERVER_OBJS = server.o Hello.o $(IDL_SRC:.cpp=.o) TAO_IDLFLAGS += -Ge 1 server: $(addprefix $(VDIR),$(SERVER_OBJS)) $(LINK.cc) $(LDFLAGS) -o $^ $(TAO_SRVR_LIBS) $(POSTLINK) client: $(addprefix $(VDIR),$(CLIENT_OBJS)) $(LINK.cc) $(LDFLAGS) -o $^ $(TAO_CLNT_LIBS) $(POSTLINK)

15 Aniruddha Gokhale Vanderbilt University, Spring 2003 Makefile (Contd.) server: $(addprefix (VDIR),$(SERVER_OBJS)) $(LINK.cc) $(LDFLAGS) -o $^ $(TAO_SRVR_LIBS) $(POSTLINK) client: $(addprefix $(VDIR),$(CLIENT_OBJS)) $(LINK.cc) $(LDFLAGS) -o $^ $(TAO_CLNT_LIBS) $(POSTLINK)