home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Platinum Edition Using HTML 4, XML, and Java 1.2
(Publisher: Macmillan Computer Publishing)
Author(s): Eric Ladd
ISBN: 078971759x
Publication Date: 11/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Java IDL

Sun already has one mechanism to enable objects on one machine to invoke methods on other machines—it’s called Remote Method Invocation (RMI). When you’re communicating from one Java class to another, RMI is efficient and easy to use. Sometimes, however, your Java program will need to communicate in a broader environment, which may include programs written in C++, SmallTalk, or COBOL. That’s where the new Java IDL comes in.

To understand why Sun introduced the Interface Definition Language (IDL) for Java, you need to understand something about Object Request Brokers (ORBs). This section describes the distributed processing environment that makes ORBs and IDL necessary.

What Is an ORB? Traditionally, business applications were built either as a monolithic application (one-tiered) or as a database with a front end (two-tiered). Modern business applications are often built with three or more tiers, such as a graphical user interface, a service module, and a database. Figure 36.5 illustrates these three models.


FIGURE 36.5  Multitiered applications are often distributed across many physical machines.

Suppose you wanted to build a distributed application. If you knew which host offered which service, you could use Java sockets to connect to other applications. If each client and each server were written in Java, you could even use Runtime Method Invocation.

But in a large, sophisticated, distributed application, you might not know where the servers resided. In fact, a really sophisticated application might move servers around as hosts are taken offline or fail. The service should continue to be offered by some host on the network and should be findable by every client application. It’s also safe to assume that not every server is written in Java (yet).

An Object Request Broker is the unifying piece of software for a large, sophisticated, distributed application. With an ORB, the clients don’t have to know where each server is located. They call the ORB, and the ORB connects them to the service. Figure 36.6 illustrates how an ORB interacts with the rest of the network.

Internet clients and servers communicate with ORBs by using the Internet Inter-ORB Protocol, or IIOP, defined by the Object Management Group.


FIGURE 36.6  With an ORB on your network, clients can find distributed software anywhere on the net.

ON THE WEB
http://www.omg.org/corba/corbaiiop.htm If you plan to use an ORB, you should learn more about CORBA and the IIOP. You can get the complete CORBA/IIOP 2.1 specification from the Web, here on the Object Management Group’s site.

The software Sun calls the Java IDL is, in fact, an ORB written in Java.

What Is IDL? For clients and servers to communicate about services, they need a common language. Because servers are written in a variety of languages, including C++ and Java, no single programming language is entirely satisfactory for describing the service interfaces. Instead, the Object Management Group has defined a new language—the Interface Definition Language—to enable programmers to describe services.

With the introduction of Sun’s idltojava compiler, Java now conforms to the Common Object Request Broker Architecture, CORBA. (Other languages with an IDL mapping include C++, C, Smalltalk, COBOL, and Ada.)

JDBC Enhancements

Many programs need to access data that is stored in a relational database—the sort of database that is usually accessed by using the Structured Query Language (SQL, pronounced see-quel). Java gives you access to SQL through the Java Database Connectivity or JDBC package, java.sql.

Some vendors—notably, Microsoft—support the Open Database Connectivity standard, ODBC. The ODBC standard is complex, and is oriented toward C and C++ programmers. Rather than force you to learn ODBC, Sun enables you to access an ODBC-compliant database from the JDBC interface. In JDK 1.2 this mechanism is called the JDBC-ODBC bridge.

The latest version of the bridge uses the JNI API and assumes that the ODBC drivers can handle multithreaded access. Both of these changes improve performance. The new version also enables you to specify a character encoding on the connection. This change makes it easier to handle international characters.


Java contains many provisions that ease internationalization of your program. Visit http://java.sun.com/products/jdk/1.1/intl/html/intlspecTOC.doc.html to learn more about Java internationalization.

Javadoc Doclets

Even the best programmers often allow the documentation of their classes to drift out of date. Most programmers, however, do a good job of keeping source comments current. Javadoc is a documentation tool that builds package and class documentation based on source comments. Figure 36.7 shows the sort of documentation javadoc produces.


FIGURE 36.7  You can use javadoc to produce package documentation in HTML.

By default, javadoc writes its documentation in HTML. Some programmers have expressed a desire to have documentation in other formats, such as Adobe’s Portable Document Format, PDF. Other programmers are content with HTML but would like a different “look and feel” than the one chosen by Sun.

Starting in version 1.2, programmers can use the Doclet API to design their own javadoc output.


To get started fast in writing doclets, don’t use the Doclet API directly. Make a copy of the standard—the one that writes HTML—and modify it to suit your needs.


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.