EAD Lecture 2-3
EAD Lecture 2-3
EAD Lecture 2-3
J2EE Introduction
9,000,000
JAVA DEVELOPERS
DEPLOYING TO 18 COMPLIANT APPLICATION SERVERS
Differences between Java EE and Java SE
When most people think of the Java programming language, they think of the Java SE API.
Java SE's API provides the core functionality of the Java programming language.
It defines everything from the basic types and objects of the Java programming language to
high-level classes that are used for networking, security, database access, graphical user
interface (GUI) development, and XML parsing.
In addition to the core API, the Java SE platform consists of a virtual machine, development
tools, deployment technologies, and other class libraries and toolkits commonly used in Java
technology applications.
Java EE
The Java EE platform is built on top of the Java SE platform.
The Java EE platform provides an API and runtime environment for developing and running
◦ large-scale
◦ multi-tiered
◦ scalable
◦ reliable
◦ secure network applications
A glance at J2EE architecture
Distributed Multi-tiered Applications
The Java EE platform uses a distributed Multi-tiered application model for enterprise
applications.
Application logic is divided into components according to function
The application components that make up a Java EE application are installed on various
machines depending on the tier in the Multi-tiered Java EE environment to which the
application component belongs.
Multi-tiered Applications
Three-tiered Applications
Although a Java EE application can consist of all tiers shown in the prior slide, Java EE Multi-
tiered applications are generally considered to be three-tiered applications because they are
distributed over three locations:
1. Client machines
2. The Java EE server machine, and the database or legacy machines at the back end.
3. 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.
Java EE Components
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:
◦ 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
◦ they are deployed to production, where they are run and managed by the Java EE server.
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.
Java EE Clients
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 have get() and set() methods for accessing those properties.
JavaBeans components used in this way are typically simple in design and implementation
Should conform to the naming and design conventions outlined in the JavaBeans component
architecture.
Java EE Server Communications
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.
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.
Web Tier and Java EE Applications
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.
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.
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.
Business and EIS Tiers
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
◦ other legacy information systems
For example, Java EE application components might need access to enterprise information
systems for database connectivity.
Java EE Containers
Normally, thin-client Multi-tiered applications are hard to write because they involve many lines of
intricate code to handle
◦ transaction and state management
◦ multithreading
◦ resource pooling
◦ other complex low-level details.
Containers are the interface between a component and the low-level, platform-specific
functionality that supports the component.
Before it can be executed, a web, enterprise bean, or application client component must be
assembled into a Java EE module and deployed into its container.
The assembly process involves specifying container settings for each component in the Java EE
application and for the Java EE application itself.
Container settings customize the underlying support provided by the Java EE server, including
such services as
◦ security
◦ transaction management
◦ Java Naming and Directory Interface (JNDI) API lookups
◦ remote connectivity.
Container Services
The Java EE security model lets you configure a web component or enterprise bean so that system
resources are accessed only by authorized users.
The Java EE transaction model lets you specify relationships among methods that make up a single
transaction so that all methods in one transaction are treated as a single unit.
JNDI lookup services provide a unified interface to multiple naming and directory services in the
enterprise so that application components can access these services.
The Java EE remote connectivity model manages low-level communications between clients and
enterprise beans.
After an enterprise bean is created, a client invokes methods on it as if it were in the same virtual
machine.
Container Services
Because the Java EE architecture provides configurable services, components within the same
application can behave differently based on where they are deployed.
For example, an enterprise bean can have security settings that allow it a certain level of access
to database data in one production environment and another level of database access in
another production environment.
The container also manages non-configurable services such as
◦ enterprise bean and servlet lifecycles,
◦ database connection resource pooling,
◦ data persistence,
◦ access to the Java EE platform APIs
Container Types
A Java EE application is packaged into one or more standard units for deployment to any Java EE
platform-compliant system.
Each unit contains
◦ A functional component or components, such as an enterprise bean, web page, servlet, or applet
◦ An optional deployment descriptor that describes its content
EJB as a component
◦ Persistence
◦ Entity Beans
◦ Business Logic
◦ Session Beans
◦ Message Driven Beans
EJB Overview
EJB as a framework
◦ Out of the box services
◦ Available to all components during execution via EJB Container
◦ Annotations : The magic wand
◦ Specify services, types and behavior
◦ Service Oriented Architecture
◦ Fast and easy Web Service Creation
JSF Overview
Basic Characteristics
◦ Event oriented components
◦ Powerful architectures for different Uis (desktop browsers, mobile devices etc.)
◦ Flexible Navigation System
JSF Overview
Basic Characteristics
◦ Synchronization with Java Objects through backing beans
◦ Internationalization
◦ Validators & Converters
◦ Several popular implementations
◦ RichFaces
◦ IceFaces
◦ PrimeFaces
XHTML Overview
Documents can be transformed via tools like XSLT into other documents for consumption by
devices like handhelds
Fragments of documents can be retrieved faster
Text can be stored more efficiently in object oriented databases
J2EE Introduction
Taken from a presentation by Papapetrou P. Patroklos
Supplemented by Oracle’s J2EE 7 Tutorial