Download as pdf or txt
Download as pdf or txt
You are on page 1of 44

BS Grupo SฺAฺCฺ

Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Placing the Java™ EE Model in Context

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
B ER ailฺc tude
RO hotm this S
a b e@
er n
a r b
g u il
(r a
BS Grupo SฺAฺCฺ

Objectives

After completing this lesson, you should be able to:


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

• Describe the needs of enterprise applications and how the


Java EE platform addresses these needs
• Describe the Java Platform, Enterprise Edition 6
Specification (Java EE platform 6) APIs and supporting
services
• Describe the Java EE platform tiers and architectures
• Describe how to simplify Java EE application development
using architecture patterns u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
B ER ailฺc tude
RO hotm this S
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 2


BS Grupo SฺAฺCฺ

Requirements of Enterprise Applications

The Java EE platform:


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

• Is an architecture for implementing enterprise-class


applications
• Uses Java and Internet technology
• Has a primary goal of simplifying the development of
enterprise-class applications through an application model
that is:
– Vendor neutral
– Component based u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
B ER ailฺc tude
RO hotm this S
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 3


BS Grupo SฺAฺCฺ

Java Technology Platforms


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Java technology- Java technology- Workgroup High-end


enabled devices enabled desktop server server

Micro Edition Standard Edition Enterprise Edition


u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E
Java Technology O
R Platforms
o t ma is St
Java EE technology@ h to develop
is used th distributed, enterprise-scale applications that, by their
very nature, are a e quite complex and resource intensive.
boften
er n
la r b
g u i
(ra

Developing Applications for the Java EE 6 Platform 1 - 4


BS Grupo SฺAฺCฺ

Enterprise Application Infrastructure


Technologies
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Single-User Enterprise Infrastructure Technology or Domain Multiuser


Business Requirement Enterprise
Application Applications
User authentication Security domain technologies

Multi-user support Persistence technologies

Data integrity Transaction technologies

Client-tier communications Networking and distributed


object technologies

Communication with other Messaging, connector and

se
enterprise and legacy related technologies
applications
to u
Service location assistance
B E ense
Naming service technologies

R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E t
Enterprise Application
tma his S Technologies
RO hoInfrastructure
The figure in the slide @ shows thetenterprise infrastructure technologies that are required to
expose the applicatione
aanbenterprise
logic and functionality that is provided in a single-user business
application e r n
as application.
la r b
g u i
Developing enterprise-scale applications is a difficult and time-consuming task that requires
(ra technical expertise, typically from a group of people who have separate roles and
responsibilities, such as system architects, designers, and component developers.
When developing an enterprise application, a host of design considerations must be made,
some of which involve trade-offs and compromises. The work performed by separate
development teams must also be managed and coordinated. It is important to remember that
the Java EE model exists to make a difficult job tractable, not to make it easy.

Developing Applications for the Java EE 6 Platform 1 - 5


BS Grupo SฺAฺCฺ

Java EE Technology Elements


At the heart of the Java EE platform is the Java Platform, Standard Edition (Java SE)
technology. The figure in the following slide illustrates how the Java EE specification is built
on top of the functionality that is defined in the Java SE specification. The figure in the
following slide includes a number of acronyms that are defined here for your reference:
• Common Object Request Broker Architecture (CORBA)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

• Enterprise JavaBeans™ (EJB™) components


• Java API for XML Web Services (JAX-WS)
• Java API for RESTful Web Services (JAX-RS)
• Java Management Extensions (JMX™)
• Java Message Service (JMS) API
• Java Naming and Directory Interface™ (JNDI) API
• Java Transaction API (JTA)
• JavaServer Pages™ (JSP™)
• JavaServer Faces™ (JSF™)
• Remote Method Invocation (RMI) u se
to
• Structured Query Language (SQL)
B E ense
• Java Persistence API (JPA)
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S US s a n deฺ
J E
) h a Gui
R TO com ent
O BE mailฺ Stud
R hot this
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 6


BS Grupo SฺAฺCฺ

Java EE Technology Suite

Application Components Integration


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Email

Servlets and JMS API


JSP Pages
Web Services

Entity
Classes ebXML
Java SE
JAX-WS
JNDI API, RMI,
EJB CORBA, SQL, JTA
Components Connectors

u se
Declarative JMX
to
Transaction
Management B E ense
Specification

Declarative
R NA le lic
Security
B E rab
I L AR nsfe
GU on-tra
Container Management
A
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E
Java EE Technology
RO Suite o t ma is St
The figure in the slide
@ h a piethchart that breaks down the Java EE Technology suite into
shows
three regions:a
n be
Application Components, Container Management, and Integration.
The Java b r
eEE specification incorporates a suite of other technologies and specifications, in
a r
il to those defined by Java SE, to provide a rich feature set and enhanced server-side
addition
g u
(ra functionality for enterprise application developers.
• Application components: Application developers use application components to
create the application business logic and control elements.
• Integration: Integration elements allow a Java EE application to interact with and
incorporate the functionality from other applications and systems, such as legacy
systems or databases.
• Container management: Container management elements provide runtime support for
Java EE application components.

Developing Applications for the Java EE 6 Platform 1 - 7


BS Grupo SฺAฺCฺ

Java EE Specifications and the Java Community


ProcessSM
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

• Java EE
• EJB Component
• Servlet

Java Community Process Specifications and APIs Developers


u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E
RO hoand
Java EE Specifications
tmathehJavai s StCommunity Process
The figure in the slide@ shows howt a set of specifications that are maintained as part of the
e
nab tools providers, and component developers.
Java Community Process (JCP ) defines the roles and responsibilities of Java EE
SM SM

platform e r
vendors,
Thei l a rb
specifications outline the rules that each of these participants must follow when they
g u
(ra develop Java EE technology components and supporting services. The standards-based
approach helps to ensure that Java EE applications and application components are portable
across a wide variety of deployment platforms. To find out more about the JCP, visit the JCP
home page: http://jcp.org/en/home/index.
The Java EE specification defines the types of components and the associated APIs that are
available to Java EE application component developers. The Java EE specification also
defines the infrastructure requirements for a robust, scalable, and reliable runtime
environment for distributed, enterprise applications. Java EE server vendors use these
specifications when they develop server elements.

Developing Applications for the Java EE 6 Platform 1 - 8


BS Grupo SฺAฺCฺ

Component, API, and Service Layer

Component
Vendor neutral
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Layer

API Defined by the Java EE


Layer specification (vendor neutral)

Service
Vendor specific
Layer

u se
to
B E ense
R NA le lic
Databases and other B E rab
back-end services
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E
RO hEE
Functions of the Java
o tmAPIa
i s St
The Java EE APIs define
@ th between the application component developer and the
the contract
platform provider
a e the interface mechanism that is defined by the Java programming
busing
language. n
r long as the application server implements the API set for the Java EE platform,
eAs
a r b
theilapplication component developer need not be concerned with how the vendor has chosen
u
( ragto implement the APIs. The figure in the slide shows how the Java EE platform provides
vendor neutrality in the component layer using the APIs.

Developing Applications for the Java EE 6 Platform 1 - 9


BS Grupo SฺAฺCฺ

Java EE Component Containers


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Embedded
EJB
Container
Web EJB
Container Container

Application
Database
Client
Container

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E
Java EE Component
RO Containers
o t ma is St
Java EE application@ h
components threside in containers from which they obtain runtime support.
The figure in thea e shows the four types of containers that are available in the Java EE
bslide
platform,e r n
including the web container, the enterprise bean container, an embedded EJB
r b
la and the application client container.
container,
g u i
(ra Each container type provides a support infrastructure that is customized to the specific needs
of the respective component types. Application components interact with other components
and platform services using the protocols and methods that are provided by the container. All
interactions with container-based components pass through the container. Consequently, the
container can inject service and runtime support when necessary as part of this interaction.

Developing Applications for the Java EE 6 Platform 1 - 10


BS Grupo SฺAฺCฺ

Separation of Business Logic from Platform


Services
Developer’s Checklist
Business services
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Persistence

Transaction management

Multithreading

Security management
Build from the
ground up Networking

Service publishing

Developer’s Checklist
Business services

Services Provided by Server u se


to
E ense
Persistence and Transaction management
B
NA le lic
Multithreading

Security management R
E rab
B
Use Application Networking
I L AR nsfe
GU on-tra
Component Server
Service publishing

S an A
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E t
RO hoLogic
Separation of Business
tma hfrom i s SPlatform Services
A key feature of the@ Java EE platform t is the strict separation of the application components
from the general e
abservices and infrastructure. One of the main benefits of the Java EE platform
e r n
for the application developer is that it makes it possible for developers to focus on the
la r b
application business logic while leveraging the supporting services and platform infrastructure
u i
gprovided by the container and application server vendor.
(ra For example, in an online banking application, the application component developers need to
code the logic that underlies the transfer of funds from one account to another, but they do not
need to be concerned about managing database concurrency or data integrity in the event of
a failure. The application server infrastructure and services are responsible for these
functions.

Developing Applications for the Java EE 6 Platform 1 - 11


BS Grupo SฺAฺCฺ
The figure in the previous slide contrasts the tasks that are required of an application
developer who builds an application and supporting services from the ground up to those of a
developer who relies on an application component server for service-level and platform-level
functions.
The application component developer relies on a component server for application support
services and, therefore, the amount of coding to be done by the application component
developer is dramatically reduced.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S US s a n deฺ
J E
) h a Gui
R TO com ent
O BE mailฺ Stud
R hot this
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 12


BS Grupo SฺAฺCฺ

Java EE Platform APIs and Services

Java EE service categories:


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

• Deployment-based services
• API-based services
• Inherent services
• Vendor-specific functionality

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E
Java EE Platform O
R APIshoand
a
tmServices i s St
The Java EE component@ th on both container-based and platform services for
model relies

n a be that is not directly related to the application business logic. The Java EE
ancillary functionality
platform e
b r beyond the traditional middleware server in terms of the range of services that it
goes
offers
i r
la and the generality of applications that can be supported.
g u
(ra Java EE Service Categories
Java EE services can be grouped into the following categories:
• Deployment-based services: You request deployment-based services declaratively
using XML in a file called a deployment descriptor or by using Java annotations.
Deployment-based services may include:
- Persistence
- Transaction
- Security
- URL mapping

Developing Applications for the Java EE 6 Platform 1 - 13


BS Grupo SฺAฺCฺ
• API-based services: You request API-based services programmatically. You must
include code in the component to request these services. API-based services may
include:
- Naming
- Messaging
- Connector
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

• Inherent services: The container automatically supplies inherent services to


components on an as-needed basis. Inherent services include:
- Life cycle
- Dependency Injection
- Threading
- Remote object communication, such as RMI and CORBA
• Vendor-specific functionality: Vendor-specific functionality can include clustering,
which addresses:
- Scalability
- Failover u se
to
- Load balancing
B E ense
R NA land
Note: You should consider vendor-specific functionality, such as scalability
e
c
liload
balancing, more as a feature of the server than as a service.
B E rab
I L AR nsfe
A GU on-tra
S US s a n deฺ
J E
) h a Gui
R TO com ent
O BE mailฺ Stud
R hot this
a b e@
b e rn
u i lar
( rag

Developing Applications for the Java EE 6 Platform 1 - 14


BS Grupo SฺAฺCฺ

Java EE Service Infrastructure

Applet Container Web Container EJB Container


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

HTTP
Applet JSP Servlet EJB
SSL

Java SE
HTTP
SSL

Java Persistence
Java Persistence

Web Services
WS Metadata
Management

Connectors
Web Beans
Web Services
WS Metadata

JavaMail
Management

Connectors
Web Beans
JAX-RPC

JAX-RPC
JavaMail

JMS
JAX-WS

JAX-WS
JAX-RS

JAX-RS

JTA
JASPIC

JASPIC
JACC

JACC
JAXR

JAXR
JSTL
JMS

JTA

JSF
Application Client
Container

Application
SAAJ SAAJ
Client
Java SE Java SE

se
Java Persistence

to u
B E ense
SAAJ
R NA le lic Database

Java SE B E rab
I L AR nsfe New in Java EE 6

A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E
Java EE API-Based
RO Serviceso t ma is St
The figure in the slide
@ h howththe Java EE containers have access to a range of important
shows

n a be as defined by the Java EE specification.


API-based services

r b er list identifies the most important supporting services and APIs that are included
The following
in
u i la Java EE 6 platform:
the
g
(ra • Java DataBase Connectivity™ (JDBC™) API for database connectivity. This API
provides a vendor-neutral way for applications to complete relational database
operations in the Java programming language, with SQL as the query medium.
• Java Naming Directory Interface (JNDI) API. This API is used for vendor-neutral access
to directory services, such as Network Information Service Plus (NIS+) and Lightweight
Directory Access Protocol (LDAP). Java EE applications also make use of the JNDI API
to locate components and services using a central lookup service.
• RMI over Internet Inter-Object Request Broker (ORB) Protocol (IIOP) and the Interface
Definition Language (IDL) for the Java application. Together, these services form a
CORBA-compliant remote method invocation strategy. The strength of this strategy over
Java RMI schemes is that it is programming language–independent, so not all clients of
a particular enterprise application need to be written in the Java programming language.

Developing Applications for the Java EE 6 Platform 1 - 15


BS Grupo SฺAฺCฺ
• JavaMail™ API and JavaBeans™ Activation Framework (JAF) API. These APIs allow a
Java EE software application to send email messages in a vendor-independent way.
• Java EE Connector Architecture (JCA) API. This API allows the provision of integration
modules, called resource adapters, for legacy systems in a way that is independent of
the application server vendor.
• Java Message Service (JMS) API. This is an API for sending and receiving
asynchronous messages.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

• Java Transaction (JTA) API. This is an API by which software components can initiate
and monitor distributed transactions. Java Transaction Service (JTS) specifies the
implementation of a transaction manager, which supports the JTA 1.0 Specification at
the high level, and implements the Java programming language mapping of the Object
Management Group (OMG) Object Transaction Service (OTS) 1.1 specification at the
low level.
The previous features were part of the J2EE 1.3 platform. The following features are
mandated by the J2EE 1.4 platform.
• Java Authentication and Authorization Service (JAAS). In the Java EE platform, JAAS
may be used to integrate an application server with an external security infrastructure.
u se
• Java API for XML Processing (JAXP). This API provides access to XML parsers. The to
B E ense
parsers themselves might be vendor specific, but as long as they implement the JAXP
NA le lic
interfaces, vendor distinctions should be invisible to the application programmer.
R
B E rab
• Web services integration features JAX-RPC was part of J2EE 1.4; JAX-PRC was
I L AR nsfe
updated and renamed to JAX-WS in Java EE 5: These services include, Simple Object
GU on-tra
Access Protocol (SOAP) for the Java application, SOAP with Attachments API for
A
US s a n deฺ
Java™ (SAAJ), Streaming API for XML (StAX), Java API for XML Registries (JAXR),

J E S
JAX-WS, and JAX-RS. Together these services allow Java EE software applications to
a Gui
) h
respond to SOAP and RESTful-based web services requests and to initiate SOAP
operations. R TO com ent
O BE mailฺ Stud
• Java Management Extensions (JMX) API. This API exposes the internal operation of the
R hot this
application server and its components for control and monitoring vendor-neutral

a b e@
management tools.
r n
• Timer services. These services provide the ability to run scheduled background tasks.
e
a r b
g u il
• Java Persistence API (JPA). This API provides access to object relational mapping
a services enabling object-oriented applications to persist object state in a database
(r management system (DBMS).

Developing Applications for the Java EE 6 Platform 1 - 16


BS Grupo SฺAฺCฺ

Java EE Platform Tiers and Architecture

• The Java EE specification outlines an architectural model


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

based on tiers that developers are encouraged to use.


• The historical motivation for tiering:
– Division of labor around specialized servers
– Formal definitions of application responsibilities based on the
division of labor

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
B ER ailฺc tude
RO hotm this S
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 17


BS Grupo SฺAฺCฺ

N-Tier Architectural Model


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

EIS/Data
Client Presentation Business Integration
(Resource)
Tier Tier Tier Tier
Tier

The N-tier architectural model:


• Programmatically separates application functionality
across three or more tiers
• Has tier components and tier infrastructure that is uniquely
u se
suited to a particular task to
E e
• Has programmatic interfaces that define the tierAB cens
boundaries E RN ble li
B R sfera
A
IL tran
U
S AG non-
Copyright © 2011,E S Uand/or itssaffiliates.
a eฺ reserved.
a Allidrights
O J om) h nt Gu
Oracle

T
R ilฺc ude
B E a t
N-Tier Architecture
RO hotm this S
The figure in the slide
@ shows the five standard tiers in an N-Tier architecture design.
The presentation
e
abtier components and runtime infrastructure for an application that interacts
with browser r n
e clients over the Internet must be able to process HTTP requests and generate
a r b
g u il
responses that are formatted using HTML. Similarly, the integration tier runtime infrastructure
(r a and associated components may support functionality for representing a back-end data store
as an object model. The integration tier components synchronize changes in the data model
across a set of data resources that are provided by the enterprise information system (EIS).
The programmatic interfaces are contracts that define the functionality that is available from a
tier, as well as the data elements that are passed between the tiers. These interfaces must be
well-designed and stable within the system. Changes to any tier have minimal impact on any
other tier, as long as the interface definitions do not change.
The responsibility for developing and maintaining application components in each tier is often
delegated to separate programming teams based on their area of expertise. For example,
developers, who specialize in the creation of user interfaces, create presentation-tier
components, whereas developers, who have specific knowledge about a business domain,
develop the related business-tier components.

Developing Applications for the Java EE 6 Platform 1 - 18


BS Grupo SฺAฺCฺ

Java EE-Tiered Architecture


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

EIS/Data
Client Presentation Business Integration
(Resource)
Tier Tier Tier Tier
Tier

Web Browser Web Container EJB Container


HTML Form DBMS
Controller
Business
HTTP RMI/IIOP Services SQL

Entities
u se
UI Views
to
B E ense
NA le lic
Client Presentation Business Resource
R
E rab
Java EE Application Boundary
B
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E t Model
Java EE Application
RO Mappedo t mato ithes SN-Tier
As shown in the figure
@ h the slide,
in thyou can typically map the functionality contained within a
n a be to the middle tiers of an N-tier model.
Java EE application
As per b
r erexample used in the figure, the Java EE web container hosts the presentation-tier
the
i la and the EJB container hosts the business-tier elements and integration-tier
elements,
u
g
(ra elements that interface with the database management system (DBMS). The Java EE
technology elements can be configured to support many application architectures. Each
architecture provides a framework that best supports specific application categories.

Developing Applications for the Java EE 6 Platform 1 - 19


BS Grupo SฺAฺCฺ

Java EE Application Architecture

• Web-centric architecture
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

• Combined web and EJB™ component–based architecture,


sometimes called EJB component–centric architecture
• Business-to-business (B2B) application architecture
• Web service application architecture

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
B ER ailฺc tude
RO hotm this S
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 20


BS Grupo SฺAฺCฺ

Java EE Web-Centric Architecture


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Web Browser Web Container EJB Container


HTML Form DBMS
Controller
Business
HTTP Services SQL

Entities
UI Views Model

Client Presentation and Business Resource

u se
The introduction of EJB Lite in Java EE 6 allows the use to
B E of ense
some EJB technology in web-centric architectures. NA lic
B ER rable
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E a t
RO hotm this S
Web-Centric Architecture
The figure in the slide @ illustrates the web-centric configuration of the Java EE technology
application server e
ab (Java EE server) middle tier.
e r
The configuration
n shown in the figure in the slide uses only the web container of the Java EE
l a r b
g u i
technology server. The web container hosts all of the components that are required to
(ra generate the client view, process the business logic, and connect with the back-end data
store.

Developing Applications for the Java EE 6 Platform 1 - 21


BS Grupo SฺAฺCฺ

Java EE EJB Component–Centric Architecture


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Web Browser Web Container EJB Container


HTML Form DBMS
Controller
Business
HTTP RMI/IIOP Services SQL

Entities
UI Views

Client Presentation Business Resource

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E
Combined Web and
RO EJB o t ma is St
Component–Based Architecture
The figure in the slide @ h
illustrates h
t EJB component–based configuration of the Java EE
the
e
ab server middle tier.
technology application
e r
The configuration
n shown in the figure in the slide uses both the web container and EJB
l a r b
g u i
containers of the Java EE server. In this model, the business logic and data access
(ra components are located in the EJB container. The web-tier components process the incoming
request and generate the view based on the results of the business process.

Developing Applications for the Java EE 6 Platform 1 - 22


BS Grupo SฺAฺCฺ

Java EE Profiles

• Java EE 6 standardized profiles for application developers


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

that do not need the full Java EE platform but require


application portability. Developers can choose between:
– The Java EE 6 Web Profile: Similar to Tomcat, when
developers are working primarily on web applications
– The Java EE 6 Full Platform: Complete Java EE 6
application servers
• Technically “Full Platform” is not a profile. The only profile
included in the Java EE 6 specification is the web profile.
u se
Additional profiles may be added in future releases. to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E a t
Java EE Profiles O
R hotm this S
Java EE 6 adds the@ standardization of profiles. The definition in the Java EE 6 specification is:
“A profile is a a b e
configuration of the Java EE platform targeted at a specific class of
applications”.
e r n Many Java EE applications will never use all the features an enterprise
la r b
application server. Application server vendors have provided proprietary configuration options
u i
gto selectively enable and disable application server features. The problem with this proprietary
(ra approach is that application developers cannot rely on specific features being enabled and,
therefore, have difficulty maintaining application portability.
One profile has been created for inclusion in the Java EE 6 platform, the Java EE 6 Web
Profile.

Developing Applications for the Java EE 6 Platform 1 - 23


BS Grupo SฺAฺCฺ

Java EE 6 Web Profile


The Java EE 6 Web Profile specifies a subset of the full Java EE platform. The web profile
requires the following APIs:
• Servlet 3.0
• JavaServer Pages (JSP) 2.2
• Expression Language (EL) 2.2
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

• Debugging Support for Other Languages (JSR-45) 1.0


• Standard Tag Library for JavaServer Pages (JSTL) 1.2
• JavaServer Faces (JSF) 2.0
• Common Annotations for Java Platform (JSR-250) 1.1
• Enterprise JavaBeans (EJB) 3.1 Lite
• Java Transaction API (JTA) 1.1

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S US s a n deฺ
J E
) h a Gui
R TO com ent
O BE mailฺ Stud
R hot this
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 24


BS Grupo SฺAฺCฺ

EJB 3.1 Lite

• The Java EE 6 Web Profile includes support for Enterprise


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

JavaBeans (EJB) 3.1 Lite.


• EJB 3.1 Lite:
– Is a subset of the EJB API
– Allows local session beans
– Enables EJB usage in Java EE Web-Centric Architectures
– Is supported in web containers and Java SE applications
with an embedded EJB container
• EJB 3.1 Lite is covered in more detail in the lesson titled u se
“EJB Component Model.” to
E B e n se
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
B ER ailฺc tude
RO hotm this S
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 25


BS Grupo SฺAฺCฺ

B2B Application Architecture


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Web EJB
Container Container

Java EE Server

Web EJB
Container Container

u se
to
Java EE Server
B E ense
EIS Resources

R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E a t
RO hotm this S
B2B Application Architecture
The figure in the slide @ illustrates the Java EE technology B2B application architecture.
The B2B application
e
ab architecture is an extension of the Java EE technology EJB component–
e r n
based architecture. It involves two EJB servers, one in each business location. Each Java EE
l a r b
g u i
server hosts a web container and an EJB container.
(ra This architecture allows for peer-to-peer communications between the corresponding
containers in the two Java EE servers. The two web containers communicate using XML
messaging over HTTP. This communication is loosely coupled. Java EE technology
components in the two EJB containers communicate directly with one another. This
communication is tightly coupled.

Developing Applications for the Java EE 6 Platform 1 - 26


BS Grupo SฺAฺCฺ

Java EE Web Service Architecture

Web Container
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Service
Endpoint POJO
Interface

Java EE Application Server

Web Service
Client

EJB Container
Web Service Requester

se
Service
Stateless
Endpoint
Interface
Session Bean
to u
B E ense
A lic
NServer
R
Java EE Application
E rable
B
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E
ma is St
RO hotArchitecture
Web Service Application
Starting with the Java™
@ 2 Platform,th Enterprise Edition (J2EE™) 1.4 platform, a Java EE
n a be can expose the functionality of Java EE business components by using
component developer
web service
r b er technology. The figure in the slide illustrates the Java EE web service application
u i la
architecture.
g
(ra The web service model for the J2EE 1.4 platform uses a stateless session EJB component as
the web service endpoint, which serves as the access point to the service functions. The Java
EE 5 platform defines a web service endpoint class that can be extended to create a web
service endpoint. Communication between a web service client and the server-side endpoint
is typically performed using SOAP-formatted messages that are transmitted over HTTP. The
functionality that is exposed by a web service is typically defined by a web services
description language (WSDL) file. The Java EE 6 platform adds support for RESTful web
services with the introduction of JAX-RS. Web services can support both B2B and
business-to-consumer (B2C) interactions.
Note: A web service registry is an optional component of a web service architecture.

Developing Applications for the Java EE 6 Platform 1 - 27


BS Grupo SฺAฺCฺ

Java EE Patterns

• Patterns provide a standard solution for well understood


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

programming problems.
• The Java EE pattern catalog:
– Helps a developer create scalable, robust, high-performance,
Java EE technology applications
– Presupposes the use of the Java programming language and
the Java EE technology platform
– Is, in many places, closely related to the Gang of Four (GoF)
patterns
u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E a t
Java EE Patterns O
R hotm this S
In addition to the basic
@ architecture types that are supported by the Java EE platform, a set of
architecture patternse
abare exist to help the Java EE developer deal with some of the issues and
complexities
e r nthat involved in creating a Java EE application.
r b
la The Gang of Four is a common term used as shorthand for the four authors who wrote
g u i
Note:
(ra one of the most popular books on the topic of software patterns.

Developing Applications for the Java EE 6 Platform 1 - 28


BS Grupo SฺAฺCฺ

Java EE Pattern Tiers


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Java EE Patterns GoF Patterns

Presentation Tier Presentation Tier

Business Tier Business Tier

Integration Tier Integration Tier

u se
to
Architectural Principles
E ense
Design Principles
B
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E a t
RO hotm this S
Java EE Pattern Catalog
As illustrated in figure@ in the slide, within the Java EE pattern catalog, the patterns are
e
ab to the tier in which they are applied.
categorized according
The three r n
etiers for which patterns are described are the presentation tier, the business tier,
a r b
g
and
u il the integration tier. In the same way that the GoF patterns were derived from a set of
(ra basic design principles, the Java EE patterns are derived from a set of standard architectural
principles.
The description of each pattern includes at least a statement of the problem that the pattern is
intended to solve. You can use a single pattern to solve a single problem. However, in many
cases, a developer will face more than one problem within a single system. It is reasonable to
expect that a developer will use more than one pattern within the overall system.

Developing Applications for the Java EE 6 Platform 1 - 29


BS Grupo SฺAฺCฺ

Using Java EE Patterns


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

View
JSP View
Page Helper

Controller Model

Session Facade
Service Business
Locator Delegate

Session Entity DAO


u se
to
B E ense
R NA le lic
JNDI
API B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E t
Application of Java
tma his S
RO EEhoPatterns
The figure in the slide@shows howt a Java EE application developer might apply a set of
e
ab EE application.
patterns to a Java
The example r n
e used in the figure in slide uses the following Java EE patterns:
a r b
u•il Service Locator: A business tier pattern that abstracts components from the
ra g
( mechanism that is required to look up and connect to remote objects
• View Helper: A presentation tier pattern for a component that provides ancillary
functions, such as constructing an intermediate data model, that are required by view
components
• Session Facade: A business tier pattern that exposes the business functions that are
implemented as coarse-grained services by the business logic components of the EJB
tier
• Data Access Object (DAO): An integration tier pattern for creating a component that
encapsulates the data access code that is required to interact with a data store

Developing Applications for the Java EE 6 Platform 1 - 30


BS Grupo SฺAฺCฺ
However, you must be a little cautious in your use of patterns, because using too many
patterns has the potential to unnecessarily complicate a system. However, it is often better to
have a complicated system that uses clearly specified and well understood patterns, than to
have a complicated system that is built without patterns. You will implement several Java EE
patterns in the lab exercises for this course.
For a more thorough description of software design patterns that you can use to effectively
solve complex business problems with the Java EE platform technology, refer to the Java
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

EE™ Patterns course.

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S US s a n deฺ
J E
) h a Gui
R TO com ent
O BE mailฺ Stud
R hot this
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 31


BS Grupo SฺAฺCฺ

Java EE BluePrints

• Developed by the Java software group


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

• Provide a set of guidelines and a sample application


• Used as a reference when designing and developing a
Java EE application or Java EE application components
• Known as the Java BluePrints Solutions Catalog for Java
EE

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
B ER ailฺc tude
RO hotm this S
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 32


BS Grupo SฺAฺCฺ

Summary

In this lesson, you should have learned:


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

• The requirements of an enterprise application


• How Java EE technology helps an application developer
create robust and functional enterprise-scale applications
• The role of the container and services in the Java EE
framework
• The most common Java EE application architectures
• How patterns can be applied when developing a Java EE
application u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E a t
Summary
RO hotm this S
The Java EE platform @ is an architecture for implementing enterprise-class applications using
Java and Internet e
abenterprise-class
technology. A primary goal of Java EE technology is to simplify the
developmente r nof applications through a vendor-neutral, component-based
la r b
application model.
u i
( ragAt the heart of the Java EE platform is the Java Standard Edition (Java SE). The Java EE
specification incorporates a suite of other technologies and specifications, in addition to those
defined by Java SE, to provide a rich feature set and enhanced server-side functionality for
enterprise application developers.
A set of specifications maintained as part of the Java Community Process (JCP) defines the
roles and responsibilities of Java EE platform vendors, tools providers, and component
developers. The Java EE APIs define the contract between the application component
developer and the platform provider using the interface mechanism defined by the Java
programming language.

Developing Applications for the Java EE 6 Platform 1 - 33


BS Grupo SฺAฺCฺ
Java EE application components reside in containers from which they obtain runtime support.
Each container type provides a support infrastructure that is customized to the specific needs
of the respective component types. A key feature of the Java EE platform is the strict
separation of the application components from the general services and infrastructure. One of
the main benefits of the Java EE platform for the application developer is that it makes it
possible for developers to focus on the application business logic, while leveraging the
supporting services and platform infrastructure that is provided by the container and
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

application server vendor. The Java EE containers have access to a range of important API-
based services, as defined by the Java EE specification.
There are several basic Java EE application architectures. The four most common are: web-
centric, EJB-centric, B2B, and web services. In addition to the basic architecture types that
are supported by the Java EE platform, a set of architecture patterns exist to help the Java EE
developer deal with some of the issues and complexities that are involved in creating a Java
EE application. The Java EE pattern catalog contains architectural patterns that focus on the
creation of scalable, robust, high-performance, Java EE technology applications.

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S US s a n deฺ
J E
) h a Gui
R TO com ent
O BE mailฺ Stud
R hot this
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 34


BS Grupo SฺAฺCฺ

Quiz

Which of the following is not an element of Java EE 6?


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

a. JavaServer Pages (JSP)


b. JavaServer Faces (JSF)
c. Java Persistence API (JPA)
d. Java Geographic API (JGA)

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
B ER ailฺc tude
Answer: d
RO hotm this S
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 35


BS Grupo SฺAฺCฺ

Quiz

Which process determines the Java EE specifications?


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

a. Java Coding Process


b. Java Committee Process
c. Java Community Process
d. Java Cooperation Process

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
B ER ailฺc tude
Answer: c
RO hotm this S
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 36


BS Grupo SฺAฺCฺ

Quiz

Which of the following are Java EE component containers


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(select all that apply)?


a. EJB Container
b. Web Container
c. Remote Object Container
d. Business Object Container

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E a t
Answer: a, b
RO hotm this S
a b e@
b e rn
u i lar
(r ag

Developing Applications for the Java EE 6 Platform 1 - 37


BS Grupo SฺAฺCฺ

Quiz

Which of the following is not a Java EE Service category?


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

a. API services
b. Inherent services
c. Deployment services
d. Inheritance services

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
B ER ailฺc tude
Answer: d
RO hotm this S
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 38


BS Grupo SฺAฺCฺ

Quiz

Which of the following is not part of the N-Tier architecture?


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

a. Server tier
b. Client tier
c. Business tier
d. Presentation tier

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
B ER ailฺc tude
Answer: b
RO hotm this S
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 39


BS Grupo SฺAฺCฺ

Quiz

Which of the following are part of the Java EE 6 Web Profile


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(select all that apply)?


a. EJB
b. JMX
c. JSPs
d. Servlets

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E a t
Answer: c, d
RO hotm this S
a b e@
b e rn
u i lar
(r ag

Developing Applications for the Java EE 6 Platform 1 - 40


BS Grupo SฺAฺCฺ

Quiz

Which of the following technologies was added to the Java EE


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

6 platform?
a. WSDL
b. JAX-RS
c. Web service end points
d. Stateless session beans

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
B ER ailฺc tude
Answer: b
RO hotm this S
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 41


BS Grupo SฺAฺCฺ

Quiz

Which of the following are specifically Java EE patterns?


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

a. Facade
b. Composite
c. Service Locator
d. Session Facade

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
R ilฺc ude
B E a t
Answer: c, d
RO hotm this S
a b e@
b e rn
u i lar
(r ag

Developing Applications for the Java EE 6 Platform 1 - 42


BS Grupo SฺAฺCฺ

Practice 1: Overview

This practice covers the following topics:


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

• Categorizing Java EE services


• Describing the Java EE platform layers
• Examining the Java SE Broker Tool Application

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S an
Copyright © 2011,E S U itssaffiliates. All
Oracle and/ora i d eฺ
O J om) h nt Gu
rights reserved.

T
B ER ailฺc tude
RO hotm this S
a b e@
er n
a r b
g u il
(r a

Developing Applications for the Java EE 6 Platform 1 - 43


BS Grupo SฺAฺCฺ
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

u se
to
B E ense
R NA le lic
B E rab
I L AR nsfe
A GU on-tra
S US s a n deฺ
J E
) h a Gui
R TO com ent
O BE mailฺ Stud
R hot this
a b e@
er n
a r b
g u il
(r a

You might also like