SlideShare una empresa de Scribd logo
1 de 25
Architectural Overview of EJB Session 2
Session Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Review of Session 1 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Stages in Developing Business Solutions Grouping of resuable modules by vendors Running of these EJB components on multi-tier applications Combining the components into a workflow Deploying the whole system over multiple systems across the network Application Servers are provided  by middleware  vendors. These servers are needed  to run the  components
Parties Involved in EJB Deployment Bean  Provider Parties in EJB Deployment Container Provider The Deployer Server  Provider Application  Assembler System  Administrator Provides reusable components Provides low-level execution environment Supplies Application server logic Puts together components and applications Deploys prewritten components Monitors functioning EJB Cont/ Server
Logical EJB Architecture  Client Home Interface Remote Interface EJB Server Home Object EJB Object JDBC Database
The EJB Container THE SERVER THE EJB CONTAINER THE CLIENT Outside World The container which resides insides the server acts as a BUFFER between the the beans and the outside world. Connects   clients to the Beans Managing Life-cycle of a Bean
The EJB Server Server Container 1 Container 2 Client Responsibilities Process and Thread  Management System Resource Management Database Connection
The Application Assembler and EJB Deployer Assembled application EJB Deployer Operational Environments Application  Assembler Server Side Client Side
Services provided by the Container and Server Container/Server Transaction support Support for management  of multiple instances Persistence support Security Support
Security Support EJB The Access  Control List Functionality 1 Functionality 2 Functionality 3 The ACL comprises the list of persons who are allowed to access particular sections of functionality.
Persistent Support Persistence can be defined as saving the state of an object to a constant storage. The state  of the  object  is maintained in this  constant  storage
Support for Management of Multiple Instances Instance Passivation Instance  pooling In order to perform timely servicing to the client the container performs a variety of tasks. Server Tasks Database  connection pooling
Enterprise Beans The Enterprise Java Bean is a server-side component that is employed on a distributed multi-tier environment.  Enterprise Bean Session Bean Entity Bean Stateful   Bean Stateless   Bean BMP CMP Message Driven Beans
Features of an EJB Container Resource Management and Life Cycle  Management of a Bean Features State Management Transactions Security Persistence Remote Accessibility and location transparency
Resource Management and Life Cycle of a bean ,[object Object],[object Object],[object Object],[object Object],[object Object]
State  Management Fills up  Application in a site Page 1  Submits the form Application in a site Page 2  User takes time as he reads the contents in the page Client Container is used  for another process  while user takes time to read
Transactions Operation2 Operation1 Operation3 Executed as  one unit  of work Multiple users use the same  data
Transactions-Two phase commit protocol Prepare Phase Prepare  message Commit Phase Commit/Rollback  Transaction Request All databases issue commit request Commit/Rollback  Transaction Request Records results  of transaction Transaction Coordinator Database 1 Database 3 Database 2
Remote Accessibility  Bean Bean Bean Deployed  across multiple  tiers Bean Bean Bean Networked after deployment Not-Networked
Location Transparency   Component    Component  Clients do not know where the components are, and whether these components  are  local or remote
Specialized Containers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Summary - 1 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Summary - 2 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Summary - 3 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Más contenido relacionado

La actualidad más candente

Ubiquity final design_wireframes
Ubiquity final design_wireframesUbiquity final design_wireframes
Ubiquity final design_wireframesJSLKent
 
JSUG - Seam by Florian Motlik
JSUG - Seam by Florian MotlikJSUG - Seam by Florian Motlik
JSUG - Seam by Florian MotlikChristoph Pickl
 
DistributedMediaApplicationProject
DistributedMediaApplicationProjectDistributedMediaApplicationProject
DistributedMediaApplicationProjectLakshmi Sreejith
 
Hierarchical architecture
Hierarchical architectureHierarchical architecture
Hierarchical architecturebrigeit
 
Chapter 10:Understanding Java Related Platforms and Integration Technologies
Chapter 10:Understanding Java Related Platforms and Integration TechnologiesChapter 10:Understanding Java Related Platforms and Integration Technologies
Chapter 10:Understanding Java Related Platforms and Integration TechnologiesIt Academy
 
Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to strutsAnup72
 
Chapter2
Chapter2Chapter2
Chapter2suks_87
 
Enterprise Java Beans - EJB
Enterprise Java Beans - EJBEnterprise Java Beans - EJB
Enterprise Java Beans - EJBPeter R. Egli
 
Case Study for Dotnetnuke Intranet Portal for MNC’s
Case Study for Dotnetnuke Intranet Portal for MNC’sCase Study for Dotnetnuke Intranet Portal for MNC’s
Case Study for Dotnetnuke Intranet Portal for MNC’sMike Taylor
 

La actualidad más candente (20)

enterprise java bean
enterprise java beanenterprise java bean
enterprise java bean
 
Ubiquity final design_wireframes
Ubiquity final design_wireframesUbiquity final design_wireframes
Ubiquity final design_wireframes
 
PAC
PACPAC
PAC
 
Client server
Client serverClient server
Client server
 
JSUG - Seam by Florian Motlik
JSUG - Seam by Florian MotlikJSUG - Seam by Florian Motlik
JSUG - Seam by Florian Motlik
 
DistributedMediaApplicationProject
DistributedMediaApplicationProjectDistributedMediaApplicationProject
DistributedMediaApplicationProject
 
EJB3 Basics
EJB3 BasicsEJB3 Basics
EJB3 Basics
 
Hierarchical architecture
Hierarchical architectureHierarchical architecture
Hierarchical architecture
 
Introduction to EJB
Introduction to EJBIntroduction to EJB
Introduction to EJB
 
Chapter 10:Understanding Java Related Platforms and Integration Technologies
Chapter 10:Understanding Java Related Platforms and Integration TechnologiesChapter 10:Understanding Java Related Platforms and Integration Technologies
Chapter 10:Understanding Java Related Platforms and Integration Technologies
 
EJB 3.1 by Bert Ertman
EJB 3.1 by Bert ErtmanEJB 3.1 by Bert Ertman
EJB 3.1 by Bert Ertman
 
Stephy
StephyStephy
Stephy
 
Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to struts
 
Chapter2
Chapter2Chapter2
Chapter2
 
Java bean
Java beanJava bean
Java bean
 
Enterprise Java Beans - EJB
Enterprise Java Beans - EJBEnterprise Java Beans - EJB
Enterprise Java Beans - EJB
 
Month 3 report
Month 3 reportMonth 3 report
Month 3 report
 
Client server architecture
Client server architectureClient server architecture
Client server architecture
 
EJB 3.0 and J2EE
EJB 3.0 and J2EEEJB 3.0 and J2EE
EJB 3.0 and J2EE
 
Case Study for Dotnetnuke Intranet Portal for MNC’s
Case Study for Dotnetnuke Intranet Portal for MNC’sCase Study for Dotnetnuke Intranet Portal for MNC’s
Case Study for Dotnetnuke Intranet Portal for MNC’s
 

Similar a Session 2 Tp2 (20)

Ejb notes
Ejb notesEjb notes
Ejb notes
 
Unite5-EJB-2019.ppt
Unite5-EJB-2019.pptUnite5-EJB-2019.ppt
Unite5-EJB-2019.ppt
 
ADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.pptADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.ppt
 
Ch4 ejb
Ch4 ejbCh4 ejb
Ch4 ejb
 
EJB 2
EJB 2EJB 2
EJB 2
 
Session 9 Tp9
Session 9 Tp9Session 9 Tp9
Session 9 Tp9
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
 
Session 3 Tp3
Session 3 Tp3Session 3 Tp3
Session 3 Tp3
 
J2 ee architecture
J2 ee architectureJ2 ee architecture
J2 ee architecture
 
Aravind vinnakota ejb_architecture
Aravind vinnakota ejb_architectureAravind vinnakota ejb_architecture
Aravind vinnakota ejb_architecture
 
Introcution to EJB
Introcution to EJBIntrocution to EJB
Introcution to EJB
 
J2EEFeb11.ppt
J2EEFeb11.pptJ2EEFeb11.ppt
J2EEFeb11.ppt
 
EJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another IntroductionEJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another Introduction
 
The Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans TechnologyThe Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans Technology
 
J2EEFeb11 (1).ppt
J2EEFeb11 (1).pptJ2EEFeb11 (1).ppt
J2EEFeb11 (1).ppt
 
Ejb - september 2006
Ejb  - september 2006Ejb  - september 2006
Ejb - september 2006
 
Virtual classroom
Virtual classroomVirtual classroom
Virtual classroom
 
TY.BSc.IT Java QB U5&6
TY.BSc.IT Java QB U5&6TY.BSc.IT Java QB U5&6
TY.BSc.IT Java QB U5&6
 
UNIT 4.pptx
UNIT 4.pptxUNIT 4.pptx
UNIT 4.pptx
 
B Shilpa
B ShilpaB Shilpa
B Shilpa
 

Más de phanleson

Learning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with SparkLearning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with Sparkphanleson
 
Firewall - Network Defense in Depth Firewalls
Firewall - Network Defense in Depth FirewallsFirewall - Network Defense in Depth Firewalls
Firewall - Network Defense in Depth Firewallsphanleson
 
Mobile Security - Wireless hacking
Mobile Security - Wireless hackingMobile Security - Wireless hacking
Mobile Security - Wireless hackingphanleson
 
Authentication in wireless - Security in Wireless Protocols
Authentication in wireless - Security in Wireless ProtocolsAuthentication in wireless - Security in Wireless Protocols
Authentication in wireless - Security in Wireless Protocolsphanleson
 
E-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server AttacksE-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server Attacksphanleson
 
Hacking web applications
Hacking web applicationsHacking web applications
Hacking web applicationsphanleson
 
HBase In Action - Chapter 04: HBase table design
HBase In Action - Chapter 04: HBase table designHBase In Action - Chapter 04: HBase table design
HBase In Action - Chapter 04: HBase table designphanleson
 
HBase In Action - Chapter 10 - Operations
HBase In Action - Chapter 10 - OperationsHBase In Action - Chapter 10 - Operations
HBase In Action - Chapter 10 - Operationsphanleson
 
Hbase in action - Chapter 09: Deploying HBase
Hbase in action - Chapter 09: Deploying HBaseHbase in action - Chapter 09: Deploying HBase
Hbase in action - Chapter 09: Deploying HBasephanleson
 
Learning spark ch11 - Machine Learning with MLlib
Learning spark ch11 - Machine Learning with MLlibLearning spark ch11 - Machine Learning with MLlib
Learning spark ch11 - Machine Learning with MLlibphanleson
 
Learning spark ch10 - Spark Streaming
Learning spark ch10 - Spark StreamingLearning spark ch10 - Spark Streaming
Learning spark ch10 - Spark Streamingphanleson
 
Learning spark ch09 - Spark SQL
Learning spark ch09 - Spark SQLLearning spark ch09 - Spark SQL
Learning spark ch09 - Spark SQLphanleson
 
Learning spark ch07 - Running on a Cluster
Learning spark ch07 - Running on a ClusterLearning spark ch07 - Running on a Cluster
Learning spark ch07 - Running on a Clusterphanleson
 
Learning spark ch06 - Advanced Spark Programming
Learning spark ch06 - Advanced Spark ProgrammingLearning spark ch06 - Advanced Spark Programming
Learning spark ch06 - Advanced Spark Programmingphanleson
 
Learning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your DataLearning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your Dataphanleson
 
Learning spark ch04 - Working with Key/Value Pairs
Learning spark ch04 - Working with Key/Value PairsLearning spark ch04 - Working with Key/Value Pairs
Learning spark ch04 - Working with Key/Value Pairsphanleson
 
Learning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with SparkLearning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with Sparkphanleson
 
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about LibertagiaHướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagiaphanleson
 
Lecture 1 - Getting to know XML
Lecture 1 - Getting to know XMLLecture 1 - Getting to know XML
Lecture 1 - Getting to know XMLphanleson
 
Lecture 4 - Adding XTHML for the Web
Lecture  4 - Adding XTHML for the WebLecture  4 - Adding XTHML for the Web
Lecture 4 - Adding XTHML for the Webphanleson
 

Más de phanleson (20)

Learning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with SparkLearning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with Spark
 
Firewall - Network Defense in Depth Firewalls
Firewall - Network Defense in Depth FirewallsFirewall - Network Defense in Depth Firewalls
Firewall - Network Defense in Depth Firewalls
 
Mobile Security - Wireless hacking
Mobile Security - Wireless hackingMobile Security - Wireless hacking
Mobile Security - Wireless hacking
 
Authentication in wireless - Security in Wireless Protocols
Authentication in wireless - Security in Wireless ProtocolsAuthentication in wireless - Security in Wireless Protocols
Authentication in wireless - Security in Wireless Protocols
 
E-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server AttacksE-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server Attacks
 
Hacking web applications
Hacking web applicationsHacking web applications
Hacking web applications
 
HBase In Action - Chapter 04: HBase table design
HBase In Action - Chapter 04: HBase table designHBase In Action - Chapter 04: HBase table design
HBase In Action - Chapter 04: HBase table design
 
HBase In Action - Chapter 10 - Operations
HBase In Action - Chapter 10 - OperationsHBase In Action - Chapter 10 - Operations
HBase In Action - Chapter 10 - Operations
 
Hbase in action - Chapter 09: Deploying HBase
Hbase in action - Chapter 09: Deploying HBaseHbase in action - Chapter 09: Deploying HBase
Hbase in action - Chapter 09: Deploying HBase
 
Learning spark ch11 - Machine Learning with MLlib
Learning spark ch11 - Machine Learning with MLlibLearning spark ch11 - Machine Learning with MLlib
Learning spark ch11 - Machine Learning with MLlib
 
Learning spark ch10 - Spark Streaming
Learning spark ch10 - Spark StreamingLearning spark ch10 - Spark Streaming
Learning spark ch10 - Spark Streaming
 
Learning spark ch09 - Spark SQL
Learning spark ch09 - Spark SQLLearning spark ch09 - Spark SQL
Learning spark ch09 - Spark SQL
 
Learning spark ch07 - Running on a Cluster
Learning spark ch07 - Running on a ClusterLearning spark ch07 - Running on a Cluster
Learning spark ch07 - Running on a Cluster
 
Learning spark ch06 - Advanced Spark Programming
Learning spark ch06 - Advanced Spark ProgrammingLearning spark ch06 - Advanced Spark Programming
Learning spark ch06 - Advanced Spark Programming
 
Learning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your DataLearning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your Data
 
Learning spark ch04 - Working with Key/Value Pairs
Learning spark ch04 - Working with Key/Value PairsLearning spark ch04 - Working with Key/Value Pairs
Learning spark ch04 - Working with Key/Value Pairs
 
Learning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with SparkLearning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with Spark
 
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about LibertagiaHướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
 
Lecture 1 - Getting to know XML
Lecture 1 - Getting to know XMLLecture 1 - Getting to know XML
Lecture 1 - Getting to know XML
 
Lecture 4 - Adding XTHML for the Web
Lecture  4 - Adding XTHML for the WebLecture  4 - Adding XTHML for the Web
Lecture 4 - Adding XTHML for the Web
 

Último

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Último (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Session 2 Tp2

  • 2.
  • 3.
  • 4. Stages in Developing Business Solutions Grouping of resuable modules by vendors Running of these EJB components on multi-tier applications Combining the components into a workflow Deploying the whole system over multiple systems across the network Application Servers are provided by middleware vendors. These servers are needed to run the components
  • 5. Parties Involved in EJB Deployment Bean Provider Parties in EJB Deployment Container Provider The Deployer Server Provider Application Assembler System Administrator Provides reusable components Provides low-level execution environment Supplies Application server logic Puts together components and applications Deploys prewritten components Monitors functioning EJB Cont/ Server
  • 6. Logical EJB Architecture Client Home Interface Remote Interface EJB Server Home Object EJB Object JDBC Database
  • 7. The EJB Container THE SERVER THE EJB CONTAINER THE CLIENT Outside World The container which resides insides the server acts as a BUFFER between the the beans and the outside world. Connects clients to the Beans Managing Life-cycle of a Bean
  • 8. The EJB Server Server Container 1 Container 2 Client Responsibilities Process and Thread Management System Resource Management Database Connection
  • 9. The Application Assembler and EJB Deployer Assembled application EJB Deployer Operational Environments Application Assembler Server Side Client Side
  • 10. Services provided by the Container and Server Container/Server Transaction support Support for management of multiple instances Persistence support Security Support
  • 11. Security Support EJB The Access Control List Functionality 1 Functionality 2 Functionality 3 The ACL comprises the list of persons who are allowed to access particular sections of functionality.
  • 12. Persistent Support Persistence can be defined as saving the state of an object to a constant storage. The state of the object is maintained in this constant storage
  • 13. Support for Management of Multiple Instances Instance Passivation Instance pooling In order to perform timely servicing to the client the container performs a variety of tasks. Server Tasks Database connection pooling
  • 14. Enterprise Beans The Enterprise Java Bean is a server-side component that is employed on a distributed multi-tier environment. Enterprise Bean Session Bean Entity Bean Stateful Bean Stateless Bean BMP CMP Message Driven Beans
  • 15. Features of an EJB Container Resource Management and Life Cycle Management of a Bean Features State Management Transactions Security Persistence Remote Accessibility and location transparency
  • 16.
  • 17. State Management Fills up Application in a site Page 1 Submits the form Application in a site Page 2 User takes time as he reads the contents in the page Client Container is used for another process while user takes time to read
  • 18. Transactions Operation2 Operation1 Operation3 Executed as one unit of work Multiple users use the same data
  • 19. Transactions-Two phase commit protocol Prepare Phase Prepare message Commit Phase Commit/Rollback Transaction Request All databases issue commit request Commit/Rollback Transaction Request Records results of transaction Transaction Coordinator Database 1 Database 3 Database 2
  • 20. Remote Accessibility Bean Bean Bean Deployed across multiple tiers Bean Bean Bean Networked after deployment Not-Networked
  • 21. Location Transparency Component Component Clients do not know where the components are, and whether these components are local or remote
  • 22.
  • 23.
  • 24.
  • 25.

Notas del editor

  1. Additional teaching: The original JavaBeans specification describes the standard behavior and properties of Java components that run primarily on the client side of a client/server system. The introduction of the Enterprise JavaBeans Specification Version 1.0 changes all that. Enterprise JavaBeans is a component architecture for creating scalable, multitier, distributed applications, and it makes possible the creation of dynamically-extensible application servers. This month, Mark presents a high-level view of Enterprise JavaBeans (EJB) technology, setting the stage for understanding the underlying components. He also talks about why EJB is so interesting to so many people. (4,200 words) Enterprise JavaBeans (EJB) has generated a great deal of excitement since the March 1998 announcement of the Enterprise JavaBeans Specification Version 1.0. Companies such as Oracle, Borland, Tandem, Symantec, Sybase, and Visigenic, among many others, have announced and/or delivered products that adhere to the EJB specification. This month, we'll take a high-level look at what exactly Enterprise JavaBeans is. We'll go over how EJB differs from the original JavaBeans component model, and discuss why EJB has generated such an enormous amount of interest. But first, an advisory: we won't be looking at source code or how-to topics this month. This article isn't a tutorial; rather it's an architectural overview. EJB covers a lot of territory, and without first understanding the basic concepts involved, code snippets and programming tricks are meaningless. If there's interest on the part of JavaWorld 's readers, future articles may cover the specifics of using the Enterprise JavaBeans API to create your own Enterprise JavaBeans. In order to understand why EJB is so attractive to developers, we need some historical background. First, we'll look at the history of client/server systems, and at the current state of affairs. Then, we'll discuss the various parts of an EJB system: EJB components -- which live on an EJB container running inside an EJB server -- and EJB objects, which the client uses as a kind of "remote control" of EJB components. We'll go over the two types of EJBs: session and entity objects. You'll also read about home and remote interfaces, which create EJB instances and provide access to the EJB's business methods, respectively. By the end of the article, you'll have an idea of how extensible servers can be built using Enterprise JavaBeans. But first, a look back in time. Client/server history Ancient history In the beginning, there was the mainframe computer. And it was good. (Or as good as it got, anyway.) The state of the art in information processing through the 1960s consisted primarily of big, expensive machines used by large organizations to support their daily business operations. Minicomputers and timesharing in the 1970s increased the accessibility of computing power, but information and processing were still centralized on individual machines. The first personal computers in the 1980s quickly cluttered the corporate landscape with thousands of tiny islands of information, all tirelessly churning out reports of variable quality, losing critical data when they crashed, and quickly becoming inconsistent with each other. Client/server to the rescue The client/server architecture is one of the most common solutions to the conundrum of how to handle the need for both centralized data control and widespread data accessibility. In client/server systems, information is kept relatively centralized (or is partitioned and/or replicated among distributed servers), which facilitates control and consistency of data, while still providing access to the data users need. Client-server systems are now commonly composed of various numbers of tiers. The standard old mainframe or timesharing system, where the user interface runs on the same computer as the database and business applications, is known as single tier. Such systems are relatively easy to manage, and data consistency is simple because data is stored in only one place. Unfortunately, single-tier systems have limited scalability and are prone to availability hazards (if one computer's down, your whole business goes down), particularly if communication is involved. The first client/server systems were two-tier, wherein the user interface ran on the client, and the database lived on the server. Such systems are still common. One garden-variety type of two-tier server performs most of the business logic on the client, updating shared data by sending streams of SQL to the server. This is a flexible solution, since the client/server conversation occurs at the level of the server's database language. In such a system, a properly designed client can be modified to reflect new business rules and conditions without modifying the server, as long as the server has access to the database schema (tables, views, and so forth) needed to perform the transactions. The server in such a two-tier system is called a database server. Database servers have some liabilities, though. Often the SQL for a particular business function (for example, adding an item to an order) is identical, with the exception of the data being updated or inserted, from call to call. A database server ends up parsing and reparsing nearly identical SQL for each business function. For example, all SQL statements for adding an item to an order are likely to be very similar, as are the SQL statements for finding a customer in the database. The time this parsing takes would be better spent actually processing data. (There are remedies to this problem, including SQL parse caches and stored procedures.) Another problem that arises is versioning the clients and the database at the same time: all machines must shut down for upgrades, and clients or servers that fall behind in their software version typically aren't usable until they're upgraded. Application servers An application server architecture is a popular alternative to a database server architecture because it solves some of the problems database servers have. A database server environment usually executes business methods on the client, and uses the server mostly for persistence and enforcing data integrity. In an application server, business methods run on the server, and the client requests that the server execute these methods. In this scenario, the client and server typically will use a protocol that represents a conversation at the level of business transactions, instead of at the level of tables and rows. Such application servers often perform better than their database counterparts, but they still suffer from versioning problems. Both database and application systems can be enhanced by adding additional tiers to the architecture. So-called three-tier systems place an intermediate component between the client and the server. An entire industry -- middleware -- has cropped up to address the liabilities of two-tier systems. A transaction-processing monitor, one type of middleware, receives streams of requests from many clients, and may balance the load between multiple servers, provide failover when a server fails, and manage transactions on a client's behalf. Other types of middleware provide communications protocol translation, consolidate requests and responses between clients and multiple heterogeneous servers (this is particularly popular in dealing with legacy systems in business process reengineering), and/or provide service metering and network traffic information. Multiple tiers provide a flexibility and interoperability that has resulted in systems with more than these three layers of service. For example, n-tier systems are generalizations of three-tier systems, each layer of software providing a different level of service to the layers above and beneath it. The n-tier perspective considers the network to be a pool of distributed services, rather than simply the means for a client to accesses a single server. As object-oriented languages and techniques have come into vogue, so have client/server systems increasingly moved toward object-orientation. CORBA (Common Object Request Broker Architecture) is an architecture that allows objects within applications -- even objects written in different languages -- to run on separate machines, depending on the needs of a given application. Applications written years ago can be packaged as CORBA services and interoperate with new systems. Enterprise JavaBeans, which is designed to be compatible with CORBA, is another entry into the object-oriented application-server ring. Enterprise JavaBeans and extensible application servers Now that we've looked at a bit of history and have an understanding of what application servers are, let's look at Enterprise JavaBeans and see what it offers in that context. The basic idea behind Enterprise JavaBeans is to provide a framework for components that may be "plugged in" to a server, thereby extending that server's functionality. Enterprise JavaBeans is similar to the original JavaBeans only in that it uses some similar concepts. EJB technology is governed not by the JavaBeans Component Specification, but by the entirely different (and massive) Enterprise JavaBeans Specification. (See Resources for details on this spec.) The EJB Spec calls out the various players in the EJB client/server system, describes how EJB interoperates with the client and with existing systems, spells out EJB's compatibility with CORBA, and defines the responsibilities for the various components in the system. Enterprise JavaBeans goals The EJB Spec tries to meet several goals at once: EJB is designed to make it easy for developers to create applications, freeing them from low-level system details of managing transactions, threads, load balancing, and so on. Application developers can concentrate on business logic and leave the details of managing the data processing to the framework. For specialized applications, though, it's always possible to get "under the hood" and customize these lower-level services. The EJB Spec defines the major structures of the EJB framework, and then specifically defines the contracts between them. The responsibilities of the client, the server, and the individual components are all clearly spelled out. (We'll go over what these structures are in a moment.) A developer creating an Enterprise JavaBean component has a very different role from someone creating an EJB-compliant server, and the specification describes the responsibilities of each. EJB aims to be the standard way for client/server applications to be built in the Java language. Just as the original JavaBeans (or Delphi components, or whatever) from different vendors can be combined to produce a custom client, EJB server components from different vendors can be combined to produce a custom server. EJB components, being Java classes, will of course run in any EJB-compliant server without recompilation. This is a benefit that platform-specific solutions can't hope to offer. Finally, the EJB is compatible with and uses other Java APIs, can interoperate with non-Java apps, and is compatible with CORBA.
  2. The slide is self explanatory. Additional Teaching: EJB Container A container is a set of classes generated by the deployment tool that manages, among other things, an enterprise bean's persistence, transactional properties, and security. Obtaining Services from the Container The EJB container provides EJBs with a distributed object infrastructure . EJB assumes an underlying ORB that understands the CORBA/IDL or RMI/IDL semantics. The IIOP transport layer should be able to propagate CORBA OTS transactions. The container helps in component packing and deployment. An EJB is packaged using manifests, JARs, and deployment descriptors. The container un-JARs the EJBs and then executes it based on the instructions it gets from the manifest file and deployment descriptors EJB containers provide declarative transaction management by enabling you to define your transactional objects. Although EJB supports transactions built around the JTS service, your application need not make explicit calls to JTS to participate in a distributed transaction. The EJB container can explicitly manage the start, commit, and rollback of a transaction. It can also start a transaction if none exist and manage its completion using the underlying JTS services. You design the transactional attributes of the EJB at design-time (or during deployment) using declarative statements in the deployment descriptors. Optionally, EJBs can explicitly control the boundaries of a transaction using explicit JTS semantics. EJB containers manage the entire lifecycle of a bean. As a bean provider, you are responsible for providing a remote interface for your EJB. You must also define a factory interface that extends the javax.ejb.EJBHome factory object. The interface should provide one or more create() methods, one for each way you create your EJBObject . The container provider automatically generates the factory implementation. However, your enterprise Bean must implement an ejbCreate() method for each create() method you defined in your factory interface. As a last step, you must register your factories with the container so clients can create new beans. The container also provides a finder interface to help clients locate existing entity beans. As part of managing the lifecycle of an enterprise bean, the container calls your bean when it is loaded into memory (or activated) and also calls it when it is deactivated from memory (passivated). Your component can then use these calls to manage its state explicitly and allocate or release system resources. EJB containers can manage both transient enterprise Bean and persistent enterprise Beans. Persistent or entity beans encapsulate in their object reference a unique ID that points to their state. An entity bean manages its own persistence by implementing the persistence operations directly. The container just hands down a unique key and tells it to load its state. The entity EJB can also direct the EJB container to manage its state. The container can do this simply by serializing the enterprise Bean’s state and storing it in some persistent store. Or, it can be as sophisticated as to map the enterprise Bean’s persistent fields to columns in an RDBMS. Alternately, the EJB container may choose to implement persistence using an embedded ODBMS. The more advanced EJB containers can load the state of an enterprise Bean from a persistent store and later save it on transactional boundaries. EJB containers can provide metadata about the enterprise Beanthey contain. For example, the EJB container can return the class name of the enterprise Bean with which this factory ( EJBHome ) interface is associated. EJB containers automate the management of some of the security aspects of the enterprise Bean. The EJB developer gets to define the security roles for his EJB in a SecurityDescriptor object. The developer then serializes this object and puts it in his bean’s JAR. The EJB container uses this object to perform all security checks on behalf of the EJB
  3. EJB Servers An EJB application server is a prerequisite for using EJBs. It is an integral component of the EJB architecture—the EJB containers run within the application server. Generally speaking, the primary goals of an application server are to improve performance and to simplify development. An application server combines the capabilities of a TP monitor with distributed object technology. The most important feature in a TP monitor and, likewise, within an application server, is efficient resource management. Application servers pool and recycle expensive system resources such as network connections, processes, threads, memory, and database connections. As a developer, you don't want to write your own thread management and synchronization services within your application code. You don't want to write code within your application to initialize database connections, cache them in a pool, and then allocate them to other applications as needed. You want the application server to do that for you. EJB increases the simplicity level even more than a plain application server. EJB automates complicated middleware services such as transactions, security, state management, and persistence. Distributed objects need to know where to find each other using naming services, whom to trust using appropriate security, and how to manage their life cycles. Services such as naming services, distributed transaction control, security mechanisms, remote access, persistence, resource pooling or threading, instance pooling and concurrency issues, and so forth are automatically handled (and built into) by the EJB server. Additionally, EJB also defines some design patterns and naming conventions.
  4. Server Infrastructure The EJB server provides an organized framework for EJB containers to execute in. Some of the important services EJB servers typically provides are as follows: Distributed transactional support Distributed transaction management involves two possible layers of distribution: multiple application participants and multiple data resource managers. Each layer must be managed separately. JTS/OTS focuses on managing the multiple application participants, while XA and DTC focus on managing the multiple data resource managers. In a distributed object environment, a single transaction may involve a number of different objects. One object starts the transaction and then it calls some number of methods in other objects to perform some work. When everything is complete, it commits the transaction. JTS/OTS defines an object, called the transaction context, which keeps track of all the object participants in the transaction. When the transaction commits, the OTS forwards the commit request to a transaction coordinator (TC) to manage the data resource managers. An OTS can provide its own TC or it can delegate it to a third party—either the transaction coordinator in a database or a separate distributed transaction coordinator (such as Microsoft's DTC or an XA-compliant transaction coordinator like Encina or Tuxedo). Most EJB implementations (for example,, WebLogic, Bluestone, Novera, Persistence, Oracle AS, and Oracle8i) use the database delegation approach and don't support heterogeneous transactions. As of now, GemStone, Inprise, Secant, OrchidSoft, and IBM WebSphere are the only EJB servers that provide an integrated distributed TC service.Although EJBs can be used to implement nontransactional systems, the model was designed to support distributed transactions. EJB requires the application server to use a distributed transaction management system that supports two-phase commit protocols. EJB transactions are based on JTS. Individual enterprise beans do not need to specify transaction demarcation code to participate in distributed transactions. The EJB environment automatically manages the start, commit, and rollback of transactions on behalf of the enterprise bean. Transaction policies can be defined during the deployment process using declarative statements. Optionally, transactions can be controlled by the client application. EJB Transaction Management Each transaction is a set of atomic operations. In methods that have transactions in them, the method executes completely and commits or returns a failure notice. It's also possible to undo the action using a rollback mechanism . These kinds of transactions are common in the database world because they help maintain coherency of content data. Each executed method functions as a separate transaction. Figure 11 shows how transactions are handled. Figure 11: Transactional sessions The basics of transactional programming are the same, except when calling the EJB's methods. Figure 11 is a sequence diagram, which corresponds to the following code and shows what happens when the getStockPrice() method is invoked. The following code snippet in Listing 21 is important because not only does it show how to build transactional code into your beans, but it also shows how to connect to a remote CORBA server object using EJBs. import javax . ejb . * ; import javax . jts . UserTransaction ; import java . rmi . * ; import org . omg . CORBA . * ; import org . omg . CosNaming . * ; import Trader . * ; public class QuoteBean implements SessionBean { SessionContext ctx ; public StockTrader trader ; public double getStockPrice ( String company ) throws RemoteException { // Code for Transactions in the enterprise bean UserTransaction tx = ctx . getUserTransaction (); tx . begin (); double value = trader . getStockPrice ( company ); if ( value > 0 ) tx . commit (); else tx . rollback (); return value ; } // Implement the methods mandated by the EJB Spec public void ejbCreate () {} public void ejbActivate () {} public void ejbPassivate (){} public void ejbRemove () {} // Set the Session context and also get a reference to the // Stock Trader CORBA server object running on a remote system. public void setSessionContext ( SessionContext ctx ) throws RemoteException { this . ctx = ctx ; try { // Create and initialize the ORB ORB orb = ORB . init ( args , null ); // Get the root naming context org . omg . CORBA . Object objRef = orb . resolve_initial_references ( "NameService" ); NamingContext ncRef = NamingContextHelper . narrow ( objRef ); // Resolve the object reference in naming NameComponent nc = new NameComponent ( "NASDAQ" , "" ); NameComponent path [] = { nc }; trader = TraderHelper . narrow ( ncRef . resolve ( path )); } catch ( Exception e ) { e . printStackTrace (); } } } Listing 21: How the QuoteBean session EJB, acts as a CORBA client Before a method is called, the client needs to indicate a new transaction is starting using the javax.jts.UserTransaction.begin() call. When a method is called by the client, the container signals the EJB instance with the afterBegin() call. The EJB then begins processing the method call. At this point, one of two things can happen: The client may request the method call be committed or change its mind and execute a rollback. When the client requests the method be committed to action, the container informs the EJB it is ready to receive the information with the beforeCompletion() signal. When the EJB's processing of the method call is complete and the action has been committed, the EJB first sends a response back to the client (if there is a response) and then the container sends the afterCompletion() signal, as True , to the EJB. If the client changes its mind, it can execute a rollback call after the method call is started. The container sends a setRollbackOnly() signal to the EJB to undo whatever it may have done. When the rollback is complete, the container sends the afterCompletion() signal, as False , indicating to the EJB that it should reinitialize itself. The passivation and activation methods defined in the EJB interface to the container work just the same as before with the exception that an EJB instance cannot be made passive while a transaction is in progress. One additional thing to note is that a transaction does not have to be limited to just one method call. In fact, typically a number of method calls are packaged inside a single transaction. This allows the client to execute complex operations while still reserving the ability to roll them all back in case of partial failure. Multithreading and resource pooling An enterprise bean is not allowed to use thread synchronization primitives. Hence, the keyword synchronized should never appear in an enterprise Bean implementation code. The EJB specification allows the server to passivate an entity bean between methods—even within a transaction. This is to allow the server to perform scalable state management and resource pooling. When the container passivates bean X, it first calls ejbStore() to allow the bean to synchronize its updated state with the underlying database. When the container reactivates bean X in the future, it will ejbLoad() the state stored in the database. The loaded state is the state saved at the most recent ejbStore() by the transaction. Note, the database is doing all the necessary synchronization with other transactions free. As far as threading is concerned, the EJB specification makes it explicitly illegal for an enterprise bean to start new threads. To ensure the system is manageable, the EJB server must control all thread creations. Allowing enterprise beans to start threads would lead to serious problems. For example, imagine two concurrent threads running with the same transaction context trying to access an underlying database. If one thread is reading data while the other thread is updating the data, it would be difficult to predict what data the first thread would read. Another problem is the EJB server will be unable to guarantee the X/Open checked transaction semantics because it would have little knowledge of whether all the threads involved in a transaction have terminated before the transaction's commit starts. Security EJB server implementations may choose to use connection-based authentication in which the client program establishes a connection to the EJB server and the client's identity is attached to the connection at connection establishment time. The communication mechanism between the client and the server propagates the client's identity to the server. However, the EJB specification does not specify how the EJB server should accomplish this. The getCallerIdentity() method should always retrieve the identity of the current caller. The EJB/CORBA mapping prescribes this mechanism—it specifies the CORBA principal propagation mechanism be used. This means the client ORB adds the client's principal to each client request. If two EJB servers, X and Y, from two different vendors, both implement the EJB/CORBA mapping, it is possible for enterprise beans running on system X to access enterprise beans running on system Y, as if they were local enterprise beans (and vice versa). The transaction context will be properly propagated using the OTS propagation protocol between the transaction managers running at the two sites. The same applies to security, although one of the systems must provide mapping of principals. The same level of interoperability exists between client systems and a server system. If both systems implement the EJB/CORBA mapping, they can interoperate even if they are from different vendors. This means, for example, if the EJB/CORBA client runtime becomes part of the JRE, and JRE is part of a browser, then the browser can run applets that are clients to any EJB server that implements the EJB/CORBA mapping. The downloaded applet only includes the application-specific client stubs, but not a server-specific ORB, transaction proxy, or EJB runtime. This level of interoperability was the primary motivation for doing the EJB/CORBA mapping. CORBA/IIOP compatibility While the EJB specification allows the EJB server implementers to use any communication protocol between the client and server, the EJB/CORBA mapping document is prescriptive with respect to what goes on the wire. This allows both system-level and application-level interoperability between products from vendors who choose to implement the EJB/CORBA protocol as the underlying communication protocol. For example, Java clients have a choice of APIs—either the Java RMI or Java IDL. Non-Java clients can communicate with the server components using IIOP and the appropriate IDL language mapping. Clients using Microsoft’s COM+ protocol can also communicate with the server component through a COM-CORBA bridge. Interesting to note is the client of an EJB can itself be a server component when, for example, it is a servlet. In this case, even a browser client can make EJB invocations by means of an HTTP connection to the servlet.
  5. The slide is self explanatory. Additional Teaching Distributed transactional support Distributed transaction management involves two possible layers of distribution: multiple application participants and multiple data resource managers. Each layer must be managed separately. JTS/OTS focuses on managing the multiple application participants, while XA and DTC focus on managing the multiple data resource managers. In a distributed object environment, a single transaction may involve a number of different objects. One object starts the transaction and then it calls some number of methods in other objects to perform some work. When everything is complete, it commits the transaction. JTS/OTS defines an object, called the transaction context, which keeps track of all the object participants in the transaction. When the transaction commits, the OTS forwards the commit request to a transaction coordinator (TC) to manage the data resource managers. An OTS can provide its own TC or it can delegate it to a third party—either the transaction coordinator in a database or a separate distributed transaction coordinator (such as Microsoft's DTC or an XA-compliant transaction coordinator like Encina or Tuxedo). Most EJB implementations (for example,, WebLogic, Bluestone, Novera, Persistence, Oracle AS, and Oracle8i) use the database delegation approach and don't support heterogeneous transactions. As of now, GemStone, Inprise, Secant, OrchidSoft, and IBM WebSphere are the only EJB servers that provide an integrated distributed TC service.Although EJBs can be used to implement nontransactional systems, the model was designed to support distributed transactions. EJB requires the application server to use a distributed transaction management system that supports two-phase commit protocols. EJB transactions are based on JTS. Individual enterprise beans do not need to specify transaction demarcation code to participate in distributed transactions. The EJB environment automatically manages the start, commit, and rollback of transactions on behalf of the enterprise bean. Transaction policies can be defined during the deployment process using declarative statements. Optionally, transactions can be controlled by the client application. EJB Transaction Management Each transaction is a set of atomic operations. In methods that have transactions in them, the method executes completely and commits or returns a failure notice. It's also possible to undo the action using a rollback mechanism . These kinds of transactions are common in the database world because they help maintain coherency of content data. Each executed method functions as a separate transaction. The basics of transactional programming are the same, except when calling the EJB's methods. Figure 11 is a sequence diagram, which corresponds to the following code and shows what happens when the getStockPrice() method is invoked. The following code snippet in Listing 21 is important because not only does it show how to build transactional code into your beans, but it also shows how to connect to a remote CORBA server object using EJBs. import javax . ejb . * ; import javax . jts . UserTransaction ; import java . rmi . * ; import org . omg . CORBA . * ; import org . omg . CosNaming . * ; import Trader . * ; public class QuoteBean implements SessionBean { SessionContext ctx ; public StockTrader trader ; public double getStockPrice ( String company ) throws RemoteException { // Code for Transactions in the enterprise bean UserTransaction tx = ctx . getUserTransaction (); tx . begin (); double value = trader . getStockPrice ( company ); if ( value > 0 ) tx . commit (); else tx . rollback (); return value ; } // Implement the methods mandated by the EJB Spec public void ejbCreate () {} public void ejbActivate () {} public void ejbPassivate (){} public void ejbRemove () {} // Set the Session context and also get a reference to the // Stock Trader CORBA server object running on a remote system. public void setSessionContext ( SessionContext ctx ) throws RemoteException { this . ctx = ctx ; try { // Create and initialize the ORB ORB orb = ORB . init ( args , null ); // Get the root naming context org . omg . CORBA . Object objRef = orb . resolve_initial_references ( "NameService" ); NamingContext ncRef = NamingContextHelper . narrow ( objRef ); // Resolve the object reference in naming NameComponent nc = new NameComponent ( "NASDAQ" , "" ); NameComponent path [] = { nc }; trader = TraderHelper . narrow ( ncRef . resolve ( path )); } catch ( Exception e ) { e . printStackTrace (); } } } Listing 21: How the QuoteBean session EJB, acts as a CORBA client Before a method is called, the client needs to indicate a new transaction is starting using the javax.jts.UserTransaction.begin() call. When a method is called by the client, the container signals the EJB instance with the afterBegin() call. The EJB then begins processing the method call. At this point, one of two things can happen: The client may request the method call be committed or change its mind and execute a rollback. When the client requests the method be committed to action, the container informs the EJB it is ready to receive the information with the beforeCompletion() signal. When the EJB's processing of the method call is complete and the action has been committed, the EJB first sends a response back to the client (if there is a response) and then the container sends the afterCompletion() signal, as True , to the EJB. If the client changes its mind, it can execute a rollback call after the method call is started. The container sends a setRollbackOnly() signal to the EJB to undo whatever it may have done. When the rollback is complete, the container sends the afterCompletion() signal, as False , indicating to the EJB that it should reinitialize itself. The passivation and activation methods defined in the EJB interface to the container work just the same as before with the exception that an EJB instance cannot be made passive while a transaction is in progress. One additional thing to note is that a transaction does not have to be limited to just one method call. In fact, typically a number of method calls are packaged inside a single transaction. This allows the client to execute complex operations while still reserving the ability to roll them all back in case of partial failure.