11
Enterprise JavaBeans (EJB) Container The Evolution of Server Side Containers Copyright 2001-2002, Dan Harkey. All rights reserved. DO NOT COPY OR DISTRIBUTE.

Enterprise JavaBeans (EJB) Container - Santa Clara Universitycmehta/handouts/IntroEJB.pdf · The EJB Contracts Client/Server Contract Defines factory, finder, business methods for

  • Upload
    buidung

  • View
    231

  • Download
    0

Embed Size (px)

Citation preview

Enterprise JavaBeans (EJB) Container

The Evolution of Server Side Containers

Copyright 2001-2002, Dan Harkey. All rights reserved. DO NOT COPY OR DISTRIBUTE.

The Five Types of Enterprise JavaBeans

Session EJBsExtension of a J2EE client, not sharedWhen client terminates, association with Session EJB is lostTwo types:

Stateful -- conversational state maintained across method callsStateless -- no conversational state maintained

EJB Types

Copyright 2001-2002, Dan Harkey. All rights reserved. DO NOT COPY OR DISTRIBUTE.

Entity EJBsRepresents a business object (customer, order, products, etc.)Has persistent stateShared by J2EE clientsHas a unique identifier called a primary key

Finder methods and query language used to locate entity EJB instances

Can have relationships to other entity EJBsTwo kinds of persistence strategies

Container managedBean Managed

EJB Types (cont)

Message Driven EJBsProcesses asynchronous messages from JMSMessages can originate from any J2EE client, EJB, or web component, or any JMS applicationClients do not directly access Message Driven EJBs

EJB Types (cont)

Copyright 2001-2002, Dan Harkey. All rights reserved. DO NOT COPY OR DISTRIBUTE.

The EJB Contracts

Client/Server ContractDefines factory, finder, business methods for a client to interact with an EJB

Component ContractDefines call-back methods for the EJB container to manage EJB instances

Deployment Descriptor ContractDefines XML deployment descriptor information

Interoperability ContractDefines interoperability protocols between containers

J2EE/EJB Contracts

Copyright 2001-2002, Dan Harkey. All rights reserved. DO NOT COPY OR DISTRIBUTE.

Client/Server Contract:Defining Remote EJB Client Access via Interfaces

Two Java Interfaces define methods for remote client access

Home InterfaceProvides factory and finder methods

Remote InterfaceDefines business methods

Client/Server Contract:EJB Home/Remote Interfaces

Copyright 2001-2002, Dan Harkey. All rights reserved. DO NOT COPY OR DISTRIBUTE.

Client/Server Contract:Defining Local EJB Client Access via Interfaces

Two Java Interfaces also define methods for local client access

LocalHome InterfaceProvides factory and finder methods

Local InterfaceDefines business methods

Some requirements for Local AccessClient and local EJB must run in the same JVMCan be a web component or another EJBLocation is not transparentOften an EJB with a relationship to another EJB

The Container/EJB Contract

Copyright 2001-2002, Dan Harkey. All rights reserved. DO NOT COPY OR DISTRIBUTE.

Session Bean Component ContractMethods for lifecycle, activation/passivation, and business logic

Entity Bean Component ContractMethods for lifecycle, persistence, and business logic

MessageDriven Bean Component ContractMethods for lifecycle and message queue processing

The Container/EJB Contract (cont.)

EJB Delegation: From Client/Server Contract to Component Contract

Copyright 2001-2002, Dan Harkey. All rights reserved. DO NOT COPY OR DISTRIBUTE.

EJB Delegation: From Client/Server Contract to Component Contract

EJB Runtime Support

Copyright 2001-2002, Dan Harkey. All rights reserved. DO NOT COPY OR DISTRIBUTE.

EJB Clients

OverviewJSP/ServletsCORBA ClientsApplets, Applications, COM+EJBs as Clients

EJB Clients

Copyright 2001-2002, Dan Harkey. All rights reserved. DO NOT COPY OR DISTRIBUTE.

Steps for a Client to Access an EJB

Locate the Home or LocalHome Interface via JNDICreate or find an EJB instanceUse reference to EJB instance to invoke business methods defined in the remote or local interfaceRemove EJB instance (if necessary)

The JSP - EJB Connection

Copyright 2001-2002, Dan Harkey. All rights reserved. DO NOT COPY OR DISTRIBUTE.

EJB CORBA Clients

EJB Interoperability

Copyright 2001-2002, Dan Harkey. All rights reserved. DO NOT COPY OR DISTRIBUTE.