Object Oriented Middleware (OOMI) Presentation: Locating Distributed Objects - A presentation of the Interoperable Naming Service & Sun’s Java ORB/ Orbacus.

Slides:



Advertisements
Similar presentations
Objektorienteret Middleware (TIOOMI) Dynamic Requests.
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.
After this 1x35 lessons you will be
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.
CORBA/IDL Common Object Resource Broker Architecture (CORBA) Interface Definition Language (IDL) Object Management Group (OMG) ( Specification.
1 Distributed Systems Distributed Objects & Remote Invocation CORBA Dr. Sunny Jeong. Mr. Colin Zhang With Thanks.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 11: CORBA.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 13: CORBA.
II. Middleware for Distributed Systems
Naming Service 1 Common Principles  Object-oriented middleware uses object references to address server objects  We need to find a way to get hold of.
By Dr. Jiang B. Liu 11. Java IDL and CORBA  Generic ORB Core  idltojava development tool  CORBA Object Service (COS) name service - nameserv  Java.
CS603 Communication Mechanisms: DCE RPC (cont.) 23 January 2002.
CORBA Chapter 17 Coulouris text. Today’s Topics CORBA History and goals CORBA RMI CORBA services The Distributed Whiteboard Revisited.
1 Aniruddha Gokhale Vanderbilt University, Spring 2003 Intro to TAO Programming Study the Hello example in ACE_wrappers/TAO/tests –Show IDL definition,
Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.
1 Java Programming II Java Network II (Distributed Objects in Java)
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
CORBA Celsina Bignoli Enterprise Computing Corporation have similar computing environments: –mixed set of HW platforms –a mixed set.
Distributed Objects and Remote Invocation: RMI and CORBA Most concepts are drawn from Chapter 17 © Pearson Education Rajkumar Buyya, Xingchen Chu, Rodrigo.
Slide 1 © Ingeniørhøjskolen i Århus Objektorienteret Middleware (OOMI) CORBA Introduction.
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Slides for Chapter 8: Distributed.
Objektorienteret Middleware (TIOOMI) Presentation 20 : Value Types in CORBA.
15 - RMI. Java RMI Architecture Example Deployment RMI is a part of J2SE (standard edition), but is used by J2EE) A J2EE server is not nessesary for using.
Presentation 24: RMI, Web services, DCOM Introduction Objektorienteret Middleware.
Information Management NTU Interprocess Communication and Middleware.
CS551 - Lecture 17 1 CS551 Object Oriented Middleware (VI) Advanced Topics (Chap of EDO) Yugi Lee STB #555 (816)
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.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
Slide 1 CORBA Programming: Presentation of a simple “Hello World” CORBA client and server application ITONK1.
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.
RMI-IIOP.  RMI-IIOP combines RMI-style ease of use with CORBA cross-language interoperability  Java™ Remote Method Invocation (RMI) provides a simple.
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.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
CORBA Details Three Tier Architecture CORBA API Holders and Helpers COS Naming and Naming Contexts Transient and Persistent Objects Properties Callbacks.
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.
Slides for Chapter 17: CORBA Case Study From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley 2001.
Slide 1 Objektorienteret Netværkskommunikation CORBA Introduction.
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:
1 CORBA. 2 What options do I have for distributed application development using java? 1.RMI-IIOP is for developers who program in the Java programming.
Presentation 23:.NET Remoting Introduced Objektorienteret Middleware.
Presentation 11: RMI introduction. Ingeniørhøjskolen i Århus Slide 2 af 20 Goals of this lesson After these 2x35 lessons you will be –Introduced to Java.
Remote Method Invocation with Java-RMI
Slide 1 Objektorienteret Netværkskommunikation CORBA Introduction.
1 Naming Service. 2 Naming service The CORBA COS (Common Object Services) Naming Service provides a tree- like directory for object references –It is.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
Slide 1 of 15 © Ingeniørhøjskolen i Århus CORBA Programming: Presentation of a simple “Hello World” CORBA client and server application.
1 callback. 2 Client programs often react to changes or updates that occur in a server. For example, a client graph or spreadsheet program might need.
Presentation: Architectural Design for Distributed Systems Objektorienteret Middleware (OOMI)
// messenger.idl interface Messenger { boolean send_message ( in string user_name, in string subject, inout string message ); };
Presentation: The CORBA Portable Object Adapter (POA) Object Oriented Middleware (OOMI)
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.
Object-Oriented Middleware (OOMI) Locating Distributed Objects Emmerich – Chapter
CORBA Barış COŞKUN Çağatay DİKİCİ. INTRODUCTION Computer networks are heterogenous In 1989 OMG(Object Management Group) was formed to address the problems.
Presentation 13: RMI continued – more advanced issues: Activation & RMI over IIOP.
Introduction to CORBA.
Only small steps in CORBA programming – much complexity
Remote Method Invocation
The Common Object Request Broker Architecture (CORBA)
The Common Object Request Broker Architecture (CORBA)
CORBA Programming B.Ramamurthy Chapter 3 5/2/2019.
Copyright © 2001 Qusay H. Mahmoud
Presentation transcript:

Object Oriented Middleware (OOMI) Presentation: Locating Distributed Objects - A presentation of the Interoperable Naming Service & Sun’s Java ORB/ Orbacus C++ ORB implementations

Outline Object Naming Motivation Common Principles CORBA Initialization Service CORBA Naming Service Real world implementations vs. Specification Real world example POA relations is next presentation Object Trading not part of Course Curriculum

Motivation Recap: last time on CORBA class, IOR as files Goal: avoid using physical locations for locating components Naming: Locating components by external names Similar to white pages Java RMI Registry, CORBA Naming Service Trading: Locating components by service characteristics Similar to yellow pages Web services UDDI

Naming - Common Principles (1) Object-oriented middleware uses object references to address server objects We need to find a way to get hold of these object references without assuming physical locations A name is a sequence of character strings that can be bound to an object reference A name binding can be resolved to obtain the object reference

Naming - Common Principles (2) Potentially many server objects in system Server objects may have several names Leads to large number of name bindings Name space has to be arranged in a hierarchy to avoid Name clashes Poor performance when binding/resolving names Hierarchy achieved by naming contexts Might not be necessary if you design coarse/grained

Naming - Common Principles (3): Composite Names Names are composed of possibly more than one component Used to describe traversals across several naming contexts Examples: ("UEFA","England","Premier", “Manchester United") ("UEFA",“Cup Winners", “Manchester United") HOWEVER: Often only a flat naming structure is used! Will help you deal with performance issues

CORBA Naming Service Consists of two elements: Standardized CORBA Interfaces Vendor dependent server implementations Two specifications ”Old version”: CORBA Naming Service “New version”: CORBA Interoperable Naming Service Alternative: Trading In agreement with the principles Names are scoped in naming contexts Multiple names can be defined for object references Remember not all object references need names Façade & Factory objects have names

CORBA Names Names are composed of simple names Simple names are value-kind pairs Value attribute is used for resolving names Kind attribute is used to provide information about the role of the object module CosNaming { typedef string Istring; struct NameComponent { Istring id; Istring kind; }; typedef sequence Name;... };

Example of a bind() operation Registration of a simple Name binding at a Name Server: CosNaming::Name name; name.length(1); name[0].id=CORBA::string_dup(“MyFactory"); name[0].kind= CORBA::string_dup(""); // bind name with my_factory servant at NameServer naming_context->bind(name,my_factory.in()); “MyFactory” MyFactoryImp NameServer ior

The IDL Interfaces Naming Service is specified by two IDL interfaces: NamingContext defines operations to bind objects to names and resolve name bindings BindingInterator defines operations to iterate over a set of names defined in a naming context interface NamingContext { void bind(in Name n,in Object obj) raises (NotFound,...); Object resolve(in Name n) raises(NotFound,CannotProceed,...); void unbind(in Name n) raises(NotFound,CannotProceed...); void list(in unsigned long how_many, out BindingList bl, out BindingIterator bi);... }; Excert of NamingContext interface – the Interoperable Naming Service has extensions found in the NamingContextExt interface

Bootstrapping Naming Service How to get access to the Root Naming Context? ORB Interface provides for initialization: CORBA Initialization Service is used CORBA::ORB_init() & the CORBA::ORB interface module CORBA { interface ORB { typedef string ObjectId; typedef sequence ObjectIdList; exception InvalidName{}; ObjectIdList list_initial_services (); Object resolve_initial_references ( in ObjectId identifier) raises(InvalidName); }

Implementation details Consists of two elements: Standardized CORBA Interfaces Vendor dependent server implementation Naming Services are themselves CORBA objects Need a server proces running Very differently implemented by vendors We look at Orbacus & Java J2SE SDK ORB

Vendor specific Naming Servers Orbacus C++ nameserv OR ntnameservice (native Windows NT service) Orbacus Java com.ooc.CosNaming.Server Java J2SE (prior to 1.4.1) tnameserv (transient only and NOT interoperable) Java J2SE (after 1.4.1) orbd (ORB Daemon – which includes a naming server) servertool (if you want to use a persistent naming service) Example: start orbd –ORBIntialPort 2500 will start a transient naming service listening on port 2500

Example implementation HelloWorld using the ORBD Nameservice (in transient mode) We need: Hello.idl HelloServer.java (pos. HelloImpl.java) HelloClient.java Then we need the IDLJ tool (with –fall) the ORBD daemon – as the nameserver

module HelloApp { interface Hello { string sayHello(); oneway void shutdown(); }; Hello.idl Setting up the module, interface & the methods needed for our example Two methods defined

import HelloApp.*; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.CORBA.*; import org.omg.PortableServer.*; import org.omg.PortableServer.POA; import java.util.Properties; class HelloImpl extends HelloPOA { private ORB orb; public void setORB(ORB orb_val) { orb = orb_val; } // implement sayHello() method public String sayHello() { return "\nHello world !!\n"; } // implement shutdown() method public void shutdown() { orb.shutdown(false); } (continued on next slide) … HelloWorld Server 1 of 3 The Servant part – our implementation of the IDL interface -nothing new here Extends HelloPOA sayHello implemented Shutdown implemented

… (continued from last slide) public class HelloServer { public static void main(String args[]) { try{ // create and initialize the ORB ORB orb = ORB.init(args, null); // get reference to rootpoa & activate the POAManager POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA")); rootpoa.the_POAManager().activate(); // create servant and register it with the ORB HelloImpl helloImpl = new HelloImpl(); helloImpl.setORB(orb); // get object reference from the servant org.omg.CORBA.Object ref = rootpoa.servant_to_reference(helloImpl); Hello href = HelloHelper.narrow(ref); // get the root naming context org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); // Use NamingContextExt which is part of the Interoperable // Naming Service (INS) specification. NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); (continued on next slide) … HelloWorld Server 2 of 3 The Server part – getting the Nameservice context As discussed last week Use Init. Service to get Name Service Just another CORBA object

… (continued from last slide) // create the name compoent String name = "Hello"; NameComponent path[] = ncRef.to_name( name ); // bind the Object Reference in Naming ncRef.rebind(path, href); System.out.println("HelloServer ready and waiting..."); // wait for invocations from clients orb.run(); } catch (Exception e) { System.err.println("ERROR: " + e); e.printStackTrace(System.out); } System.out.println("HelloServer Exiting..."); } HelloWorld Server 3 of 3 Binding the HelloApp object reference to the Nameserver context using the name ”Hello” Using the ”to_name” to create a Name Component Bind name & reference Run ORB & wait for invocations

import HelloApp.*; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.CORBA.*; public class HelloClient { static Hello helloImpl; public static void main(String args[]) { try{ // create and initialize the ORB ORB orb = ORB.init(args, null); // get the root naming context – getting hold of the Name Service (ORBD) org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); // Use NamingContextExt instead of NamingContext. This is // part of the Interoperable naming Service – meaning that you may com with // other ORBs NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); // resolve the Object Reference in Naming – using ncRef’s resolve operation String name = "Hello"; helloImpl = HelloHelper.narrow(ncRef.resolve_str(name)); System.out.println("Obtained a handle on server object: " + helloImpl); System.out.println(helloImpl.sayHello()); helloImpl.shutdown(); } catch (Exception e) { System.out.println("ERROR : " + e) ; e.printStackTrace(System.out); } }} HelloWorld Client Using same name service to get the name – now using the resolve operation

Commands used To compile static stubs idlj -fall Hello.idl Compile all Java files using javac To start-up the Naming Service orbd -ORBInitialPort 1050 Starting up the server: start java HelloServer -ORBInitialPort ORBInitialHost localhost Starting up the client: java HelloClient -ORBInitialPort ORBInitialHost localhost

Now with a C++ client We want to contact the ORBD Nameserver from a C++ Client Using the Orbacus C++ ORB Needed: Hello.idl HelloCORBAClient.cpp Orbbacus idl compiler

#include int run(CORBA::ORB_ptr); int main(int argc, char* argv[]) { int status = EXIT_SUCCESS; CORBA::ORB_var orb; try { //Connect to the ORB with supplied arguments orb = CORBA::ORB_init(argc, argv); status = run(orb); } catch(const CORBA::Exception&){ status = EXIT_FAILURE;} if(!CORBA::is_nil(orb)) { try { //remember to inform the orb that we no longer need it orb -> destroy(); } catch(const CORBA::Exception&){ status = EXIT_FAILURE; } } return status; } … (continued on next) … HelloWorld C++ Client Part 1 of 2 Do the usual initialization to connect to ORB and call the Run method Init. and run(orb)

… (continued from last slide) int run(CORBA::ORB_ptr orb) { //OBTAINING REFERENCE TO Name Server CORBA::Object_var obj = orb->resolve_initial_references("NameService"); //Narrow the Call – we need to turn the Name server obj into a NamingContext CosNaming::NamingContext_var naming_context; naming_context = CosNaming::NamingContext::_narrow(obj); //Now setup the CosNaming name that we want to find (Hello) CosNaming::Name name; name.length(1); name[0].id= CORBA::string_dup("Hello"); name[0].kind= CORBA::string_dup(""); //Using the resolve operation on the root naming_context - get the Hello Servant stub CORBA::Object_var tempObj = naming_context->resolve(name); //Call Narrow now to transform the generic CORBA Obj ínto an HelloApp::Hello class HelloApp::Hello_var hello = HelloApp::Hello::_narrow(tempObj); cout sayHello() << endl; return 0; } HelloWorld C++ Client Part 2 of 2 Using the ORBD name- service to get the IOR to the Java Servant Error handling has been excluded Find NameService Use the ”manual” mapping method from the CosNaming

Commands used To compile static stubs \ooc\bin\idl Hello.idl Compile all files Remember to start-up ORBD and the Java Servant on port 1050 Starting up the client: C:\OOC_DEV\HelloCorbaCppNaming\Debug>HelloCorba - ORBInitRef NameService=corbaloc::localhost:1050/NameService Here we see the corbaloc used for bootstrapping

Transient or Persistent Naming Transient Naming Service object references will not survive termination of nameserver servants need to reregister clients need to resolve again Persistent Naming Service Servants are activated automatically Object references are persisted Not the same as persistent servants! Need a persistent portable object adapter (POA) Need to register the servant with the servertool Need a persistence mechanism

Tutorials How to implement a Transient Name binding using ”orbd” How to implement a Persistent Name binding using ”orbd & servertool” mlhttp://java.sun.com/j2se/1.5.0/docs/guide/idl/jidlExample2.ht ml We shall be taking a closer look at this when we discuss the POA in detail

Limitations of Naming Limitation of Naming: Client always has to identify the servant by name Inappropriate if client just wants to use a service at a certain quality but does not know from who: Automatic cinema ticketing Video on demand Electronic commerce Trading Service Not curriculum

Læringsmål Alignment Når kurset er færdigt forventes den studerende at kunne: Definere, beskrive og sammenligne forskellige typer af objektorienterede middleware frameworks til apparater og computere, med primær fokus på CORBA og sekundært.NET Remoting teknologierne, herunder fordele og ulemper forbundet med de forskellige teknologier Definere og beskrive principper omkring transparens og heterogenitet i relation til middlewareteknologier Definere og beskrive gængse teorier, metoder og retningslinier indenfor det objektorienterede middleware paradigme og anvende disse til at designe effektive distribuerede systemer Designe og konstruere et distribueret system der gør brug af CORBA og.NET Remoting teknologierne med tilhørende værktøjssupport Naming Servicen er central for forståelsen af CORBA. Derfor skal både koncept og Kode kunne genkendes og forklares Naming Servicen er central for forståelsen af CORBA. Derfor skal både koncept og Kode kunne genkendes og forklares MANGLER: hvordan I praktisk omsætter denne viden Naming og location Transparens hænger tæt sammen Naming og location Transparens hænger tæt sammen Det forventes at I kan bruge CORBA Naming til jeres Opgave. Både design og i praksis Det forventes at I kan bruge CORBA Naming til jeres Opgave. Både design og i praksis