Contents |
This tutorial teaches the basic tasks in building a CORBA distributed application using Java IDL. You will build the classic Hello World program as a distributed application, with both applet and application clients. The Hello World program has a single operation that returns a string to be printed. CORBA terminology and the underlying functionality of the application is discussed in the CORBA application architecture. The application diagram is repeated here, along with a review of the steps in the process of communication between the client and server.
Note: The Hello World example is provided with pre-built stub and skeleton files. However, to generate these files yourself and take full advantage of this tutorial, you will need to download theidltojava
compiler.
- The client (applet or application) invokes the sayHello operation of the HelloServer.
- The ORB transfers that invocation to the servant object registered for that IDL interface.
- The servant's sayHello method runs, returning a Java String.
- The ORB transfers that String back to the client.
- The client prints the value of the String.
Despite its simple design, the Hello World program lets you learn and experiment with all the tasks required to develop almost any CORBA program that uses static invocation.
Getting Started
Before you start working with Java IDL, you need two things: version 1.2 of the JDK software and theidltojava
compiler. The JDK provides the API and ORB needed to enable CORBA-based distributed object interaction. Theidltojava
compiler uses the IDL-to-Java mapping to convert IDL interface definitions to corresponding Java interfaces, classes, and methods, which you can then use to implement your client and server code.Previewing Hello World
You can run the Hello World application before you work through the tutorial. Follow the instructions listed for your operating system:
Overview
Each section in this lesson has a directory in thedocs/guide/idl/tutorial
directory of your JDK installation containing valid source files and compiled class files needed for completing the lesson. Although the sections are designed to build upon one another, you can read them in any order you want by using the files provided.This lesson covers these topics:
- Writing the IDL Interface teaches:
- How to write a simple IDL interface definition
- How to translate the IDL interface to Java
- The purpose of each file generated by the
idltojava
compiler- Developing a Client Application teaches how to write a simple client application, including:
- How to create an ORB object
- How to use the naming service to get an initial object reference
- How to invoke an operation on a CORBA object
- Developing the Hello World Server teaches how to write a simple server, including:
- How to create an ORB object for the server
- How to instantiate the servant and connect it to the ORB
- How to register the servant with the naming service
- How to make the server wait for invocations on the servant
- Using Stringified Object References teaches how to make an object reference when there is no naming service.
Contents |