Top Banner
EJB Design
39

EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Dec 20, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

EJB Design

Page 2: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Server-side components

• Perform– complex algorithms– high volume transactions

• Run in– highly available environment (365 days/year)– fault tolerant– transactional– secure

Page 3: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Basic Philosophy

• Enterprise applications are complex

• As they grow, specialization is a necessity

• Local control should be more focused on business/application specific issues

• Infrastructure issues should be left to specialists

• Many application issues are common

• Buying and assembling is better when possible

• Scalability is beyond the scope of most developers

Page 4: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.
Page 5: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Players in EJB System

• Bean Provider– java beans

– EJB

• Application Assembler– uses beans to build

– builds user interfaces and additional beans

• Deployer– performance and secxurity

• Systems Admin– handles problems of

day-to-day running

• Container and Server Provider

• Tool Provider– IDEs

– testing

– build

• Persistence manager

Page 6: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Basic Architecture

Page 7: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

UserInterface

BusinessLogic

Database(infrastructure)

OurFocus

Page 8: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

3 -layer

• Separate for independence as in any layer design

• Application specific logic in business layer

• Reuse and scale business and infrastrucure layers without impacting the others

• As new interface technologies emerge, logic doesn’t (e.g., cell phone internet access)

Page 9: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

How do the components interact? • Most of the communication between layers,

both interlayer and intralayer are some type of remote procedure call.

• Lots of technologies all basically the same– RPC– RMI– Corba– DCOM

• Also a need to preserve connectors to legacy system for evolution/migration needs

Page 10: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Main components

• Servers to manage complexity in first slide

• Servers are housed in containers

• Two containers– EJB – Web

• Database/infrastructure

• Input from java apps, web interfaces, legacy and related technologies (Corba).

Page 11: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Input Container

• Manages two main technologies– JSP– Servlets

• Handles issues of scalability, security, fault-tolerance, etc.

Page 12: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

EJB container

• Entity Beans– data objects– typically connected to database entries

• Session Beans– logic operations– stateful and stateless

• Message Beans – asynchronous message exchange between beans– like mail senders, readers

Page 13: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.
Page 14: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Remote calls

• Allows for execution of logic on a machine other than the one caller executes on

• Requires using a stub for initiating and receiving the call.

• Takes the caller and creates– caller and calling stub

• Takes the procedure and creates– receiving stub and procedure

Page 15: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Worries about socket calls parameter packaging

Worries about receiving socket calls unpackaging parameters

Call appears local!

Page 16: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Container simplifies Bean

Page 17: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Container simplifies Bean

Typical business function interaction would be

Page 18: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Container simplifies Bean

Business bean interaction would preferably be

Hertz used to say “leave the driving to us”.Containers would say “leave the rest to us”.

Page 19: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.
Page 20: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Dumb!Only knows business logic.

Smart!Knows everythingelse

Page 21: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

You don’t implement.. Container does that!

Page 22: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.
Page 23: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.
Page 24: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

EJB Overhead for an example remote call.

Page 25: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

To Deploy Must Use JAR

• Contents include everything the container will need to manage it

• Class files

• Deployment descriptors

• Zip format

Page 26: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.
Page 27: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Hello World

Our first example!

Page 28: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.
Page 29: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Remember it’s an interface (prototype)Insert prototype for the functionality you need .. hello()

REMOTE INTERFACE

Page 30: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

HOME INTERFACERemember it’s an interface (prototype)Insert prototype for the functionality you need .. hello()

Page 31: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.
Page 32: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

The Session Bean

Page 33: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

SESSION BEAN

Page 34: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.
Page 35: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Bean Queries the contain via Context

Page 36: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

DEPLOYMENT DESCRIPTOR - JAR

Page 37: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.

Simple Client-side Interaction with the EJB

Page 38: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.
Page 39: EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant.