Chapter 1

Intranets and Java


CONTENTS


intra net \intra-net\ n: an internal network that is sheltered from the outside world Networks aren't the same since the Java coding language and intranets burst onto the scene. A few years ago, no one had heard of the coding language named after the pervasive liquid that energizes millions. Today, not only is the Java coding language a buzzword in the computer industry, it is fueling a period of tremendous growth and enthusiasm for networked platform-independent apps. Intranets, like Java, seemingly sprang to life overnight. The key to intranets is that they apply the best Internet technologies to the internal networks of organizations the world over. When you combine the object-oriented coding language of the future with a networked publishing solution you can only dream of until recently, you have a powerful toolkit for boosting productivity, enhancing information distribution, dramatically reducing costs, increasing efficiency, and much more. This chapter discusses the basics of intranets. You learn what an intranet is, how intranets differ from Web sites, and why organizations build intranets. You also learn something about the Java coding language-like how Java can enhance an intranet.

What Is an Intranet?

Millions of people browse the World Wide Web and if you are reading this tutorial, odds are you are one of them. The Web is a networked information system based on hypertext. Hypertext allows you to navigate through networked resources at the click of a button. Using a client app called a browser, you can select highlighted keywords or specified hot areas within a document to quickly and automatically navigate to a new document. Browsers are in fact your window to everything the World Wide Web has to offer. Using Web technologies, you have instant access to anything your company publishes and it is this information-on-demand feature that makes the Web such a hot commodity. Beneath the system of hypertext documents and the wonderful graphical interface that makes it all work is a complex network-the Internet. The Internet is a global network of millions of computers. Many different technologies are used on the Internet to find, send, and retrieve information:

Trillions of research dollars went into developing the Internet and the tools that make it work. Since some of it was paid for with your tax dollars, wouldn't it be nice to put this technology to work for you and your company? This is where intranets come in. An intranet is a network within an organization-an internal network-that adapts Internet technologies for use in its information infrastructure. Worldwide, the most common Internet technology put to use within organizations is the Web's hypertext system. For this reason, many developers associate Web publishing on an internal network with intranets. Using your intranet as a publishing solution, employees throughout your organization can quickly find answers to questions. They don't have to search massive policy manuals or learn the commands to interface with the company database. To find information, all they have to do is click on a hypertext reference or enter a word or two at a prompt. Ideally, your intranet puts to use many different Internet technologies including Internet
e-mail, FTP, Telnet, and Web services. You might be wondering why you might want to use all these Internet services. After all, most networks are set up for file transfer with FTP, remote host logins, and e-mail. However, your internal network probably uses commercial software designed for a specific operating system. Further, this software is probably not entirely user and administrator friendly. Take e-mail for example. Most networks use an e-mail system. In a large organization, mail gateways and servers are needed to transfer e-mail from one area of the network to another. These gateways and servers are responsible for translating or encapsulating the protocol of the e-mail software so your messages are readable on the receiving end. Maintaining this maze of servers and gateways is the responsibility of the network administrator. When the system fails, as it inevitably does from time to time, users may lose mail and the administrator may lose sleep. By using an e-mail system designed for the Internet, you can end the nightmare. Users on any platform, be it UNIX, Mac, or Windows 95, can use the same software to send and receive messages. But best of all, you eliminate the necessity for e-mail servers.

Using Web Services on Your Intranet

Setting up a Java-ready intranet with Web services is a key focus in this tutorial. To get started, you need three things:

Note
Browsers that you can use with Java are discussed in , "Designing Intranet apps with Java."
Although the Java Development Kit includes a basic developer's environment, many developers prefer more advanced development tools. The best development tools currently available are discussed in , "Java Development Environments."

Generally, all networks have computers designated as workstations and servers. The workstations are the computers used by your end-users. The servers are the computers that provide services to the workstations. For your intranet, you need one or more servers to provide essential services, which includes Web server software and apps. The Web server software is used to display hypertext documents that you publish on your intranet. Intranet publishing is very different from Web publishing. When you publish on the Web, you are making information and products available to the world community. Yet when you publish on your intranet, the information and products are only available to those with access to the internal network. Using security mechanisms built in to most server software, you can restrict access to information and products published on your intranet, which allows you to selectively disseminate information within the company. For example, your Java spreadsheet app may only be accessible to personnel in the finance department. You may further restrict access by adding login names and passwords. In this way, corporate financial records are only accessible to those who need to know. Your intranet also needs apps and this is where Java comes in. With Java you can create powerful apps that run on virtually any operating system on your network. Unlike programs coded in other coding languages, Java programs are not system resource hogs. A typical advanced app for Windows 95 coded in C++ requires 8-16MB of memory. If you follow sound object-oriented design techniques, the same app coded in Java may require only 2-4MB memory.

Why Build an Intranet?

If you are a software developer, programmer, or network administrator, management has probably asked you a hundred different questions about intranets. Sure, thousands of companies are racing to set up intranets but does your organization need one? The answer is a resounding yes, even for a small organization, and here are the top three reasons why:

Intranets Are Affordable

Intranet services generally do not require a substantial amount of system resources. You probably don't need to use a high-performance computer to provide the services. In fact, on most networks, you find that you can use an existing computer to provide the necessary services. This computer may be a server with other roles within your existing network or a workstation sitting on someone's desk. Because you can use your existing network as the basis of your intranet, the cost of setting up an intranet is negligible. More good news is that you may not need full time developers or administrators to maintain the intranet. Your current network should have a system administrator capable of taking on the additional role as the intranet administrator. Primarily this is because intranet servers are easy to manage once they are up and running. The company also needs someone to create the wonderful Java apps for the intranet, which is probably where you fit into the picture. This tutorial is loaded with information on Java apps you can develop for intranets.

Intranets Save Money

You may be surprised to learn that creating an intranet can actually save you and your company hundreds, thousands, and possibly millions of dollars. If you don't think this is possible, find out how much the company spent on software purchases in the last 2-3 years. Wouldn't it be great to drastically reduce the need to purchase commercial software? By developing your own apps for the intranet, you can do just that. An intranet can offer immediate savings in other areas as well. The cost of a browser that includes an e-mail program is about $25 to $40 per license. Typical Web server software costs between $99 and $999. Using the Web server and browsers on your intranet, you can publish documents and send e-mail. Compare the price of the intranet solution to the hefty prices of the software currently used on most internal networks to put documents into electronic format and send e-mail. Generally, you need to purchase the document creation tool and the e-mail tool separately. A popular tool for creating documents on UNIX systems costs more than $1000 for each license. Many commercial e-mail packages require server software as well as client software. So, you not only have to pay $60 to $100 per license for the e-mail software, you also need to purchase e-mail server software at a cost of hundreds of dollars.

Intranets Are Highly Efficient

Traditional ways to spread information throughout an organization are through meetings, memos, newsletters, and the postal system. In recent years, e-mail has played an increasing role in disseminating information in the workplace. Your e-mail message can reach users in milliseconds. Still, e-mail is not the most efficient way to spread information. For example, you don't want to distribute a 200-page policy document via e-mail. Generally, large or important documents are distributed through the company's mail room or the postal system. You can take the same 200-page policy document and publish it on your intranet, making the document instantly accessible to anyone in the organization. Anything you publish on your intranet is easily searched, indexed, and cross-referenced. Because the document can be fully indexed and easily searched, employees are able to quickly find the areas of the policy document they need to read or are interested in.

Java in Brief

You have probably read all about Java in other tutorials and after reading the basic and intermediate topics those tutorials cover, you are ready to move on to more advanced topics. So instead of spending a dozen pages to tell you about Java's features, I summarize Java's features and history during a brief tour of the Web.

Java: The Early Days

If you have browsed the World Wide Web, you have probably seen Java in action. As unbelievable as it seems, Java was formally introduced to the world in May 1995 and it has been the hottest buzzword in the computer industry ever since. Java was born at JavaSoft (www.javasoft.com) and if you are a current Java programmer, you probably visit the home site featured in Figure 1.1 regularly. Most programmers and Java developers want to go straight to the Developer's Corner section of the Web site, which is where you can download the latest version of the Java Developer's Kit and extension app Programmer's Interfaces (APIs). Screenshot : JavaSoft's site on the Web is a great place to visit frequently.

Note
JavaSoft is an operating company of Oracle. Like many Internet technology companies, JavaSoft has played the Internet name game. Back in 1991, JavaSoft was a special technologies group within Sun called Green. The Green group would later become FirstPerson, Inc. and finally, they would become JavaSoft. The name changes go along with the changing role of Java. The initial goal of the Green group was to establish Oracle in the commercial electronics market. Fortunately, things didn't turn out quite as Oracle planned and the project the Green group started became the platform-independent coding solution for networks.

Intranet developers want to pay particular attention to the Java Database Connectivity (JDBC) and the Java Intranet Framework (JIF) APIs. JDBC enables developers to write Java apps that access databases. JIF is the key to developing intranet apps complete with user-friendly interfaces. You learn all about JDBC in , "Database Connectivity Options," and the classes and methods of the JIF API are explored in detail in Part III, "Extending Java for Intranets."

Note
The JIF API was developed by the authors of Developing Intranet apps with Java and is added as an extra value to our readers. You will build this API in its entirety in Part III.

The first version of Java released for general use on the Internet was an alpha version. Alpha versions of software apps and coding languages are generally released to developers for review, comments, and bug fixes. The Java coding language has come a long way since that original alpha. A major area of change is the developer's tool kit. The current developer's tool kit includes seven powerful tools capable of meeting the needs of most programmers. Table 1.1 summarizes the tools in the current JDK and describes their uses.

Table 1.1. Tools in the JDK.
Executable Tool Name Description
appletviewer Java applet viewer Displays applets.
java Java interpreter Runs Java bytecode.
javac Java compiler Compiles Java programs into bytecode.
javadoc Java documentation generator Creates documentation in HTML format from Java source code.
javah Java header and stubs file generator Creates C language header and stubs files from a Java class.
javap Java class file disassembler Disassembles Java files and prints out a representation of Java bytecode.
jdb Java language debugger Finds problems in your Java code.

Note
You should be very familiar with the tools in the JDK, especially the interpreter, compiler, and debugger. If you are not, you may want to refer to appendix B, "JDK Tools Reference." The appendix contains helpful hints and command summaries for each of the JDK tools.

Java Gets the Official Stamp of Approval

In January 1996, JavaSoft officially released Java, version 1.0, and the enthusiasm for Java really took off. Companies from every sector of the business community started putting Java to work on their intranets. These organizations include: banks, distributors, shipping companies, advertising agencies, real estate agencies, uploaders, and manufacturers. They are using Java because it is so easy to develop universally usable intranet apps with Java. On a typical network, you find one or more operating systems. The UNIX operating system may be in use by an engineering or graphics development division. The Windows NT operating system may be in use by the sales division. The Macintosh System 7 may be in use in the advertising, marketing, or desktop publishing department. Increasingly, different operating systems are in use within the same department or office. So what do you do when a person trained only on Windows NT moves to an office that doesn't use Windows NT? You retrain the person, showing him or her how to deal with the new operating system. You may also need to send the employee to special classes that teach him or her how to use all the apps installed on the new operating system. There is a tremendous difference between a popular desktop publishing program for UNIX, FrameMaker, and a popular desktop publishing program for Windows 95, Microsoft uploader. What makes these programs so different is their interface. FrameMaker and MS uploader have entirely different sets of menus, options, and commands. Why can't you develop an advanced word processor that is usable on any operating system and features a familiar interface on any system where the program is running? Enter Java. With Java, you can develop apps that are usable on any operating system and have the same familiar interface no matter if they are running on a UNIX system or a Windows NT system. Nowhere is the enthusiasm for Java more evident than at the Gamelan Web site shown in Figure 1.2-the official Java repository. In the early days of Java, Gamelan (www.gamelan.com) was the place to learn about what others were doing with Java. Today, there is such an incredible volume of Java development that it is impossible for any organization to keep track of it all. Still, the folks at Gamelan make a valiant effort to keep up. Screenshot : At Gamelan, you can learn about what others are doing with Java.

Java in Action

If you visit Gamelan, make your way past the thousands of programs designed for entertainment to the ones designed for their utility. These are the programs that help you develop and add to the usefulness of your intranet. A must see program for anyone tracking the commercial marketplace is the WallStreetWeb. The home page for the WallStreetWeb (www.wallstreetweb.com) is shown in Figure 1.3. Screenshot : The WallStreet Web home page. The WallStreetWeb is the perfect program to demonstrate the versatility of Java. When you access the WallStreetWeb home page, the WallStreetWeb applet is downloaded to your computer. As soon as the download finishes and the applet starts, you see a dialog box prompting you to enter a user name and password. This dialog box is shown in Figure 1.4. If you have a WallStreetWeb account, you can log in and access real-time stock quotes. If you don't have an account, you can log in as a guest. Guests have limited access to the program's features, but can obtain quotes on certain stocks. Screenshot : Using this dialog box, you can log onto the WallStreet Web. The WallStreetWeb (Figure 1.5) communicates with your system using a Web server that can be located halfway around the world from your location, yet you can still obtain stock quotes instantly. Even more amazing is the fact that the program may have been developed on a completely different operating system than the one you use regularly, yet the program downloads and runs on your system without making any changes to the original program. This true platform independence is what makes Java the most versatile coding language in the world. Screenshot : The WallStreetWeb applet in action. Another powerful feature of Java is its strict security model. If you refer to Figure 1.4, you see a warning at the bottom of the dialog box stating Unsigned Java Applet Window. The warning ensures that the user knows the program does not have a digital signature and is not to be trusted. Java includes many other security mechanisms to ensure the integrity of your network and that systems cannot be compromised.

Note
Security is a major issue in network programming. In the chapters ahead you learn important security issues related to Java programming, intranets, and servers. To learn more about security in Java programming, refer to .

Platform independence and strict security are features that make Java the perfect network coding language. As you develop your intranet, keep these features in mind.

Rapid Development with Java

Not only is rapid development possible with Java, it is the status quo. As most current Java developers know, the Java app Programming Interface consists of predeveloped code that you can use in your apps. This predeveloped code is organized into packages filled with useful classes and methods designed to make it easy to program with Java. The core package for the Java coding language is called java.lang. Although the java.lang package provides the core functionality of the Java coding language, it is not the only package included in the official Java Developer's Kit from JavaSoft. The official developer's kit includes eight basic packages: java.applet, java.awt, java.awt.image, java.awt.peer, java.io, java.lang, java.net, and java.util. The JDK also includes an add-on package called sun.tools.debug. Together the basic and add-on packages provide everything you need to create and debug advanced Java apps. The API in the developer's kit is only the beginning for Java APIs. Currently, there are eight other APIs in development by JavaSoft:

The Java Enterprise API provides almost everything you need to create apps that connect to databases.
The Java Commerce API is the key to enabling electronic commerce.
The Java Management API is a comprehensive tool for building apps that can manage networks.
The Java Server API provides almost everything you need to develop Java-powered servers for the Internet and intranets.
The Java Media API is an advanced toolkit for creating apps that use multi-
media.
The Java Beans API helps you create plug-ins and software modules that interact with existing architectures for object linking and embedding.
The Java Embedded API defines a minimal set of core functionality that can be used in embedded devices.

The great thing about standardized APIs is that all the packages they contain are thoroughly tested before the API is officially released. What this means is that you have millions of lines of code at your fingertips. You can use this code to develop Java apps without having to re-invent the wheel. A perfect example of this is an app called Jompanion, which is shown in Figure 1.6. Jompanion is a fairly advanced text editor that I created for Peter Norton's Guide to Java Programming. Jompanion includes all the features you want in a text editor-cut, copy, paste, find, replace, replace all, adjustable font type and size, file creation, file save, and the ability to have multiple open files. A similar text editor written in the C coding language has more than 10,000 lines of source code, yet because Jompanion is written in Java, the source code is slightly more than 800 lines. Screenshot : Jompanion: A text editor written in Java.

Using Java on an Intranet

By now, you know that Java is a great coding language for networks. What you may not know is how to put Java to use on your intranet. In this section, you find three specific examples of using Java to enhance an intranet. This is only a starting point meant to get you thinking about the kinds of Java apps you can develop.

Using a Java app to Track Employee Files

Every company has employees and files related to those employees. Sometimes those files are only a few dozen pages. Other times, the files are hundreds of pages long, especially if the file contains a record of the employee's history with the company. Wouldn't it be great to create a system to track, store, and access those files instantly? With Java, you can develop an intranet app to do just this. Because you are using Java, the app is able to fully access your databases, even if they are proprietary in nature. But best of all, using the Java Database Connectivity classes and methods, you can access several databases using the same user interface. This means you can use a single app with a standardized and friendly interface to create new entries in multiple databases; to retrieve and collate information; and to update files as necessary.

Note
In , you learn firsthand how to design, code, and implement such an app. In , you learn how to create an intranet app for the human resources department of your organization.

Using a Java app to Schedule Appointments, Meetings, and Conferences

Life in a business organization can be a rat race of meetings with the staff, conferences with management, and appointments with clients. Tracking, announcing, and scheduling these events requires a great deal of time and effort. Wouldn't it be great to have a universally accessible tool everyone at your organization can use to check schedules and announce meetings? Using Java as your intranet coding solution, you can create such an app. Because Java has a standard intranet framework API, you can develop the app using fewer resources-time and money-and obtain a better end product. In ,you learn all about a Java-powered intranet app for conference room scheduling.

Using a Java app to Track Who Is in the Office

In Star Trekā€°, the main computer knows the whereabouts of every person on the Starship Enterprise. The traditional way to track who is in the office is with an in/out board. When you remember to walk past the board on your way in or out of the office, the board is accurate. When you forget to update the board, the board is not accurate. In recent years, some enterprising programmers have created electronic versions of the in/out board. An electronic in/out board can be run automatically when you log in or out, so it gets used. The drawback to existing programs written in traditional coding languages like C/C++ is that they are really only useful as long as you and everyone else in your office uses the operating system for which the program is designed. If some of the office uses the Macintosh System 7 O/S and some of the office uses Windows 95, you cannot easily track or check the status of the office staff. When you use Java to create an electronic in/out board, you do not have a compatibility problem. Your Java-powered in/out board can be used by anyone in the office. In fact, your program can be used by anyone within the company, which allows you to find out if Susan in marketing is in her office before you leave your desk. For tips on designing and implementing an electronic in/out board using Java, see Chapter 16, "Online In/Out Board."

Summary

In this chapter, you learn about intranets and the Java coding language. With an intranet, you can put the best Internet technologies to use on your organization's network. With Java, you can create powerful apps based on APIs that have been thoroughly tested and proven. By combining the two hottest technologies in use today, you get the best of both worlds. You can create a network that is affordable, cost effective, and highly efficient. You can build apps for the network that have standard interfaces and are usable on any operating system.


Java ScreenshotJava ScreenshotJava Screenshot



Comments