Java Web 应用开发: J2EE 和 Tomcat 蔡 剑, Ph.D.. 本讲内容 EJB 层技术 (II) Transaction and Security Resource Connection Deployment Web Services.

Slides:



Advertisements
Similar presentations
J0 1 Marco Ronchetti - Basi di Dati Web e Distribuite – Laurea Specialistica in Informatica – Università di Trento.
Advertisements

21 Copyright © 2005, Oracle. All rights reserved. Oracle Application Server 10g Transaction Support.
J2EE Architecture Overview
Web Services Web Services are the basic fundamental building blocks of invoking features that can be accessed by an application program. The accessibility.
An architecture for webb applications, J2EE
Introduction to Java 2 Enterprise Edition About myself –Neutrinos, Cancer Research, IT Applications Today’s topic: J2EE –Context –Advantages –Components.
 Java  Python  Bigtable(Bt) is a distributed storage system for managing structured data that is designed to scale to a very large size.  Query Language.
The J2EE Framework 1 Introduction to Java 2 Enterprise Edition Presented by Communication & Collaboration Technologies Division of the Chief Information.
Distributed System Using Java 2 Enterprise Edition (J2EE) B.Ramamurthy.
Java 2 Platform, Enterprise Edition (J2EE). Source: Computer, August 2000 J2EE and Other Java 2 Platform Editions.
JMS Java Message Service Instructor Professor: Charles Tappert By Student: Amr Fouda.
J2EE vs..NET Nigam Patel. Topics Background –Web Services, J2EE and.NET Similarities Differences Conclusion –Pros and Con (J2EE and.NET)
Enterprise Programming By J Pearce. Enterprise Software Sales HR Inventory Customer Support Shipping.
Distributed System Using Java 2 Enterprise Edition (J2EE)
Distributed Multitiered Applications The J2EE platform uses a multitiered distributed application model. Application logic is divided into components 1.
Web Services Mohamed Fahmy Dr. Sherif Aly Hussein.
Chapter 4: Core Web Technologies
Enterprise Java Beans CS-422. Application Servers In the late 1980s and though the mid 1990s a number of corporations (Broadvision, Netscape…) marketed.
HTTP client wide area network (Internet) HTTP proxy HTTP server HTTP gateway firewall HTTP tunnel Copyright Springer Verlag Berlin Heidelberg 2004.
Notes of J2EE Tutorial Matt Tsai. 2 Outline Chapter 1: Overview Chapter 1: Overview Chapter 2: Understanding XML Chapter 2: Understanding XML Chapter.
Ing. Ignacio Roqueta ARTech GeneXus and J2EE.
What’s new in J2EE 1.4 Sean C. Sullivan Portland Java Users Group February 2004.
Enterprise Computing COSC 617 Jeff Schmitt September 7,2006.
CS 493/693: Distributed Systems Programming V. “Juggy” Jagannathan CSEE, West Virginia University March 21, 2005.
Java Web 应用开发: J2EE 和 Tomcat 蔡 剑, Ph.D.. 课程内容 互联网软件系统的理论 互联网软件系统和电子商务系统的开发方 法和应用 目前世界前沿公司所采用的互联网软件系 统开发技术 (e.g. Java Enterprise Edition, Tomcat,Web Services,
© D. Wong  Indexes  JDBC  JDBC in J2EE (Java 2 Enterprise Edition)
Entity Java Beans Jorg Janke Open Source ERP & CRM.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
Message-Driven Beans and EJB Security Lesson 4B / Slide 1 of 37 J2EE Server Components Objectives In this lesson, you will learn about: Identify features.
Java Transaction API Sean C. Sullivan
第十四章 J2EE 入门 Introduction What is J2EE ?
J2EE Structure & Definitions Catie Welsh CSE 432
Enterprise Java v120131Intro to JavaEE1 Java EE 5 TM Introduction.
Enterprise Java Beans Java for the Enterprise Server-based platform for Enterprise Applications Designed for “medium-to-large scale business, enterprise-wide.
Web Services Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Java Web 应用开发: J2EE 和 Tomcat 蔡 剑, Ph.D.. 本讲内容 Web 层技术 (IV) JSTL Web Security Web Application Architecture.
Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006.
J2EE Overview ver 1.0Page 1 © Wipro Technologies Talent Transformation J2EE Overview.
Java Web应用开发:J2EE和Tomcat
Source: Peter Eeles, Kelli Houston, and Wojtek Kozaczynsky, Building J2EE Applicationa with the Rational Unified Process, Addison Wesley, 2003 Prepared.
Ch 2 – Application Assembly and Deployment COSC 617 Jeff Schmitt September 14, 2006.
Databases JDBC (Java Database Connectivity) –Thin clients – servlet,JavaServer Pages (JSP) –Thick clients – RMI to remote databases –most recommended way.
XML and Web Services (II/2546)
CliServ. J2EE/141 Client/Server Distributed Systems v Objectives –introduce the J2EE specification, and the J2EE SDK –other approaches: Struts,
Enterprise Java Overview Panos Konstantinidis Java Developer JUG Leader & Java Champion
Assignment of JAVA id : BSSE-F10-M-10-JAVA1 Overview of J2EE/Session 2/Slide 1 of 38.
Page 1 R MVC Design Pattern Definition Properties Describing MVC design patterns.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Java Web 应用开发: J2EE 和 Tomcat 蔡 剑, Ph.D.. 本讲内容 Web 层技术 (III) Custom Tags JSP and XML JSTL.
Preface 1Introduction Course Objectives 1-2 Course Environment 1-4 Course Overview 1-5 About the Course Applications 1-8 Order Entry Schema 1-9 Human Resources.
1 Distributed System using J2EE. 2 What is J2EE?  J2EE (Java2 Enterprise Edition) offers a suite of software specification to design, develop, assemble.
Java Web 应用开发: J2EE 和 Tomcat 蔡 剑, Ph.D.. 本讲内容 Web 层技术 (II) Servlet 的新功能 JSP 技术.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
©NIIT Introducing Enterprise JavaBeans (EJB) Lesson 1A / Slide 1 of 43J2EE Server Components Objectives In this lesson, you will learn about: The features.
Enterprise JavaBeans: Fundamentals. EJB Fundamentals(c)CDAC(Formerly NCST)2 Contents Introduction Technology Overview EJB Architecture EJB Specification.
Quick Introduction to Java Enterprise Edition Instructor: Sergey Goldman Based on The Java EE Tutorial by Oracle/Sun Microsystems 1.
Apache Geronimo Open Source J2EE Application Server Getting up to speed with Apache Geronimo - Copyright 2005 Tom McQueeney 1 Getting up to speed with.
Java Web 应用开发: J2EE 和 Tomcat 蔡 剑, Ph.D.. 本讲内容 网络系统设计模式 综合案例分析.
Java Web Services Orca Knowledge Center – Web Service key concepts.
J2EE Platform Overview (Application Architecture)
Chapter 5 Remote Procedure Call
Introduction to J2EE Architecture
Chapter 9 Web Services: JAX-RPC, WSDL, XML Schema, and SOAP
Distributed System Using Java 2 Enterprise Edition (J2EE)
Enterprise Java Beans Bina Ramamurthy 1/13/2019 B.Ramamurthy.
Introduction to Web Services
Enterprise Java Beans Bina Ramamurthy 4/5/2019 B.Ramamurthy.
Objectives In this lesson, you will learn about:
Presentation transcript:

Java Web 应用开发: J2EE 和 Tomcat 蔡 剑, Ph.D.

本讲内容 EJB 层技术 (II) Transaction and Security Resource Connection Deployment Web Services

Review: J2EE Framework (X)HTML XML Applet Client Application JAFJMSJDBC JTA JNDI JSTL Servlets JSPs Web Container Session Beans Entity Beans EJB Container J2EE Application Server RDMS Mail Server Java Application CORBA Server Directory Service Message Queue JDBC JavaMail RMI IIOP JNDI JMS HTTP Message Beans Application Client Container JAX RPC SAAJ JAXRJACC Mgmt JMX JAFJMSJDBC JTA JNDI JAX RPC SAAJ JAXRJACC Mgmt JMX JAX RPC SAAJ JAXR JMS Mgmt JMX

Web Application Architecture: MVC Model Model Encapsulates application state Responds to state queries Exposes application functionality Notifies views of changes Model Encapsulates application state Responds to state queries Exposes application functionality Notifies views of changes View Renders the models Request updates from models Sends user gestures to Controller Allows controller to select View View Renders the models Request updates from models Sends user gestures to Controller Allows controller to select View Controller Define application behavior Maps user actions to model updates Select view for response One for each functionality Controller Define application behavior Maps user actions to model updates Select view for response One for each functionality State Query State Change View Selection User gestures Change Notice

Transaction Concept begin transaction debit checking account credit savings account update history log commit transaction

CMT Transaction Management public void transferToSaving(double amount) throws InsufficientBalanceException { checkingBalance -= amount; savingBalance += amount; try { updateChecking(checkingBalance); if (checkingBalance < 0.00) { context.setRollbackOnly(); throw new InsufficientBalanceException(); } updateSaving(savingBalance); } catch (SQLException ex) { throw new EJBException ("Transaction failed due to SQLException: " + ex.getMessage()); }

BMT Transaction Management : JDBC public void ship (String productId, String orderId, int quantity) { try { con.setAutoCommit(false); updateOrderItem(productId, orderId); updateInventory(productId, quantity); con.commit(); } catch (Exception ex) { try { con.rollback(); throw new EJBException("Transaction failed: " + ex.getMessage()); } catch (SQLException sqx) { throw new EJBException("Rollback failed: " + sqx.getMessage()); }

BMT Transaction Management : JTA public void withdrawCash(double amount) { UserTransaction ut = context.getUserTransaction(); try { ut.begin(); updateChecking(amount); machineBalance -= amount; insertMachine(machineBalance); ut.commit(); } catch (Exception ex) { try { ut.rollback(); } catch (SystemException syex) { throw new EJBException ("Rollback failed: " + syex.getMessage()); } throw new EJBException ("Transaction failed: " + ex.getMessage()); }

Transaction Allowance Bean Type Container- Managed Bean- Managed JTAJDBC EntityYNN SessionYYY Message- driven YYY

Updating Multiple Databases

Resource Connections Resource Manager Type Connection Factory TypeJNDI Subcontext JDBC javax.sql.DataSourcejava:comp/env/jdbc JMS javax.jms.TopicConnectionFactor y javax.jms.QueueConnectionFactor y java:comp/env/jms JavaMail javax.mail.Sessionjava:comp/env/mail URL java.net.URLjava:comp/env/url Connector javax.resource.cci.ConnectionFa ctory java:comp/env/eis JAXR Resource Adapter javax.xml.registry.ConnectionFa ctory java:comp/env/eis/ JAXR

Database Connection private String dbName = "java:comp/env/jdbc/SavingsAccountDB"; InitialContext ic = new InitialContext(); DataSource ds = (DataSource) ic.lookup(dbName); Connection con = ds.getConnection();

EJB Deployment: Security Declare

Programmatic Security in the EJB Tier public String getUser() { return context.getCallerPrincipal().getName (); } boolean result = context.isCallerInRole("Customer");

Propagating Security Identity

Web Deployment: Security Declare

Packaging Modules EJB 模块,其包含 ejb 文件及相应类 Web 模块,其包含网络层的组件及资源 应用客户模块,其包含应用客户类 资源适配器模块,其包含 java 连接器 (connector), 资源适配器,和帮助库函数及 相关资源。

Deployment Configuration Files EJB 部署描述文件 网络层部署描述文件 web.xml 应用客户部署描述文件 资源适配器部署描述文件

EJB Deployment: Packaging

EJB and Web Services J2EE1.4 Web Services.Net Web Services Perl Web Services EJB2.1 Container Stateless Session Bean SOAP

Web Services

Web Services Support Web services are Web-based enterprise applications that use open, Extensible Markup Language (XML)-based standards and transport protocols to exchange data with calling clients. The J2EE platform provides the XML APIs and tools you need to quickly design, develop, test, and deploy Web services and clients that fully interoperate with other Web services and clients running on Java-based or non-Java- based platforms. It is easy to write Web services and clients with the J2EE XML APIs. No low-level programming is needed because the XML API implementations do the work of translating the application data to and from an XML-based data stream that is sent over the standardized XML-based transport protocols. The translation of data to a standardized XML-based data stream is what makes Web services and clients written with the J2EE XML APIs fully interoperable.

Web Services Concept

Web Services

Web Services Standards

Three Players of WS

SOAP

UDDI

WSDL

J2EE Web Services