站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Java Tutorial 5.0 英文版

The Java IDL Development Process - Java Tutorial 5.0 英文版

The JavaTM Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Trail: IDL
Lesson: Introducing Java IDL

The Java IDL Development Process

Now that you've seen the relationships between client and server in CORBA, you're ready to step through the process of designing and developing a distributed object application with Java IDL.

Define the Remote Interface

You define the interface for the remote object using the OMG's interface definition langauge. You use IDL instead of the Java language because the idltojava compiler automatically maps from IDL, generating all Java language stub and skeleton source files, along with the infrastructure code for connecting to the ORB. Also, by using IDL, you make it possible for developers to implement clients and servers in any other CORBA-compliant language.

Note that if you're implementing a client for an existing CORBA service, or a server for an existing client, you would get the IDL interfaces from the implementer--such as a service provider or vendor. You would then run the idltojava compiler over those interfaces and follow the steps for creating the client or server described in this trail.

Compile the remote interface

When you run the idltojava compiler over your interface definition file, it generates the Java version of the interface, as well as the class code files for the stubs and skeletons that enable your applications to hook into the ORB.

Implement the server

Once you run the idltojava compiler, you can use the skeletons it generates to put together your server application. In addition to implementing the methods of the remote interface, your server code includes a mechanism to start the ORB and wait for invocation from a remote client.

Implement the client

Similarly, you use the stubs generated by the idltojava compiler as the basis of your client application. The client code builds on the stubs to start its ORB, look up the server using the name service provided with Java IDL, obtain a reference for the remote object, and call its method.

Start the applications

Once you implement a server and a client, you can start the name service, then start the server, then run the client.
You'll see the details of each of these steps in The Hello Client-Server Example, a simple client-server model based on the classic "Hello World" application.
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.