Component technologies are used by developers to create
essential parts of the enterprise application, namely user interface and
business logic. In addition to JavaBeans, which are part of the J2SE platform,
the J2EE platform supports different type of components that can be classified
as client-side components and server-side components.
Client-side Components
Client-side components are developed by the application
developers to provide user interface for enterprise application clients. These
components can be classified as follows:
·
Application clients
·
Browser-based clients
Application clients are Java programs that execute on
desktop computers. They are often referred to as standalone applications
because they run on their own JVM. J2EE specification refers to application
clients as GUI components.
J2EE must support application components and provide a
container to run the application clients. However, an application client runs
on the client machine and not on The J2EE server. The application client
container is required to provide runtime support for standalone applications.
Brower-based clients are developed by the application
developers to provide user interface for web clients. Web client applications
are generally developed using simple HTML pages, although applets are also used
at times.
Browser-based clients do not have an associated J2EE
container. In order to access enterprise resources, web clients should
communicate through the web container of the J2EE server. Applets embedded in
HTML pages are deployed and managed on the J2EE server, although they run on
client machines.
Server-Side Components
Server-side components are used for providing dynamic user
interface and business logic. Server-side components are deployed in the J2EE
server. Based on the functionality provided by server-side components, they are
classified as:
·
Web components
·
EJB components
Web components are software entities that provide responses
to requests. A web component typically generates the dynamic user interface for
web-based clients. J2EE specifies two types of web components. They are as
mentioned below:
Servlet
Servlet is a Java program that extends the functionalities
of a web server. They dynamically generate and send responses to the requests
received from the client.
JSP
JSP provides an extensible way to generate dynamic content
for a web client. It is a text-based document, containing information on
creating a response for a request.
EJB components are developed by application developers to
provide business logic for the enterprise application. J2EE provides an EJB
specification for developing and deploying EJB components. EJB components,
termed enterprise beans, are scalable, transactional (i.e., they participate in
a transaction) and provide multi-user support. There are two types of beans:
Session Bean
It is created to provide service on behalf of a client and
usually exists only for the duration of a single client-server session.
Entity Bean
It is a persistent object that represents data maintained in
the data store; its focus is data-centric.
The EJB 2.0 specification introduces a new bean called
Message Driven Bean (MDB), which is used for messaging.
Service Technologies
Since most enterprise applications require access to
existing EISs, J2EE supports APls that provide access to database, transaction
and JNDI services. J2EE service technologies allow applications to access these
services in a uniform manner.
Database Access
J2EE provides database access to applications based on the
JDBC specification. An application's components can use JDBC to handle data
from relational databases.
JDBC APls provide database-independent connectivity between
wide ranges of relational data sources. JDBC APls can also be divided into two
parts, an application level interface used by components for accessing
databases and a service provider interface to attach providers to the platform.
J2EE requires JDBC 2.0 core APls and extension APls, which
provide row sets, connection naming via JNDI, connection pooling, and
distributed transaction support. The JDBC drivers use the connection pooling
and distributed transaction to co-ordinate with the J2EE server.
Java Naming and Directory Interface (JNDI)
This API allows the J2EE components to lookup other remote
objects that they may need to access. Using JNDI, an application can store and
retrieve any type of named.
Java objects. The JNDI API was designed to standardize
access to a variety of naming and directory interfaces and has two parts. They
are as follows:
An application-level interface used by the application
components to access naming and directory services.
A service provider interface used to attach a provider of a
naming and directory services to the J2EE platform.
Transaction Service
Transaction services in J2EE environment is based on Java
Transaction API (JTA) and Java Transaction Service (JTS).
JTA provides a way for J2EE components and clients to manage
their own transactions. It allows multiple components to participate in a
single transaction. JTA specifies standard Java interfaces between the
transaction manager and the parties involved in a distributed transaction
system, such as the application which needs transaction support.
Communication Technologies
Communication technologies provide mechanisms for communication
between client and server and between collaborating objects hosted by different
servers. J2EE specification requires support for the following protocols and
APls under communication technologies:
·
HTTP
·
HTTP (S)
·
Remote Method Invocation (RMI)
·
Object Management Group (OMG)
·
JMS
·
JavaMail/JAF
·
Connector architecture
J2EE Containers
The J2EE specification defines a container as being
responsible for providing the runtime support for the application components.
The container acts as an intermediary between the J2EE application and the
services provided by the J2EE server, to give a federated view of APls for the
application components. The container provides the APls to application components
for accessing services. It also handles security, resource pooling, and state
management.
Figure shown below illustrates the container architecture.
Figure 5
In the J2EE container architecture, the developers provide
the following information:
Application Components: J2EE application components include
Java Servlets, JSPs, and EJB components.
Deployment Descriptor: It is an XML file containing
information about application components and additional services required by
the application components.
The J2EE container provides the following APls and services
to support application components in the J2EE environment:
Component Contract: In order to maintain the application
components in the J2EE environment, the container provides a set of APls that
should be extended and implemented by the application components. The web
application components, for example, should follow Java Servlet APls and JSP
APls and EJB application components should follow EJB APls.
Container Service APls: The J2EE container provides a
service level abstraction of APls specified in Java standard edition. These
APls allow access to JBDC, JNDI. or JTS or JMS services within the container.
These services are implemented by the application server.
Declarative Services: These services are handled by the J2EE
container on behalf of application components such as transaction management in
accordance with the requirements of application components. It is specified in
the deployment descriptor.
Other Container Services: This includes life cycle
management of components such as the creation, initialization and destruction
of components. They also take care of connection pooling and resource pooling.
J2EE provides specification for the following containers:
·
Application client Applet
·
Web
·
EJB
Next, we discuss each of these containers in detail.