|
To access the contents, click the chapter and section titles.
Platinum Edition Using HTML 4, XML, and Java 1.2
Java IDLSun already has one mechanism to enable objects on one machine to invoke methods on other machinesits called Remote Method Invocation (RMI). When youre 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. Thats 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.
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. Its 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 dont 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.
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 languagethe Interface Definition Languageto enable programmers to describe services. With the introduction of Suns 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 EnhancementsMany programs need to access data that is stored in a relational databasethe 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 vendorsnotably, Microsoftsupport 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.
Javadoc DocletsEven 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.
By default, javadoc writes its documentation in HTML. Some programmers have expressed a desire to have documentation in other formats, such as Adobes 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.
|
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. |