Tải bản đầy đủ (.ppt) (50 trang)

Bài giảng Lập trình mạng Title - GV. Nguyễn Xuân Vinh

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (2.02 MB, 50 trang )

28/05/151 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
TITLE
Presenter: Nguyễn Xuân Vinh
Information Technology Faculty
Nong Lam University
28/05/152 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
Session 1
Introduction to Enterprise
Java Beans
28/05/153 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
Session Objectives

Discuss Component Architecture

Describe Distributed Object Architecture

Discuss RMI

Explain RMI-IIOP

Discuss the Java Naming and Directory Interface
28/05/154 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
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.
28/05/155 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
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.
28/05/156 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
Distributed Object Architecture
28/05/157 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
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.
28/05/158 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
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
R
E
M

O
T
E
R
E
G
I
S
T
R
Y
28/05/159 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
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.
28/05/1510 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
The Transport Layer
T

r
a
n
s
p
o
r
t

L
a
y
e
r
Client
T
r
a
n
s
p
o
r
t

L
a
y
e
r

Server
TCP Protocol
UDP Protocol
Sockets
28/05/1511 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
Remote Registry
Remote
Registry
Registers
Database of Objects
SERVER
28/05/1512 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
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
28/05/1513 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
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
28/05/1514 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
The JNDI Architecture
Client
JNDI
LDAP Service
Provider
NDS Service

Provider
RMI
Application
Service Provider
Interface
CORBA
Application
28/05/1515 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
Naming Concepts in JNDI
C
o
m
p
o
u
n
d
C
o
m
p
o
s
i
t
e
A
t
o

m
i
c
The three types of
names in JNDI
28/05/1516 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
Steps in JNDI Programming
Looking up the Component/Object
Creating the Initial ContextImporting the JNDI classes
Catching the Naming Exception
Running the program
Compiling the Program
28/05/1517 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
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.
28/05/1518 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN

Initial Context Factory and the
Directory Context
Initial Context
Factory
Context
Initial Context
Context
Naming System
Binding
28/05/1519 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
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…)
28/05/1520 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
Java 2 Platform Enterprise Edition (J2EE)

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

* Java Mail
* Connectors
* Extensible Markup Language (XML)
28/05/1521 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
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)
28/05/1522 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
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.
28/05/1523 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
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.
28/05/1524 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
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.
28/05/1525 /XX MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
Architectural Overview of EJB
Session 2

×