This month the Java platform segues into the new millennium. These are very exciting times; 1999 was a crucial year in the acceptance of Java in the enterprise as one of the key drivers of e-business. It's ironic that applets the components of Java that helped propel it into the mainstream of Internet applications currently occupy a backseat in the vehicle that propels Java into the 21st century. During the year gone by, the focus was on server-side Java, as predicted last year by several industry pundits more precisely, on Java in the middle tiers of distributed computing.
This month in e-Java we'll take a look at some of the developments in Java that have had an impact on Java-based e-business. Specifically, we'll examine the segregation of Java into three separate editions, the role of Java servlets and JavaServer Pages and the impact of J2EE in defining middle-tier business logic.
The Three Lives of Java
At JavaOne '99 Sun made an important announcement that defines the future direction of the Java platform. The architecture for the platform was redefined, aimed at making it simpler for software developers, service providers and device manufacturers to target specific markets. The revised structure defines three editions of the platform:
Each of the new Java platform editions combines the Java Virtual Machine, the Java programming language, core packages and optional packages. The new editions share many core packages and the Java programming environment. Each comes with its own set of core APIs to enable development of business solutions in its respective domain.
- Java 2 Platform, Standard Edition (J2SE)
- Java 2 Platform, Enterprise Edition (J2EE)
- Java 2 Platform, Micro Edition (J2ME)
Applications on all three editions may be developed using a common application programming model. Those developed using this model should be able to scale upwardly from systems built with J2ME to systems built with J2SE. With the Java 2 platform Sun defines what constitutes the core Java technology platform for the enterprise. A core set of APIs forms the "least common denominator" of APIs offered by the platform. For programmers on virtually any Java platform from smart cards to the mainframe that means that 15 class libraries have been declared "core," and thus constitute the soul of all Java technology. These are applet, awt, beans, io, lang, math, net, rmi, security, sql, text, util, accessibility, swing and corba. The three editions of the platform are described below.
Java 2 Platform, Micro Edition
J2ME is a new edition of the Java 2 platform targeted at consumer electronics and embedded devices. It consists of a virtual machine and a minimal layer of APIs targeted at providing only enough functionality to securely and safely download Java classes to a device and configure the Java environment. The rest of the Java functionality needed to provide a complete Java runtime environment for a particular kind of device is provided within the context of an industry-defined profile. J2ME comes in two flavors, called configurations, that are targeted at two broad categories of devices:
- Devices with 128512K of memory available for the Java environment and applications
- Devices with 512K+ of memory available for the Java environment and applications
Java 2 Platform, Standard Edition
J2SE provides a complete, secure foundation for building and deploying network-centric enterprise applications ranging from the PC desktop computer to the workgroup server. It's implemented by the Java 2 Software Development Kit (SDK), Standard Edition, and the Java 2 Runtime Environment, Standard Edition. J2SE includes the following APIs:
Java 2 Platform, Enterprise Edition
- Java Foundation Classes (JFC) and Swing
- Pluggable Look & Feel (PLAF)
- Drag and drop
- Java Interface Definition Language (Java IDL)
- Remote Method Invocation (RMI)
- Java 2D
- The Collections Framework
J2EE enhances J2SE to server-side, middle-tier applications that address multitier enterprise solutions. It enables solutions for developing, deploying and managing multitier server-centric applications. J2EE is a unified platform for building, deploying and managing enterprise-class software applications that have the ability to run on a variety of computing environments. The primary technologies in J2EE (in addition to the J2SE technologies) are:
- Enterprise JavaBeans (EJB)
- Java Servlets and JavaServer Pages (JSP)
- Java Naming and Directory Interface (JNDI)
- Java Transaction API (JTA)
EJB technology, the basis of J2EE, provides a scalable architecture for executing business logic in a distributed computing environment. J2EE combines the EJB component architecture with other enterprise technologies to offer solutions on the Java platform for development and deployment of server-side applications.
. . .
If we cut through the entire gamut of Java technologies that hold the promise of enabling the development of enterprise-wide business solutions, Java servlets (and JSPs), RMI and Enterprise JavaBeans emerge at the core of these technologies.
Java Servlets and JavaServer Pages
Java servlets play the role of access mechanisms to middle-tier services. They are a specific enhancement to the world of enterprise computing, not a Java layer on top of an existing service. The popularity of Java servlets is based on the premise that most enterprises are taking advantage of the thin-client environment made possible by the ubiquitous acceptance of the worldwide Web and the Internet. Under this model the Web server becomes enterprise middleware and is responsible for running applications for clients. Servlets are used primarily by Web servers as Java-based replacements for CGI scripts. They can access server-side APIs in a variety of ways by sending and receiving e-mail, invoking methods on remote objects using RMI or CORBA, or by obtaining directory information via JNDI and using that information to invoke business services offered by EJBs.
JavaServer Pages are based on servlet technology and are currently poised as one of the most significant elements of dynamic content presentation in e-business applications.
JSPs combine markup (HTML or XML) languages with blocks of Java code to produce dynamic Web pages. Each of these pages is compiled into a servlet by the JSP engine the first time it's requested. Subsequent requests for the page use the compiled servlet. JSPs provide a variety of ways to talk to Java classes, servlets, applets and the Web server. Using JSPs, an application developer can split the functionality of a Web application into components with well-defined public interfaces. These components are contained in a single page. JSPs also have mechanisms that allow the application to leverage JavaBean components so as to present different data views to the Web browser. They facilitate the creation of front-end business components such as shopping carts and user profile managers.
Enterprise Java Beans form the core of Java enterprise computing. EJB defines how server-side components are written and provides standard contracts between components and application servers that manage them. EJB promotes the development of a component marketplace in the enterprise, where vendors can sell reusable components that can be purchased to help solve business problems. Thus EJBs offer business services in the form of APIs that may be accessed via a distributed object framework. This framework is offered by Java in the form of RMI.
The idea behind EJBs is to enable the creation of business services in the middle tier. The business objects defined via EJBs are responsible for accessing data from the end-server tier, processing it and making the results available to the presentation tier via RMI. If the presentation tier is accessed via a Web browser, servlets and JSPs are used to make the results available in HTML (or XML) format via a Web server.
When Java first emerged as a popular technology, its scope was more or less limited to the client. Client-side technologies were used to access server-side services via different protocols, depending on the programming environment. With the advent of J2EE, Java has firmly ensconced itself in the middle tier. In the new millennium we can hope to see further penetration of Java in various tiers of the enterprise.
Ajit Sagar is a member of the technical staff at i2 Technologies in Dallas, Texas, focusing on
Web-based e-commerce applications and
A Sun-certified Java
programmer with nine years of programming
experience, including three in Java, Ajit holds an MS in computer science and a BS in electrical engineering.
He can be reached at: [email protected]