IDL Models The Inheritance Model: Using the Inheritance Model, you implement the IDL interface using an implementation class that also extends the compiler-generated.

Slides:



Advertisements
Similar presentations
Slides for Chapter 20: CORBA Case Study From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 4, © Addison-Wesley 2005.
Advertisements

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.
CORBA/IDL Common Object Resource Broker Architecture (CORBA) Interface Definition Language (IDL) Object Management Group (OMG) ( Specification.
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.
Remote Object Invocation Tran, Van Hoai Department of Systems & Networking Faculty of Computer Science & Engineering HCMC University of Technology.
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.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 11: CORBA.
A First Java ORB Application 1  Object Request Broker (ORB)  This is the object manager in CORBA  Mechanisms for specifying interfaces  Interface Definition.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 13: CORBA.
Introduction to CORBA Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie Mellon.
By Dr. Jiang B. Liu 11. Java IDL and CORBA  Generic ORB Core  idltojava development tool  CORBA Object Service (COS) name service - nameserv  Java.
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.
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Slides for Chapter 8: Distributed.
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
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.
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.
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.
1 Java RMI G53ACC Chris Greenhalgh. 2 Contents l Java RMI overview l A Java RMI example –Overview –Walk-through l Implementation notes –Argument passing.
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
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.
An Overview of CORBA and Parlay/OSA APIs ZTE (USA)
Vakgroep Informatietechnologie - IBCN CORBA & RMI Design of Distributed Software.
Presentation: RMI introduction. Goals of this lesson After this 35 min. lesson you will be: Introduced to Java RMI Ready to present RMI’s position in.
Slides for Chapter 17: CORBA Case Study From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley 2001.
CORBA Common Object Request Broker Architecture. Basic Architecture A distributed objects architecture. Logically, an object client makes method calls.
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.
Server-Side Java Mapping Copyright © ZeroC, Inc. Ice Programming with Java 6. Server-Side Java Mapping.
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
1 Naming Service. 2 Naming service The CORBA COS (Common Object Services) Naming Service provides a tree- like directory for object references –It is.
Portable Object Adaptor
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.
Distributed Computing in Life Science Research -Presenter: Yijian Yang
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
Object Oriented Middleware (OOMI) Presentation: Locating Distributed Objects - A presentation of the Interoperable Naming Service & Sun’s Java ORB/ Orbacus.
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.
Only small steps in CORBA programming – much complexity
CORBA (Common Object Request Broker Architecture)
The Common Object Request Broker Architecture (CORBA)
Building a CORBA Server
The Common Object Request Broker Architecture (CORBA)
Remote method invocation (RMI)
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:

IDL Models The Inheritance Model: Using the Inheritance Model, you implement the IDL interface using an implementation class that also extends the compiler-generated skeleton. –The OMG-standard, POA. Given an interface My defined in My.idl, the file MyPOA.java is generated by the idlj compiler. You must provide the implementation for My and it must inherit from MyPOA, a stream-based skeleton that extends org.omg.PortableServer.Servant, which serves as the base class for all POA servant implementations. org.omg.PortableServer.Servant

The Delegation ModelUsing the Delegation Model, you implement the IDL interface using two classes: –An IDL-generated Tie class that inherits from the compiler-generated skeleton, but delegates all calls to an implementation class. –A class that implements the IDL-generated operations interface (such as HelloOperations), which defines the IDL function. The Delegation model is also known as the Tie model, or the Tie Delegation model. It inherits from either the POA or ImplBase compiler-generated skeleton, so the models will be described as POA/Tie or ImplBase/Tie models in this document.

Portable Object Adaptor An object adapter is the mechanism that connects a request using an object reference with the proper code to service that request. The Portable Object Adapter, or POA, is a particular type of object adapter that is defined by the CORBA specification.

POA Allow programmers to construct object implementations that are portable between different ORB products. Provide support for objects with persistent identities. Provide support for transparent activation of objects. Allow a single servant to support multiple object identities simultaneously.servant

Create and Use a POA Get the root POA –The root POA is managed by the ORB and provided to the application using the ORB initialization interface under the initial object name "RootPOA". Define the POA's Policies –control over the object's identity, state, storage, and life cycle

Create the POA Activate the POAManager –Each POA object has an associated POAManager object that controls the processing state of the POAs with which it is associated Activate the servants –At any point in time, a CORBA object may or may not be associated with an active servant. Create the object reference –Explicitly activate a servant and associate it with an object reference. –Server application directly creates a reference. –Server application causes a servant to implicitly activate itself.

IDL and Java module HelloApp { interface Hello { string sayHello(); oneway void shutdown(); };

A CORBA module is a namespace that acts as a container for related interfaces and declarations. It corresponds closely to a Java package. Each module statement in an IDL file is mapped to a Java package statement.namespace Like Java interfaces, CORBA interfaces declare the API contract an object has with other objects. Each interface statement in the IDL maps to a Java interface statement when mapped. CORBA operations are the behavior that servers promise to perform on behalf of clients that invoke them. Each operation statement in the IDL generates a corresponding method statement in the generated Java interface.operations

Hello.java is the signature interface and is used as the signature type in method declarations when interfaces of the specified type are used in other interfaces. the IDL-to-Java mapping puts all of the operations defined on the IDL interface in the operations interface, HelloOperations.java.

import HelloApp.*;//stubs import org.omg.CosNaming.*;//Naming Service import org.omg.CosNaming.NamingContextPackage.*;//Naming Exceptions import org.omg.CORBA.*;//CORBA import org.omg.PortableServer.*;//Portable Server Model import org.omg.PortableServer.POA; import java.util.Properties;//To initiate ORB class HelloImpl extends HelloPOA {//Servant inheritance 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); }

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);

// bind the Object Reference in Naming String name = "Hello"; NameComponent path[] = ncRef.to_name( name ); 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..."); }

Persistent Server PersistentHello.idl module Persistent { interface Hello { string sayHello( ); oneway void shutdown(); }; persistent object An object that can survive the process or thread that created it. A persistent object exists until it is explicitly deleted.

import java.util.Properties; import org.omg.CORBA.Object; import org.omg.CORBA.ORB; import org.omg.CosNaming.NameComponent; import org.omg.CosNaming.NamingContextExt; import org.omg.CosNaming.NamingContextExtHelper; import org.omg.CORBA.Policy; import org.omg.PortableServer.POA; import org.omg.PortableServer.*; import org.omg.PortableServer.Servant; public class PersistentServer { public static void main( String args[] ) { Properties properties = System.getProperties(); properties.put( "org.omg.CORBA.ORBInitialHost", "localhost" ); properties.put( "org.omg.CORBA.ORBInitialPort", "1050" ); try { // Step 1: Instantiate the ORB ORB orb = ORB.init(args, properties); // Step 2: Instantiate the servant PersistentHelloServant servant = new PersistentHelloServant(orb);

// Step 3 : Create a POA with Persistent Policy // ******************* // Step 3-1: Get the rootPOA POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA")); // Step 3-2: Create the Persistent Policy Policy[] persistentPolicy = new Policy[1]; persistentPolicy[0] = rootPOA.create_lifespan_policy( LifespanPolicyValue.PERSISTENT); // Step 3-3: Create a POA by passing the Persistent Policy POA persistentPOA = rootPOA.create_POA("childPOA", null, persistentPolicy ); // Step 3-4: Activate PersistentPOA's POAManager, Without this // All calls to Persistent Server will hang because POAManager // will be in the 'HOLD' state. persistentPOA.the_POAManager().activate( ); // *********************** // Step 4: Associate the servant with PersistentPOA persistentPOA.activate_object( servant );

// Step 5: Resolve RootNaming context and bind a name for the // servant. // NOTE: If the Server is persistent in nature then using Persistent // Name Service is a good choice. Even if ORBD is restarted the Name // Bindings will be intact. To use Persistent Name Service use // 'NameService' as the key for resolve_initial_references() when // ORBD is running. org.omg.CORBA.Object obj = orb.resolve_initial_references( "NameService" ); NamingContextExt rootContext = NamingContextExtHelper.narrow( obj ); NameComponent[] nc = rootContext.to_name( "PersistentServerTutorial" ); rootContext.rebind( nc, persistentPOA.servant_to_reference( servant ) ); // Step 6: We are ready to receive client requests orb.run(); } catch ( Exception e ) { System.err.println( "Exception in Persistent Server Startup " + e ); }

import org.omg.CORBA.ORB; public class PersistentHelloServant extends Persistent.HelloPOA { private ORB orb; public PersistentHelloServant( ORB orb ) { this.orb = orb; } /** * sayHello() method implementation returns a simple message. */ public String sayHello( ) { return "Hello From Persistent Server..."; } /** * shutdown() method shuts down the Persistent Server. * See NOTE below. */ public void shutdown( ) { orb.shutdown( false ); }

import java.util.Properties; import org.omg.CORBA.ORB; import org.omg.CORBA.OBJ_ADAPTER; import org.omg.CosNaming.NamingContext; import org.omg.CosNaming.NamingContextHelper; import org.omg.CosNaming.NameComponent; import org.omg.PortableServer.POA; import Persistent.HelloHelper; import Persistent.Hello; public class PersistentClient { public static void main(String args[]) { try { // Step 1: Instantiate the ORB ORB orb = ORB.init(args, null); // Step 2: Resolve the PersistentHelloServant by using INS's // corbaname url. The URL locates the NameService running on // localhost and listening on 1050 and resolve // 'PersistentServerTutorial' from that NameService org.omg.CORBA.Object obj = orb.string_to_object( "corbaname::localhost:1050#PersistentServerTutorial"); Hello hello = HelloHelper.narrow( obj );

// Step 3: Call the sayHello() method every 60 seconds and shutdown // the server. Next call from the client will restart the server, // because it is persistent in nature. while( true ) { System.out.println( "Calling Persistent Server.." ); String helloFromServer = hello.sayHello(); System.out.println("Message From Persistent Server: " + helloFromServer ); System.out.println( "Shutting down Persistent Server.." ); hello.shutdown( ); Thread.sleep( ); } } catch ( Exception e ) { System.err.println( "Exception in PersistentClient.java..." + e ); e.printStackTrace( ); }