![]() ![]() ![]() ![]() |
Introducing Java IDL |
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 theidltojava
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'd get the IDL interfaces from the implementer -- such as a service provider or vendor. You'd then run the
idltojava
compiler over those interfaces, then follow the steps for creating the client or server described in this tutorial.Compile the remote interface
When you run theidltojava
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've run theidltojava
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 theidltojava
compiler as the basis of your client application. The client code builds on the stubs to starts its ORB, look up the server using the name service provided with Java IDL, obtain a reference for the remote object, and calls its method.Start the applications
Once you've implemented 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 example that follows, a simple client-server model based on the classic "Hello World" application
![]() ![]() ![]() ![]() |
Introducing Java IDL |