Download presentation
Presentation is loading. Please wait.
Published byPaul Chapman Modified over 8 years ago
1
CORBA Barış COŞKUN Çağatay DİKİCİ
2
INTRODUCTION Computer networks are heterogenous In 1989 OMG(Object Management Group) was formed to address the problems of developping portable distributed applications for heteregenous systems OMG supplies CORBA specifications
3
CORBA BASICS CORBA (Common Object Request Broker Architecture) Provides platform independent program interfaces and models for portable distributed object oriented computer applications
4
CORBA Brings... Partial failures Impact of latency Load Balancing Language Independency
5
CORBA concepts Corba Object Client Server Object Reference Servant
6
CORBA requirements IDL (Interface Definition Language) ORB (Object Request Broker) POA (Portable Object Adapter)
7
IDL Both server and client should know the general specification of the CORBA object. IDL defines language bindings for many different programming languages.(C,C++,Java,COBOL...) Stub and Skeleton are generated from IDL
8
ORB Locates the remote object on the network Transports the request to the object Waits for results and transports results from object to client Implements location transparency
9
IIOP
10
POA Manages server-side resources by set of policies – LifeSpan Policy Transient Persistent – Servant Retention Policy Retain Non-Retain
11
How can ORB locate Objects? Naming Service (Tnameserv.exe) – ServerSide Bind (host,port,object,name) – ClientSide Lookup(host,port,name) get (object)
12
CORBA Interface Definition Language (IDL) OMG IDL is an object-oriented interface definition language that used to specify interfaces containing methods and attributes Support interface inheritance OMG IDL is designed to map onto multiple programming language
13
OMG IDL Compiler A OMG IDL compiler generates client stubs and server skeletons OMG IDL supports the following features: *modules *interfaces *methods *attributes *inheritance *arrays *exceptions
14
OMG IDL vs C++ No data members No pointers No constructors or destructors No overloaded methods No int data type String type
15
The Hello Client Server Example
16
Example (cont..) Writing the IDL Interface Developing the Hello World Server Developing a Client Application Compiling and Running the Application
17
Writing IDL Interface(Hello.idl) module HelloApp { interface Hello { string sayHello(); };
19
Writing the Remote Object Implementation Public class HelloServant extends _HelloImplBase { public String sayHello() { return "\nHello world!!\n"; }
20
Writing Object Server Overview Initialize the ORB Create an instance of the remote object Connect the remote object to the ORB Assign the remote object a name in the CORBA Name Service
21
HelloServer.java import HelloApp.*; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.CORBA.*; public class HelloServer { public static void main(String args[]) { try{ ORB orb = ORB.init(args, null); HelloServant helloRef = new HelloServant(); orb.connect(helloRef);
22
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContext ncRef = NamingContextHelper.narrow(objRef); NameComponent nc = new NameComponent("Hello", ""); NameComponent path[] = {nc}; ncRef.rebind(path, helloRef); java.lang.Object sync = new java.lang.Object(); synchronized(sync){ sync.wait(); } } catch(Exception e) { System.err.println("ERROR: " + e); e.printStackTrace(System.out); } }}
23
Client Development Overview Initialize the ORB and Naming Service Look up the object in the Naming Service Call Remote Methods
24
HelloClient.java import HelloApp.*; import org.omg.CosNaming.*; import org.omg.CORBA.*; public class HelloClient { public static void main(String args[]) { try{ ORB orb = ORB.init(args, null); org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContext ncRef = NamingContextHelper.narrow(objRef);
25
NameComponent nc = new NameComponent("Hello", ""); NameComponent path[] = {nc}; Hello helloRef = HelloHelper.narrow(ncRef.resolve(path)); String hello = helloRef.sayHello(); System.out.println(hello); } catch(Exception e) { System.out.println("ERROR : " + e); e.printStackTrace(System.out); } } }
26
Compiling and Running the Application Compile Client and Server javac HelloClient.java HelloServer.java Running the Application tnameserv (default port 900) java HelloServer –ORBInitialHost 193.62.43.122 java HelloClient –ORBInitialHost 193.62.43.122
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.