building a corba server

12
Building a CORBA Building a CORBA Server Server

Upload: austin-mcintyre

Post on 01-Jan-2016

27 views

Category:

Documents


2 download

DESCRIPTION

Building a CORBA Server. Basic Steps for Building a CORBA Server. 1 . Define the server's interfaces using IDL. 2 . Choose an implementation approach for the server's interfaces. 3 . Use the IDL compiler to generate client stubs and server skeletons for the server interfaces. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Building a CORBA Server

Building a CORBA Server Building a CORBA Server

Page 2: Building a CORBA Server

Basic Steps for Building a Basic Steps for Building a CORBA Server CORBA Server

11. Define the server's interfaces using IDL.. Define the server's interfaces using IDL.

22. Choose an implementation approach for the . Choose an implementation approach for the server's interfaces. server's interfaces.

33. Use the IDL compiler to generate client stubs . Use the IDL compiler to generate client stubs and server skeletons for the server interfaces. and server skeletons for the server interfaces.

44. Implement the server interfaces.. Implement the server interfaces.

55. Compile the server application.. Compile the server application.

66. Run the server application. . Run the server application.

Page 3: Building a CORBA Server

1. Defining the Server 1. Defining the Server Interfaces Interfaces

// StockMarket.idl// StockMarket.idl module StockMarket module StockMarket {{ typedef string StockSymbol;typedef string StockSymbol; typedef sequence<StockSymbol> StockSymbolList;typedef sequence<StockSymbol> StockSymbolList;

interface StockServer interface StockServer {{ float getStockValue(in StockSymbol symbol);float getStockValue(in StockSymbol symbol); StockSymbolList getStockSymbols();StockSymbolList getStockSymbols(); };}; };};

Page 4: Building a CORBA Server

2. Choosing an Implementation 2. Choosing an Implementation Approach Approach

Implementation by Implementation by inheritanceinheritance consists of a base class that defines the consists of a base class that defines the

interfaces of a particular object and a separate interfaces of a particular object and a separate class, inheriting from this base class, which class, inheriting from this base class, which provides the actual implementations of these provides the actual implementations of these interfaces interfaces

Implementation by Implementation by delegationdelegation consists of a class that defines the interfaces for consists of a class that defines the interfaces for

an object and then delegates their an object and then delegates their implementations to another class or classes. implementations to another class or classes.

Page 5: Building a CORBA Server
Page 6: Building a CORBA Server
Page 7: Building a CORBA Server

3. Using the IDL Compiler 3. Using the IDL Compiler Sun's Java IDL product is this:Sun's Java IDL product is this:

idltojava -fno-cpp -fclient -fserver StockMarket.idl idltojava -fno-cpp -fclient -fserver StockMarket.idl

IDL Compiler generate number of filesIDL Compiler generate number of files Helper classesHelper classes Client Stub classesClient Stub classes Server Stub classesServer Stub classes

The names of the files generated by the IDL compiler The names of the files generated by the IDL compiler are dependent on the language mapping used and are dependent on the language mapping used and sometimes on command-line arguments passed to the sometimes on command-line arguments passed to the IDL compiler. IDL compiler.

Page 8: Building a CORBA Server

Using the IDL Compiler Using the IDL Compiler (Cont)(Cont)

For each IDL interface compiler For each IDL interface compiler generategenerate a source file and header file for the client a source file and header file for the client

stubstub a source file and header file for the server a source file and header file for the server

skeletonskeleton

IDL Compiler can create separate IDL Compiler can create separate directories for IDL module.directories for IDL module.

Page 9: Building a CORBA Server

4. 4. Implementing the Implementing the Server InterfacesServer Interfaces

To keep the example as simple Java To keep the example as simple Java is used as implementation language.is used as implementation language.

Page 10: Building a CORBA Server

i) i) Using Server SkeletonsUsing Server Skeletons

The server skeleton, as you have The server skeleton, as you have learned, provides a framework upon learned, provides a framework upon which to build the server which to build the server implementation. implementation.

In Java, a server skeleton combines a In Java, a server skeleton combines a set of helper classes with an interface, set of helper classes with an interface, for providing the implementation. for providing the implementation.

Page 11: Building a CORBA Server

After Compilation within StockMarket After Compilation within StockMarket directory are a number of files directory are a number of files containing client stub and server containing client stub and server skeleton definitions: skeleton definitions:

StockSymbolHelper.java StockSymbolHelper.java StockSymbolListHolder.java StockSymbolListHolder.java StockSymbolListHelper.java StockSymbolListHelper.java

StockServer.java StockServer.java

StockServerHolder.java StockServerHolder.java StockServerHelper.java StockServerHelper.java

_StockServerStub.java _StockServerStub.java _StockServerImplBase.java _StockServerImplBase.java

Page 12: Building a CORBA Server

StockServer.javaStockServer.java

package StockMarket;package StockMarket; public interface StockServer extends public interface StockServer extends

org.omg.CORBA.Object org.omg.CORBA.Object {{ float getStockValue(String float getStockValue(String

symbol);symbol); String[] getStockSymbols();String[] getStockSymbols(); }}