[ Team LiB ] Previous Section Next Section

18.1 The Java 2 Enterprise Edition Model

At the JavaOne conference in San Francisco in June 1999, Sun Microsystems announced a new architecture for Java, with separate editions for different types of applications: the Java 2 Standard Edition (J2SE) for desktop and workstation devices; the Java 2 Micro Edition (J2ME) for small devices such as cell phones, pagers, and PDAs; and the Java 2 Enterprise Edition (J2EE) for server-based applications.

J2EE is a compilation of various Java APIs that have previously been offered as separate packages; an Application Programming Model (APM) (also known as the J2EE Blueprints) that describes how they can all be combined; and a test suite J2EE vendors can use to test their products for compatibility. J2EE has gone through a number of revisions since 1999, and the latest version (J2EE 1.4) includes the following enterprise-specific APIs among others:

  • JavaServer Pages (JSP)

  • Java Servlet

  • Enterprise JavaBeans (EJB)

  • Java Database Connection (JDBC)

  • Java Transaction API (JTA) and Java Transaction Service (JTS)

  • Java Naming and Directory Interface (JNDI)

  • Java Message Service (JMS)

  • Java IDL and Remote Method Invocation (RMI)

  • Java API for XML Parsing (JAXP), Java API for XML-based RPC (JAX-RPC), SOAP with Attachments API for Java (SAAJ), and Java API for XML Registries (JAXR)

  • JavaMail and JavaBeans Activation Framework (JAF)

  • J2EE Connector Architecture (JCX)

  • Java Authentication and Authorization Service (JAAS)

  • Java Management Extensions (JMX)

In addition, all the J2SE APIs can be used when developing a J2EE application. These APIs can be used in numerous combinations. The first three J2EE APIs—EJB, JSP, and servlets—represent different component technologies, managed by what the J2EE documents call containers. A web container provides the runtime environment for servlets and JSP components, translating requests and responses into standard Java objects. EJB components are similarly handled by an EJB container. Don't be fooled by the name similarity between JavaBeans and Enterprise JavaBeans (EJB); they are completely different animals. A JavaBeans component is a regular Java class, following a few simple naming conventions, which can be used by any other Java class. An Enterprise JavaBean component, on the other hand, must be developed in compliance with a whole set of strict rules and works only in the environment provided by an EJB container.

Components in the two types of containers can use the other J2EE APIs to access databases (JDBC and JTA/JTS) and other EIS tier applications (JCX), authenticate users and control access (JAAS), locate various resources (JNDI), and communicate with other server resources (JavaMail/JAF, JMS, Java IDL, RMI, JAXP, JAX-RPC, SAAJ and JAXR). Figure 18-1 shows a high-level view of the main pieces and their relationship.

Figure 18-1. EE overview
figs/Jsp3_1801.gif

Enterprise applications are often divided into a set of tiers, and J2EE identifies three: the client tier, the middle tier, and the Enterprise Information System (EIS) tier. The middle tier can be further divided into the web tier and the EJB tier. This logical separation, with well-defined interfaces, makes it possible to build scalable applications. Initially one or more tiers can be running on the same physical server. With increased demands, the tiers can be separated and distributed over multiple servers without modifying the code, just by changing the configuration.

The client tier contains browsers as well as regular GUI applications. A browser uses HTTP to communicate with the web container. A standalone application can also use HTTP or communicate directly with the EJB container using RMI or IIOP (a CORBA protocol). Another type of client that's becoming more and more popular is the extremely thin client, such as a cell phone or PDA. This type of client typically uses the Wireless Access Protocol (WAP), typically converted into HTTP via a gateway, to communicate with the web container.

The middle tier provides client services through the web container and the EJB container. A client that communicates with the server through HTTP uses components in the web container, such as servlets and JSP pages, as entry points to the application. Many applications can be implemented solely as web container components. In other applications, the web components just act as an interface to the application logic implemented by EJB components. A standalone application, written in Java or any other programming language, can also communicate directly with the EJB components. General guidelines for when to use the different approaches are discussed later in this chapter. Components in this tier can access databases and communicate with other server applications using all the other J2EE APIs.

The Enterprise Information System (EIS) tier holds the application's business data. Typically, it consists of one or more relational database management servers, but other types of databases such as IMS databases; legacy applications such as Enterprise Resource Planning (ERP); and mainframe transaction processing systems such as CICS, are also included in this tier. The middle tier uses J2EE APIs such as JDBC, JTA/JTS, and the J2EE Connector Architecture (JCX) to interact with the EIS tier.

    [ Team LiB ] Previous Section Next Section