23
ACCP2005/EJB 2.0/ Session 1/1 of 23 Session 1 Introduction to Enterprise Java Beans

Session 1 Tp1

Embed Size (px)

Citation preview

Page 1: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/1 of 23

Session 1

Introduction to EnterpriseJava Beans

Page 2: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/2 of 23

Session Objectives

Discuss Component Architecture Describe Distributed Object

Architecture Discuss RMI Explain RMI-IIOP Discuss the Java Naming and

Directory Interface

Page 3: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/3 of 23

Component Architecture

Components are building blocks of an application Provides a set of services or functions, such that

it can easily interact with other applications or components

Consists mainly of Web components, business logic components, and service components.

Web components consist mainly of JSP and Servlets, the business logic component consists of EJB and the services component primarily consists of JavaMail, JNDI, JMS, JTS, JDBC, and RMI-IIOP.

Page 4: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/4 of 23

Evolution of Enterprise JavaBeans

EJB was developed so that it would: * Specialize in handling the business

logic of an application * Be robust * Be secure so that it cannot be

tampered. EJB Component has been designed to

encapsulate business logic.

Page 5: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/5 of 23

Distributed Object Architecture

Page 6: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/6 of 23

RMI Architecture

RMI Application consists of * Server

* Client RMI defines two types of objects * Stubs * Skeletons Marshalling - process of converting data or

objects into a byte-stream .

Unmarshalling - reverse process of converting the byte-stream back to the original data or objects.

Page 7: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/7 of 23

RMI Layered Architecture

Transport Layer

Object A

Object A

Remote Reference Layer

Object A Stub

Transport Layer

Object B

Object B

Remote Reference Layer

Object B Skeleton

Client Server

REMOTE

REGISTRY

Page 8: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/8 of 23

RMI Layers

Stub and the Skeleton Layer The stub forwards the request

from the client to the remote reference layer and then to the skeleton through transport layer.

Remote Reference Layer Responsible for unicast point-to-

point method invocation. Transport Layer Uses TCP/IP for communication.

Page 9: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/9 of 23

The Transport Layer

Transport Layer

Client

Transport Layer

Server

TCP Protocol

UDP Protocol

Sockets

Page 10: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/10 of 23

Remote Registry

Remote Registry

Registers

Database of Objects

SERVER

Page 11: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/11 of 23

RMI over IIOP

Client

Client

Client

Server

Server

Server

RMI(Java only)

RMI(Java only)

RMI-IIOP(Java)

RMI-IIOP(Java)

CORBA(Any Language)

CORBA(Any Language)

JRMP

JRMP

IIOP

IIOP

Page 12: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/12 of 23

Java Naming and Directory Interface

Java Naming and Directory Interface provides the naming and directory functionality to Java applications.

Provides a standard interface to locate the components, users,networks, and services placed across the network.

Bridges the gap between directory services and makes it possible for the developer to write portable naming and directory services

Page 13: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/13 of 23

The JNDI Architecture

Client

JNDI

LDAP Service Provider

NDS Service Provider

RMI Application

Service Provider Interface

CORBA Application

Page 14: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/14 of 23

Naming Concepts in JNDI

Compound

Composite

Atomic

The three types of names in JNDI

Page 15: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/15 of 23

Steps in JNDI Programming

Looking up the Component/Object

Creating the Initial ContextImporting the JNDI classes

Catching the Naming Exception

Running the programCompiling the Program

Page 16: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/16 of 23

Initial Context Factory and the Directory Context

Initial Context Factory is the point where all naming and directory operations are first performed.

When the initial context is acquired, all information pertaining to this must be provided to JNDI.

The directory context or directory object is another type of context. It is used to define methods for inspecting and modifying attributes associated with a directory object.

Page 17: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/17 of 23

Initial Context Factory and the Directory Context

Initial Context Factory

Context

Initial ContextContext

Naming System

Binding

Page 18: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/18 of 23

Java 2 Platform Enterprise Edition ( J2EE )

J2EE Technologies * Enterprise Java Beans (EJB) * Remote Method Invocation (RMI) * Java Naming and Directory Interface (JNDI) * Java Database Connectivity (JDBC) * Java Transaction API (JTA) and Java

Transaction Service (JTS)

* Java Messaging Service (JMS)

(cont…)

Page 19: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/19 of 23

Java 2 Platform Enterprise Edition (J2EE)

J2EE Technologies * Java Servlets and Java Server Pages (JSP)

* Java IDL * Java Mail * Connectors * Extensible Markup Language (XML)

Page 20: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/20 of 23

New Features in EJB 2.0

Container-Managed Persistence Container-Managed Relationships Message-Driven Beans Local Interface Additional Methods on the Home-

Interface New Query Language (EJB QL)

Page 21: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/21 of 23

Summary

The multi-tier application model focuses on three important areas:

* Programming business logic * Relying on backend services * Providing user interaction using client-side

applications A software component is an individual unit

of composition with no persistent state. A software component can be deployed

independently, and is subject to composition by third parties.

Page 22: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/22 of 23

Summary - 2

A component in EJB is an object that is deployed on any EJB server.

In a distributed application, processing is distributed across multiple networked computers.

The J2EE Platform collects all the Enterprise APIs to form a total development platform that distributes object architectures.

Page 23: Session 1 Tp1

ACCP2005/EJB 2.0/ Session 1/23 of 23

Summary - 3

The RMI API has mainly 5 packages * java.rmi * java.rmi.registry * java.rmi.server * java.rmi.activation * java.rmi.dgc JNDI is used by Enterprise JavaBeans to perform

a look-up to distribute objects in a network. The point where all naming and directory

operations are first performed is called the Initial Context Factory.