Docsity

Enterprise Java Beans - Java and the Web - Lecture Slides, Slides of Java Programming

Partial preview of the text

Download Enterprise Java Beans - Java and the Web - Lecture Slides and more Slides Java Programming in PDF only on Docsity!

J2EE and Enterprise Java Beans

Distributed Multi-tiered Applications

  • The J2EE platform uses a multi-tiered distributed application model for both enterprise applications
  • Application logic is divided into “components” according to function, and the various application components that make up a J2EE application are installed on different machines depending on the tier in the multi-tiered J2EE environment to which the application component belongs

J2EE Architecture

  • Three-tiered applications that run in this way extend the standard two-tiered client and server model by placing a multithreaded application server between the client application and back-end storage

J2EE Containers

• The application server maintains control and

provides services through an interface or

framework known as a container

• There are five defined container types in the

J2EE specification

Client J2EE Containers

• The other two container types are client-side:

  • An application container for stand-alone GUIs,

console

  • An applet container, meaning a browser, usually

with the Java Plug-in

J2EE Components

• As said earlier, J2EE applications are made up

of components

• A J2EE component is a self-contained

functional software unit that is assembled into

a J2EE application with its related classes and

files and that communicates with other

components

Packaging Applications and Components

  • Under J2EE, applications and components reside in Java Archive (JAR) files
  • These JARs are named with different extensions to denote their purpose, and the terminology is important

Various File types

• Enterprise Archive (EAR) files represent the

application, and contain all other server-side

component archives that comprise the

application

• Client interface files and EJB components

reside in JAR files

• Web components reside in Web Archive

(WAR) files

Deployment Descriptors

  • Most J2EE Web Services vendors provide a GUI tool for

generating deployment descriptors and performing deployment because creating manual entries is tedious and error prone

  • The deployment descriptor for an EJB component must be

named ejb-jar.xml, and it resides in the META-INF directory inside the EJB JAR file

EJB Components

  • EJB components are server-side, modular, and reusable, comprising specific units of functionality
  • They are similar to the Java classes we create every day, but are subject to special restrictions and must provide specific interfaces for container and client use and access
  • We should consider using EJB components for applications that require scalability, transactional processing, or availability to multiple client types

The home and component interface

  • A bean's home interface specifies methods that allow the client to create, remove, and find objects of the same type
  • The home interface provides bean management and life cycle

methods

  • EJB functionality is obtained through the bean's component interface, which defines the business methods visible to, and callable by, the client
  • The developer writes the component interface, and the container creates the implementation for client interaction

Overview

  • Enterprise JavaBeans is a specification for creating server-side

secure, scalable, transactional, multi-user secure enterprise- level applications.

  • These server-side components, called enterprise beans, are

distributed objects that are hosted in Enterprise Java Bean containers and provide remote services for clients distributed throughout the network.

Advantages of EJB

  • Simplifies the development of middleware components that are secure, transactional, scalable & portable.
  • Simplifies the process to focus mainly on business logic rather than application development.
  • Overall increase in developer productivity
  • Reduces the time to market for mission critical applications

Purpose of EJBs

  • SESSION Beans (verbs of the system):
    • Model task or workflow
    • Façade for Entity beans
    • Maintain conversational state with clients
  • ENTITY Beans (nouns of the system):
    • Object/Relational (O/R) mapping
    • Transparent and implicit persistence with transaction support
  • Message Driven Beans:
    • Asynchronous communication with MOM
    • Conduit for non-J2EE resources to access Session and Entity Beans via JCA Resource adapters.