Enterprise Java Beans Bina Ramamurthy 4/5/2019 B.Ramamurthy.

Slides:



Advertisements
Similar presentations
J0 1 Marco Ronchetti - Basi di Dati Web e Distribuite – Laurea Specialistica in Informatica – Università di Trento.
Advertisements

Session #, Speaker Name1 Enterprise JavaBeans Architecture Vlada Matena Sun Microsystems Inc.
11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
Distributed System Using Java 2 Enterprise Edition (J2EE) B.Ramamurthy.
Sapana Mehta (CS-6V81) Overview Of J2EE & JBoss Sapana Mehta.
Overview of The Java Platform Solution for E-Business Applications : JSP, Servlet and EJB.
Enterprise Applications & Java/J2EE Technologies Dr. Douglas C. Schmidt Professor of EECS.
Java 2 Platform, Enterprise Edition (J2EE). Source: Computer, August 2000 J2EE and Other Java 2 Platform Editions.
J2EE Security and Enterprise Java Beans Mrunal G. Dhond Department of Computing and Information Sciences Master of Science, Final Defense February 26,
CS 483 Enterprise and Web Application Programming
Distributed System Using Java 2 Enterprise Edition (J2EE)
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
EJB Overview Celsina Bignoli Distributed Business Applications Server DB Client DB Server DB.
Distributed Multitiered Applications The J2EE platform uses a multitiered distributed application model. Application logic is divided into components 1.
EJB. Component Characteristics An enterprise Bean typically contains business logic that operates on the enterprise’s data. An enterprise Bean’s instances.
1 Session Bean Chuyên đề Lập trình Java & J2EE Chương 14 Biên soạn: Th.S Nguyễn văn Lành.
J2EE Part 2: Enterprise JavaBeans CSCI 4300 Images and code samples from jGuru EJB tutorial,
Enterprise Java Beans - (EJB)
Ing. Ignacio Roqueta ARTech GeneXus and J2EE.
Seminar: Enterprise JavaBeans. Agenda Agenda Java™ 2 Platform Java™ 2 Platform Java™ 2 Platform,Enterprise Edition(J2EE) Java™ 2 Platform,Enterprise Edition(J2EE)
CS 493/693: Distributed Systems Programming V. “Juggy” Jagannathan CSEE, West Virginia University March 21, 2005.
Entity Beans BMP Celsina Bignoli
Container-Managed Persistence (CMP) Entity Beans Lesson 3A / Slide 1 of 42J2EE Server Components Objectives In this lesson, you will learn to: Identify.
Enterprise Java Bean Matt. 2 J2EE 3 J2EE Overview.
The Triad of Beans I Oleh: Dini Addiati ( ) Fahrurrozi Rahman ( Y) Irfan Hilmy ( ) Salman Azis A ( ) Aziiz Surahman.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
Enterprise JavaBeans. What is EJB? l An EJB is a specialized, non-visual JavaBean that runs on a server. l EJB technology supports application development.
Introduction to J2EE Architecture Portions by Kunal Mehta.
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
第十四章 J2EE 入门 Introduction What is J2EE ?
Enterprise Java Beans Java for the Enterprise Server-based platform for Enterprise Applications Designed for “medium-to-large scale business, enterprise-wide.
J2EE Overview ver 1.0Page 1 © Wipro Technologies Talent Transformation J2EE Overview.
Source: Peter Eeles, Kelli Houston, and Wojtek Kozaczynsky, Building J2EE Applicationa with the Rational Unified Process, Addison Wesley, 2003 Prepared.
© jGuru.com Enterprise JavaBeans Fundamentals.
1 Java EE Programming Enterprise JavaBeans. 2 Topics J2EE Overview Enterprise JavaBeans Overview Enterprise Entity Beans Case Study How to build them.
Introduction to Enterprise JavaBeans Topics In Systems Architecture Barry Herbold
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
1 Distributed System using J2EE. 2 What is J2EE?  J2EE (Java2 Enterprise Edition) offers a suite of software specification to design, develop, assemble.
Modern Programming Language. Web Container & Web Applications Web applications are server side applications The most essential requirement.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
Enterprise Java Beans N.V.RAJASEKHAR REDDY. Definition of EJB EJBs are the components that are the set of classes and interfaces deployed within a container.
Copyright © 2002 ProsoftTraining. All rights reserved. Enterprise JavaBeans.
13 Copyright © 2004, Oracle. All rights reserved. Managing Persistent Data in the Business Tier Entity EJBs.
©NIIT Introducing Enterprise JavaBeans (EJB) Lesson 1A / Slide 1 of 43J2EE Server Components Objectives In this lesson, you will learn about: The features.
Enterprise JavaBeans: Fundamentals. EJB Fundamentals(c)CDAC(Formerly NCST)2 Contents Introduction Technology Overview EJB Architecture EJB Specification.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
EJB Enterprise Java Beans JAVA Enterprise Edition
EJB. Introduction Enterprise Java Beans is a specification for creating server- side scalable, transactional, multi-user secure enterprise-level applications.
14 Copyright © 2004, Oracle. All rights reserved. Achieving State Management in the Business Tier.
©NIIT Session Beans Lesson 1B/ Slide 1 of 37J2EE Server Components Objectives In this lesson, you will learn to: Describe the characteristics of session.
J2EE Lecture 10: EJB 3.0 Overview
J2EE Platform Overview (Application Architecture)
EJB (Enterprise Java Beans)
EADD – Introduction Chapter -1.
Introduction to J2EE Architecture
Enterprise Application Architecture
Structure of Enterprise Java Beans
J2EE Application Development
Distributed System Using Java 2 Enterprise Edition (J2EE)
Understanding and Designing with EJB
Luca Simone Software Engineering 2 a.a. 2001/2002
Objectives In this lesson, you will learn to:
Understanding and Designing with EJB
Enterprise Java Beans Bina Ramamurthy 1/13/2019 B.Ramamurthy.
Component-based Applications
Component Technology Bina Ramamurthy 2/25/2019 B.Ramamurthy.
Understanding and Designing with EJB
Enterprise Java Beans.
Presentation transcript:

Enterprise Java Beans Bina Ramamurthy 4/5/2019 B.Ramamurthy

Introduction J2EE (Java2 Enterprise Edition) offers a suite of software specification to design, develop, assemble and deploy enterprise applications. It provides a distributed, component-based, loosely coupled, reliable and secure, platform independent and responsive application environment. 4/5/2019 B.Ramamurthy

J2EE Technologies Enterprise Java Bean Technology 2.0 JDBC API 2.0 Java Servlet Technology 2.3 Java Server Pages Technology 1.2 Java Messaging Service 1.0 Java Naming and Directory Interface 1.2 Java Transaction API 1.0 Java Mail API 1.2 Javabeans activation framework 1.0 Java API for XML Processing 1.1 Java Connector Architecture 1.0 Java Authentication and Authorization Service 1.0 Tools: deploytool (scripts etc.) 4/5/2019 B.Ramamurthy

Systems and Application Integration The J2EE APIs enable systems and applications integration through the following: Unified application model across tiers with enterprise beans Simplified response and request mechanism with JSP pages and servlets Reliable security model with JAAS XML-based data interchange integration with JAXP Simplified interoperability with the J2EE Connector Architecture Easy database connectivity with the JDBC API Enterprise application integration with message-driven beans and JMS, JTA, and JNDI 4/5/2019 B.Ramamurthy

J2EE Technology Architecture html Web clients Application clients IIOP, others Java Server pages Servlets Enterprise Java Beans Components Server platform JTS JMAPI JNDI JMS JAXP JDBC JAAS … 4/5/2019 B.Ramamurthy

Enterprise Java Bean(EJB) An enterprise bean is a server-side component that contains the business logic of an application. At runtime, the application clients execute the business logic by invoking the enterprise bean's methods. Main goal of Enterprise Java Bean (EJB) architecture is to free the application developer from having to deal with the system level aspects of an application. This allows the bean developer to focus solely on the logic of the application. 4/5/2019 B.Ramamurthy

Roles in EJB Development Bean developer: Develops bean component. Application assembler: composes EJBs to form applications Deployer: deploys EJB applications within an operation environment. System administrator: Configures and administers the EJB computing and networking infrastructure. EJB Container Provider and EJB server provider: Vendors specializing in low level services such as transactions and application mgt. 4/5/2019 B.Ramamurthy

Enterprise Java Bean (EJB) Deployable unit of code. At run-time, an enterprise bean resides in an EJB container. An EJB container provides the deployment environment and runtime environment for enterprise beans including services such as security, transaction, deployment, concurrency etc. Process of installing an EJB in a container is called EJB deployment. 4/5/2019 B.Ramamurthy

Enterprise Application with many EJBs WebClient EJB1 EJB5 EJB3 EJB6 ApplClient Lets consider a shopping front application and figure out the possible components (EJBs) 4/5/2019 B.Ramamurthy

Deployment with Multiple EJB Clients Container2 Deploys : EJB4 Web Container1 Deploys: WebApp1 EJB Container1 Deploys : EJB1,EJB2,EJB3 Client Container1 Deploys : Client1 Client Container3 Deploys : EJB5,EJB6 4/5/2019 B.Ramamurthy

Business Entities, Processes and Rules EJB Applications organize business rules into components. Components typically represent a business entity or business process. Entity: is an object representing some information maintained in the enterprise. Has a “state” which may be persistent. Example: Customer, Order, Employee, Relationships are defined among the entities: dependencies. 4/5/2019 B.Ramamurthy

Process Is an object that typically encapsulates an interaction of a user with business entities. A process typically updated and changes the state of the entities. A business process may have its own state which may exist only for the duration of the process; at the completion of the process the state ceases to exist. Process state may be transient or persistent. States ate transient for conversational processes and persistent for collaborative processes. 4/5/2019 B.Ramamurthy

Rules Rules that apply to the state of an entity should be implemented in the component that represents the entity. Rules that apply to the processes should be implemented in the component that represents the processes. 4/5/2019 B.Ramamurthy

EJB Types There are three types of EJBs: Entity, session and message-driven We will discuss message-driven bean in a separate discussion. The syntax of the session bean and entity bean client-view API is almost identical. But they have different life cycle, different persistence management, etc. EJBs can be stateless and stateful beans. 4/5/2019 B.Ramamurthy

Life Cycle Differences Session Bean Object state: Maintained by container Object Sharing: No sharing: per client State Externalization: State is inaccessible to other programs Transactions: Not recoverable Failure Recovery: Not guaranteed to survive failures Entity Bean Maintained by DB Shared by multiple client Accessible to other programs State changed transactionally and is recoverable. Survives failures and restored when the container restarts. 4/5/2019 B.Ramamurthy

Choosing Entity or Session Bean Entity (business entity) is typically implemented as entity bean or a dependent object of an entity bean. Conversational (business) process as a session bean. Collaborative bean as an entity bean. Any process that requires persistence is implemented as an entity bean. When exposure to other applications are not needed for an entity or process (local/private process) then they are implemented as bean dependent objects. 4/5/2019 B.Ramamurthy

Parts of EJB EJB class that implements the business methods and life cycle methods; uses other helper classes and libraries to implement. Client-view API: consists of EJB home interface and remote interface. Home interface: controls life cycle : create, remove, find methods Remote interface: to invoke the EJB object methods 4/5/2019 B.Ramamurthy

Parts of EJB (contd.) Deployment Descriptor: XML document for bean assembler and deployer; A declaration about EJB environment needed for customizing the bean to the operating environment. Container Runtime services include: transactions, security,distribution,load balancing, multithreading, persistence, failure recovery, resource pooling, state management, clustering.. 4/5/2019 B.Ramamurthy

Enterprise Bean Parts <<Home Interface>> AccountHome <<Remote Interface>> Account create() find() remove() debit() credit() getBalance() <<Enterrpise Bean class> AccountBean Deployment Descriptor name = AccountEJB class = AccountBean home = AccountHome remote = Account type = Entity transaction = required ….. ejbCreate() ejbFind() ejbRemove() debit() credit() getBalance() 4/5/2019 B.Ramamurthy

AccountHome Interface import java.rmi.RemoteException; import javax.ejb.CreateException; import javax.ejb.FinderException; import java.util.Collection; public interface AccountHome extends javax.ejb.EJBHome { //create methods Account create (String lastName, String firstName) throws RemoteException, CreateException, BadNameException; Account create (String lastName) throws RemoteException, CreateException; // find methods Account findByPrimaryKey (AccountKey primaryKey) throws RemoteException, FinderException; Collection findInActive(Date sinceWhen) throws RemoteException, FinderException, BadDateException; 4/5/2019 B.Ramamurthy

Account Interface import java.rmi.RemoteException; public interface Account extends javax.ejb.EJBObject { BigDecimal getBalance() throws RemoteException; void credit(BiGDecimal amount) throws RemoteException; Void debit(BigDecimal amount) throws RemoteException, InSufficientFundsException; } 4/5/2019 B.Ramamurthy

AccountBean class public class AccountBean implements javax.ejb.EntityBean { // life cycle methods from home interface public AccountKey ejbCreate (String latName, String firstName) throws … {…} public AccountKey ejbCreate(String lastName) throws …{…} public AccountKey ejbFindByPrimaryKey(AccountKey primarykey)… {…} Public Collection ejbFindInactive( Data sinecWhen).. {…} // business methods from remote interface public BigDecimal getBalance() {….} public void credit(BigDecimal amt) {…} Public void debit(BigDecimal amt) throws InsufficientFundException {….} // container callbacks from EntityBean container public ejbRemove( ) throws RemoveException{ …} public void setEntityContext(EntityContext ec) {…} public unsetEntityContext(EntityContext ec) {…} public void ejbActivate() {…} public void ejbLoad() {….} public void ejbStore() {….} } 4/5/2019 B.Ramamurthy

Deployment Descriptor … <entity-bean> <ejb-name>AccountEJB</ejb-name> <home>com.wombat.AccopuntHome</home> <remote>com.wombat.Account</remote> <ejb-class>com.wombat.AccountBean</ejb-class> <persistence-type>Bean<\persistence-type> <primary-key-class>com.wombat.AccountKey</primary-key-class> </entity-bean> <container-transaction> <method> <ejb-name>AcoountEJB</ejb-name> <method-name>*</method-name> </method> <trans-attribute>required</trans-attribute> </container-transaction> 4/5/2019 B.Ramamurthy

Summary J2EE environment provides a framework for bundling together the components into an application and provide the applications necessary common services such as persistence, security, mail, naming and directory service etc. Next class we will look a complete running example. Browse through: http://java.sun.com/j2ee/faq.html http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/index.html#chapters 4/5/2019 B.Ramamurthy