type=page
status=published
title=Distributed Multitiered Applications
next=overview005.html
prev=overview003.html
~~~~~~
Distributed Multitiered Applications
====================================

[[BNAAY]]

[[distributed-multitiered-applications]]
Distributed Multitiered Applications
------------------------------------

The Java EE platform uses a distributed multitiered application model
for enterprise applications. Application logic is divided into
components according to function, and the application components that
make up a Java EE application are installed on various machines
depending on the tier in the multitiered Java EE environment to which
the application component belongs.

link:#BNAAZ[Figure 1-1] shows two multitiered Java EE applications
divided into the tiers described in the following list. The Java EE
application parts shown in link:#BNAAZ[Figure 1-1] are presented in
link:#BNABB[Java EE Components].

* Client-tier components run on the client machine.
* Web-tier components run on the Java EE server.
* Business-tier components run on the Java EE server.
* Enterprise information system (EIS)-tier software runs on the EIS
server.

Although a Java EE application can consist of all tiers shown in
link:#BNAAZ[Figure 1-1], Java EE multitiered applications are generally
considered to be three-tiered applications because they are distributed
over three locations: client machines, the Java EE server machine, and
the database or legacy machines at the back end. Three-tiered
applications that run in this way extend the standard two-tiered
client-and-server model by placing a multithreaded application server
between the client application and back-end storage.

[[BNAAZ]]

.*Figure 1-1 Multitiered Applications*
image:img/javaeett_dt_001.png[
"Diagram of multitiered application structure, including client tier, web
tier, business tier, and EIS tier."]

[[BNABA]]

[[security]]
Security
~~~~~~~~

Although other enterprise application models require platform-specific
security measures in each application, the Java EE security environment
enables security constraints to be defined at deployment time. The Java
EE platform makes applications portable to a wide variety of security
implementations by shielding application developers from the complexity
of implementing security features.

The Java EE platform provides standard declarative access control rules
that are defined by the developer and interpreted when the application
is deployed on the server. Java EE also provides standard login
mechanisms so that application developers do not have to implement these
mechanisms in their applications. The same application works in a
variety of security environments without changing the source code.

[[BNABB]]

[[java-ee-components]]
Java EE Components
~~~~~~~~~~~~~~~~~~

Java EE applications are made up of components. A Java EE component is a
self-contained functional software unit that is assembled into a Java EE
application with its related classes and files and that communicates
with other components.

The Java EE specification defines the following Java EE components:

* Application clients and applets are components that run on the client.
* Java Servlet, JavaServer Faces, and JavaServer Pages (JSP) technology
components are web components that run on the server.
* EJB components (enterprise beans) are business components that run on
the server.

Java EE components are written in the Java programming language and are
compiled in the same way as any program in the language. The differences
between Java EE components and "standard" Java classes are that Java EE
components are assembled into a Java EE application, they are verified
to be well formed and in compliance with the Java EE specification, and
they are deployed to production, where they are run and managed by the
Java EE server.

[[BNABC]]

[[java-ee-clients]]
Java EE Clients
~~~~~~~~~~~~~~~

A Java EE client is usually either a web client or an application
client.

[[BNABD]]

[[web-clients]]
Web Clients
^^^^^^^^^^^

A web client consists of two parts:

* Dynamic web pages containing various types of markup language (HTML,
XML, and so on), which are generated by web components running in the
web tier
* A web browser, which renders the pages received from the server

A web client is sometimes called a thin client. Thin clients usually do
not query databases, execute complex business rules, or connect to
legacy applications. When you use a thin client, such heavyweight
operations are off-loaded to enterprise beans executing on the Java EE
server, where they can leverage the security, speed, services, and
reliability of Java EE server-side technologies.

[[BNABF]]

[[application-clients]]
Application Clients
^^^^^^^^^^^^^^^^^^^

An application client runs on a client machine and provides a way for
users to handle tasks that require a richer user interface than can be
provided by a markup language. An application client typically has a
graphical user interface (GUI) created from the Swing API or the
Abstract Window Toolkit (AWT) API, but a command-line interface is
certainly possible.

Application clients directly access enterprise beans running in the
business tier. However, if application requirements warrant it, an
application client can open an HTTP connection to establish
communication with a servlet running in the web tier. Application
clients written in languages other than Java can interact with Java EE
servers, enabling the Java EE platform to interoperate with legacy
systems, clients, and non-Java languages.

[[BNABE]]

[[applets]]
Applets
^^^^^^^

A web page received from the web tier can include an embedded applet.
Written in the Java programming language, an applet is a small client
application that executes in the Java virtual machine installed in the
web browser. However, client systems will likely need the Java Plug-in
and possibly a security policy file for the applet to successfully
execute in the web browser.

Web components are the preferred API for creating a web client program
because no plug-ins or security policy files are needed on the client
systems. Also, web components enable cleaner and more modular
application design because they provide a way to separate applications
programming from web page design. Personnel involved in web page design
thus do not need to understand Java programming language syntax to do
their jobs.

[[BNABG]]

[[the-javabeans-component-architecture]]
The JavaBeans Component Architecture
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The server and client tiers might also include components based on the
JavaBeans component architecture (JavaBeans components) to manage the
data flow between the following:

* An application client or applet and components running on the Java EE
server
* Server components and a database

JavaBeans components are not considered Java EE components by the Java
EE specification.

JavaBeans components have properties and have `get` and `set` methods
for accessing those properties. JavaBeans components used in this way
are typically simple in design and implementation but should conform to
the naming and design conventions outlined in the JavaBeans component
architecture.

[[BNABH]]

[[java-ee-server-communications]]
Java EE Server Communications
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

link:#BNABI[Figure 1-2] shows the various elements that can make up the
client tier. The client communicates with the business tier running on
the Java EE server either directly or, as in the case of a client
running in a browser, by going through web pages or servlets running in
the web tier.

[[BNABI]]

.*Figure 1-2 Server Communication*
image:img/javaeett_dt_002.png[
"Diagram of client-server communication. Application clients access the
business tier directly. Browsers, web pages, and applets access the web
tier."]

[[BNABJ]]

[[web-components]]
Web Components
~~~~~~~~~~~~~~

Java EE web components are either servlets or web pages created using
JavaServer Faces technology and/or JSP technology (JSP pages). Servlets
are Java programming language classes that dynamically process requests
and construct responses. JSP pages are text-based documents that execute
as servlets but allow a more natural approach to creating static
content. JavaServer Faces technology builds on servlets and JSP
technology and provides a user interface component framework for web
applications.

Static HTML pages and applets are bundled with web components during
application assembly but are not considered web components by the Java
EE specification. Server-side utility classes can also be bundled with
web components and, like HTML pages, are not considered web components.

As shown in link:#BNABM[Figure 1-3], the web tier, like the client tier,
might include a JavaBeans component to manage the user input and send
that input to enterprise beans running in the business tier for
processing.

[[BNABM]]

.*Figure 1-3 Web Tier and Java EE Applications*
image:img/javaeett_dt_003.png[
"Diagram of client-server communication showing detail of JavaBeans
components and web pages in the web tier."]

[[BNABK]]

[[business-components]]
Business Components
~~~~~~~~~~~~~~~~~~~

Business code, which is logic that solves or meets the needs of a
particular business domain such as banking, retail, or finance, is
handled by enterprise beans running in either the business tier or the
web tier. link:#BNABN[Figure 1-4] shows how an enterprise bean receives
data from client programs, processes it (if necessary), and sends it to
the enterprise information system tier for storage. An enterprise bean
also retrieves data from storage, processes it (if necessary), and sends
it back to the client program.

[[BNABN]]

.*Figure 1-4 Business and EIS Tiers*
image:img/javaeett_dt_004.png[
"Diagram of client-server communication showing detail of entities,
session beans, and message-driven beans in the business tier."]

[[BNABL]]

[[enterprise-information-system-tier]]
Enterprise Information System Tier
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The enterprise information system tier handles EIS software and includes
enterprise infrastructure systems, such as enterprise resource planning
(ERP), mainframe transaction processing, database systems, and other
legacy information systems. For example, Java EE application components
might need access to enterprise information systems for database
connectivity.


