Download presentation
Presentation is loading. Please wait.
Published byGeorge Parsons Modified over 9 years ago
2
Object Oriented Analysis and Design 1 Chapter 8 - Web Application System Design Modeling Web Application using UML Application Server Web Application Design
3
Object Oriented Analysis and Design 2 Modeling Web Application using UML
4
Object Oriented Analysis and Design 3 8.1 - Modeling Web Application using UML Modeling Web Pages Modeling EJB
5
Object Oriented Analysis and Design 4 Modeling Web Pages For web pages, the stereotypes indicate that the class is an abstraction of the logical behavior of a web page on either the client or the server. The two abstractions are related to each other with a directional relationship between the two. This association is stereotyped as «build», since it can be said that a server page builds a client page.
6
Object Oriented Analysis and Design 5 Modeling Web Pages
7
Object Oriented Analysis and Design 6 Modeling Web Pages
8
Object Oriented Analysis and Design 7 Modeling Web Pages
9
Object Oriented Analysis and Design 8 Modeling Web Pages
10
Object Oriented Analysis and Design 9 Modeling Web Pages
11
Object Oriented Analysis and Design 10 Modeling EJB Modeling EJB as a subsystem Two approach: Standard UML-Java Mapping Sun JSR-000026 UML/EJB Mapping
12
Object Oriented Analysis and Design 11 Modeling EJB as a subsystem
13
Object Oriented Analysis and Design 12 Modeling EJB as a subsystem ICustomerMgt => CustomerHome (home interface) Icustomer => Customer (remote interface) >Customer =>CustomerEJB (bean class) validateCustomer() => findUser() (in home interface)
14
Object Oriented Analysis and Design 13 Modeling EJB as a subsystem
15
Object Oriented Analysis and Design 14 Modeling EJB as a subsystem
16
Object Oriented Analysis and Design 15 Modeling EJB as a subsystem
17
Object Oriented Analysis and Design 16 Modeling EJB as a subsystem
18
Object Oriented Analysis and Design 17 Standard UML-Java Mapping
19
Object Oriented Analysis and Design 18 Sun JSR-000026 UML/EJB Mapping
20
Object Oriented Analysis and Design 19 Application Server
21
Object Oriented Analysis and Design 20 8.2 - Application Server Application Servers J2EE Application Servers Web Server and Application Server
22
Object Oriented Analysis and Design 21 Application Servers In the beginning, there was darkness and cold. Then, … Centralized, non-distributed terminals mainframe terminals
23
Object Oriented Analysis and Design 22 Application Servers The In the 90' s, systems should be client- server
24
Object Oriented Analysis and Design 23 Application Servers Today, enterprise applications use the multi-tier model
25
Object Oriented Analysis and Design 24 Application Servers " The Multi- tier applications" have several independent components An application server provides the infrastructure and services to run such applications
26
Object Oriented Analysis and Design 25 Application Servers Application server products can be separated into 3 categories: J2EE-based solutions Non-J2EE solutions (PHP, ColdFusion, Perl, etc.) And the Microsoft solution (ASP/COM and now.NET with ASP.NET, VB.NET, C#, etc.)
27
Object Oriented Analysis and Design 26 J2EE Application Servers Major J2EE products: BEA WebLogic IBM WebSphere Sun iPlanet Application Server Oracle 9iAS HP/Bluestone Total-e-Server Borland AppServer Jboss (free open source)
28
Object Oriented Analysis and Design 27 Web Server and Application Server Web Server (HTTP Server) App Server 1 App Server 2 Internet Browser HTTP(S)
29
Object Oriented Analysis and Design 28 Web Application Design
30
Object Oriented Analysis and Design 29 8.3 - Web Application Design Application Layer Business Layer J2EE Multi-tier Model J2EE Application Scenarios Main Technologies Examples Case Study –Online Bank
31
Object Oriented Analysis and Design 30 Application Layer
32
Object Oriented Analysis and Design 31 Business Layer
33
Object Oriented Analysis and Design 32 J2EE Multi-tier Model
34
Object Oriented Analysis and Design 33 J2EE Application Scenarios Multi-tier typical application
35
Object Oriented Analysis and Design 34 J2EE Application Scenarios Stand-alone client
36
Object Oriented Analysis and Design 35 J2EE Application Scenarios Web-centric application
37
Object Oriented Analysis and Design 36 J2EE Application Scenarios Business-to-business
38
Object Oriented Analysis and Design 37 Main technologies JavaServer Pages (JSP) Servlet Enterprise JavaBeans (EJB) JSPs, servlets and EJBs are application components
39
Object Oriented Analysis and Design 38 JSP Used for web pages with dynamic content Processes HTTP requests (non-blocking call-and- return) Accepts HTML tags, special JSP tags, and scriptlets of Java code Separates static content from presentation logic Can be created by web designer using HTML tools
40
Object Oriented Analysis and Design 39 Servlet Used for web pages with dynamic content Processes HTTP requests (non-blocking call- and-return) Written in Java; uses print statements to render HTML Loaded into memory once and then called many times Provides APIs for session management
41
Object Oriented Analysis and Design 40 EJB EJBs are distributed components used to implement business logic (no UI) Developer concentrates on business logic Availability, scalability, security, interoperability and integrability handled by the J2EE server Client of EJBs can be JSPs, servlets, other EJBs and external aplications Clients see interfaces
42
Object Oriented Analysis and Design 41 EJB – The Big Picture
43
Object Oriented Analysis and Design 42 EJB at runtime Client can be local or remote
44
Object Oriented Analysis and Design 43 EJB at runtime
45
Object Oriented Analysis and Design 44 Types of EJB
46
Object Oriented Analysis and Design 45 Session Bean Stateful session bean: Retains conversational state (data) on behalf of an individual client If state changed during this invocation, the same state will be available upon the following invocation Example: shopping cart
47
Object Oriented Analysis and Design 46 Session Bean Stateless session bean: Contains no user-specific data Business process that provides a generic service Container can pool stateless beans Example: shopping catalog
48
Object Oriented Analysis and Design 47 Entity Bean Represents business data stored in a database ? persistent object Underlying data is normally one row of a table A primary key uniquely identifies each bean instance Allows shared access from multiple clients The Can live past the duration of client' s session Example: shopping order
49
Object Oriented Analysis and Design 48 Entity Bean Bean-managed persistence (BMP): bean developer writes JDBC code to access the database; allows better control for the developer Container-managed persistence (CMP): container generates all JDBC code to access the database; developer has less code to write, but also less control
50
Object Oriented Analysis and Design 49 Message-Driven Bean Message consumer for a JMS queue or topic Benefits from EJB container services that are not available to standard JMS consumers Has no home or remote interface Example: Order processing – stock info
51
Object Oriented Analysis and Design 50 Examples JSP example Servlet example EJB example
52
Object Oriented Analysis and Design 51 JSP example
53
Object Oriented Analysis and Design 52 JSP example Hello, User My name is Duke. What's yours?
54
Object Oriented Analysis and Design 53 JSP example <% if (request.getParameter("username") != null) { %> <% } %>
55
Object Oriented Analysis and Design 54 Servlet example public class HelloWorldServlet extends HttpServlet { public void service(HttpServletRequest req, HttpServletResponse res) throws IOException { res.setContentType("text/html"); PrintWriter out = res.getWriter(); out.println(" Hello World Servlet "); out.println(" Hello World! "); }
56
Object Oriented Analysis and Design 55 EJB Example // Shopping Cart example // Home interface public interface CartHome extends EJBHome { Cart create(String person) throws RemoteException, CreateException; Cart create(String person, String id) throws RemoteException, CreateException; }
57
Object Oriented Analysis and Design 56 EJB Example // Remote interface public interface Cart extends EJBObject { public void addBook(String title) throws RemoteException; public void removeBook(String title) throws BookException, RemoteException; public Vector getContents() throws RemoteException; }
58
Object Oriented Analysis and Design 57 EJB Example // Enterprise bean class public class CartEJB implements SessionBean { String customerName, customerId; Vector contents; private SessionContext sc; public void ejbCreate(String person) throws CreateException { if (person == null) { throw new CreateException("Null person not allowed."); } else { customerName = person; } customerId = "0"; contents = new Vector(); }
59
Object Oriented Analysis and Design 58 EJB Example public void ejbCreate(String person, String id) throws CreateException { if (person == null) { throw new CreateException("Null person not allowed."); } else { customerName = person; } IdVerifier idChecker = new IdVerifier(); if (idChecker.validate(id)) { customerId = id; } else { throw new CreateException("Invalid id: " + id); } contents = new Vector(); }
60
Object Oriented Analysis and Design 59 EJB Example public void addBook(String title) { contents. addElement(title); } public void removeBook(String title) throws BookException { boolean result = contents.removeElement(title); if (result == false) { throw new BookException(title + " not in cart."); } public Vector getContents() { return contents; }... }
61
Object Oriented Analysis and Design 60 EJB Example // EJB client (stand-alone application) public class CartClient { public static void main(String[] args) { try { CartHome home = (CartHome)initial.lookup("MyCart"); Cart shoppingCart = home.create("Duke DeEarl", "123"); shoppingCart.addBook("The Martian Chronicles"); shoppingCart.addBook("2001 A Space Odyssey"); shoppingCart.remove(); } catch (BookException ex) { System.err.println("Caught a BookException: " + ex.getMessage()); } catch (Exception ex) { System.err.println("Caught an unexpected exception!"); }
62
Object Oriented Analysis and Design 61 Case Study – Online Bank
63
Object Oriented Analysis and Design 62 Case Study – Online Bank
64
Object Oriented Analysis and Design 63 Case Study – Online Bank
65
Object Oriented Analysis and Design 64 Case Study – Online Bank
66
Object Oriented Analysis and Design 65 Case Study – Online Bank
67
Object Oriented Analysis and Design 66 Case Study – Online Bank
68
Object Oriented Analysis and Design 67 Case Study – Online Bank
69
Object Oriented Analysis and Design 68 Case Study – Online Bank
70
Object Oriented Analysis and Design 69 Case Study – Online Bank
71
Object Oriented Analysis and Design 70 Case Study – Online Bank
72
Object Oriented Analysis and Design 71 Case Study – Online Bank
73
Object Oriented Analysis and Design 72 Case Study – Online Bank
74
Object Oriented Analysis and Design 73 Case Study – Online Bank
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.