This month, we'll focus on CORBA's support for legacy code. Because CORBA is a language-independent technology, any client written in a language with CORBA support (Java, C++, Ada, SmallTalk, COBOL, etc.) can access server objects in a platform- and language-independent manner.
To demonstrate this feature, we're going to extend the basic Java applet and Java server application that we created in the previous article by trading in the Java server for a new server application written in C++. Our Java client applet will remain completely unchanged. Then, we'll extend both the client and the server to explore additional features of the CORBA IDL, which we briefly touched on back in October. For those readers familiar with JavaWorld's extensive coverage of Java programming issues, you may be taken aback to find a preponderance of C++ code in this article. This code is necessary to show that CORBA servers and clients can communicate and share data regardless of which language they are written in. I chose to use C++ because it is the most popular (in terms of usage) object-oriented programming language, and also because the majority of existing CORBA applications have been written in C++. My future articles on CORBA and distributed object computing (yes, that's right; JavaWorld is expanding its coverage ot this topic) will focus almost exclusively on Java.
Because of the different ways in which C++ and Java handle memory usage, stub and skeleton code generated by the C++ and Java IDL compilers can vary significantly. The beauty of CORBA lies in the fact that Java developers can simply ask for and receive remote objects without worrying about the implementation details contained within those objects. Likewise, the server object developer (writing in C++ or some other language) need not be concerned with which language will be accessing the object being created.
ORBInfo. The interface to this object was described using the following IDL interface:module ORBQuery
{
interface ORBInfo
{
string GetName(in long index);
string GetVendor(in long index);
string GetOS(in long index);
string GetLanguages(in long index);
string GetURL(in long index);
};
};
This month, we'll create our first example using this same interface. This time, however, we'll create a server application using the Visigenic VisiBroker for C++ 3.0 ORB, which you can download on a free trial basis from Visigenic Software (see Resources). The VisiBroker for C++ ORB offers many of the features included with VisiBroker for Java, including the Smart Agent Interface Repository, and support for Dynamic Invocation and Server Interfaces. As a Java developer, you'll be interested to know that with the new 3.0 release of VisiBroker for C++, several of the main components of the ORB are written in Java, showing that yet another major software vendor is practicing what they preach when it comes to Java development. Components written in Java include the idl2cpp (IDL-to-C++) compiler, the Interface Repository, and the Object Activation Daemon registration utilities.