View
731
Download
1
Category
Tags:
Preview:
Citation preview
ACCP2005/EJB 2.0/ Session 1/1 of 23
Session 1
Introduction to EnterpriseJava Beans
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
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.
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.
ACCP2005/EJB 2.0/ Session 1/5 of 23
Distributed Object Architecture
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.
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
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.
ACCP2005/EJB 2.0/ Session 1/9 of 23
The Transport Layer
Transport Layer
Client
Transport Layer
Server
TCP Protocol
UDP Protocol
Sockets
ACCP2005/EJB 2.0/ Session 1/10 of 23
Remote Registry
Remote Registry
Registers
Database of Objects
SERVER
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
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
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
ACCP2005/EJB 2.0/ Session 1/14 of 23
Naming Concepts in JNDI
Compound
Composite
Atomic
The three types of names in JNDI
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
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.
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
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…)
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)
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)
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.
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.
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.
Recommended