Enterprise JavaBeans: Fundamentals. EJB Fundamentals(c)CDAC(Formerly NCST)2 Contents Introduction Technology Overview EJB Architecture EJB Specification.

Slides:



Advertisements
Similar presentations
12 Copyright © 2005, Oracle. All rights reserved. Implementing Business Tasks with Session EJBs.
Advertisements

11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
Approaches to EJB Replication. Overview J2EE architecture –EJB, components, services Replication –Clustering, container, application Conclusions –Advantages.
1 Softsmith Open Learning - EJB 21-Nov Enterprise Java Beans Introduction –Application ServerApplication Server –Java 2 Enterprise EditionJava.
Introduction to Enterprise JavaBeans. Integrating Software Development Server-side Component Model Distributed Object Architecture –CORBA –DCOM –Java.
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.
Enterprise Java Beans Welcome to the world of “Distributed System” Presented By: Sameer Nanda Date: 12/17/03.
Application Server Lecture Paulo Barroso Kris Carver Todd Kitterman Eric Silva.
Copyright W. Howden1 Lecture 19: Intro to O/O Components.
Java 2 Platform, Enterprise Edition (J2EE). Source: Computer, August 2000 J2EE and Other Java 2 Platform Editions.
J2EE Kenneth M. Anderson CSCI Web Technologies October 3, 2001.
CS 483 Enterprise and Web Application Programming
EJB Overview Celsina Bignoli Distributed Business Applications Server DB Client DB Server DB.
EJB Fundamentals Celsina Bignoli
EJB. Component Characteristics An enterprise Bean typically contains business logic that operates on the enterprise’s data. An enterprise Bean’s instances.
1 J2EE Components. 2 Application Servers relieve the programming burden for business distributed components. They provide support for system level services.
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)
EJB Enterprise Java Bean.
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)
Entity Beans BMP Celsina Bignoli
Advanced Java Session 7 New York University School of Continuing and Professional Studies.
Enterprise Java Beans Part I Kyungmin Cho 2001/04/10.
Enterprise JavaBeans Umer Farooq CS6704: Design Patterns & Component FrameworksFebruary 25, 2002.
Overview Of Enterprise Java Bean (EJB) COSC 513 Presentation Mei Li March 17, 2001.
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.
Presented By Pradeep K Sahu. What will be the Contents of the Seminar ? What is EJB ? EJB Architecture Types of EJB Session Entity Why EJB ? Writing a.
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 ?
J2EE Structure & Definitions Catie Welsh CSE 432
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.
Enterprise JavaBeans Understanding EJB Components Version 0.1 Kamal Wickramanayake
© 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
Assignment of JAVA id : BSSE-F10-M-10-JAVA1 Overview of J2EE/Session 2/Slide 1 of 38.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Session Beans Based on: Patel, Brose, Silverman, Mastering Enterprise JavaBeans 3.0.
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.
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. Lesson 1: Introduction to Server-Side Component Software.
Middleware Technology (J2EE/EJB) EJB Fundamentals.
Advanced Java Session 7 New York University School of Continuing and Professional Studies.
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.
©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
Introduction to J2EE Architecture
Introduction to Enterprise JavaBean
Distributed System Using Java 2 Enterprise Edition (J2EE)
Enterprise Java Beans Bina Ramamurthy 1/13/2019 B.Ramamurthy.
Component-based Applications
Understanding and Designing with EJB
Enterprise Java Beans Bina Ramamurthy 4/5/2019 B.Ramamurthy.
Enterprise Java Beans.
Introduction to Session beans
Knowledge Byte In this section, you will learn about:
Presentation transcript:

Enterprise JavaBeans: Fundamentals

EJB Fundamentals(c)CDAC(Formerly NCST)2 Contents Introduction Technology Overview EJB Architecture EJB Specification Sample Application

EJB Fundamentals(c)CDAC(Formerly NCST)3 Sun’s Definition EJB architecture is a component architecture for the development and deployment of component based distributed business applications. Applications written using EJB architecture are scalable, transactional, and multi-user secure. These applications may be write once, and then deployed on any server platform that supports the EJB specification.

EJB Fundamentals(c)CDAC(Formerly NCST)4 Short Definition EJB is a server-side component architecture that simplifies the process of building enterprise-class distributed component applications in Java. EJB provides standard for component architecture.

EJB Fundamentals(c)CDAC(Formerly NCST)5 Enterprise Bean Server side software components that can be deployed in distributed multi tier environment. They encapsulate business logic of an application. Consists of one or more java objects.

EJB Fundamentals(c)CDAC(Formerly NCST)6 Types of Beans Session Bean Entity Bean Message driven Bean

EJB Fundamentals(c)CDAC(Formerly NCST)7 Session Bean Session beans model business processes. They are like ‘verbs’ because they are actions. E.g. billing engine, catalog engine etc:

EJB Fundamentals(c)CDAC(Formerly NCST)8 Entity Bean Entity Bean Models business data. They are like ‘nouns’ because they are data objects E.g. product, an order, an employee etc: Session beans typically calls entity beans to perform business goals.

EJB Fundamentals(c)CDAC(Formerly NCST)9 Message Driven Bean Message driven beans are similar to session beans. They are actions. They are called only when they receive some message. E.g. : stock trade message.

EJB Fundamentals(c)CDAC(Formerly NCST)10 EJB Architecture EJB Message Driven Bean EJB Session Bean EJB Entity Bean EJB Session Bean EJB Session Bean EJB Session Bean ServletJSP Messaging Client C/C++ Client Java Applet Java Appl Business Partner System HTML Client Messaging CORBA-IIOPRMI-IIOP HTTP Firewall SOAP,UDDI WSDL,ebXML Web Server Application Server Presentation Tier Business Tier

EJB Fundamentals(c)CDAC(Formerly NCST)11 EJB Foundation: Distributed Objects Client Skeleton Distributed Object Stub Network Remote Interface

EJB Fundamentals(c)CDAC(Formerly NCST)12 What do we need to worry about now? We take a monolithic application and break it into distributed system with multiple clients connecting to multiple servers and databases over network.

EJB Fundamentals(c)CDAC(Formerly NCST)13 Services Remote Method Invocation Load Balancing Transparent Fail Over Back end integration. Clustering Dynamic Re deployment Object life cycle Caching Security Resource Pooling System Management Message Oriented Middleware And many more….. Middleware

EJB Fundamentals(c)CDAC(Formerly NCST)14 Explicit Middleware Client Skeleton Distributed Object Stub Network Remote Interface Remote Interface Transaction Services Security Services Database drivers Database API Security API Transaction API

EJB Fundamentals(c)CDAC(Formerly NCST)15 Example – Bank account obj Transfer(Acct acc1, Acct acc2,long amt) //1.Call middleware API to perform security check. //2.Call middleware API to start a trans //3.Call middleware API to load rows from db. //4.perform trans. //5.Call middleware API to store rows in db //6.Call middleware API to end the trans.

EJB Fundamentals(c)CDAC(Formerly NCST)16 Explicit Middleware Difficult to Write. Difficult to Maintain. Difficult to Support.

EJB Fundamentals(c)CDAC(Formerly NCST)17 Implicit Middleware Client Skeleton Request Interceptor Stub Network Remote Interface Remote Interface Transaction Services Security Services Database drivers Database API Security API Transaction API Distributed Object Remote Interface

EJB Fundamentals(c)CDAC(Formerly NCST)18 Example – Bank account obj Transfer(Acct acc1,Acct acc2,long amt) //1. Perform trans.(subtract bal from one account and add to other).

EJB Fundamentals(c)CDAC(Formerly NCST)19 Implicit Middleware Easy to Write. Easy to Maintain. Easy to Support.

EJB Fundamentals(c)CDAC(Formerly NCST)20 EJB Container House enterprise bean and makes them available to the client to invoke them remotely. It intercepts the client request and delegates them to corresponding bean class. It automatically performs implicit middleware that the distributed object needs. EJB object is the physical part of the container.

EJB Fundamentals(c)CDAC(Formerly NCST)21 EJB Component Ingredients Enterprise Bean Class Interfaces Remote and Home interface for remote access. Local and Local Home interface for local access. Deployment Descriptor. Vendor Specific files.

EJB Fundamentals(c)CDAC(Formerly NCST)22 Enterprise Bean Class It conforms to a well defined interface. It contains business implementation details of our component. Each bean type has more specific interface that extends javax.ejb.EnterpriseBean interface. Bean class implements the interface corresponding to the bean type.

EJB Fundamentals(c)CDAC(Formerly NCST)23 EJB Object Client request interceptor. It duplicates all the business logic methods that the corresponding bean class exposes. Proprietary and specific to each EJB container.

EJB Fundamentals(c)CDAC(Formerly NCST)24 Remote Interface Interface to request interceptor. Informs EJB Object auto generator which methods to clone. All remote interfaces must derive from javax.ejb.EJBObject. EJB remote interfaces must confirm to RMI rules.

EJB Fundamentals(c)CDAC(Formerly NCST)25 Home Object EJB object factory. Creates,finds and destroys EJB objects. Proprietary and specific to each EJB container. Home objects implements Home Interface.

EJB Fundamentals(c)CDAC(Formerly NCST)26 Home Interface EJB Object factory interface. They define methods for creating,destroying and finding EJB Objects. All home interfaces must extend javax.ejb.EJBHome. EJB remote interfaces must confirm to RMI rules.

EJB Fundamentals(c)CDAC(Formerly NCST)27 Local Access Local objects make enterprise bean calls fast and efficient. Local objects implements Local Interface. Local home objects creates beans fast. Local home object implements Local Home interface.

EJB Fundamentals(c)CDAC(Formerly NCST)28 Deployment Descriptor Declare how the container should perform middleware services for the EJB component. In EJB 2.0 deployment descriptor is a XML file. Key to implicit middleware.

EJB Fundamentals(c)CDAC(Formerly NCST)29 Vendor Specific Files All vendors have proprietary value added features. Include files specific to that vendor.

EJB Fundamentals(c)CDAC(Formerly NCST)30 Package Remote Interface Local Interface Enterprise Bean Home Interface Deployment Descriptor Vendor Specific Jar file creator EJB jar file

EJB Fundamentals(c)CDAC(Formerly NCST)31 Sample Application My First Bean!

EJB Fundamentals(c)CDAC(Formerly NCST)32 Session Bean : FirstBean package example; public class FirstBean implements javax.ejb.SessionBean{ private SessionContext ctx; public void ejbCreate(){ System.out.println(“ejbCreate()”); } public void ejbRemove(){ System.out.println(“ejbRemove()”); } public void ejbActivate(){ System.out.println(“ejbActivate()”); }

EJB Fundamentals(c)CDAC(Formerly NCST)33 public void ejbPassivate() { System.out.println(“ejbPassivate()”); } public void setSessionContext(javax.ejb.SessionContext ctx) { this.ctx=ctx; } public String first() { System.out.println(“first()”); return “My First Bean”; }

EJB Fundamentals(c)CDAC(Formerly NCST)34 Remote Interface : First.java package example; public interface First extends javax.ejb.EJBObject { public String first() throws java.rmi.RemoteException; }

EJB Fundamentals(c)CDAC(Formerly NCST)35 Home Interface : FirstHome package example; public interface FirstHome extends javax.ejb.EJBHome { First create() throws java.rmi.RemoteException, javax.ejb.CreateException; }

EJB Fundamentals(c)CDAC(Formerly NCST)36 Deployment Descriptor First example.FirstHome example.First example.FirstBean Stateless Container

EJB Fundamentals(c)CDAC(Formerly NCST)37 Client Application package example; import javax.naming.*; Import java.util.*; public class FirstClient{ public static void main(String[] arg) throws Exception{ Properties props=System.getProperties(); Context ctx=new InitialContext(props); Object obj=ctx.llokup(“FirstHome”); FisrtHome home=(FirstHome) javax.rmi.RemotePortableObject.narrow (obj,FirstHome.class);

EJB Fundamentals(c)CDAC(Formerly NCST)38 First first=home.create(); System.out.println(first.first()); first.remove(); }

EJB Fundamentals(c)CDAC(Formerly NCST)39 EJB Object Model > java.rmi.Remote > java.io.Serializable > javax.ejb.EnterpriseBean > javax.ejb.SessionBean Bean Implement Class > javax.ejb.EJBObject > Javax.ejb.EJBHome > Remote Interface > Home Interface EJB ObjectHome Object Comes with Java2 platform Comes with EJB Distribution Written by developer Generated by Componet Vendor Tool

EJB Fundamentals(c)CDAC(Formerly NCST)40 Home Object EJB Object Enterprise Bean Client Naming Service 1 : Retrieve Home object Reference 2 : Return Home object Reference JNDI 3: Create a new EJB Object 4: Create a new EJB Object 5: Return EJB Object Reference 6: Invoke Business Method 7: Delegate Request to Bean Remote Interface Home Interface EJB Container

EJB Fundamentals(c)CDAC(Formerly NCST)41 Advantages of EJB Helps to write scalable,reliable and secure applications. Provides distributed component framework and hence supports rapid application development. Supports application portablility and reusability across any vendor’s enterprise middleware services. It is agreed upon by industry.

EJB Fundamentals(c)CDAC(Formerly NCST)42 References Mastering Enterprise Java Beans J2EE 1.4 Tutorials Professional Java Server Programming, J2EE Edition