SlideShare a Scribd company logo
1 of 75
Enterprise Java Beans
Dr M.Rani Reddy
Introduction
J2EE (Java2 Enterprise Edition) offers a
suite of software specification to design,
develop, assemble and deploy
enterprise applications.
It provides a distributed, component-
based, loosely coupled, reliable and
secure, platform independent and
responsive application environment.
J2EE Technologies
Enterprise Java Bean Technology 2.0
JDBC API 2.0
Java Servlet Technology 2.3
Java Server Pages Technology 1.2
Java Messaging Service 1.0
Java Naming and Directory Interface 1.2
Java Transaction API 1.0
Java Mail API 1.2
Javabeans activation framework 1.0
Java API for XML Processing 1.1
Java Connector Architecture 1.0
Java Authentication and Authorization Service 1.0
Tools: deploytool (scripts etc.)
Systems and Application
Integration
The J2EE APIs enable systems and
applications integration through the following:
 Unified application model across tiers with
enterprise beans
 Simplified response and request mechanism with
JSP pages and servlets
 Reliable security model with JAAS
 XML-based data interchange integration with JAXP
 Simplified interoperability with the J2EE Connector
Architecture
 Easy database connectivity with the JDBC API
 Enterprise application integration with message-
driven beans and JMS, JTA, and JNDI
J2EE Technology Architecture
Server
platform
JTS JMAPI JNDI JMS JDBC
JAXP JAAS …
Enterprise Java Beans Components
Java Server
pages
Servlets
Application clients Web clients
IIOP,
others
html
Enterprise Java Bean(EJB)
An enterprise bean is a server-side
component that contains the business logic of
an application. At runtime, the application
clients execute the business logic by invoking
the enterprise bean's methods.
Main goal of Enterprise Java Bean (EJB)
architecture is to free the application
developer from having to deal with the
system level aspects of an application. This
allows the bean developer to focus solely on
the logic of the application.
Roles in EJB Development
Bean developer: Develops bean component.
Application assembler: composes EJBs to form
applications
Deployer: deploys EJB applications within an
operation environment.
System administrator: Configures and administers the
EJB computing and networking infrastructure.
EJB Container Provider and EJB server provider:
Vendors specializing in low level services such as
transactions and application mgt.
Enterprise Java Bean (EJB)
Deployable unit of code.
At run-time, an enterprise bean resides in an
EJB container.
An EJB container provides the deployment
environment and runtime environment for
enterprise beans including services such as
security, transaction, deployment,
concurrency etc.
Process of installing an EJB in a container is
called EJB deployment.
Enterprise Application with
many EJBs
WebClient
ApplClient
EJB1
EJB2
EJB3
EJB4
EJB5
EJB6
Lets consider a shopping front application and figure out the
possible components (EJBs)
Deployment with Multiple EJB
Clients
Web
Container1
Deploys:
WebApp1
EJB
Container1
Deploys :
EJB1,EJB2,EJB3
Client
Container1
Deploys :
Client1
EJB
Container2
Deploys :
EJB4
Client
Container3
Deploys :
EJB5,EJB6
Business Entities, Processes
and Rules
EJB Applications organize business rules into
components.
Components typically represent a business
entity or business process.
Entity: is an object representing some
information maintained in the enterprise. Has
a “state” which may be persistent.
Example: Customer, Order, Employee,
Relationships are defined among the entities:
dependencies.
Process
Is an object that typically encapsulates an interaction
of a user with business entities.
A process typically updated and changes the state of
the entities.
A business process may have its own state which
may exist only for the duration of the process; at the
completion of the process the state ceases to exist.
Process state may be transient or persistent.
States ate transient for conversational processes and
persistent for collaborative processes.
Rules
Rules that apply to the state of an
entity should be implemented in the
component that represents the entity.
Rules that apply to the processes
should be implemented in the
component that represents the
processes.
EJB Types
There are three types of EJBs:
Entity, session and message-driven
We will discuss message-driven bean in a
separate discussion.
The syntax of the session bean and entity
bean client-view API is almost identical.
But they have different life cycle, different
persistence management, etc.
EJBs can be stateless and stateful beans.
Life Cycle Differences
Session Bean
 Object state:
Maintained by container
 Object Sharing:
No sharing: per client
 State Externalization:
State is inaccessible to other
programs
 Transactions:
Not recoverable
 Failure Recovery:
Not guaranteed to survive failures
Entity Bean
Maintained by DB
Shared by multiple client
Accessible to other programs
State changed transactionally and
is recoverable.
Survives failures and restored when
the container restarts.
Choosing Entity or Session
Bean
Entity (business entity) is typically implemented as
entity bean or a dependent object of an entity bean.
Conversational (business) process as a session bean.
Collaborative bean as an entity bean.
Any process that requires persistence is implemented
as an entity bean.
When exposure to other applications are not needed
for an entity or process (local/private process) then
they are implemented as bean dependent objects.
Parts of EJB
EJB class that implements the business methods
and life cycle methods; uses other helper
classes and libraries to implement.
Client-view API: consists of EJB home interface
and remote interface.
 Home interface: controls life cycle : create, remove,
find methods
 Remote interface: to invoke the EJB object methods
Parts of EJB (contd.)
Deployment Descriptor: XML document for
bean assembler and deployer;
 A declaration about EJB environment needed for
customizing the bean to the operating
environment.
Container Runtime services include:
transactions, security,distribution,load
balancing, multithreading, persistence, failure
recovery, resource pooling, state
management, clustering..
Enterprise Bean Parts
<<Home Interface>>
AccountHome
create()
find()
remove()
<<Remote Interface>>
Account
debit()
credit()
getBalance()
<<Enterrpise Bean class>
AccountBean
ejbCreate()
ejbFind()
ejbRemove()
debit()
credit()
getBalance()
Deployment Descriptor
name = AccountEJB
class = AccountBean
home = AccountHome
remote = Account
type = Entity
transaction = required
…..
AccountHome Interface
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
import java.util.Collection;
public interface AccountHome extends javax.ejb.EJBHome {
//create methods
Account create (String lastName, String firstName) throws RemoteException,
CreateException, BadNameException;
Account create (String lastName) throws RemoteException, CreateException;
// find methods
Account findByPrimaryKey (AccountKey primaryKey) throws RemoteException,
FinderException;
Collection findInActive(Date sinceWhen)
throws RemoteException, FinderException, BadDateException;
Account Interface
import java.rmi.RemoteException;
public interface Account extends javax.ejb.EJBObject {
BigDecimal getBalance() throws RemoteException;
void credit(BiGDecimal amount) throws RemoteException;
Void debit(BigDecimal amount) throws RemoteException,
InSufficientFundsException;
}
AccountBean class
public class AccountBean implements javax.ejb.EntityBean {
// life cycle methods from home interface
public AccountKey ejbCreate (String latName, String firstName) throws … {…
public AccountKey ejbCreate(String lastName) throws …{…}
public AccountKey ejbFindByPrimaryKey(AccountKey primarykey)… {…}
Public Collection ejbFindInactive( Data sinecWhen).. {…}
// business methods from remote interface
public BigDecimal getBalance() {….}
public void credit(BigDecimal amt) {…}
Public void debit(BigDecimal amt) throws InsufficientFundException {….}
// container callbacks from EntityBean container
public ejbRemove( ) throws RemoveException{ …}
public void setEntityContext(EntityContext ec) {…}
public unsetEntityContext(EntityContext ec) {…}
public void ejbActivate() {…}
public void ejbLoad() {….}
public void ejbStore() {….}
}
Deployment Descriptor
…
<entity-bean>
<ejb-name>AccountEJB</ejb-name>
<home>com.wombat.AccopuntHome</home>
<remote>com.wombat.Account</remote>
<ejb-class>com.wombat.AccountBean</ejb-class>
<persistence-type>Bean<persistence-type>
<primary-key-class>com.wombat.AccountKey</primary-key-class>
</entity-bean>
…
<container-transaction>
<method>
<ejb-name>AcoountEJB</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>required</trans-attribute>
</container-transaction>
Introduction to
Java EE (J2EE)
By
Dr Rani Reddy
Session Objectives
 Understanding the value propositions of
J2EE
 Getting a big picture of J2EE architecture and
platform
 Getting high-level exposure of APIs and
Technologies that constitute J2EE
 You don't have to understand all the details
 Understanding why J2EE can be used for as
a platform for development and deployment
of web services
What is J2EE?
Challenges
Portability
Diverse
Environments
Time-to-market
Core Competence
Assembly
Integration
Key
Technologies
J2SE™
J2EE™
JMS
Servlet
JSP
Connector
XML
Data
Binding
XSLT
Products
App Servers
Web Servers
Components
Databases
Object to DB
tools
Legacy
Systems
Databases
TP Monitors
EIS Systems
Enterprise Computing
What Is the J2EE?
 Open and standard based platform for
 developing, deploying and managing
 n-tier, Web-enabled, server-centric, and
component-based enterprise applications
The Java™ Platform
High-End
Server
Java Technology
Enabled Desktop
Workgroup
Server
Java Technology
Enabled Devices
The JavaTM Platform
Optional
Packages
Java 2
Enterprise
Edition
(J2EE)
Java 2
Standard
Edition
(J2SE)
JVM
Java
Card
APIs
CardVM
Optional
Packages
Personal
Basis Profile
Personal
Profile
Foundation Profile
CDC
MIDP
CLDC
KVM
Java 2 Platform Micro Edition
(J2METM
)
* Under development in JCP
Open and Standard Solution
 Use "component and container" model in
which container provides system services in
a well-defined and as industry standard
 J2EE is that standard that also provides
portability of code because it is based on
Java technology and standard-based Java
programming APIs
Why J2EE?
Platform Value to Developers
 Can use any J2EE implementation for
development and deployment
 Use production-quality standard implementation which is
free for development/deployment
 Use high-end commercial J2EE products for scalability and
fault-tolerance
 Vast amount of J2EE community resources
 Many J2EE related books, articles, tutorials, quality code
you can use, best practice guidelines, design patterns etc.
 Can use off-the-shelf 3rd-party business
components
Platform Value to Vendors
 Vendors work together on specifications and
then compete in implementations
 In the areas of Scalability, Performance,
Reliability, Availability, Management and
development tools, and so on
 Freedom to innovate while maintaining the
portability of applications
 Do not have create/maintain their own
proprietary APIs
Platform Value to Business Customers
 Application portability
 Many implementation choices are possible
based on various requirements
 Price (free to high-end), scalability (single CPU to
clustered model), reliability, performance, tools,
and more
 Best of breed of applications and platforms
 Large developer pool
J2EE APIs &
Technologies
J2EE 1.4 APIs and Technologies
 J2SE 1.4 (improved)
 JAX-RPC (new)
 Web Service for J2EE
 J2EE Management
 J2EE Deployment
 JMX 1.1
 JMS 1.1
 JTA 1.0
 Servlet 2.4
 JSP 2.0
 EJB 2.1
 JAXR
 Connector 1.5
 JACC
 JAXP 1.2
 JavaMail 1.3
 JAF 1.0
Java EE 5
 JAX-WS 2.0 & JSR 181
 Java Persistence
 EJB 3.0
 JAXB 2.0
 JavaSever Faces 1.2 – new to Platform
 JSP 2.1 – Unification w/ JSF 1.2
 StAX – Pull Parser – new to Platform
Servlet &
JSP (JavaServer
Pages)
What is a Servlet?
 Java™ objects which extend the functionality
of a HTTP server
 Dynamic contents generation
 Better alternative to CGI, NSAPI, ISAPI, etc.
 Efficient
 Platform and server independent
 Session management
 Java-based
Servlet vs. CGI
CGI
Based
Webserver
CGI
Based
Webserver
Request CGI1
Child for CGI1
CGI
Based
Webserver
Servlet Based Webserver
JVM
Request CGI1
Child for CGI1
Request Servlet1
CGI
Based
Webserver
Servlet Based Webserver
JVM
Servlet1
Request CGI1
Child for CGI1
Request CGI2
Request Servlet1
CGI
Based
Webserver
Child for CGI2
Servlet Based Webserver
JVM
Servlet1
Request CGI1
Child for CGI1
Request CGI2
Request Servlet1
Request Servlet2
CGI
Based
Webserver
Child for CGI2
Servlet Based Webserver
JVM
Servlet1
Servlet2
Request CGI1
Child for CGI1
Request CGI2
Request CGI1
Request Servlet1
Request Servlet2
CGI
Based
Webserver
Child for CGI2
Child for CGI1
Servlet Based Webserver
JVM
Servlet1
Servlet2
Request CGI1
Child for CGI1
Request CGI2
Request CGI1
Request Servlet1
Request Servlet2
Request Servlet1
CGI
Based
Webserver
Child for CGI2
Child for CGI1
Servlet Based Webserver
JVM
Servlet1
Servlet2
Request CGI1
Child for CGI1
What is JSP Technology?
 Enables separation of business logic
from presentation
 Presentation is in the form of HTML or
XML/XSLT
 Business logic is implemented as Java Beans
or custom tags
 Better maintainability, reusability
 Extensible via custom tags
 Builds on Servlet technology
EJB
(Enterprise Java
Beans)
What is EJB Technology?
 A server-side component technology
 Easy development and deployment of Java
technology-based application that are:
 Transactional, distributed, multi-tier, portable,
scalable, secure, …
Why EJB Technology?
● Leverages the benefits of component-model
on the server side
● Separates business logic from system code
 Container provides system services
● Provides framework for portable components
 Over different J2EE-compliant servers
 Over different operational environments
● Enables deployment-time configuration
 Deployment descriptor
EJB Architecture
Enterprise JavaBeans
Enterprise JavaBeans
Entity Bean Message-Driven Bean
Synchronous communication Asynchronous communication
Stateless Stateful
Bean managed
Persistence
(BMP)
Container managed
Persistence
(CMP)
Session Bean
JMS
(Java Message
Service)
Java Message Service (JMS)
 Messaging systems (MOM) provide
 De-coupled communication
 Asynchronous communication
 Plays a role of centralized post office
 Benefits of Messaging systems
 Flexible, Reliable, Scalable communication
systems
 Point-to-Point, Publish and Subscribe
 JMS defines standard Java APIs to
messaging systems
Connector
Architecture
Connector Architecture
 Defines standard API for integrating J2EE
technology with EIS systems
 CICS, SAP, PeopleSoft, etc.
 Before Connector architecture, each App server has
to provide an proprietary adaptor for each EIS
system
 m (# of App servers) x n (# of EIS's) Adaptors
 With Connector architecture, same adaptor works
with all J2EE compliant containers
 1 (common to all App servers) x n (# of EIS's) Adaptors
m x n Problem Before Connector
Architecture
App
Server1
App
Server
App
Server3
App
Server2
SAP
EIS4
EIS3
m n
EIS
2
JAAS (Part of J2SE
1.4)
(Java Authentication &
Authorization Service)
JAAS: Authentication
 Pluggable authentication framework
 Userid/password
 Smartcard
 Kerberos
 Biometric
 Application portability regardless of authentication
schemes underneath
 JAAS provides authentication scheme independent API
 Authentication schemes are specified Login configuration
file, which will be read by JAAS
JAAS Pluggable Authentication
Other J2EE APIs &
Technologies
JNDI
 Java Naming and Directory Interface
 Utilized by J2EE applications to locate
resources and objects in portable fashion
 Applications use symbolic names to find object
references to resources via JNDI
 The symbolic names and object references have
to be configured by system administrator when
the application is deployed.
JDBC
 Provides standard Java programming
API to relational database
 Uses SQL
 Vendors provide JDBC compliant driver
which can be invoked via standard Java
programming API
J2EE Management (JSR-77)
 Management applications should be able to
discover and interpret the managed data of
any J2EE platform
 Single management platform can manage
multiple J2EE servers from different vendors
 Management protocol specifications ensure a
uniform view by SNMP and WBEM
management stations
 Leverages JMX
J2EE Deployment (JSR-88) - J2EE 1.4
Tools J2EE Platforms
Standard
Deployment API
(Universal Remote)
IDEs
Vendor Deploy
Tools
Management
Tools
J2EE App Server
App
JMX
JMX
JMX defacto
Dynamic Deployment
JMX API into
the J2EE 1.4 platform
A single technology for the J2EE platform
JMX
J2EE is an End-to-End
Architecture
N-tier J2EE Architecture
Web Tier EJB Tier
J2EE
Component & Container
Architecture
JNDI
J2SE
JMS
RMI/IIOP
JDBC
Database
App
Client
App Client Container
HTTP/
HTTPS
J2SE
RMI
J2SE
JNDI
JMS
RMI/IIOP
JDBC
JTA
JavaMail
JAF
JNDI
JMS
RMI/IIOP
JDBC
JTA
JavaMail
JAF
HTTP/
HTTPS
Applet Container
Applet JSP Servlet EJB
Web Container EJB Container
RMI
J2SE
J2EE Containers & Components
Components
Handle
 Concurrency
 Security
 Availability
 Scalability
 Persistence
 Transaction
 Life-cycle
management
 Management
 Presentation
 Business Logic
Containers
Handle
Containers & Components
 Containers do their work invisibly
q No complicated APIs
q They control by interposition
 Containers implement J2EE
– Look the same to components
– Vendors making the containers have great
freedom to innovate
J2EE Application
Anatomies
DB & EIS
Resources
Browser
Stand-alone
Web Server EJB Server
Web Server EJB Server
Possible J2EE Application
Anatomies
J2EE Application Anatomies
● 4-tier J2EE applications
– HTML client, JSP/Servlets, EJB, JDBC/Connector
● 3-tier J2EE applications
– HTML client, JSP/Servlets, JDBC
● 3-tier J2EE applications
– EJB standalone applications, EJB, JDBC/Connector
● B2B Enterprise applications
– J2EE platform to J2EE platform through the
exchange of JMS or XML-based messages
Which One to Use?
● Depends on several factors
 Requirements of applications
 Availability of EJB tier
 Availability of developer resource
Web Tier and JavaServer Pages
The Web Tier is also the location where JavaServer Pages (JSP) programs reside.
A JSP program is identified with a URL that is associated with a hyperlink built into a web page
displayed on the client.
Presentation and processing
A JSP program can contain two components: the presentation component and the processing logic.
Presentation Component: The presentation component defines the content that is
displayed by the client.
Processing logic: . Processing logic defines the business rules that are applied whenever the
client calls the JSP program.
• Although placing both the presentation and processing logic components in the same
component seems to compartmentalize enterprise application, this technique can lead to
nonmaintainable code
The Inclusion Strategy:
The designer of an enterprise application typically uses the same elements for all web pages of the
user interface to provide continuity throughout the application.
This means that the same code can appear in more than one web page, which is inefficient and a
maintenance nightmare.
The critical difference between the include action and the include directive is that the include action
places the results generated by the called JSP program into the calling JSP program.
Style sheets:
Consistency helps the user become familiar with how to use the application. This means that the
developer must write JSP programs that generate web pages having the same general appearance
(i.e., same font style, font size, and color combination).
Enterprise java beans tier:
The Enterprise JavaBeans Tier contains Enterprise JavaBeans that provide processing logic to other
tiers. Processing logic includes all code and data that is necessary to implement one or more
business rules.
There is a tendency for developers to create a one-to-one relationship between entities defined in
an application's entity relationship diagram and with Enterprise JavaBeans. Each time an Enterprise
JavaBean is created, there is increased overhead for the network and for the Enterprise JavaBeans
container.
MVC:
The Myth of Using Inheritance :
inheritance enables functionality and data to be reused without having to rewrite the functionality
and data several times in an application. Inheritance is also used to embellish both a functionality and
data. That is, the class that inherits a functionality can modify the functionality without affecting the
original functionality. Inheritance also provides a common interface based on functionality that is
used by similar classes.
Interfaces and Inheritance:
An interface contains functionality that is used across unlike real-world objects. This is different from
a base class in that a base class provides functionality that is fundamental to like real-world objects. A
common mistake is to use an interface as a base class because intuitively this seems sensible, but an
interface is too narrow in scope which means an interface consists of one of many functionalities that
are used by real-world objects.
Potential problems: Ripple effect
Maintainable Classes:
There are two factors that determine if classes are maintainable. These are coupling and cohesion.
Coupling occurs when there is a class dependent on another class.
Coupling also occurs when a class delegates responsibility to another class.
Before a change can be made to either the derived class or the base class, the developer must assess
the impact on the coupled class.
Cohesion describes how well a class functionality is focused. That is, a class that has broad
functionality isn't as cohesive as a class that has a single functionality.
Performance Enhancements :
There are two ways to reduce or practically eliminate the amount of bytecode that is interpreted at
runtime: by using HotSpot, new in the Just In Time compiler from Sun Microsystems, Inc., or by using
a native compiler. HotSpot tunes the performance of an application at runtime so the application
runs at optimal performance.
HotSpot analyzes both client- and server-side programs and applies an optimization algorithm that
has the greatest performance impact for the application.
concern about using HotSpot is the complexity of debugging runtime errors. Runtime errors occur in
the optimized code and not necessarily in the bytecode. Therefore, it can be difficult to re-create the
error.
Power of interfaces:
Designing an enterprise application using interfaces provides built-in flexibility, known as pluggability,
because an interface enables the developer to easily replace components.
A method signature consists of the name and the number and type of parameters for a method. A
developer implements the interface by defining a method of a class that has the same method
signature as the interface.
An interface defines a standard way to interact with classes that implement the interface. This
enables a developer to replace a class with another class that implements the same interface, and
only the statement that creates the instance of the class needs to be changed in the program that
calls the method.
Power of threads:
Proper use of threads can increase the efficiency of running an enterprise application because
multiple operations can appear to perform simultaneously. More than one thread can be executed
within an enterprise application. This means that multiple statements can run parallel. The thread
class is used to create a thread. Once the thread is created, the developer can specify the behaviour
of the thread (i.e., start, stop) and the point within the program where the thread begins execution.
Actually, the number of application threads being processed at one time is equal to or less than the
number of CPUs on the machine. Multiple threads that execute the same method share values, which
can cause unexpected results. However, synchronizing a method enables one thread at a time to run
within the method. This practically locks the method and assures that values aren't shared.
Be on the alert for possible deadlocks when using too many synchronized methods in an application.
A deadlock can occur when a synchronized method calls other methods that are also synchronized.
Power of Notification:
Each event might affect multiple objects within the application and therefore it is critical that a
notification process be implemented within the application, so that changes experienced by an object
can be transmitted to other objects that are affected by the change.
There are three ways in which objects are notified of changes: passive notification, timed notification,
and active notification.
Passive notification is the process whereby objects poll relative objects to determine the current
state of the object.
An alternative to the passive notification method is timed notification. Timed notification suspends
the thread that polls objects for a specific time period. The drawback of both passive notification and
timed notification is that each of these notification methods polls relative objects.
The original active notification method was called the observable-observer method, which is also
known as the publisher-scriber model.

More Related Content

Similar to ADVANCED JAVA MODULE I & II.ppt

Similar to ADVANCED JAVA MODULE I & II.ppt (20)

Ch4 ejb
Ch4 ejbCh4 ejb
Ch4 ejb
 
Java J2EE
Java J2EEJava J2EE
Java J2EE
 
EJB 2
EJB 2EJB 2
EJB 2
 
Ejb intro
Ejb introEjb intro
Ejb intro
 
J2 EEE SIDES
J2 EEE  SIDESJ2 EEE  SIDES
J2 EEE SIDES
 
Skillwise EJB3.0 training
Skillwise EJB3.0 trainingSkillwise EJB3.0 training
Skillwise EJB3.0 training
 
Unite5-EJB-2019.ppt
Unite5-EJB-2019.pptUnite5-EJB-2019.ppt
Unite5-EJB-2019.ppt
 
Ejb intro
Ejb introEjb intro
Ejb intro
 
Enterprise Java Beans( E)
Enterprise  Java  Beans( E)Enterprise  Java  Beans( E)
Enterprise Java Beans( E)
 
Enterprice java
Enterprice javaEnterprice java
Enterprice java
 
Java j2eeTutorial
Java j2eeTutorialJava j2eeTutorial
Java j2eeTutorial
 
Free EJB Tutorial | VirtualNuggets
Free EJB Tutorial | VirtualNuggetsFree EJB Tutorial | VirtualNuggets
Free EJB Tutorial | VirtualNuggets
 
Session 3 Tp3
Session 3 Tp3Session 3 Tp3
Session 3 Tp3
 
Topic4 Application Servers
Topic4 Application ServersTopic4 Application Servers
Topic4 Application Servers
 
Enterprise java beans(ejb) Update 2
Enterprise java beans(ejb) Update 2Enterprise java beans(ejb) Update 2
Enterprise java beans(ejb) Update 2
 
Enterprise java beans(ejb) update 2
Enterprise java beans(ejb) update 2Enterprise java beans(ejb) update 2
Enterprise java beans(ejb) update 2
 
Lec2 ecom fall16
Lec2 ecom fall16Lec2 ecom fall16
Lec2 ecom fall16
 
Introcution to EJB
Introcution to EJBIntrocution to EJB
Introcution to EJB
 
Ejb
EjbEjb
Ejb
 
Web programming and development - Introduction
Web programming and development - IntroductionWeb programming and development - Introduction
Web programming and development - Introduction
 

More from rani marri

NAAC PPT M.B.A.pptx
NAAC PPT M.B.A.pptxNAAC PPT M.B.A.pptx
NAAC PPT M.B.A.pptxrani marri
 
oops with java modules iii & iv.pptx
oops with java modules iii & iv.pptxoops with java modules iii & iv.pptx
oops with java modules iii & iv.pptxrani marri
 
oops with java modules i & ii.ppt
oops with java modules i & ii.pptoops with java modules i & ii.ppt
oops with java modules i & ii.pptrani marri
 
software engineering modules iii & iv.pptx
software engineering  modules iii & iv.pptxsoftware engineering  modules iii & iv.pptx
software engineering modules iii & iv.pptxrani marri
 
software engineering module i & ii.pptx
software engineering module i & ii.pptxsoftware engineering module i & ii.pptx
software engineering module i & ii.pptxrani marri
 
ADVANCED JAVA MODULE III & IV.ppt
ADVANCED JAVA MODULE III & IV.pptADVANCED JAVA MODULE III & IV.ppt
ADVANCED JAVA MODULE III & IV.pptrani marri
 
data structures module III & IV.pptx
data structures module III & IV.pptxdata structures module III & IV.pptx
data structures module III & IV.pptxrani marri
 
data structures module I & II.pptx
data structures module I & II.pptxdata structures module I & II.pptx
data structures module I & II.pptxrani marri
 
php programming.pptx
php programming.pptxphp programming.pptx
php programming.pptxrani marri
 
CODING QUESTIONS.pptx
CODING QUESTIONS.pptxCODING QUESTIONS.pptx
CODING QUESTIONS.pptxrani marri
 
OOPS IN PHP.pptx
OOPS IN PHP.pptxOOPS IN PHP.pptx
OOPS IN PHP.pptxrani marri
 
12-OO-PHP.pptx
12-OO-PHP.pptx12-OO-PHP.pptx
12-OO-PHP.pptxrani marri
 
PHP-05-Objects.ppt
PHP-05-Objects.pptPHP-05-Objects.ppt
PHP-05-Objects.pptrani marri
 

More from rani marri (16)

NAAC PPT M.B.A.pptx
NAAC PPT M.B.A.pptxNAAC PPT M.B.A.pptx
NAAC PPT M.B.A.pptx
 
must.pptx
must.pptxmust.pptx
must.pptx
 
node.js.pptx
node.js.pptxnode.js.pptx
node.js.pptx
 
oops with java modules iii & iv.pptx
oops with java modules iii & iv.pptxoops with java modules iii & iv.pptx
oops with java modules iii & iv.pptx
 
oops with java modules i & ii.ppt
oops with java modules i & ii.pptoops with java modules i & ii.ppt
oops with java modules i & ii.ppt
 
software engineering modules iii & iv.pptx
software engineering  modules iii & iv.pptxsoftware engineering  modules iii & iv.pptx
software engineering modules iii & iv.pptx
 
software engineering module i & ii.pptx
software engineering module i & ii.pptxsoftware engineering module i & ii.pptx
software engineering module i & ii.pptx
 
ADVANCED JAVA MODULE III & IV.ppt
ADVANCED JAVA MODULE III & IV.pptADVANCED JAVA MODULE III & IV.ppt
ADVANCED JAVA MODULE III & IV.ppt
 
data structures module III & IV.pptx
data structures module III & IV.pptxdata structures module III & IV.pptx
data structures module III & IV.pptx
 
data structures module I & II.pptx
data structures module I & II.pptxdata structures module I & II.pptx
data structures module I & II.pptx
 
php programming.pptx
php programming.pptxphp programming.pptx
php programming.pptx
 
NodeJS.ppt
NodeJS.pptNodeJS.ppt
NodeJS.ppt
 
CODING QUESTIONS.pptx
CODING QUESTIONS.pptxCODING QUESTIONS.pptx
CODING QUESTIONS.pptx
 
OOPS IN PHP.pptx
OOPS IN PHP.pptxOOPS IN PHP.pptx
OOPS IN PHP.pptx
 
12-OO-PHP.pptx
12-OO-PHP.pptx12-OO-PHP.pptx
12-OO-PHP.pptx
 
PHP-05-Objects.ppt
PHP-05-Objects.pptPHP-05-Objects.ppt
PHP-05-Objects.ppt
 

Recently uploaded

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 

Recently uploaded (20)

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 

ADVANCED JAVA MODULE I & II.ppt

  • 2. Introduction J2EE (Java2 Enterprise Edition) offers a suite of software specification to design, develop, assemble and deploy enterprise applications. It provides a distributed, component- based, loosely coupled, reliable and secure, platform independent and responsive application environment.
  • 3. J2EE Technologies Enterprise Java Bean Technology 2.0 JDBC API 2.0 Java Servlet Technology 2.3 Java Server Pages Technology 1.2 Java Messaging Service 1.0 Java Naming and Directory Interface 1.2 Java Transaction API 1.0 Java Mail API 1.2 Javabeans activation framework 1.0 Java API for XML Processing 1.1 Java Connector Architecture 1.0 Java Authentication and Authorization Service 1.0 Tools: deploytool (scripts etc.)
  • 4. Systems and Application Integration The J2EE APIs enable systems and applications integration through the following:  Unified application model across tiers with enterprise beans  Simplified response and request mechanism with JSP pages and servlets  Reliable security model with JAAS  XML-based data interchange integration with JAXP  Simplified interoperability with the J2EE Connector Architecture  Easy database connectivity with the JDBC API  Enterprise application integration with message- driven beans and JMS, JTA, and JNDI
  • 5. J2EE Technology Architecture Server platform JTS JMAPI JNDI JMS JDBC JAXP JAAS … Enterprise Java Beans Components Java Server pages Servlets Application clients Web clients IIOP, others html
  • 6. Enterprise Java Bean(EJB) An enterprise bean is a server-side component that contains the business logic of an application. At runtime, the application clients execute the business logic by invoking the enterprise bean's methods. Main goal of Enterprise Java Bean (EJB) architecture is to free the application developer from having to deal with the system level aspects of an application. This allows the bean developer to focus solely on the logic of the application.
  • 7. Roles in EJB Development Bean developer: Develops bean component. Application assembler: composes EJBs to form applications Deployer: deploys EJB applications within an operation environment. System administrator: Configures and administers the EJB computing and networking infrastructure. EJB Container Provider and EJB server provider: Vendors specializing in low level services such as transactions and application mgt.
  • 8. Enterprise Java Bean (EJB) Deployable unit of code. At run-time, an enterprise bean resides in an EJB container. An EJB container provides the deployment environment and runtime environment for enterprise beans including services such as security, transaction, deployment, concurrency etc. Process of installing an EJB in a container is called EJB deployment.
  • 9. Enterprise Application with many EJBs WebClient ApplClient EJB1 EJB2 EJB3 EJB4 EJB5 EJB6 Lets consider a shopping front application and figure out the possible components (EJBs)
  • 10. Deployment with Multiple EJB Clients Web Container1 Deploys: WebApp1 EJB Container1 Deploys : EJB1,EJB2,EJB3 Client Container1 Deploys : Client1 EJB Container2 Deploys : EJB4 Client Container3 Deploys : EJB5,EJB6
  • 11. Business Entities, Processes and Rules EJB Applications organize business rules into components. Components typically represent a business entity or business process. Entity: is an object representing some information maintained in the enterprise. Has a “state” which may be persistent. Example: Customer, Order, Employee, Relationships are defined among the entities: dependencies.
  • 12. Process Is an object that typically encapsulates an interaction of a user with business entities. A process typically updated and changes the state of the entities. A business process may have its own state which may exist only for the duration of the process; at the completion of the process the state ceases to exist. Process state may be transient or persistent. States ate transient for conversational processes and persistent for collaborative processes.
  • 13. Rules Rules that apply to the state of an entity should be implemented in the component that represents the entity. Rules that apply to the processes should be implemented in the component that represents the processes.
  • 14. EJB Types There are three types of EJBs: Entity, session and message-driven We will discuss message-driven bean in a separate discussion. The syntax of the session bean and entity bean client-view API is almost identical. But they have different life cycle, different persistence management, etc. EJBs can be stateless and stateful beans.
  • 15. Life Cycle Differences Session Bean  Object state: Maintained by container  Object Sharing: No sharing: per client  State Externalization: State is inaccessible to other programs  Transactions: Not recoverable  Failure Recovery: Not guaranteed to survive failures Entity Bean Maintained by DB Shared by multiple client Accessible to other programs State changed transactionally and is recoverable. Survives failures and restored when the container restarts.
  • 16. Choosing Entity or Session Bean Entity (business entity) is typically implemented as entity bean or a dependent object of an entity bean. Conversational (business) process as a session bean. Collaborative bean as an entity bean. Any process that requires persistence is implemented as an entity bean. When exposure to other applications are not needed for an entity or process (local/private process) then they are implemented as bean dependent objects.
  • 17. Parts of EJB EJB class that implements the business methods and life cycle methods; uses other helper classes and libraries to implement. Client-view API: consists of EJB home interface and remote interface.  Home interface: controls life cycle : create, remove, find methods  Remote interface: to invoke the EJB object methods
  • 18. Parts of EJB (contd.) Deployment Descriptor: XML document for bean assembler and deployer;  A declaration about EJB environment needed for customizing the bean to the operating environment. Container Runtime services include: transactions, security,distribution,load balancing, multithreading, persistence, failure recovery, resource pooling, state management, clustering..
  • 19. Enterprise Bean Parts <<Home Interface>> AccountHome create() find() remove() <<Remote Interface>> Account debit() credit() getBalance() <<Enterrpise Bean class> AccountBean ejbCreate() ejbFind() ejbRemove() debit() credit() getBalance() Deployment Descriptor name = AccountEJB class = AccountBean home = AccountHome remote = Account type = Entity transaction = required …..
  • 20. AccountHome Interface import java.rmi.RemoteException; import javax.ejb.CreateException; import javax.ejb.FinderException; import java.util.Collection; public interface AccountHome extends javax.ejb.EJBHome { //create methods Account create (String lastName, String firstName) throws RemoteException, CreateException, BadNameException; Account create (String lastName) throws RemoteException, CreateException; // find methods Account findByPrimaryKey (AccountKey primaryKey) throws RemoteException, FinderException; Collection findInActive(Date sinceWhen) throws RemoteException, FinderException, BadDateException;
  • 21. Account Interface import java.rmi.RemoteException; public interface Account extends javax.ejb.EJBObject { BigDecimal getBalance() throws RemoteException; void credit(BiGDecimal amount) throws RemoteException; Void debit(BigDecimal amount) throws RemoteException, InSufficientFundsException; }
  • 22. AccountBean class public class AccountBean implements javax.ejb.EntityBean { // life cycle methods from home interface public AccountKey ejbCreate (String latName, String firstName) throws … {… public AccountKey ejbCreate(String lastName) throws …{…} public AccountKey ejbFindByPrimaryKey(AccountKey primarykey)… {…} Public Collection ejbFindInactive( Data sinecWhen).. {…} // business methods from remote interface public BigDecimal getBalance() {….} public void credit(BigDecimal amt) {…} Public void debit(BigDecimal amt) throws InsufficientFundException {….} // container callbacks from EntityBean container public ejbRemove( ) throws RemoveException{ …} public void setEntityContext(EntityContext ec) {…} public unsetEntityContext(EntityContext ec) {…} public void ejbActivate() {…} public void ejbLoad() {….} public void ejbStore() {….} }
  • 24. Introduction to Java EE (J2EE) By Dr Rani Reddy
  • 25. Session Objectives  Understanding the value propositions of J2EE  Getting a big picture of J2EE architecture and platform  Getting high-level exposure of APIs and Technologies that constitute J2EE  You don't have to understand all the details  Understanding why J2EE can be used for as a platform for development and deployment of web services
  • 28. What Is the J2EE?  Open and standard based platform for  developing, deploying and managing  n-tier, Web-enabled, server-centric, and component-based enterprise applications
  • 29. The Java™ Platform High-End Server Java Technology Enabled Desktop Workgroup Server Java Technology Enabled Devices
  • 30. The JavaTM Platform Optional Packages Java 2 Enterprise Edition (J2EE) Java 2 Standard Edition (J2SE) JVM Java Card APIs CardVM Optional Packages Personal Basis Profile Personal Profile Foundation Profile CDC MIDP CLDC KVM Java 2 Platform Micro Edition (J2METM ) * Under development in JCP
  • 31. Open and Standard Solution  Use "component and container" model in which container provides system services in a well-defined and as industry standard  J2EE is that standard that also provides portability of code because it is based on Java technology and standard-based Java programming APIs
  • 33. Platform Value to Developers  Can use any J2EE implementation for development and deployment  Use production-quality standard implementation which is free for development/deployment  Use high-end commercial J2EE products for scalability and fault-tolerance  Vast amount of J2EE community resources  Many J2EE related books, articles, tutorials, quality code you can use, best practice guidelines, design patterns etc.  Can use off-the-shelf 3rd-party business components
  • 34. Platform Value to Vendors  Vendors work together on specifications and then compete in implementations  In the areas of Scalability, Performance, Reliability, Availability, Management and development tools, and so on  Freedom to innovate while maintaining the portability of applications  Do not have create/maintain their own proprietary APIs
  • 35. Platform Value to Business Customers  Application portability  Many implementation choices are possible based on various requirements  Price (free to high-end), scalability (single CPU to clustered model), reliability, performance, tools, and more  Best of breed of applications and platforms  Large developer pool
  • 37. J2EE 1.4 APIs and Technologies  J2SE 1.4 (improved)  JAX-RPC (new)  Web Service for J2EE  J2EE Management  J2EE Deployment  JMX 1.1  JMS 1.1  JTA 1.0  Servlet 2.4  JSP 2.0  EJB 2.1  JAXR  Connector 1.5  JACC  JAXP 1.2  JavaMail 1.3  JAF 1.0
  • 38. Java EE 5  JAX-WS 2.0 & JSR 181  Java Persistence  EJB 3.0  JAXB 2.0  JavaSever Faces 1.2 – new to Platform  JSP 2.1 – Unification w/ JSF 1.2  StAX – Pull Parser – new to Platform
  • 40. What is a Servlet?  Java™ objects which extend the functionality of a HTTP server  Dynamic contents generation  Better alternative to CGI, NSAPI, ISAPI, etc.  Efficient  Platform and server independent  Session management  Java-based
  • 41. Servlet vs. CGI CGI Based Webserver CGI Based Webserver Request CGI1 Child for CGI1 CGI Based Webserver Servlet Based Webserver JVM Request CGI1 Child for CGI1 Request Servlet1 CGI Based Webserver Servlet Based Webserver JVM Servlet1 Request CGI1 Child for CGI1 Request CGI2 Request Servlet1 CGI Based Webserver Child for CGI2 Servlet Based Webserver JVM Servlet1 Request CGI1 Child for CGI1 Request CGI2 Request Servlet1 Request Servlet2 CGI Based Webserver Child for CGI2 Servlet Based Webserver JVM Servlet1 Servlet2 Request CGI1 Child for CGI1 Request CGI2 Request CGI1 Request Servlet1 Request Servlet2 CGI Based Webserver Child for CGI2 Child for CGI1 Servlet Based Webserver JVM Servlet1 Servlet2 Request CGI1 Child for CGI1 Request CGI2 Request CGI1 Request Servlet1 Request Servlet2 Request Servlet1 CGI Based Webserver Child for CGI2 Child for CGI1 Servlet Based Webserver JVM Servlet1 Servlet2 Request CGI1 Child for CGI1
  • 42. What is JSP Technology?  Enables separation of business logic from presentation  Presentation is in the form of HTML or XML/XSLT  Business logic is implemented as Java Beans or custom tags  Better maintainability, reusability  Extensible via custom tags  Builds on Servlet technology
  • 44. What is EJB Technology?  A server-side component technology  Easy development and deployment of Java technology-based application that are:  Transactional, distributed, multi-tier, portable, scalable, secure, …
  • 45. Why EJB Technology? ● Leverages the benefits of component-model on the server side ● Separates business logic from system code  Container provides system services ● Provides framework for portable components  Over different J2EE-compliant servers  Over different operational environments ● Enables deployment-time configuration  Deployment descriptor
  • 47. Enterprise JavaBeans Enterprise JavaBeans Entity Bean Message-Driven Bean Synchronous communication Asynchronous communication Stateless Stateful Bean managed Persistence (BMP) Container managed Persistence (CMP) Session Bean
  • 49. Java Message Service (JMS)  Messaging systems (MOM) provide  De-coupled communication  Asynchronous communication  Plays a role of centralized post office  Benefits of Messaging systems  Flexible, Reliable, Scalable communication systems  Point-to-Point, Publish and Subscribe  JMS defines standard Java APIs to messaging systems
  • 51. Connector Architecture  Defines standard API for integrating J2EE technology with EIS systems  CICS, SAP, PeopleSoft, etc.  Before Connector architecture, each App server has to provide an proprietary adaptor for each EIS system  m (# of App servers) x n (# of EIS's) Adaptors  With Connector architecture, same adaptor works with all J2EE compliant containers  1 (common to all App servers) x n (# of EIS's) Adaptors
  • 52. m x n Problem Before Connector Architecture App Server1 App Server App Server3 App Server2 SAP EIS4 EIS3 m n EIS 2
  • 53. JAAS (Part of J2SE 1.4) (Java Authentication & Authorization Service)
  • 54. JAAS: Authentication  Pluggable authentication framework  Userid/password  Smartcard  Kerberos  Biometric  Application portability regardless of authentication schemes underneath  JAAS provides authentication scheme independent API  Authentication schemes are specified Login configuration file, which will be read by JAAS
  • 56. Other J2EE APIs & Technologies
  • 57. JNDI  Java Naming and Directory Interface  Utilized by J2EE applications to locate resources and objects in portable fashion  Applications use symbolic names to find object references to resources via JNDI  The symbolic names and object references have to be configured by system administrator when the application is deployed.
  • 58. JDBC  Provides standard Java programming API to relational database  Uses SQL  Vendors provide JDBC compliant driver which can be invoked via standard Java programming API
  • 59. J2EE Management (JSR-77)  Management applications should be able to discover and interpret the managed data of any J2EE platform  Single management platform can manage multiple J2EE servers from different vendors  Management protocol specifications ensure a uniform view by SNMP and WBEM management stations  Leverages JMX
  • 60. J2EE Deployment (JSR-88) - J2EE 1.4 Tools J2EE Platforms Standard Deployment API (Universal Remote) IDEs Vendor Deploy Tools Management Tools
  • 61. J2EE App Server App JMX JMX JMX defacto Dynamic Deployment JMX API into the J2EE 1.4 platform A single technology for the J2EE platform JMX
  • 62. J2EE is an End-to-End Architecture
  • 66. Components Handle  Concurrency  Security  Availability  Scalability  Persistence  Transaction  Life-cycle management  Management  Presentation  Business Logic Containers Handle
  • 67. Containers & Components  Containers do their work invisibly q No complicated APIs q They control by interposition  Containers implement J2EE – Look the same to components – Vendors making the containers have great freedom to innovate
  • 69. DB & EIS Resources Browser Stand-alone Web Server EJB Server Web Server EJB Server Possible J2EE Application Anatomies
  • 70. J2EE Application Anatomies ● 4-tier J2EE applications – HTML client, JSP/Servlets, EJB, JDBC/Connector ● 3-tier J2EE applications – HTML client, JSP/Servlets, JDBC ● 3-tier J2EE applications – EJB standalone applications, EJB, JDBC/Connector ● B2B Enterprise applications – J2EE platform to J2EE platform through the exchange of JMS or XML-based messages
  • 71. Which One to Use? ● Depends on several factors  Requirements of applications  Availability of EJB tier  Availability of developer resource
  • 72. Web Tier and JavaServer Pages The Web Tier is also the location where JavaServer Pages (JSP) programs reside. A JSP program is identified with a URL that is associated with a hyperlink built into a web page displayed on the client. Presentation and processing A JSP program can contain two components: the presentation component and the processing logic. Presentation Component: The presentation component defines the content that is displayed by the client. Processing logic: . Processing logic defines the business rules that are applied whenever the client calls the JSP program. • Although placing both the presentation and processing logic components in the same component seems to compartmentalize enterprise application, this technique can lead to nonmaintainable code The Inclusion Strategy: The designer of an enterprise application typically uses the same elements for all web pages of the user interface to provide continuity throughout the application. This means that the same code can appear in more than one web page, which is inefficient and a maintenance nightmare. The critical difference between the include action and the include directive is that the include action places the results generated by the called JSP program into the calling JSP program.
  • 73. Style sheets: Consistency helps the user become familiar with how to use the application. This means that the developer must write JSP programs that generate web pages having the same general appearance (i.e., same font style, font size, and color combination). Enterprise java beans tier: The Enterprise JavaBeans Tier contains Enterprise JavaBeans that provide processing logic to other tiers. Processing logic includes all code and data that is necessary to implement one or more business rules. There is a tendency for developers to create a one-to-one relationship between entities defined in an application's entity relationship diagram and with Enterprise JavaBeans. Each time an Enterprise JavaBean is created, there is increased overhead for the network and for the Enterprise JavaBeans container. MVC: The Myth of Using Inheritance : inheritance enables functionality and data to be reused without having to rewrite the functionality and data several times in an application. Inheritance is also used to embellish both a functionality and data. That is, the class that inherits a functionality can modify the functionality without affecting the original functionality. Inheritance also provides a common interface based on functionality that is used by similar classes. Interfaces and Inheritance: An interface contains functionality that is used across unlike real-world objects. This is different from a base class in that a base class provides functionality that is fundamental to like real-world objects. A common mistake is to use an interface as a base class because intuitively this seems sensible, but an interface is too narrow in scope which means an interface consists of one of many functionalities that are used by real-world objects. Potential problems: Ripple effect
  • 74. Maintainable Classes: There are two factors that determine if classes are maintainable. These are coupling and cohesion. Coupling occurs when there is a class dependent on another class. Coupling also occurs when a class delegates responsibility to another class. Before a change can be made to either the derived class or the base class, the developer must assess the impact on the coupled class. Cohesion describes how well a class functionality is focused. That is, a class that has broad functionality isn't as cohesive as a class that has a single functionality. Performance Enhancements : There are two ways to reduce or practically eliminate the amount of bytecode that is interpreted at runtime: by using HotSpot, new in the Just In Time compiler from Sun Microsystems, Inc., or by using a native compiler. HotSpot tunes the performance of an application at runtime so the application runs at optimal performance. HotSpot analyzes both client- and server-side programs and applies an optimization algorithm that has the greatest performance impact for the application. concern about using HotSpot is the complexity of debugging runtime errors. Runtime errors occur in the optimized code and not necessarily in the bytecode. Therefore, it can be difficult to re-create the error. Power of interfaces: Designing an enterprise application using interfaces provides built-in flexibility, known as pluggability, because an interface enables the developer to easily replace components. A method signature consists of the name and the number and type of parameters for a method. A developer implements the interface by defining a method of a class that has the same method signature as the interface. An interface defines a standard way to interact with classes that implement the interface. This enables a developer to replace a class with another class that implements the same interface, and only the statement that creates the instance of the class needs to be changed in the program that calls the method. Power of threads: Proper use of threads can increase the efficiency of running an enterprise application because multiple operations can appear to perform simultaneously. More than one thread can be executed within an enterprise application. This means that multiple statements can run parallel. The thread class is used to create a thread. Once the thread is created, the developer can specify the behaviour of the thread (i.e., start, stop) and the point within the program where the thread begins execution. Actually, the number of application threads being processed at one time is equal to or less than the number of CPUs on the machine. Multiple threads that execute the same method share values, which can cause unexpected results. However, synchronizing a method enables one thread at a time to run within the method. This practically locks the method and assures that values aren't shared.
  • 75. Be on the alert for possible deadlocks when using too many synchronized methods in an application. A deadlock can occur when a synchronized method calls other methods that are also synchronized. Power of Notification: Each event might affect multiple objects within the application and therefore it is critical that a notification process be implemented within the application, so that changes experienced by an object can be transmitted to other objects that are affected by the change. There are three ways in which objects are notified of changes: passive notification, timed notification, and active notification. Passive notification is the process whereby objects poll relative objects to determine the current state of the object. An alternative to the passive notification method is timed notification. Timed notification suspends the thread that polls objects for a specific time period. The drawback of both passive notification and timed notification is that each of these notification methods polls relative objects. The original active notification method was called the observable-observer method, which is also known as the publisher-scriber model.

Editor's Notes

  1. .
  2. These are the session objectives. At the end of this session, I expect you to get a big picture of J2EE architecture and platform. So I am trying to cover J2EE at 10,000 feet level. in this session. I also expect you to understand the value propositions of J2EE, that is, why J2EE is the platform of choice for building and deploying enterprise applications. I will also cover all the major API's and technologies that constitute J2EE in this session so that you know what they are and how they are related to each other. Finally, I will talk about why J2EE is the platform of choice not only for building we-based based enterprise applications but also building web services.
  3. Now let's talk what J2EE really is, first.
  4. What is J2EE? In short, it is an open, standard-based, development and deployment platform for building n-tier, web-based and server-centric, and component-based enterprise applications.
  5. This is another picture that shows three flavors of Java technology. Java is being used at JavaCard at one end and at the supercomputer at the other end. The key point in this picture is that the syntax and semantics of Java programming language is preserved regardless of which edition you use. And regardless where it is being used, it provides the secure, portable, and robust application development and deployment platform.
  6. Open and standard based solution is that a standard specification defines the contract of the component and container model in a well-defined and in an industry-standard. And J2EE is that standard. And because it is based on Java technology, the portability of code also can be achieved regardless underlying OS or hardware architecture.
  7. OK, by now, I assume you get the sense of how enterprise application architecture has evolved into what it is today, namely open standard basedJ2EE framework. Now I would like to spend some time talking about the concrete value that J2EE provides to different players in the scene of enterprise computing.
  8. First, let's talk about J2EE platform value to developers. Now with J2EE, developers do not have to be tied up with particular vendor platform because they can use any J2EE-compliant implementation as their development platform while application portability is still guaranteed. For example, you can use freely available J2EE implementations such as Sun Java System App Server Platform Edition for development while you might want to use high-end commercial platforms for actual production deployment especially when scalability, reliability, fault-tolerance, and high-performance are important factors. Second,J2EE is, for that matter, Java, is all about community. There is vast amount of J2EE community resource that be leveraged by J2EE developers, for example, books, articles, tutorials, and quality code that you can use, best practice guidelines and design patterns people have spent time to develop. If you think about it, these are very significant value. Thirdly, because J2EE is based on component model, that is, 3rd party components can be used to build enterprise applications thus saving time and money.
  9. So what are the J2EE value proposition to vendors? First vendors work together on creating specifications and then they compete in implementations. And the areas they compete include scalability, performance, reliability, availability, management and development tools, and so on. This way, vendors have freedom to innovate in their implementations while maintaining the portability of their applications. So bottom line is that vendors can influence the future of Java while they can continue to innovate. And vendors are free from having to maintain their own proprietary APIs. Instead they focus on better implementations.
  10. Now what about the business customers? First and foremost, to customers, application portability is guaranteed, which means they can choose best of breed applications as well as best of breed platforms based on many criteria, for example, price, scalability, reliability, and performance, and tools, and so on. There are large developer pool they can tap with. And then they can use many quality open source implementations such Tomcat, Struts, Cocoon, and Axis and so on, over the J2EE platform
  11. Now let's talk J2EE APIs and technologies. I don't intend to give detail description of these technologies here since we have the remaining sessions talking about these technologies in detail. But I want to give you a big picture so that you understand where these individual technologies fit in under the big picture of J2EE. So if you don't understand the details of these technologies, don't worry about it. Instead just get some sense on the roles these technologies play for particular application requirements.
  12. So this is the summary slide of all Java APIs and technologies that will be part of J2EE 1.4. I put it here for your reference. The ones in red color are newly added features while the ones in blue color are the ones whose functionality is enhanced from the previous version.
  13. OK. Let's talk about servlet and JSP, which are cornerstone technologies of J2EE.
  14. What is Servlet? A servlet is a Java object that extends the functionality of HTTP server by providing the capability of dynamic contents generation. Now you might remember that people used to use CGI for dynamic contents generation. “What is wrong with CGI?” Lots of things. First, inefficiency. In CGI, every HTTP request from client results in a creating of a new process, even if they are from a same client, which is quite inefficient and of course because of that, cannot scale to handle large number of clients at the same time. The servlet technology is designed to solve these problems associated with using CGI, or proprietary APIs such as NSAPI or ISAPI. For example, Servlet handles the HTTP client requests much more efficiently than CGI because it does not have to create new process every time there is a new client request. Instead, it creates a new thread. Because it is Java and because it is standard-based, most of the web servers out there support servlet. It also handles session management for you so that you don’t have to deal with it yourself. By being Java code, it is cross-platform technology as opposed to vendor-specific or product-specific technologies such as NSAPI or ISAPI.
  15. This picture shows difference between CGI and servlet-based model. In CGI, for every HTTP request, a new process has to be created while in servlet model, it is the thread that gets created in the same Java VM (Virtual Machine) and that thread can stay there for serving other requests.
  16. JSP, Java Server Pages, was introduced as a follow-on technology to the Servlet. Even though the Servlet solves many problems associated with CGI for dynamic contents generation, it has one downside. The downside is that, under Servlet, the presentation, typically HTML pages, has to be generated as part of the servlet Java code, for example, using printf statement. What this means is that whenever you have to make some change to the presentation, the Java code has to be changed and then recompiled, redeployed. This in turn result in maintenance problem of your applications. Also it makes web-page prototyping effort rather a difficult task. JSP is designed to address of this shortcoming of the Servlet while maintaining all the benefits of Servlet. That is, it provides a clear separation between the presentation and business logic code. That is, the presentation will be designed by Web page designers in the form of either HTML or XML or JSP page while the business logic will be implemented by Java programmers either in the form of Java Beans or custom tags. This separation will result in a better maintainability of both presentation pages and business code. And because the business logic is encapsulated into Java beans or custom tags, it increased reusability of the code as well. I mentioned about custom tags. Custom tags are basically specialized Java beans which encapsulate the application-specific business logic. The functionality of enterprise applications can be extended by building more custom tags. Finally, JSP technology is built over servlet. In fact, JSP pages when deployed get converted into servlet first. Because it is built over servlet, it maintains all the benefits of servlet. For example, all the ready-to-use objects in a servlet such as session objects can be also available to JSP page designers and custom tag developers.
  17. What is EJB? In short, it is a server-side component technology, which enable the easy development and deployment of Java-based enterprise applications in the form of components that have to be enterprise-quality, meaning they are transactional, distributed, multi-tier, portable, scalable, secure, and reliable, and the list can go on.
  18. Why EJB? By providing a standard component model on the server side, it leverages all the benefits that are inherent in component technology, for example, simplified development and deployment and reuse of the code. Another key benefit of EJB is the separation of business logic from system code. That is, the EJB server platform provides all the system services such as resource management, transaction coordination and persistence management. Since the system services are provided by the server platform itself, you, as a developer, can now focus your development effort to building business logic components rather than system code. Because EJB is built around industry-standard component framework, because it is based on Java, it allows portability of your components. That is, the business logic components you build will be portable across different vendors’ server platforms as well as different operational environments without any change in your code or without even recompiling. It is truly binary portability we are talking about. Now you might want to ask? How do these components adapt themselves to the different operational environments? That is, different operational environments have different requirements on security policy, they have different databases in place , different transactional model maybe have to be used. How do you instruct your business components to a different behavior without actual change of code? It is done by what is called deployment descriptor. The deployment descriptor is essentially an XML file that specifies the runtime behavioral characteristics of your business component. And it gets constructed or changed at the time of deployment not at the time of code development.
  19. This picture shows a somewhat simplified architecture of EJB. We will talk about the concept of containers and components later on. But a key architectural concept of EJB is that there is a separation of business logic components from the hosting execution environment in which those components are running. The business logic components under EJB architecture are represented as EJB beans while the hosting environment is represented by EJB container (sometimes called as EJB server). As a business component developer, you have to write three Java files and a deployment descriptor. First you have to write EJB home interface which defines the methods that will be used by clients in order to create and locate your bean through the container. Second, you have to write EJB remote interface which defines the business methods of your bean. Finally, you will build your bean and deployment descriptor which specifies which Java interface is home interface and which Java interface is remote interface, and which class is in fact your bean class. Now container, at the time of deployment of your beans, will create two internal and intermediary objects, EJB home object and EJB remote object. These objects are implementation of home and remote interface you have defined. So when the client wants to invoke some business methods of the EJB bean you created, it is actually talking to these two intermediary objects instead. Why this indirection? This is to allow the container to intercept the calls so that it can provide system services such as security, transaction, persistence, resource management, life cycle management, and so on.
  20. Now EJB has three bean type - session bean, entity bean, and message driven bean. And session bean can be either stateful or stateless session bean. And entity bean can be either bean managed or container managed. And you as a developer choose which bean type to use depending on the needs and requirements of your application. For example, you use session bean when you have to have a client session and you use entity beans to reflect persistent data and you use message driven bean to receive messages in an asynchronous fashion. And we will talk about these bean types and their usage in gory detail later in this course.
  21. Now let’s talk about JMS, Java Messaging Service. The Java Message Service (JMS) API has been developed by Sun working in close cooperation with the leading enterprise messaging vendors.
  22. As more businesses move towards an e-business strategy, integration with existing Enterprise Information Systems (EIS) becomes a key to success. Enterprises with successful e-businesses need to integrate their existing EISs with new web-based applications. They need to extend the reach of their EISs to support business-to-business (B2B) transactions. Before the J2EE Connector architecture was defined, no specification for the Java platform addressed the problem of providing a standard architecture for integrating EISs to J2EE application server in a standard-fashion. Most EIS vendors and application server vendors use non-standard vendor-specific adaptors to provide connectivity between application servers and enterprise information systems. The J2EE Connector architecture provides a Java solution to the problem of connectivity between the many application servers and EISs already in existence. By using the J2EE Connector architecture, EIS vendors no longer need to customize their product for each application server. Application server vendors who conform to the J2EE Connector architecture do not need to add custom code whenever they want to add connectivity to a enterprise information system. So it solves the m (appservers) times n (enterprise information systems) adaptor problem. That is with connector architecture, the number of adaptors that need to be developed are the same number of enterprise information systems since a common adaptor can be used for all J2EE compliant application servers.
  23. So this picture shows the m times n adaptor problem before connection architecture. Again, the connector architecture will reduce it to 1 times n adaptor scenario.
  24. Now let's talk about a bit on JAAS, Java Authentication and Authorization Service. It is now part of J2SE 1.4. That is, every J2SE 1.4 should have JAAS. Before J2SE 1.4, it used to be an optional package and J2EE 1.3 specifies that JAAS is to be supported by any J2EE 1.3 compliant implementation.
  25. JAAS addresses both authentication and authorization. So let's talk about authentication aspect of JAAS first. JAAS provides pluggable authentication framework. It is expected that different business organizations would employ different authentication schemes. Examples of authentication schemes they might use include userid/password based authentication, smartcard, Kerberos, or Biometric authentication. The idea of JAAS pluggable authentication framework is to allow Java application that performs the authentication to be portable regardless of the underlying authentication schemes. So JAAS provides authentication scheme independent API that can be used by the Java application. There is also login configuration file that contains information on the authentication schemes that are deployed for a particular operational environment. And this login configuration file will be read by JAAS runtime.
  26. This picture shows the pluggable authentication framework of JAAS. The application uses the API that is provided by the JAAS runtime implementation. So the boxes of purple color represents the implementation code that is provided by the JAAS. And this code reads the login configuration file during runtime. And each authentication scheme should provide a class file that is compliant to loginModule service provider interface that JAAS architecture defines.
  27. Now let's go over other Java programming APIs and technologies that constitute J2EE.
  28. JNDI stands for Java naming and directory interface and it is a common method for locating resources or objects under J2EE framework. JNDI is utilized by J2EE applications to locate resources and objects in a portable fashion. That is, in your application, you are using a symbolic name to refer an object assuming that symbolic name has been configured to real object reference or resource by the system administrator. Because the system administrator can configure the association of the symbolic name and actual object at the time of deployment, the code portability is still assured.
  29. With J2EE 1.2 and recently with 1.3, pretty much all architectural components that are considered as fundamental aspects of J2EE have been standardized. During the past year or so, J2EE community also has been working on tools standardization mainly in the areas of management, deployment, performance bench mark, and portability because they felt that as more and more J2EE applications and platforms are being deployed, these issues are increasingly becoming more important. So let's talk about, the J2EE Management Specification effort, JSR-77, first. The goal of JSR-77 is to provide server vendors and tool vendors with a standard model for managing the J2EE Platform. What are the things J2EE management is trying to address? First, management applications should be able to discover managed objects and then interpret the data collected in a standard fashion. Second, a single management platform should be able to manage multiple J2EE servers which might be from different vendors. Thirdly, uniform view should be presented regardless what management protocols are used to access the data. For example, whether data is collected using SNMP or WBEM, the data should be consistent. Finally it leverages JMX (Java Management Extension), which is an framework and APIs for creating Java based management agents.
  30. Now let's talk about J2EE deployment. J2EE platform vendors currently implement their own proprietary deployment interface to their server because there is no standard deployment API. This makes it cumbersome for companies who need to deploy J2EE applications over J2EE platforms from different vendors, because they must run the different deploy tool for different servers. A standard deployment API will enable any J2EE application to be deployed by any deployment tool that uses the deployment APIs onto any J2EE compatible environment. In this sense, the standard deployment API functions as a universal remote control that can be used to perform the deployment process over multiple J2EE platforms from different vendors.
  31. Now let's talk about J2EE as an end-to-end architecture. One important aspect of J2EE as an architecture is that it covers end-to-end. That is, it covers from the client tier on the left all the way to the enterprise information systems on the rightmost tier.
  32. This is somewhat simplified J2EE platform architecture. The key point in the picture is that regardless of who is the user of the service that is provided by the J2EE, that is, whether it is B2B application, or B2C application, or web services client, or J2ME based wireless devices, J2EE platform is the platform of choice for implementation because it provides highly scalable, highly available, highly reliable, and high performing implementation platform regardless of the fact that whether the services are exposed as web services or not.
  33. This picture shows the same architecture in which web-tier and EJB tier are more clearly divided.
  34. OK, one of the most significant architectural characteristics of J2EE, in my mind, is its component and container model. So let's talk about it in a bit more detail.
  35. This is what I call the J2EE Container & components diagram. As this diagram illustrates, containers and components are the key concepts of J2EE. As for the relationship between components and containers, as you might have guessed it, the components are running within containers. That is, the containers provides the host execution environments for the components. In this picture, the components are colored in green and the containers are in purple. The types of components within J2EE environment are •Client components that are running on client either as a stand-alone or applet JSP or servlet as web components running inside web container •EJB beans as business components running inside EJB container And you developers are responsible for the implementation of these components. On the other hand, the containers are provided by the platform vendors. The containers provide runtime system services such as life-cycle management of the components, transaction coordination, persistence management, resource pooling The containers are also responsible for providing the enterprise APIs, shown in gold, and the distributed communication protocols, shown in brown. In a typical multi-tier, thin client enterprise application, most of the development effort will be focused on building web-tier components at web-tier and enterprise Java beans at EJB tier..
  36. We touched upon the roles of container and components a bit in the previous slide. Now let’s compare the tasks that are being performed by containers and the ones performed by components side by side. As we talked about in the previous slide, the platform vendors provide containers while you, as application developers, develop your applications in the form of components and deploy them over the containers. As you probably will notice, many of the tasks that the containers perform are system services that a typical enterprise application would need. First., container handles concurrency. That is, it handles concurrent access from multiple clients to your business component so that you don’t have to deal with it. Each platform vendor might use different synchronization schemes to support concurrency, however. Second, containers provide built-in security framework so that implementing secure applications can be a matter of configuring some options on authentication and access control at the time of deployment not at the time of code development. Next, availability and scalability. We mentioned already that platform vendors compete in their implementations especially in the area of availability and scalability. For example, one J2EE container vendor might provide high availability by maintaining session state on a persistent storage. Another vendor might choose to implement it in a different way. Persistence and transaction can be also handled by the container if you choose to do so. Or you might want to implement them on your own in your code, if more customized behavior is desired. Life-cycle management. Containers handle the creation and destruction of your component instances according to its own implementation scheme. Finally management and administration, some vendors might provide better management tool for managing and administering various resources in the container. So what do you have to do as developers? Very little really. You handle only presentation and focus majority of your development effort on building business components.
  37. This container based architecture is the key to J2 EE’s simplicity and flexibility. It decouples the component from the container so both are free to handle their part of the problem in the most effective way. As the slide says, containers don’t have complicated API’s, they exert their control transparently. This gives the container vendors great flexibility to provide innovation that is immediately accessible to all components.
  38. Now I would like to spend sometime talking about various ways J2EE applications can be created. As you will see there is no single fixed way of developing J2EE applications. Some people think that in order to build J2EE application, you have to use EJB. That is not really true. Using EJB is just one way of building J2EE application.
  39. So this slide is just recapturing what I just said. So depending on how you build J2EE applications, they can be in fact in several different forms.
  40. Now you might want to ask which form of J2EE application should I build? The answer is of course “it depends”. It depends on the requirements of application or even non-technical factors such as availability of EJB tier or availability of developer resource.