1 J2EE Components. 2 Application Servers relieve the programming burden for business distributed components. They provide support for system level services.

Slides:



Advertisements
Similar presentations
J0 1 Marco Ronchetti - Basi di Dati Web e Distribuite – Laurea Specialistica in Informatica – Università di Trento.
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.
6/1/20151 Luca Simone Software Engineering 2 a.a. 2001/2002.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB JavaForum.
June 1999 EJB1 EJB and CHAIMS Dorothea Beringer Enterprise Java Beans and how to build a CHAIMS infrastructure using the EJB paradigm.
Sapana Mehta (CS-6V81) Overview Of J2EE & JBoss Sapana Mehta.
Introduction to Enterprise JavaBeans. Integrating Software Development Server-side Component Model Distributed Object Architecture –CORBA –DCOM –Java.
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.
Enterprise Java Beans (EJB)
J2EE Kenneth M. Anderson CSCI Web Technologies October 3, 2001.
CS 483 Enterprise and Web Application Programming
Emmanuel Cecchet et al.  Performance Scalability of J2EE application servers.  Test effect of: ◦ Application Implementation Methods ◦ Container Design.
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.
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.
Enterprise Java Beans CS-422. Application Servers In the late 1980s and though the mid 1990s a number of corporations (Broadvision, Netscape…) marketed.
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,
Entity Beans BMP Celsina Bignoli
Middleware Technology (J2EE/EJB) Entity Bean. 2 Introduction to Entity Beans Persistence Concepts Entity beans are persistent objects that can be stored.
Advanced Java Session 7 New York University School of Continuing and Professional Studies.
Enterprise Java Beans Part I Kyungmin Cho 2001/04/10.
Container-Managed Persistence (CMP) Entity Beans Lesson 3A / Slide 1 of 42J2EE Server Components Objectives In this lesson, you will learn to: Identify.
1 Stateful Session Beans Stateless Session Beans Michael Brockway Sajjad Shami Northumbria University School of Computing, Engineering & Information Sciences.
Replication & EJB Graham Morgan. EJB goals Ease development of applications –Hide low-level details such as transactions. Provide framework defining the.
Overview Of Enterprise Java Bean (EJB) COSC 513 Presentation Mei Li March 17, 2001.
Enterprise Java Beans Part II Kyungmin Cho 2001/04/13.
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.
Message-Driven Beans and EJB Security Lesson 4B / Slide 1 of 37 J2EE Server Components Objectives In this lesson, you will learn about: Identify features.
第十四章 J2EE 入门 Introduction What is J2EE ?
J2EE Structure & Definitions Catie Welsh CSE 432
Middleware for FIs Apeego House 4B, Tardeo Rd. Mumbai Tel: Fax:
Enterprise JavaBeans Understanding EJB Components Version 0.1 Kamal Wickramanayake
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
CSE300 EAIusing EJB & XML CSE Enterprise Application Integration Using EJB and XML by Prithwis Sett Mumtaz Lohawala Nayana Paranjape.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
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.
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.
EJB (Enterprise Java Beans)
Introduction to J2EE Architecture
Introduction to Enterprise JavaBean
Understanding and Designing with EJB
Objectives In this lesson, you will learn to:
Component-based Applications
Component Technology Bina Ramamurthy 2/25/2019 B.Ramamurthy.
Understanding and Designing with EJB
Enterprise Java Beans.
Presentation transcript:

1 J2EE Components

2 Application Servers relieve the programming burden for business distributed components. They provide support for system level services such as connection pooling, security, and life-cycle management (middle-ware services).

3 EJB development EJB partitions the responsibility of EJB deployment to up to six different parties. The bean provider provides reusable components that companies can purchase and use to solve business problems. The bean provider provides reusable components that companies can purchase and use to solve business problems. The container provider supplies the low-level runtime execution environment needed for EJB execution. The container provider supplies the low-level runtime execution environment needed for EJB execution. The server provider supplies the application server logic to contain, manage, and deploy components. The server provider supplies the application server logic to contain, manage, and deploy components. The application assembler is the application architect. The application assembler is the application architect. The deployer takes prewritten components and installs them The deployer takes prewritten components and installs them in application servers. The system administrator oversees the well-being of a deployed system. The system administrator oversees the well-being of a deployed system.

4 Parties involved in EJB

5 EJB Containers and Servers The EJB container. The EJB container provides the infrastructure where enterprise beans can run. There can be many beans running within a container. EJB containers are responsible for managing the beans running within them. Containers interact with EJBs by calling some required methods that the bean must expose. Containers may also provide access to a legacy system. The EJB server. The EJB server provides a runtime environment for one or more containers. EJB servers manage low-level system resources, allocating resources to containers as they are needed.

6 EJB Containers and Servers

7 Server/Container services Implicit distributed transaction management. EJB transaction support is compliant with JTA (Java Transaction API). Implicit distributed transaction management. EJB transaction support is compliant with JTA (Java Transaction API). Implicit security ( ). Implicit security (authorise and authenticate users, secure deployments). Implicit resource (sockets, threads, db connections) management and component life cycle. Implicit resource (sockets, threads, db connections) management and component life cycle. Implicit persistence. Implicit persistence. Implicit remote accessibility. Implicit remote accessibility. Implicit component location transparency. Implicit component location transparency.

8 EJB Types EJB specification defines two different kinds of enterprise beans: session beans and entity beans. A session bean represents work being performed for client code that is calling it. Session beans are business process objects. They implement business logic, rules, and workflow. A session bean could perform price quoting, order entry, database operations, etc. Session beans are called “session” because they live for the lifetime of the client code tha t ’s invoking the bean. If client code contacted a session bean to perform order entry logic, the application server is responsible for creating an instance of that session bean component. When the client disconnects, the application server may destroy the bean instance.

9 EJB Types In certain application scenarios, business process components are manipulating data in some underlying data storage, such as a relational database. An entity bean is a component that represents such persistent data. Entity beans model bank accounts, orders, order line items, stock portfolios, and so on. Entity beans represent real data objects, such as customers, products, or employees. Entity beans do not contain business process logi c— they simply model data. Session beans handle the business processes. Session beans might use entity beans to represent the data they use.

10 Session Beans Session beans are usable by one client at a time—that is, they are not shared between clients. When a client is using a session bean, that client is the only client dealing with that session bean. On the other hand, the state of entity beans is shared among many clients. The EJB server is responsible for managing the lifetime of beans. The client does not directly instantiate beans - the EJB container does this automatically. The EJB container destroys session beans when needed. This allows beans to be pooled and reused for multiple clients. There are two subtypes of session beans— stateful session beans and stateless session bean s.

11 Stateful Session Beans Some business processes can be performed in a single method request, e.g., computing the price of goods or verifying a credit card account. Other business processes are more drawn out and can last across multiple method requests and transactions. A stateful session bean is designed to service business processes that span multiple method requests or transactions. Stateful session beans retain state on behalf of an individual client. If a stateful session bea n ’s state is changed during a method invocation, that same state will be available to that same client upon the following invocation.

12 Entity Beans Entity beans provide is an object-oriented in-memory view of data in an underlying data store. The traditional way for applications to deal with data is to work with relational tables in a database, reading and writing that data as needed. Entity beans are object representations of this underlying data. Data in a relational store can be treated as real objects.

13 Entity Beans Entity beans have a lifecycle much longer than a clien t ’s session depending on how long the data sits in the database.

14 Relationship between EJB types In the EJB distributed object architecture, session beans can be used to provide a high- level interface f a çade to business processes, masking the lower-level entity bean subsystems used behind the scenes.

15 Relationship between EJB types

16 Entity Bean persistence A bean-managed persistent entity bean is an entity bean that must be persisted by hand in the underlying information store (e.g., the RDBMS). The component developer must write code to translate in-memory fields into an underlying store. Container-Managed Persistent Entity Beans. EJB 1.1 containers must provide automatic persistence for entity beans. The container/server performs every function of the componen t ’s data access layer including saving, loading, and finding component data.

17 Container/Server tasks Scalability is enhanced when an application server intelligently manages needed resources across a variety of deployed components. Resources could be threads, sockets, database connections, etc. In the EJB world, the container is responsible for providing all resource management services behind the scenes. The EJB container is also responsible for controlling the life cycle of the deployed EJBs. The EJB container dynamically instantiates, destroys, and reuses beans as appropriate. If a client requests a certain type of bean that does not exist in memory yet, the container may instantiate a new in-memory instance. If a bean already exists in memory, it may not be appropriate to instantiate a new bean - especially if the system is low on memory. Instead, a bean could be re-assigned from one client to another. It might also make sense to destroy some beans that are not being used anymore. This is called instance poolin g.

18 The EJB Object When a client wants to use an instance of an enterprise bean class, the client never invokes the method directly on an actual bean instance. Rather, the invocation is intercepted by the EJB container and then delegated to the bean instance. The EJB container is acting as a layer of indirection between the client code and the bean. This layer of indirection manifests itself as a single network-aware object, called the EJB objec t. The EJB object is an object that knows about networking, transactions, security, etc. It is an intelligent object that knows how to perform intermediate logic that the EJB container requires before a method call is serviced by a bean class instance.

19 EJB Remote Interface

20 Remote Interface Bean clients invoke methods on EJB objects, rather than the beans themselves. To achieve this, EJB objects must clone every business method that bean classes expose. To accomplish this duplication, there is a special interface that a bean provider writes. This interface duplicates all the business logic methods that the corresponding bean class exposes. This interface is called the remote interfac e.

21 Methods of EJB Objects getEJBHome(): Retrieves a reference to the corresponding home object. getPrimaryKey() Returns the primary key for this EJB object. A primary key is used only for entity beans. remove() Destroys this EJB object. When the client code is done using an EJB object, you should call this method. The system resources for the EJB object can then be reclaimed. Note: For entity beans, remove() also deletes the bean from the underlying persistent store. getHandle() Acquires a handle for this EJB object. IsIdentical() Tests whether two EJB objects are identical.

22 Home Objects To acquire a reference to an EJB object, client code asks for an EJB object from an EJB object factory. This factory is responsible for instantiating (and destroying) EJB objects. The EJB specification calls such a factory a home object. The main responsibilities of home objects are to do the following: Create EJB objects Find existing EJB objects (for entity bean s ) Remove EJB objects

23 Home Objects & Interfaces

24 Deployment Descriptors Deployment descriptors enable EJB containers to provide implicit middleware services to enterprise bean components. Deployment descriptors are used to describe the requirements of beans: Bean management and life-cycle requirements. E.g., whether the bean is a session or entity bean, and the home interface that generates the beans. Persistence requirements (entity beans only). Authors of entity beans use the deployment descriptors to inform the container about whether the bean handles its persistence on its own or delegates the persistence to the EJB container. Transaction requirements, Security requirements.

25 JNDI-based access to Home Object