The JavaTM 2 SDK, Enterprise Edition (J2EE SDK) is the reference implementation provided by Sun Microsystems, Inc. The following figure shows the major elements of the architecture for the J2EE SDK:
FIGURE 1-2 J2EE Architecture
The J2EE server provides the following services:
- Naming and Directory - allows programs to locate services and components through the Java Naming and Directory InterfaceTM (JNDI) API
- Authentication - enforces security by requiring users to log in
- HTTP - enables Web browsers to access servlets and JavaServer PagesTM (JSP) files
- EJB - allows clients to invoke methods on enterprise beans
Enterprise bean instances run within anEJB container. The container is a runtime environment that controls the enterprise beans and provides them with important system-level services. Since you don't have to develop these services yourself, you are free to concentrate on the business methods in the enterprise beans. The container provides the following services to enterprise beans:
When a client invokes a method in an enterprise bean, the container intervenes in order to manage the transaction. Because the container manages the transaction, you do not have to code transaction boundaries in the enterprise bean. The code required to control distributed transactions can be quite complex. Instead of writing and debugging complex code, you simply declare the enterprise bean's transactional properties in the deployment descriptor file. The container reads the file and handles the enterprise bean's transactions for you.
The container permits only authorized clients to invoke an enterprise bean's methods. Each client belongs to a particular role, and each role is permitted to invoke certain methods. You declare the roles and the methods they may invoke in the enterprise bean's deployment descriptor. Because of this declarative approach, you don't need to code routines that enforce security.
Remote Client Connectivity
The container manages the low-level communications between clients and enterprise beans. After an enterprise bean has been created, a client invokes methods on it as if it were in the same virtual machine.
Life Cycle Management
An enterprise bean passes through several states during its lifetime. The container creates the enterprise bean, moves it between a pool of available instances and the active state, and finally, removes it. Although the client calls methods to create and remove an an enterprise bean, the container performs these tasks behind the scenes.
Database Connection Pooling
A database connection is a costly resource. Obtaining a database connection is time-consuming and the number of connnections may be limited. To alleviate these problems, the container manages a pool of database connections. An enterprise bean can quickly obtain a connection from the pool. After the bean releases the connection, it may be re-used by another bean.
The Web container is a runtime environment for JSP files and and servlets. Although these Web components are an important part of a J2EE application, this manual focuses on enterprise beans. For more information on developing Web components, see the home pages for the JavaServer PagesTM and Java Servlet technologies.
Prev | Next
TOC | Index
Copyright © 2000 Sun Microsystems, Inc. All rights reserved.