EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in...

39
EJB Design
  • date post

    20-Dec-2015
  • Category

    Documents

  • view

    213
  • download

    0

Transcript of EJB Design. Server-side components Perform –complex algorithms –high volume transactions Run in...

EJB Design

Server-side components

• Perform– complex algorithms– high volume transactions

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

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

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

Basic Architecture

UserInterface

BusinessLogic

Database(infrastructure)

OurFocus

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)

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

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).

Input Container

• Manages two main technologies– JSP– Servlets

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

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

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

Worries about socket calls parameter packaging

Worries about receiving socket calls unpackaging parameters

Call appears local!

Container simplifies Bean

Container simplifies Bean

Typical business function interaction would be

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”.

Dumb!Only knows business logic.

Smart!Knows everythingelse

You don’t implement.. Container does that!

EJB Overhead for an example remote call.

To Deploy Must Use JAR

• Contents include everything the container will need to manage it

• Class files

• Deployment descriptors

• Zip format

Hello World

Our first example!

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

REMOTE INTERFACE

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

The Session Bean

SESSION BEAN

Bean Queries the contain via Context

DEPLOYMENT DESCRIPTOR - JAR

Simple Client-side Interaction with the EJB