CORBA - PowerPoint PPT Presentation

About This Presentation
Title:

CORBA

Description:

CORBA - SUNY Oneonta ... corba – PowerPoint PPT presentation

Number of Views:147
Avg rating:3.0/5.0
Slides: 15
Provided by: hig123
Category:

less

Transcript and Presenter's Notes

Title: CORBA


1
CORBA
2
A CORBA example
  • From url
  • http//java.sun.com/developer/technicalArticles/re
    leases/corba/
  • The transient server example

3
The IDL file, Add.idl
  • module ArithApp
  • interface Add
  • const unsigned short SIZE10
  • typedef long arraySIZE
  • void addArrays(in array a, in array b,
  • out array result)

4
Use idl compiler to compile this file
  • promptgt idlj -fall Add.idl
  • This command will generate several files. Check
    the local directory where you run the command
    from to see the files. You will notice that a new
    subdirectory with the name ArithApp has been
    created. This is because an OMG IDL module is
    mapped to a Java package. For more information on
    the idlj compiler and the options you can use,
    please see the IDL-to-Java Compiler.

5
AddImpl.java implements the idl
  • import ArithApp.
  • import org.omg.CORBA.
  • class AddImpl extends AddPOA
  • private ORB orb
  • public AddImpl(ORB orb)
  • this.orb orb
  • // implement the addArrays() method
  • public void addArrays(int a, int b,
  • ArithApp.AddPackage.arrayHolder result)
  • result.value new intArithApp.Add.SIZE
  • for(int i0 iltArithApp.Add.SIZE i)
  • result.valuei ai bi

6
AddServer
  • AddServer.java in notes section

7
AddClient
  • AddClient.java in notes

8
Compile these files
  • promptgt javac .java ArithApp/.java

9
To run the application
  • Start the orbd, which is a name server promptgt
    orbd -ORBInitialPort 2500
  • The number 2500 is the port number where you want
    the orbd to run. Note that the -ORBInitialPort is
    a require command-line argument. Start the
    AddServer promptgt java AddServer
    -ORBInitialPort 2500
  • Start the AddClient promptgt java AddClient
    -ORBInitialPort 2500

10
Run orbd at ORBInitialPort 2500
11
Run server
12
Run client
13
Persistent server
14
Persistent serverstart server tool-this 2nd
example not completed
Write a Comment
User Comments (0)
About PowerShow.com