SlideShare ist ein Scribd-Unternehmen logo
1 von 40
The Latest in
Enterprise JavaBeans
Technology
Simon Ritter
Sun Microsystems, Inc
Technical Topics
•What is Enterprise JavaBeans?
•Objectives of EJB
•Enterprise JavaBeans Architecture
•Enterprise Beans (Session and Entity)
•Advanced EJB Topics
2
What is Enterprise JavaBeans?
• A specification from Sun Microsystems
• Enterprise JavaBeans defines a server component
model for the development and deployment of
Java applications based on a multi-tier,
distributed object architecture
• The Enterprise JavaBeans specification defines:
– A container model
– A definition of the services the container needs to
provide to an Enterprise JavaBean, and vice versa
– How a container should manage Enterprise JavaBeans
3
JavaBeans vs Enterprise JavaBeans
• Enterprise JavaBeans is a framework for
building and deploying server-side Java
components
• JavaBeans is a framework for client-side Java
components
• Conceptually related because both are
components
• The specifications are different
• The specifications do not build on each other
or rely on each other
4
What’s in the EJB Specification
• Goals for the Release
• Roles and Scenarios
• Fundamentals (Scope of EJB)
• Session and Entity Beans
• Transactions, Exceptions, Distribution
• EJB Bean and Container Responsibilities
• API Reference
EJB Vendors
Have to do all the WORK
6
What EJB Accomplishes
You can take any Java class and with little effort
make it a distributed, secure, transactional class
You can take any data source and make the data
source appear to be a collection of Java objects
– Eliminates distinction between data from a database
and any other source
– All information is accessed through Java objects
– All SQL is cleanly encapsulated in Java objects
• true object-oriented programming
• high reusability
– Database objects work with the full Java class library
7
What EJB Means to IT Groups
• Java everywhere - one language, one environment
– Java on the client
– Java in the middle tier
– Java in the database
• Easier to program
• Easier to maintain
• All platforms look the same
8
What EJB Means to Developers
• Developers can focus on writing business logic
rather than writing low-level infrastructure like
data access, concurrency, transactions, threading,
etc.
– Reduces complexity & development time
– Increases quality and reliability
• The knowledge you learn about EJB will be
portable among many different products because
EJB products are based on a common standard
• You will see greater reuse because your code is
located in shareable, server objects
9
What’s Unique About EJB
• Mandates a container model where common
services are declared, not programmed
– At development and/or deployment time, attributes
defining the bean’s transaction and security
characteristics are specified
– At deployment time, the container introspects the
Enterprise JavaBean attributes for the runtime services
it requires and wraps the bean with the required
functionality
– At runtime, the container intercepts all calls to the
object
10
Power of EJB
• Write a simple Java class
• Get a server-based,
transactional and secure class
automatically
• N-Tier made easy
11
Typical EJB Usage Scenario
Enterprise JavaBeans
Architecture
Enterprise JavaBeans Architecture
The EJB architecture specifies the responsibilities
and interactions among EJB entities
 EJB Servers
 Enterprise Beans  EJB Clients
 EJB Containers
EJB Server
EJB Container
Enterprise
Bean
Enterprise
Bean
Java Clients
13
EJB Server
EJB Server
• Provides a Runtime Environment
• The EJB Server provides system services and
manages resources
– Process and thread management
– System resources management
– Database connection pooling and caching
– Management API
14
EJB Server
EJB Container
EJB Container
• Provides a Run-time Environment for an
Enterprise Bean
• Hosts the Enterprise JavaBeans
• Provides services to Enterprise JavaBeans
– Naming
– Life cycle management
– Persistence (state management)
– Transaction Management
– Security
15
EJB Server
Enterprise JavaBeans Components
• A specialized Java class where the real business
logic lives
– May be developer-written or tool-generated
• Distributed over a network
• Transactional & Secure
• Server vendors provide tools that automatically
generate distribution, transaction and security
behavior
EJB Container
Enterprise
Bean
Enterprise
Bean
16
EJB Clients
• Client access is controlled by the container in
which the enterprise Bean is deployed
• Clients locates an Enterprise JavaBean
through Java Naming and Directory Interface
(JNDI)
• RMI is the standard method for accessing a
bean over a network
• CORBA is also supported
EJB Server
EJB Container
Enterprise
Bean
Enterprise
Bean
Java Clients
17
Enterprise Beans
 Enterprise Bean Components
 Session Beans
 Entity Beans
Written by Developer
Generated at Development
Generated at Deployment
Enterprise Bean Contents
• EJB Class is written by the developer
• Home and Remote interfaces and classes
control access to the EJB class
• Deployment Descriptor and MANIFEST
describe security and transactional
characteristics of the bean
20
EJB Jar File
EJB Class
Home
Interface
Remote
Interface
Home
Class
(Implementation)
Remote
Class
(Implementation)
Deployment
Descriptor
The Deployment Descriptor
• Allows declarative customization
• Created at deployment time
• Gives the container instructions on how to
manage the enterprise bean
• Controls behaviors for:
– Transaction
– Security
– Life cycle
– State management
– Persistence
Bean Development Process
EJB Jar File
EJB Class
Home
Interface
Remote
Interface
Home
Class
(Implementation)
Remote
Class
(Implementation)
Deployment
Descriptor
• Implement the EJB Class
• Specify the remote interface
• Specify the home interface
• Specify security and transactional characteristics
using vendor tools (Deployment Descriptor)
• Use vendor tools to
generate supporting
code and package
components in EJB-jar
• Iterate...
21
EJB Class
• A bean has a single Java class at its core
– This class is written by a developer or generated by a tool
• Implements application-specific business logic
• Implements one of the following contracts:
– javax.ejb.EntityBean &
javax.ejb.SessionBean
• These contracts provide for consistent behavior
when activating beans, passivating beans, reading
data, writing data
• Every container can expect these methods in every
bean
22
EJB Jar File
EJB Class
Home
Interface
Remote
Interface
Home
Class
Remote
Class
DD
Manifest
Remote Interface and Class
• Intercepts calls to the EJB Class to add support for:
– Transactions/security/threading
• Remote class has the same methods as the bean
and delegates to the bean for actual behavior
• Remote class checks security and sets up
transaction before delegating method call to the
bean
• Clients can never get a reference
to a bean’s EJB Class, only the
Remote interface
23
Home Interface and Class
EJB Jar File
EJB Class
Home
Interface
Remote
Interface
Home
Class
Remote
Class
DD
Manifest
• Used to get a reference to a bean’s remote
interface
• Provides bean creation services
– myFoo = FooHome.create() instead of
myFoo = new Foo()
– Supports multiple signatures to create EJB
instances
• Similar to class factory in COM
and CORBA
• May be generated by tools that
come with an EJB server
24
EJB Object Interactions
Remote Interface
Implements
Home Interface
Implements
Client
Calls Calls
Remote Class
Bean Class
Delegates
Home Class
Delegates
Returns
Client
Server
25
Comparing Session and Entity
Beans
• Mandatory for EJB 1.0
• Represents a specific
client
(1 instance per client)
• Short-lived
• Transient
• Can be any Java class
• May be transactional
• Optional for EJB 1.0
• Represents underlying
data object or context
(clients share instance)
• Long-lived
• Persistent
• Can be a class that
maps to persistent
data (e.g., database)
• Always transactional
Session Beans Entity Beans
26
Entity and Session Beans --
Typical Architecture
Database
Row 2
Row 7
Java Clients
Entity
Bean
Session
Bean
Session
Bean
Session
Bean
Entity
Bean
27
Session Beans Represents Process
• A transient agent for an individual client that
executes on a server (e.g., ShoppingCart)
• Session beans are often a client of multiple entity
beans
• Implements javax.ejb.SessionBean interface
• State management types for session EJBs
– stateful - session bean may maintain state information
across method calls
– stateless - session bean may be used to service multiple
clients
– a stateless session bean can only have a single no-
argument create() method in its Home interface
Entity Bean Represents State
Implements javax.ejb.EntityBean interface
• Maps a data source to a Java class
– table, view, join or stored procedure in a relational
database
– a set of related records in a database
– legacy data
• Each instance of an entity bean is one row of data
• Each instance of an entity bean is uniquely
identified by a primary key
• An Entity Bean can also have additional methods
for business logic, etc.28
EJB Persistence
• Provides Entity Beans the ability to store and
retrieve their state
• Can be implemented by a bean
– Bean Managed Persistence
• Can be implemented by a container
– Container Managed Persistence
50
Enterprise JavaBean Packaging
EJB Jar File
EJB Class
Home
Interface
Remote
Interface
Home
Class
Remote
Class
DD
Manifest
• Enterprise JavaBeans are comprised of many
Java files
• These files are put in a JAR file
– A JAR file is a ZIP file with a MANIFEST that
describes the contents of the file
– A MANIFEST is a simple text file
• A JAR file can contain more
than one Enterprise JavaBean
35
EJB Supporting
Technologies
 Java Transaction Service (JTS)
 Java Naming and Directory Interface (JNDI)
 The Object Bus (RMI, CORBA)
 Java Security
JavaÂŽ 2 Platform Enterprise
Edition (J2EE)
Go to http://java.sun.com/marketing/enterprise/apis.html
for more information37
Java Transaction Service (JTS)
• JTS is an API specification that is used to
provide a common interface to transaction
managers
• JTS is needed because clients no longer talk
directly to databases, so a database commit is
not accessible to client
• Object-level transactions are provided in
place of database transactions by JTS
• The objects in the middle-tier will eventually
delegate to database for transactions
JTS
Java
Transaction
Service
A Standard
Transaction
Management
API
38
JTS Architecture
EJB Server
Commit
Bean Bean
Container
Transaction
Service
Java Clients
Database Database
39
Java Naming and Directory
Interface (JNDI)
• JNDI is an API specification that is used to
provide naming/directory services
• JNDI can be used to find files, printers, objects,
etc. on a network
• JNDI provides a common API on top of any
directory service product
– JNDI is partially implemented by JavaSoft
– Directory service products (LDAP, DNS, NDS, etc)
implement most of the specification
• JNDI is used in conjunction with RMI and EJB
to locate Enterprise JavaBeans on a server
JNDI
Java Naming
and Directory
Interface
Connectivity to
Enterprise
Naming and
Directory
Services
43
Java Application
JNDI Implementation
Manager
LDAP NDS
JNDI-
COSNaming
JNDI-RMI
Object Object Object
JNDI API
JNDI SPI
JNDI Architecture
JNDI
Java Naming
and Directory
Interface
Connectivity to
Enterprise
Naming and
Directory
Services
Remote Method Invocation (RMI)
• Remote Method Invocation (RMI) is a
standard that allows client computers to
access objects located on a server
– Java Software provides a complete implementation of RMI
– RMI puts a stub on the client computer that looks like the
object but is instead a proxy to the real object located on the
server
– Primary network protocol for RMI is Java Remote Method
Protocol (JRMP)
– RMI is used to make an Enterprise JavaBean accessible to
clients over a network
RMIStub
RMI
Skeleton
Application
Server
Bean
RMI
Java Remote
Method
Invocation
Distributed
Java-to-Java
Applications,
in JDK 1.1
46
Common Object Request
Broker Architecture (CORBA)
• CORBA is a standard for remotely referencing objects
written in any language and calling the methods on
those objects
• CORBA supports multi-language programming
– Client and server do not have to be the same language
• Primary network protocol for CORBA is IIOP
• Enterprise JavaBeans can use CORBA instead of RMI
– Makes the beans accessible from languages other than Java
– Simplifies configuration for organizations that have already
standardized on CORBA before introducing Java and EJB
into the organization
47
Summary
• Enterprise JavaBeans delivers mult-vendor,
OS independent standard for developing web-
based N-tier applications
• Java 2 Platform, Enterprise Edition is the
server-side platform delivering all the
Enterprise APIs

Weitere ähnliche Inhalte

Was ist angesagt?

IBM WebSphere Portal
IBM WebSphere PortalIBM WebSphere Portal
IBM WebSphere Portal
Vincent Perrin
 
WebSphere Portal Technical Overview
WebSphere Portal Technical OverviewWebSphere Portal Technical Overview
WebSphere Portal Technical Overview
Vincent Perrin
 
WebSphere 6.1 Admin Course 1
WebSphere 6.1 Admin Course 1WebSphere 6.1 Admin Course 1
WebSphere 6.1 Admin Course 1
odedns
 
IBM WebSphere Portal - Die nächste Generation
IBM WebSphere Portal - Die nächste GenerationIBM WebSphere Portal - Die nächste Generation
IBM WebSphere Portal - Die nächste Generation
IBM Lotus
 
01. Portal Business Overview
01. Portal Business Overview01. Portal Business Overview
01. Portal Business Overview
Nick Davis
 
01 web sphere portal business overview
01 web sphere portal business overview01 web sphere portal business overview
01 web sphere portal business overview
ygolani
 
WSO2Con2011: Using WSO2 ESB with SAP ERP (Retail)
WSO2Con2011: Using WSO2 ESB with SAP ERP (Retail)WSO2Con2011: Using WSO2 ESB with SAP ERP (Retail)
WSO2Con2011: Using WSO2 ESB with SAP ERP (Retail)
WSO2
 
Java EE 6 Component Model Explained
Java EE 6 Component Model Explained Java EE 6 Component Model Explained
Java EE 6 Component Model Explained
Shreedhar Ganapathy
 

Was ist angesagt? (20)

Java language pppppt
Java language ppppptJava language pppppt
Java language pppppt
 
IBM WebSphere Portal
IBM WebSphere PortalIBM WebSphere Portal
IBM WebSphere Portal
 
WebSphere Portal Technical Overview
WebSphere Portal Technical OverviewWebSphere Portal Technical Overview
WebSphere Portal Technical Overview
 
WebSphere 6.1 Admin Course 1
WebSphere 6.1 Admin Course 1WebSphere 6.1 Admin Course 1
WebSphere 6.1 Admin Course 1
 
Integrating IBM Web Sphere Portal With Web Analytic Hosted And Non Hosted Sit...
Integrating IBM Web Sphere Portal With Web Analytic Hosted And Non Hosted Sit...Integrating IBM Web Sphere Portal With Web Analytic Hosted And Non Hosted Sit...
Integrating IBM Web Sphere Portal With Web Analytic Hosted And Non Hosted Sit...
 
WebSphere Application Server Information Resources
WebSphere Application Server Information ResourcesWebSphere Application Server Information Resources
WebSphere Application Server Information Resources
 
IBM WebSphere Portal - Die nächste Generation
IBM WebSphere Portal - Die nächste GenerationIBM WebSphere Portal - Die nächste Generation
IBM WebSphere Portal - Die nächste Generation
 
JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6
 
Overview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUGOverview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUG
 
What's new in WebSphere Portal 8 roundtable 27 september 2012
What's new in WebSphere Portal 8 roundtable 27 september 2012What's new in WebSphere Portal 8 roundtable 27 september 2012
What's new in WebSphere Portal 8 roundtable 27 september 2012
 
Websphere Portal
Websphere PortalWebsphere Portal
Websphere Portal
 
Websphere Application Server V8.5
Websphere Application Server V8.5Websphere Application Server V8.5
Websphere Application Server V8.5
 
01. Portal Business Overview
01. Portal Business Overview01. Portal Business Overview
01. Portal Business Overview
 
Sun Java EE 6 Overview
Sun Java EE 6 OverviewSun Java EE 6 Overview
Sun Java EE 6 Overview
 
WebSphere application server 8.5.5 - quick overview
WebSphere application server 8.5.5 - quick overviewWebSphere application server 8.5.5 - quick overview
WebSphere application server 8.5.5 - quick overview
 
Java Enterprise Edition 6 Overview
Java Enterprise Edition 6 OverviewJava Enterprise Edition 6 Overview
Java Enterprise Edition 6 Overview
 
01 web sphere portal business overview
01 web sphere portal business overview01 web sphere portal business overview
01 web sphere portal business overview
 
What's new in Portal and WCM 8.5
What's new in Portal and WCM 8.5What's new in Portal and WCM 8.5
What's new in Portal and WCM 8.5
 
WSO2Con2011: Using WSO2 ESB with SAP ERP (Retail)
WSO2Con2011: Using WSO2 ESB with SAP ERP (Retail)WSO2Con2011: Using WSO2 ESB with SAP ERP (Retail)
WSO2Con2011: Using WSO2 ESB with SAP ERP (Retail)
 
Java EE 6 Component Model Explained
Java EE 6 Component Model Explained Java EE 6 Component Model Explained
Java EE 6 Component Model Explained
 

Ähnlich wie The Latest in Enterprise JavaBeans Technology

Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010
Rohit Kelapure
 
Introduction to java_ee
Introduction to java_eeIntroduction to java_ee
Introduction to java_ee
Yogesh Bindwal
 
Enterprise beans
Enterprise beansEnterprise beans
Enterprise beans
vpulec
 

Ähnlich wie The Latest in Enterprise JavaBeans Technology (20)

EJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another IntroductionEJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another Introduction
 
EJB 3.0 and J2EE
EJB 3.0 and J2EEEJB 3.0 and J2EE
EJB 3.0 and J2EE
 
Unite5-EJB-2019.ppt
Unite5-EJB-2019.pptUnite5-EJB-2019.ppt
Unite5-EJB-2019.ppt
 
Ch4 ejb
Ch4 ejbCh4 ejb
Ch4 ejb
 
Lecture 8 Enterprise Java Beans (EJB)
Lecture 8  Enterprise Java Beans (EJB)Lecture 8  Enterprise Java Beans (EJB)
Lecture 8 Enterprise Java Beans (EJB)
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010
 
Java online training from hyderabad
Java online training from hyderabadJava online training from hyderabad
Java online training from hyderabad
 
Advance java1.1
Advance java1.1Advance java1.1
Advance java1.1
 
Ejb (1)
Ejb (1)Ejb (1)
Ejb (1)
 
Unit4wt
Unit4wtUnit4wt
Unit4wt
 
Unit4wt
Unit4wtUnit4wt
Unit4wt
 
Java Online Training
Java Online TrainingJava Online Training
Java Online Training
 
Virtual classroom
Virtual classroomVirtual classroom
Virtual classroom
 
Ejb course-in-mumbai
Ejb course-in-mumbaiEjb course-in-mumbai
Ejb course-in-mumbai
 
Introduction to java_ee
Introduction to java_eeIntroduction to java_ee
Introduction to java_ee
 
Ejb notes
Ejb notesEjb notes
Ejb notes
 
UNIT 4.pptx
UNIT 4.pptxUNIT 4.pptx
UNIT 4.pptx
 
Enterprise beans
Enterprise beansEnterprise beans
Enterprise beans
 
Web Sphere Administration guide – Packaging and Deploying Jee Applications
Web Sphere Administration guide – Packaging and Deploying Jee ApplicationsWeb Sphere Administration guide – Packaging and Deploying Jee Applications
Web Sphere Administration guide – Packaging and Deploying Jee Applications
 
Lecture 19 dynamic web - java - part 1
Lecture 19   dynamic web - java - part 1Lecture 19   dynamic web - java - part 1
Lecture 19 dynamic web - java - part 1
 

Mehr von Simon Ritter

Mehr von Simon Ritter (20)

Cloud Native Compiler
Cloud Native CompilerCloud Native Compiler
Cloud Native Compiler
 
Java On CRaC
Java On CRaCJava On CRaC
Java On CRaC
 
The Art of Java Type Patterns
The Art of Java Type PatternsThe Art of Java Type Patterns
The Art of Java Type Patterns
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java Workshop
 
Java performance monitoring
Java performance monitoringJava performance monitoring
Java performance monitoring
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java Workshop
 
Getting the Most From Modern Java
Getting the Most From Modern JavaGetting the Most From Modern Java
Getting the Most From Modern Java
 
Building a Better JVM
Building a Better JVMBuilding a Better JVM
Building a Better JVM
 
JDK 14 Lots of New Features
JDK 14 Lots of New FeaturesJDK 14 Lots of New Features
JDK 14 Lots of New Features
 
Java after 8
Java after 8Java after 8
Java after 8
 
How to Choose a JDK
How to Choose a JDKHow to Choose a JDK
How to Choose a JDK
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
Is Java Still Free?
Is Java Still Free?Is Java Still Free?
Is Java Still Free?
 
Moving Towards JDK 12
Moving Towards JDK 12Moving Towards JDK 12
Moving Towards JDK 12
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
 
Java Is Still Free
Java Is Still FreeJava Is Still Free
Java Is Still Free
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
 
JDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep DiveJDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep Dive
 
JDK 9 Deep Dive
JDK 9 Deep DiveJDK 9 Deep Dive
JDK 9 Deep Dive
 
Java Support: What's changing
Java Support:  What's changingJava Support:  What's changing
Java Support: What's changing
 

KĂźrzlich hochgeladen

%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 

KĂźrzlich hochgeladen (20)

MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 

The Latest in Enterprise JavaBeans Technology

  • 1. The Latest in Enterprise JavaBeans Technology Simon Ritter Sun Microsystems, Inc
  • 2. Technical Topics •What is Enterprise JavaBeans? •Objectives of EJB •Enterprise JavaBeans Architecture •Enterprise Beans (Session and Entity) •Advanced EJB Topics 2
  • 3. What is Enterprise JavaBeans? • A specification from Sun Microsystems • Enterprise JavaBeans defines a server component model for the development and deployment of Java applications based on a multi-tier, distributed object architecture • The Enterprise JavaBeans specification defines: – A container model – A definition of the services the container needs to provide to an Enterprise JavaBean, and vice versa – How a container should manage Enterprise JavaBeans 3
  • 4. JavaBeans vs Enterprise JavaBeans • Enterprise JavaBeans is a framework for building and deploying server-side Java components • JavaBeans is a framework for client-side Java components • Conceptually related because both are components • The specifications are different • The specifications do not build on each other or rely on each other 4
  • 5. What’s in the EJB Specification • Goals for the Release • Roles and Scenarios • Fundamentals (Scope of EJB) • Session and Entity Beans • Transactions, Exceptions, Distribution • EJB Bean and Container Responsibilities • API Reference EJB Vendors Have to do all the WORK 6
  • 6. What EJB Accomplishes You can take any Java class and with little effort make it a distributed, secure, transactional class You can take any data source and make the data source appear to be a collection of Java objects – Eliminates distinction between data from a database and any other source – All information is accessed through Java objects – All SQL is cleanly encapsulated in Java objects • true object-oriented programming • high reusability – Database objects work with the full Java class library 7
  • 7. What EJB Means to IT Groups • Java everywhere - one language, one environment – Java on the client – Java in the middle tier – Java in the database • Easier to program • Easier to maintain • All platforms look the same 8
  • 8. What EJB Means to Developers • Developers can focus on writing business logic rather than writing low-level infrastructure like data access, concurrency, transactions, threading, etc. – Reduces complexity & development time – Increases quality and reliability • The knowledge you learn about EJB will be portable among many different products because EJB products are based on a common standard • You will see greater reuse because your code is located in shareable, server objects 9
  • 9. What’s Unique About EJB • Mandates a container model where common services are declared, not programmed – At development and/or deployment time, attributes defining the bean’s transaction and security characteristics are specified – At deployment time, the container introspects the Enterprise JavaBean attributes for the runtime services it requires and wraps the bean with the required functionality – At runtime, the container intercepts all calls to the object 10
  • 10. Power of EJB • Write a simple Java class • Get a server-based, transactional and secure class automatically • N-Tier made easy 11
  • 11. Typical EJB Usage Scenario
  • 13. Enterprise JavaBeans Architecture The EJB architecture specifies the responsibilities and interactions among EJB entities  EJB Servers  Enterprise Beans  EJB Clients  EJB Containers EJB Server EJB Container Enterprise Bean Enterprise Bean Java Clients 13
  • 14. EJB Server EJB Server • Provides a Runtime Environment • The EJB Server provides system services and manages resources – Process and thread management – System resources management – Database connection pooling and caching – Management API 14
  • 15. EJB Server EJB Container EJB Container • Provides a Run-time Environment for an Enterprise Bean • Hosts the Enterprise JavaBeans • Provides services to Enterprise JavaBeans – Naming – Life cycle management – Persistence (state management) – Transaction Management – Security 15
  • 16. EJB Server Enterprise JavaBeans Components • A specialized Java class where the real business logic lives – May be developer-written or tool-generated • Distributed over a network • Transactional & Secure • Server vendors provide tools that automatically generate distribution, transaction and security behavior EJB Container Enterprise Bean Enterprise Bean 16
  • 17. EJB Clients • Client access is controlled by the container in which the enterprise Bean is deployed • Clients locates an Enterprise JavaBean through Java Naming and Directory Interface (JNDI) • RMI is the standard method for accessing a bean over a network • CORBA is also supported EJB Server EJB Container Enterprise Bean Enterprise Bean Java Clients 17
  • 18. Enterprise Beans  Enterprise Bean Components  Session Beans  Entity Beans
  • 19. Written by Developer Generated at Development Generated at Deployment Enterprise Bean Contents • EJB Class is written by the developer • Home and Remote interfaces and classes control access to the EJB class • Deployment Descriptor and MANIFEST describe security and transactional characteristics of the bean 20 EJB Jar File EJB Class Home Interface Remote Interface Home Class (Implementation) Remote Class (Implementation) Deployment Descriptor
  • 20. The Deployment Descriptor • Allows declarative customization • Created at deployment time • Gives the container instructions on how to manage the enterprise bean • Controls behaviors for: – Transaction – Security – Life cycle – State management – Persistence
  • 21. Bean Development Process EJB Jar File EJB Class Home Interface Remote Interface Home Class (Implementation) Remote Class (Implementation) Deployment Descriptor • Implement the EJB Class • Specify the remote interface • Specify the home interface • Specify security and transactional characteristics using vendor tools (Deployment Descriptor) • Use vendor tools to generate supporting code and package components in EJB-jar • Iterate... 21
  • 22. EJB Class • A bean has a single Java class at its core – This class is written by a developer or generated by a tool • Implements application-specific business logic • Implements one of the following contracts: – javax.ejb.EntityBean & javax.ejb.SessionBean • These contracts provide for consistent behavior when activating beans, passivating beans, reading data, writing data • Every container can expect these methods in every bean 22
  • 23. EJB Jar File EJB Class Home Interface Remote Interface Home Class Remote Class DD Manifest Remote Interface and Class • Intercepts calls to the EJB Class to add support for: – Transactions/security/threading • Remote class has the same methods as the bean and delegates to the bean for actual behavior • Remote class checks security and sets up transaction before delegating method call to the bean • Clients can never get a reference to a bean’s EJB Class, only the Remote interface 23
  • 24. Home Interface and Class EJB Jar File EJB Class Home Interface Remote Interface Home Class Remote Class DD Manifest • Used to get a reference to a bean’s remote interface • Provides bean creation services – myFoo = FooHome.create() instead of myFoo = new Foo() – Supports multiple signatures to create EJB instances • Similar to class factory in COM and CORBA • May be generated by tools that come with an EJB server 24
  • 25. EJB Object Interactions Remote Interface Implements Home Interface Implements Client Calls Calls Remote Class Bean Class Delegates Home Class Delegates Returns Client Server 25
  • 26. Comparing Session and Entity Beans • Mandatory for EJB 1.0 • Represents a specific client (1 instance per client) • Short-lived • Transient • Can be any Java class • May be transactional • Optional for EJB 1.0 • Represents underlying data object or context (clients share instance) • Long-lived • Persistent • Can be a class that maps to persistent data (e.g., database) • Always transactional Session Beans Entity Beans 26
  • 27. Entity and Session Beans -- Typical Architecture Database Row 2 Row 7 Java Clients Entity Bean Session Bean Session Bean Session Bean Entity Bean
  • 28. 27 Session Beans Represents Process • A transient agent for an individual client that executes on a server (e.g., ShoppingCart) • Session beans are often a client of multiple entity beans • Implements javax.ejb.SessionBean interface • State management types for session EJBs – stateful - session bean may maintain state information across method calls – stateless - session bean may be used to service multiple clients – a stateless session bean can only have a single no- argument create() method in its Home interface
  • 29. Entity Bean Represents State Implements javax.ejb.EntityBean interface • Maps a data source to a Java class – table, view, join or stored procedure in a relational database – a set of related records in a database – legacy data • Each instance of an entity bean is one row of data • Each instance of an entity bean is uniquely identified by a primary key • An Entity Bean can also have additional methods for business logic, etc.28
  • 30. EJB Persistence • Provides Entity Beans the ability to store and retrieve their state • Can be implemented by a bean – Bean Managed Persistence • Can be implemented by a container – Container Managed Persistence 50
  • 31. Enterprise JavaBean Packaging EJB Jar File EJB Class Home Interface Remote Interface Home Class Remote Class DD Manifest • Enterprise JavaBeans are comprised of many Java files • These files are put in a JAR file – A JAR file is a ZIP file with a MANIFEST that describes the contents of the file – A MANIFEST is a simple text file • A JAR file can contain more than one Enterprise JavaBean 35
  • 32. EJB Supporting Technologies  Java Transaction Service (JTS)  Java Naming and Directory Interface (JNDI)  The Object Bus (RMI, CORBA)  Java Security
  • 33. JavaÂŽ 2 Platform Enterprise Edition (J2EE) Go to http://java.sun.com/marketing/enterprise/apis.html for more information37
  • 34. Java Transaction Service (JTS) • JTS is an API specification that is used to provide a common interface to transaction managers • JTS is needed because clients no longer talk directly to databases, so a database commit is not accessible to client • Object-level transactions are provided in place of database transactions by JTS • The objects in the middle-tier will eventually delegate to database for transactions JTS Java Transaction Service A Standard Transaction Management API 38
  • 35. JTS Architecture EJB Server Commit Bean Bean Container Transaction Service Java Clients Database Database 39
  • 36. Java Naming and Directory Interface (JNDI) • JNDI is an API specification that is used to provide naming/directory services • JNDI can be used to find files, printers, objects, etc. on a network • JNDI provides a common API on top of any directory service product – JNDI is partially implemented by JavaSoft – Directory service products (LDAP, DNS, NDS, etc) implement most of the specification • JNDI is used in conjunction with RMI and EJB to locate Enterprise JavaBeans on a server JNDI Java Naming and Directory Interface Connectivity to Enterprise Naming and Directory Services 43
  • 37. Java Application JNDI Implementation Manager LDAP NDS JNDI- COSNaming JNDI-RMI Object Object Object JNDI API JNDI SPI JNDI Architecture JNDI Java Naming and Directory Interface Connectivity to Enterprise Naming and Directory Services
  • 38. Remote Method Invocation (RMI) • Remote Method Invocation (RMI) is a standard that allows client computers to access objects located on a server – Java Software provides a complete implementation of RMI – RMI puts a stub on the client computer that looks like the object but is instead a proxy to the real object located on the server – Primary network protocol for RMI is Java Remote Method Protocol (JRMP) – RMI is used to make an Enterprise JavaBean accessible to clients over a network RMIStub RMI Skeleton Application Server Bean RMI Java Remote Method Invocation Distributed Java-to-Java Applications, in JDK 1.1 46
  • 39. Common Object Request Broker Architecture (CORBA) • CORBA is a standard for remotely referencing objects written in any language and calling the methods on those objects • CORBA supports multi-language programming – Client and server do not have to be the same language • Primary network protocol for CORBA is IIOP • Enterprise JavaBeans can use CORBA instead of RMI – Makes the beans accessible from languages other than Java – Simplifies configuration for organizations that have already standardized on CORBA before introducing Java and EJB into the organization 47
  • 40. Summary • Enterprise JavaBeans delivers mult-vendor, OS independent standard for developing web- based N-tier applications • Java 2 Platform, Enterprise Edition is the server-side platform delivering all the Enterprise APIs