Development and Deployment Roles Venugopal Pakanati.

Slides:



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

12 Copyright © 2005, Oracle. All rights reserved. Implementing Business Tasks with Session EJBs.
11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
Technische universität dortmund Service Computing Service Computing Prof. Dr. Ramin Yahyapour IT & Medien Centrum 12. November 2009.
Enterprise Java Beans Adam, Engels, Josh, Marc, Tim.
Enterprise Java Beans Welcome to the world of “Distributed System” Presented By: Sameer Nanda Date: 12/17/03.
Copyright W. Howden1 Lecture 19: Intro to O/O Components.
Writing Enterprise Applications with J2EE (Third lesson) Alessio Bechini June 2002 (based on material by Monica Pawlan)
J2EE Security and Enterprise Java Beans Mrunal G. Dhond Department of Computing and Information Sciences Master of Science, Final Defense February 26,
SEI/CBS Initiative Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Sponsored by the U.S. Department of Defense © 1999.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
EJB. Component Characteristics An enterprise Bean typically contains business logic that operates on the enterprise’s data. An enterprise Bean’s instances.
4-Tier Model Client Tier Web Tier Business Tier EIS Tier.
Brad Rippe Fullerton College. What you need to get started? JDK 1.3 standard for compilation J2EE - SDK1.2.1 App Server - An EJB Container/Web Container.
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)
Seminar: Enterprise JavaBeans. Agenda Agenda Java™ 2 Platform Java™ 2 Platform Java™ 2 Platform,Enterprise Edition(J2EE) Java™ 2 Platform,Enterprise Edition(J2EE)
Writing Enterprise Applications with J2EE (Second lesson) Alessio Bechini June 2002 (based on material by Monica Pawlan)
Distributed Object-Oriented Programming (3) – Enterprise JavaBeans SNU iDB Lab. Taewhi Lee May 14th, 2007.
Entity Beans BMP Celsina Bignoli
Advanced Java Session 7 New York University School of Continuing and Professional Studies.
EJB Container services Presentation by Arun Kalluri (04/02/2001)
Container-Managed Persistence (CMP) Entity Beans Lesson 3A / Slide 1 of 42J2EE Server Components Objectives In this lesson, you will learn to: Identify.
Enterprise JavaBeans Umer Farooq CS6704: Design Patterns & Component FrameworksFebruary 25, 2002.
Distributed Systems 1 Master of Information System Management Distributed Systems Persistence.
Enterprise Java Beans Part II Kyungmin Cho 2001/04/13.
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.
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.
Enterprise Java Bean Computer Networks Natawut Nupairoj, Ph.D. Department of Computer Engineering Chulalongkorn University.
Session Beans -) stateless -) stateful. Session Beans A session bean represents a single client inside the J2EE server. To access an application that.
A TUTORIAL TO USING EJBs by SHREERAM IYER 09/17/2001.
Enterprise JavaBeans Understanding EJB Components Version 0.1 Kamal Wickramanayake
© jGuru.com Enterprise JavaBeans Fundamentals.
Creating competitive advantage Copyright © 2003 Enterprise Java Beans Presenter: Wickramanayake HMKSK Version:0.1 Last Updated:
Entity Beans & Persistence Chris Alexander CS 486 Spring 2001.
Enterprise Java Bean Technology Briefing Markus Hebach.
Session Beans Based on: Patel, Brose, Silverman, Mastering Enterprise JavaBeans 3.0.
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.
Enterprise Java Beans Ye Zhou CS6704 Presentation Virginia Tech.
13 Copyright © 2004, Oracle. All rights reserved. Managing Persistent Data in the Business Tier Entity EJBs.
Enterprise JavaBeans: Fundamentals. EJB Fundamentals(c)CDAC(Formerly NCST)2 Contents Introduction Technology Overview EJB Architecture EJB Specification.
D Copyright © 2004, Oracle. All rights reserved. BMP Entity EJBs J2EE Connector Architecture.
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.
Enterprise JavaBeans™ Trademark of Sun Microsystems, Inc.
Session Beans & Business Logic CS 486 Sagar Deshpande.
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.
JAVA & J2EE UNIT – 8 ENTERPRISE JAVA BEAN - EJB 28-Jun-16 Prepared by: SANTHIYA.M & GANGA V. C. Department: Computer Science & Engineering Course code:
1 EJB 3.0: There’s Something Different About You Martin Jäkle, TSBU Middleware.
©NIIT Session Beans Lesson 1B/ Slide 1 of 37J2EE Server Components Objectives In this lesson, you will learn to: Describe the characteristics of session.
Enterprise Java Beans II CS-422 Steflik. EJB Development The EJB Specification define six roles that are involved in the development and deployment of.
EJB (Enterprise Java Beans)
Structure of Enterprise Java Beans
Objectives In this lesson, you will learn to:
Enterprise Java Beans Bina Ramamurthy 1/13/2019 B.Ramamurthy.
Component-based Applications
Enterprise Java Beans Bina Ramamurthy 4/5/2019 B.Ramamurthy.
Introduction to Session beans
Knowledge Byte In this section, you will learn about:
Objectives In this lesson, you will learn about:
Enterprise Java Beans.
Presentation transcript:

Development and Deployment Roles Venugopal Pakanati

What is EJB technology ? What is an EJ bean ? Types of Beans Entity Bean Session Bean

EJB Architecture : DatabasesEJB Home Interface Remote Interface EJB Server EJB Container EJB Client Locate, Create, Remove instances of EJB Invoke business methods of EJB

5 Roles in the application development and deployment life cycle 1. Enterprise Java Bean providers 2. Application Assemblers 3. Deployers 4. System Adminstrators 5. Application Server Vendors

EJB Provider Application Assembler Deployer Application Server Vendor System Administrator Development and Deployment Scenario

1. The Enterprise Java Bean Provider referred to as an ‘application domain expert’. needs to be an expert in the business logic. needs to be able to express business logic using Java code. does not need to be an expert in system-level programming do not need to understand the details of the target environment

The enterprise bean provider produces --- a JAR containing : (i) The bean’s home interface (ii) The bean’s remote interface (iii) The bean’s implementation class (iv) The bean’s primary key class, in case of an entity bean (v) A partially-complete deployment descriptor

Example: Banking Account Entity BeanSession Bean members: accountID customerName customerType accountBalance Bean Name: Account Bean Name: AccountManager Home Interface: AccountHome Home Interface: AccountManagerHome HI methods: create( ); findbyPrimaryKey( ); Remote Interface: AccountRemote Interface: AccountManager RI methods: withdraw( );RI methods: createAccount( ); deposit( ); withdraw( ); getCustomerType( ); deposit( ); cancel( ); Implementation class: AccountEJB Implementation class: AccountManagerEJB Security Roles: UnmediatedAccess (Web, ATM) deposit( ), withdraw( ) Teller----- deposit( ), withdraw( ) Manager----- All methods Of session bean

(i) The Bean’s Home Interface (a) Home Interface for the Entity Bean (b) Home Interface for the Session Bean

(a) Home interface for the entity bean : package wrox.some_isv ; import javax.ejb.* ; import java.rmi.RemoteException ; public interface AccountHome extends EJBHome { public Account create (int accountID, String customerName, String customerType, double initialBalance) throws CreateException, RemoteException ; public Account findByPrimaryKey (Integer accountID) throws FinderException, RemoteException ; }

(b) Home Interface for the Session Bean : package wrox.some_isv ; import javax.ejb.* ; import java.rmi.RemoteException ; public interface AccountManagerHome extends EJBHome { AccountManager create ( ) throws CreateException, RemoteException ; }

(ii) The Bean’s Remote Interface (a) Remote Interface for the Entity Bean (b) Remote Interface for the Session Bean

(a) Remote Interface for the Entity Bean : package wrox.some_isv ; import javax.ejb.* ; import java.rmi.RemoteException ; public interface Account extends EJBObject { void withdraw (double amount) throws InsufficientFundsException, RemoteException ; void deposit (double amount) throws RemoteException ; String getCustomerType( ) throws RemoteException ; }

(b) Remote Interface for the Session Bean : package wrox.some_isv ; import javax.ejb.* ; import java.rmi.RemoteException ; public interface AccountManager extends EJBObject { void createAccount (int accountID, String customerName, String customerType, double initialBalance) throws NoAccountCreatedException, RemoteException ; void withdraw (int accountID, double amount) throws InsufficientFundsException, NoSuchAccountException, RemoteException ; void deposit (int accountID, double amount) throws NoSuchAccountException, RemoteException ; public void cancel (int accountID) throws RemoteException ; }

(iii) Bean’s Implementation Class : Session Bean implementation class : package wrox.some_isv; import javax.ejb.*; import javax.naming.*; import java.rmi.RemoteException; public class AccountManagerEJB implements SessionBean { public SessionContext ctx; public void createAccount(int accountID, String customerName, String customerType, double initialBalance) throws NoAccountCreatedException { try { AccountHome accountHome = getAccountHome(); accountHome.create(accountID, customerName, customerType, initialBalance); } catch (CreateException ce) { throw new NoAccountCreatedException(ce.getMessage()); } catch (RemoteException re) { throw new EJBException(re); }

public void withdraw(int accountID, double amount) throws InsufficientFundsException, NoSuchAccountException { try { Account account = getAccount(accountID); if ((amount > 250) && account.getCustomerType().equals(CustomerTypes.INDIVIDUAL) && ctx.isCallerInRole("ATM")) { throw new SecurityException(); } account.withdraw(amount); } catch (RemoteException re) { throw new EJBException(re); }

public void deposit(int accountID, double amount) throws NoSuchAccountException { try { Account account = getAccount(accountID); account.deposit(amount); } catch (RemoteException re) { throw new EJBException(re); } public void cancel(int accountID) { try { Account account = getAccount(accountID); account.remove(); } catch (NoSuchAccountException nsae) { } catch (Exception e) { throw new EJBException(e); }

private Account getAccount(int accountID) throws NoSuchAccountException { try { AccountHome home = getAccountHome(); return home.findByPrimaryKey(new Integer(accountID)); } catch (RemoteException re) { throw new EJBException(re); } catch (FinderException fe) { throw new NoSuchAccountException(); } private AccountHome getAccountHome() { try { InitialContext initial = new InitialContext(); Object objref = initial.lookup("java:comp/env/ejb/GenericAccount"); AccountHome home = (AccountHome) javax.rmi.PortableRemoteObject.narrow(objref, AccountHome.class); return home; } catch (NamingException ne) { throw new EJBException(ne); }

public void ejbCreate() {} public void ejbActivate() {} public void ejbPassivate() {} public void ejbRemove() {} }

Entity Bean implementation class : package wrox.some_isv; import javax.ejb.*; import javax.naming.*; public class AccountEJB implements EntityBean { public Integer accountID; public String customerName; public String customerType; public double accountBalance; public void withdraw(double amount) throws InsufficientFundsException { if (accountBalance - amount < 0) { throw new InsufficientFundsException(); } accountBalance -= amount; } public void deposit(double amount) { accountBalance += amount; } public String getCustomerType() { return customerType; }

public Integer ejbCreate(int accountID, String customerName, String customerType, double initialBalance) throws CreateException { if (!customerType.equals(CustomerTypes.CORPORATION) &&!customerType.equals(CustomerTypes.INDIVIDUAL)) { throw new CreateException("Unknown customer type."); } this.accountID = new Integer(accountID); this.customerName = customerName; this.customerType = customerType; this.accountBalance = initialBalance; return this.accountID; } public void ejbActivate() {} public void ejbLoad() {} public void ejbPassivate() {} public void ejbRemove() {} }

(v) Deployment Descriptor : 2 types of information contained within a deployment descriptor : structural information of the EJBs (provided by the Bean Developer) Application Assembly information (provided by the Application Assembler)

At this stage, the Deployment Descriptor contains the following information for each bean : Bean’s type: session or entity Bean’s name Bean’s implementation class Bean’s home interface Bean’s remote interface Whether an entity bean is re-entrant or not Whether a session bean is stateful or stateless Whether or not a session bean manages its own transactions Whether an entity bean uses BMP or CMP Bean’s primary key class Any references in the code to other EJBs Any references in the code to security roles

Indirection : to avoid dependencies on a particular security implementation, a particular database etc. is the use of a reference ‘placeholder’ in your Java code or deployment descriptor, rather than a reference to an actual entity in the implementation environment 3 types of references : references to other EJBs references to resources references to security roles At the deployment stage, the deployer creates a map between these virtual references and the real resources (like database connections)

2. The Application Assembler just needs to understand the home and remote interfaces, and the business logic need not understand the implementation of any EJBs combines EJBs into a deployable application by (i) completing the deployment descriptor (ii) adding other types of application components (to test the functionality of EJBs)

(i) Completing the deployment descriptor : Application Assembler may define one or more security roles may define method permissions must link any security role references declared by an EJB to a security role that they have defined

Final version of our application’s deployment descriptor : // provided by Bean Developer AccountManager wrox.some_isv.AccountManagerHome wrox.some_isv.AccountManager wrox.some_isv.AccountManagerEJB Stateless

Entity Account wrox.some_isv.AccountHome wrox.some_isv.Account This role refers to automated customer withdrawals from the account; no bank intermediary is involved. ATM UnmediatedAccess

Account wrox.some_isv.AccountHome wrox.some_isv.Account wrox.some_isv.AccountEJB Container False customerType accountID accountBalance

customerName accountID

// provided by Application Assembler This role is performed by any account access in which a bank employee is not involved, such as an internet transaction or ATM withdrawal. UnmediatedAccess This role is peformed by any customer-service representative who does not have account-manager status. They will be able to handle deposits and withdrawals, but not account management. Teller

This role is performed by professionals who are allowed to manage an account (open, close). Manager Manager Account * AccountManager *

Teller UnmediatedAccess Account withdraw Account deposit Account getCustomerType

Account findByPrimaryKey AccountManager withdraw AccountManager deposit

(ii) adding other types of application components : test client: Let the security role of this client be “ATM” package wrox.some_isv; import java.rmi.RemoteException; import javax.ejb.*; import javax.naming.*; import javax.rmi.PortableRemoteObject; public class TestClient { public static void main(String[] args) { try { InitialContext initial = new InitialContext(); Object objref = initial.lookup("java:comp/env/ejb/AccountAccess"); AccountManagerHome home = (AccountManagerHome) PortableRemoteObject.narrow(objref, AccountManagerHome.class);

AccountManager accountManager = home.create(); System.out.println("withdrawing small amount from individual account"); accountManager.withdraw(1, 100.0); System.out.println("withdrawing large amount from corporate account"); accountManager.withdraw(2, ); System.out.println("withdrawing large amount from individual account"); accountManager.withdraw(1, ); } catch (Exception e) { e.printStackTrace(); }

3. Deployer maps the logical references that the bean provider uses onto actual resources or identities need not be a domain expert need to be an expert in the environment in which the application will execute

Mapping the logical references : (i) map the logical security roles to actual users or groups (ii) map logical database accesses to an actual database (iii) map all the beans and references into the JNDI namespace

4. The System Adminstrator responsible for configuring the application server, EJB container, and the environment in which they execute --- including the database, network, and security systems responsible for the ‘well-being’ of the EJBs that are executing in the container must monitor logs for system problems, security problems, etc.

5. Application Server / Container Vendor a role that we, as application developers, are unlikely to play

Choosing an Application Server : Do you need an ORB-based product to communicate with non-Java clients or for vendor interoperability ? What object/relational mapping capabilities do you require ? What kind of development and deployment tools are supported by a vendor’s application server ? What version of EJB specification does the application server support ? What platform(s) does the application server run on ?

Thank You !