SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
Unit 7: Design Patterns and Frameworks (cont.)

 Other Web presentation layer issues:
       Design Pattern: Context Object
       Web Presentation layer refactoring: Synchronizer Token
       Session state management

 Web presentation/Business layers integration
         Integration patterns with remote business layer:
               Service Locator
               Business Delegate
 Business layer architectural patterns
       Transaction Script
       Domain Model
       Table Module


dsbw 2011/2012 q1                                                1
Context Object
 Problem: You want to avoid using protocol-specific system
    information outside of its relevant context.
      For example, web components receive protocol-specific HTTP
        requests. Sharing HTTP requests with other components both
        within and outside the presentation tier exposes these
        components to protocol specifics.
 Forces:
         You have components and services that need access to system
          information.
         You want to decouple application components and services from the
          protocol specifics of system information.
         You want to expose only the relevant APIs within a context.
 Solution: Use a Context Object to encapsulate state in a protocol-
    independent way to be shared throughout your application

dsbw 2011/2012 q1                                                             2
Context Object: Structure




             Example:




dsbw 2011/2012 q1           3
Context Object: Sequence Diagram




dsbw 2011/2012 q1                  4
Synchronizer Token
 Problem: Clients make duplicate resource requests that
    should be monitored and controlled, or clients access certain
    views out of order by returning to previously bookmarked
    pages.

 Forces:
         You want to control the order or flow of the requests.
         You want to control duplicate request submissions from a
          client. Such duplicate submissions may occur when the user
          clicks the Back or Stop browser buttons and resubmits a form

 Solution: Use a Synchronizer Token to monitor and control
    the request flow and client access to certain resources.


dsbw 2011/2012 q1                                                        5
Synchronizer Token: Mechanics

                         Create one or more helper classes
                          responsible for generating and
                          comparing one-time-use, unique
                          tokens.
                         The component managing this
                          activity delegates to these helpers,
                          managing the temporary storage of a
                          fresh token for each client
                          submission.
                         A copy of the token is stored per user
                          on the server and on the client
                          browser. The token is typically stored
                          on the client browser as a hidden
                          field and on the server in a user
                          session.
                         Add logic to check whether the token
                          arriving with the client request
                          matches the token in the user
                          session.
dsbw 2011/2012 q1                                              6
Session State Management

     Solution        Implementation        Benefits          Drawbacks

On the Client       Hidden Form Fields Easy to            Limited amount of
                    HTTP Cookies       implement.         data
                    URI Rewriting      No problems with   Security concerns
                                       load-balanced      if data not
                                       server clusters    encrypted

On the Web          HttpSession and    Easy-to-use APIs   Load-balanced
container           the like                              server clusters
                                                          require special
                                                          treatments
On a DB             Stored in a DB     Sharable           Penalizes DB
                    table              Recoverable        performance




dsbw 2011/2012 q1                                                           7
Web Presentation/Business Layers Integration

                                 Web Container

                                 Web Presentation Layer



                                     Business Layer

                                   Data Source Layer

                    Web server




 Local procedure calls between web presentation and
    business components
 Direct access to the controllers in the business layer


dsbw 2011/2012 q1                                          8
Web Presentation/Business Layers Integration


                    Web Container       Application Server

                                          Business Layer
                     Web Presentation
                          Layer
                                         Data Source Layer

 Web server



 Remote communication between web presentation and
    business components:
       Communication protocols and/or middleware for distributed
        components
       Name and/or directory services to locate remote components
       DTOs to transfer data between remote components


dsbw 2011/2012 q1                                                    9
Service Locator
 Problem: You want to transparently locate business components
    and services in a uniform manner.
 Forces:
         You want to use a lookup mechanism to locate business components
          and other services.
         You want to centralize and reuse the implementation of lookup
          mechanisms for application clients.
         You want to encapsulate vendor dependencies for registry
          implementations, and hide the dependency and complexity from the
          clients.
         You want to avoid performance overhead related to initial context
          creation and service lookups.
         You want to reestablish a connection to a previously accessed
          component and service
 Solution: Use a Service Locator to implement and encapsulate
    service and component lookup.

dsbw 2011/2012 q1                                                             10
Service Locator: Structure

                              Target: the service or
                                component that the Client is
                                looking up
                              IntialContext: the starting
                                point in the lookup and
                                creation process.
                              RegistryService: the registry
                                implementation that holds
                                the references to the
                                services or components that
                                are registered as service
                                providers for Clients
                              Cache: holds onto references
                                that have been previously
                                looked up.

dsbw 2011/2012 q1                                              11
Service Locator: Sequence Diagram




dsbw 2011/2012 q1                   12
Business Delegate
 Problem: You want to hide clients (Web presentation components)
  from the complexity of remote communication with business
  service components.
 Forces:
         You want to access the business layer components from your Web
          presentation layer components.
         You want to minimize coupling between clients and the business
          services, thus hiding the underlying implementation details of the
          service, such as lookup and access.
         You want to avoid unnecessary invocation of remote services.
         You want to translate network exceptions into application or user
          exceptions.
         You want to hide the details of service creation, reconfiguration, and
          invocation retries from the clients.
 Solution: Use a Business Delegate to encapsulate access to a
    business service.

dsbw 2011/2012 q1                                                                  13
Business Delegate: Structure




dsbw 2011/2012 q1              14
Business Delegate: Sequence Diagram




dsbw 2011/2012 q1                     15
“Classic” J2EE Architecture
                    Web Container
                                                           J2EE
                         Servlets / Web Classes
                                                           Server

                           Business Interface



                           Business Delegate


                                    RMI

                    EJB Container                            J2EE
                                                            Server
                              Session EJB
                                                           (Same or
                                                           Separate
                                                             JVM
                             Entity EJB (optional)




                      DBMS                 Legacy System
dsbw 2011/2012 q1                                                     16
Business Layer Architectural Patterns

  Architectural            Description               Benefits             Drawbacks
    Pattern
Transaction         A single procedure for       Simple paradigm      Duplicated code as
Script              each action that a user      Works well with      several transactions
                    might want to do: takes      RDBMS                need to do similar
                    the input from the                                things
                    presentation, processes
                    it, and stores data in the
                    database.
Domain Model        Conceptual Model             Pure OO: reuse,      Object-Relational
                    objects become Business      inheritance,         impedance
                    Layer components             polymorphism, etc.   mismatch.
                                                 Design Patterns      Data Mapper.

Table Module        Third way solution: OO       Takes advantage      Not so easy to
                    business layer with          of many Data         implement than
                    coarse objects that          Access APIs          Transaction Script
                    correspond to DB tables      (ADO.NET, JDO,       Not so powerful
                                                 JDBC, …)             than Domain Model


dsbw 2011/2012 q1                                                                          17
Transaction Script: Example

       : WebPresLayer                                             : DataSourceLayer

                            : NewPostTrans

                    execute( )
                                   insert? = false
                                            findAuthorsByName(name)

                                                                                      : RecordSet

                                                             next()

                            alt    insertInToAuthors(name, password)             [empty RecordSet]
                                   insert? = true
                                                        get("password")
                                   insert? = “passwords match”

                            opt    insertInToPosts(title, content, author)                 [insert?]




dsbw 2011/2012 q1                                                                                      18
Domain Model: Example

 : WebPresLayer                           authorsDict :
                                           Dictionary                                                 Post
                                                                       Author
                                                                                                 title : String
                       : NewPostTrans                            name : String
                                                                                                 date : Date
                                                                 password : String
                                                                                     1    0..*   content : String
                execute( )
                                get(name)

                      opt               (name, password)         a : Author      [author didn’t exist]
                                put(name, a)


                              newPost(password, title, content )
                                                                           checkPassword(password)

                                                           opt                                     [passwordOK]
                                                                                     p : Post
                                                                         ap




dsbw 2011/2012 q1                                                                                                   19
Table Module: Example
     : WebPresLayer                         : Authors        : Posts         : DataSourceLayer

                           : NewPostTrans

                    execute( )
                                  newPost(...)
                                                        findAuthorsByName(name )

                                                                                                 : RecordSet


                                                                          next()

                                                    insertInToAuthors(name, password)


                                                                       get("password")
                                      addNewPost(title, content, authorName)
                                                                 insertInToPosts(...)




dsbw 2011/2012 q1                                                                                              20
Business Layer Architectural Patterns




dsbw 2011/2012 q1                       21
References
 Books
         ALUR, Deepak et al. Core J2EE Patterns: Best Practices and
          Design Strategies, 2on Edition, Prentice Hall PTR, 2003.
       FOWLER, Martin Patterns of Enterprise Application
        Architecture, Addison Wesley, 2002.
       JOHNSON, Rod and HOELLER Juergen. Expert One-on-One
        J2EE Development without EJB, Willey Publishing, 2004


 Web sites
         www.corej2eepatterns.com
         java.sun.com/blueprints/corej2eepatterns/



dsbw 2011/2012 q1                                                      22

Weitere ähnliche Inhalte

Was ist angesagt?

[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (2/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (2/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (2/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (2/3)Carles Farré
 
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)Kevin Sutter
 
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns FrameworksMike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns Frameworksukdpe
 
Architecture1101 jy21cyl
Architecture1101 jy21cylArchitecture1101 jy21cyl
Architecture1101 jy21cylZouhayr Rich
 
Real world java_ee_patterns
Real world java_ee_patternsReal world java_ee_patterns
Real world java_ee_patternsAlassane Diallo
 
J2EE and layered architecture
J2EE and layered architectureJ2EE and layered architecture
J2EE and layered architectureSuman Behara
 
Jee design patterns- Marek Strejczek - Rule Financial
Jee design patterns- Marek Strejczek - Rule FinancialJee design patterns- Marek Strejczek - Rule Financial
Jee design patterns- Marek Strejczek - Rule FinancialRule_Financial
 
Unit 1st and 3rd notes of java
Unit 1st and 3rd notes of javaUnit 1st and 3rd notes of java
Unit 1st and 3rd notes of javaNiraj Bharambe
 
Unit 5-jdbc2
Unit 5-jdbc2Unit 5-jdbc2
Unit 5-jdbc2msafad
 
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
2012 04-06-v2-tdp-1163-java e-evsspringshootout-finalRohit Kelapure
 

Was ist angesagt? (20)

Unit 02: Web Technologies (2/2)
Unit 02: Web Technologies (2/2)Unit 02: Web Technologies (2/2)
Unit 02: Web Technologies (2/2)
 
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (2/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (2/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (2/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (2/3)
 
Unit 02: Web Technologies (1/2)
Unit 02: Web Technologies (1/2)Unit 02: Web Technologies (1/2)
Unit 02: Web Technologies (1/2)
 
Unit 06: The Web Application Extension for UML
Unit 06: The Web Application Extension for UMLUnit 06: The Web Application Extension for UML
Unit 06: The Web Application Extension for UML
 
Unit 10: XML and Beyond (Sematic Web, Web Services, ...)
Unit 10: XML and Beyond (Sematic Web, Web Services, ...)Unit 10: XML and Beyond (Sematic Web, Web Services, ...)
Unit 10: XML and Beyond (Sematic Web, Web Services, ...)
 
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
 
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns FrameworksMike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
 
J2ee
J2eeJ2ee
J2ee
 
Chapter2 j2ee
Chapter2 j2eeChapter2 j2ee
Chapter2 j2ee
 
Architecture1101 jy21cyl
Architecture1101 jy21cylArchitecture1101 jy21cyl
Architecture1101 jy21cyl
 
Spring
SpringSpring
Spring
 
Real world java_ee_patterns
Real world java_ee_patternsReal world java_ee_patterns
Real world java_ee_patterns
 
J2EE and layered architecture
J2EE and layered architectureJ2EE and layered architecture
J2EE and layered architecture
 
Jee design patterns- Marek Strejczek - Rule Financial
Jee design patterns- Marek Strejczek - Rule FinancialJee design patterns- Marek Strejczek - Rule Financial
Jee design patterns- Marek Strejczek - Rule Financial
 
Unit 1st and 3rd notes of java
Unit 1st and 3rd notes of javaUnit 1st and 3rd notes of java
Unit 1st and 3rd notes of java
 
J2 ee tutorial ejb
J2 ee tutorial ejbJ2 ee tutorial ejb
J2 ee tutorial ejb
 
Java unit 4_cs_notes
Java unit 4_cs_notesJava unit 4_cs_notes
Java unit 4_cs_notes
 
Unit 5-jdbc2
Unit 5-jdbc2Unit 5-jdbc2
Unit 5-jdbc2
 
Java J2EE
Java J2EEJava J2EE
Java J2EE
 
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
 

Andere mochten auch

Building Your PLN
Building Your PLNBuilding Your PLN
Building Your PLNGallit Zvi
 
Tarun Kumar Thesis 2
Tarun Kumar Thesis 2Tarun Kumar Thesis 2
Tarun Kumar Thesis 2Tarun_Kumar85
 
แบบเสนอโครงร่างโครงงานคอมพิวเตอร1
แบบเสนอโครงร่างโครงงานคอมพิวเตอร1แบบเสนอโครงร่างโครงงานคอมพิวเตอร1
แบบเสนอโครงร่างโครงงานคอมพิวเตอร1Moo Mild
 
Englishidom
EnglishidomEnglishidom
EnglishidomMoo Mild
 
ใบงานที่ 11
ใบงานที่ 11ใบงานที่ 11
ใบงานที่ 11Moo Mild
 
ใบงานที่ 3 เรื่อง ขอบข่ายและประเภทของโครงงาน
ใบงานที่ 3 เรื่อง ขอบข่ายและประเภทของโครงงานใบงานที่ 3 เรื่อง ขอบข่ายและประเภทของโครงงาน
ใบงานที่ 3 เรื่อง ขอบข่ายและประเภทของโครงงานMoo Mild
 
ใบงานที่ 11
ใบงานที่ 11ใบงานที่ 11
ใบงานที่ 11Moo Mild
 
Boda Ingrid y Juan Pablo.
Boda Ingrid y Juan Pablo.Boda Ingrid y Juan Pablo.
Boda Ingrid y Juan Pablo.Ti Amat
 
Stephanie neri final_presentation
Stephanie neri final_presentationStephanie neri final_presentation
Stephanie neri final_presentationStephanie Neri
 
ใบงานที่ 4
ใบงานที่ 4ใบงานที่ 4
ใบงานที่ 4Moo Mild
 
加速器と素粒子物理での超?低レイヤー
加速器と素粒子物理での超?低レイヤー加速器と素粒子物理での超?低レイヤー
加速器と素粒子物理での超?低レイヤーRyo Ichimiya
 
แบบเสนอโครงร่างโครงงานคอมพิวเตอร1
แบบเสนอโครงร่างโครงงานคอมพิวเตอร1แบบเสนอโครงร่างโครงงานคอมพิวเตอร1
แบบเสนอโครงร่างโครงงานคอมพิวเตอร1Moo Mild
 
Flipping the ela classroom cawp version
Flipping the ela classroom cawp versionFlipping the ela classroom cawp version
Flipping the ela classroom cawp versionMrsHardin78
 
Genius Hour and ePortfolios
Genius Hour and ePortfoliosGenius Hour and ePortfolios
Genius Hour and ePortfoliosGallit Zvi
 
Extra survey celebrations
Extra survey celebrationsExtra survey celebrations
Extra survey celebrationsCornStik
 
Rscon4 presentation on Genius Hour
Rscon4 presentation on Genius HourRscon4 presentation on Genius Hour
Rscon4 presentation on Genius HourGallit Zvi
 
Interning in Silicon Valley
Interning in Silicon ValleyInterning in Silicon Valley
Interning in Silicon Valleytiffanywlim
 

Andere mochten auch (20)

Building Your PLN
Building Your PLNBuilding Your PLN
Building Your PLN
 
Tarun Kumar Thesis 2
Tarun Kumar Thesis 2Tarun Kumar Thesis 2
Tarun Kumar Thesis 2
 
แบบเสนอโครงร่างโครงงานคอมพิวเตอร1
แบบเสนอโครงร่างโครงงานคอมพิวเตอร1แบบเสนอโครงร่างโครงงานคอมพิวเตอร1
แบบเสนอโครงร่างโครงงานคอมพิวเตอร1
 
Englishidom
EnglishidomEnglishidom
Englishidom
 
ใบงานที่ 11
ใบงานที่ 11ใบงานที่ 11
ใบงานที่ 11
 
ใบงานที่ 3 เรื่อง ขอบข่ายและประเภทของโครงงาน
ใบงานที่ 3 เรื่อง ขอบข่ายและประเภทของโครงงานใบงานที่ 3 เรื่อง ขอบข่ายและประเภทของโครงงาน
ใบงานที่ 3 เรื่อง ขอบข่ายและประเภทของโครงงาน
 
Blog
BlogBlog
Blog
 
ใบงานที่ 11
ใบงานที่ 11ใบงานที่ 11
ใบงานที่ 11
 
Boda Ingrid y Juan Pablo.
Boda Ingrid y Juan Pablo.Boda Ingrid y Juan Pablo.
Boda Ingrid y Juan Pablo.
 
Stephanie neri final_presentation
Stephanie neri final_presentationStephanie neri final_presentation
Stephanie neri final_presentation
 
ใบงานที่ 4
ใบงานที่ 4ใบงานที่ 4
ใบงานที่ 4
 
加速器と素粒子物理での超?低レイヤー
加速器と素粒子物理での超?低レイヤー加速器と素粒子物理での超?低レイヤー
加速器と素粒子物理での超?低レイヤー
 
แบบเสนอโครงร่างโครงงานคอมพิวเตอร1
แบบเสนอโครงร่างโครงงานคอมพิวเตอร1แบบเสนอโครงร่างโครงงานคอมพิวเตอร1
แบบเสนอโครงร่างโครงงานคอมพิวเตอร1
 
Blog
BlogBlog
Blog
 
Flipping the ela classroom cawp version
Flipping the ela classroom cawp versionFlipping the ela classroom cawp version
Flipping the ela classroom cawp version
 
Genius Hour and ePortfolios
Genius Hour and ePortfoliosGenius Hour and ePortfolios
Genius Hour and ePortfolios
 
Extra survey celebrations
Extra survey celebrationsExtra survey celebrations
Extra survey celebrations
 
Rscon4 presentation on Genius Hour
Rscon4 presentation on Genius HourRscon4 presentation on Genius Hour
Rscon4 presentation on Genius Hour
 
Presentation1
Presentation1Presentation1
Presentation1
 
Interning in Silicon Valley
Interning in Silicon ValleyInterning in Silicon Valley
Interning in Silicon Valley
 

Ähnlich wie Web Presentation Patterns

Day Of Cloud - Windows Azure Platform
Day Of Cloud - Windows Azure PlatformDay Of Cloud - Windows Azure Platform
Day Of Cloud - Windows Azure PlatformWade Wegner
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts frameworks4al_com
 
A Service Oriented Architecture For Order Processing In The I B M Supp...
A  Service  Oriented  Architecture For  Order  Processing In The  I B M  Supp...A  Service  Oriented  Architecture For  Order  Processing In The  I B M  Supp...
A Service Oriented Architecture For Order Processing In The I B M Supp...Kirill Osipov
 
OOW 2012: Integrate Cloud Applications with Oracle SOA Suite
OOW 2012: Integrate Cloud Applications with Oracle SOA SuiteOOW 2012: Integrate Cloud Applications with Oracle SOA Suite
OOW 2012: Integrate Cloud Applications with Oracle SOA SuiteRajesh Raheja
 
Jeffrey Richter
Jeffrey RichterJeffrey Richter
Jeffrey RichterCodeFest
 
Siebel Resume Arquitecture
Siebel Resume ArquitectureSiebel Resume Arquitecture
Siebel Resume ArquitectureJose Martinez
 
HCLT Whitepaper: Multi- Tenancy on Private Cloud
HCLT Whitepaper: Multi- Tenancy on Private CloudHCLT Whitepaper: Multi- Tenancy on Private Cloud
HCLT Whitepaper: Multi- Tenancy on Private CloudHCL Technologies
 
WebLogic im neuen Gewand
WebLogic im neuen GewandWebLogic im neuen Gewand
WebLogic im neuen GewandVolker Linz
 
Novell Service Desk overview
Novell Service Desk overviewNovell Service Desk overview
Novell Service Desk overviewJon Giffard
 
10 - Architetture Software - More architectural styles
10 - Architetture Software - More architectural styles10 - Architetture Software - More architectural styles
10 - Architetture Software - More architectural stylesMajong DevJfu
 
Easy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applicationsEasy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applicationsJack-Junjie Cai
 

Ähnlich wie Web Presentation Patterns (20)

Day Of Cloud - Windows Azure Platform
Day Of Cloud - Windows Azure PlatformDay Of Cloud - Windows Azure Platform
Day Of Cloud - Windows Azure Platform
 
Chap 1
Chap 1Chap 1
Chap 1
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
 
Servlet programming
Servlet programmingServlet programming
Servlet programming
 
Java one2010 presentation-s313909
Java one2010 presentation-s313909Java one2010 presentation-s313909
Java one2010 presentation-s313909
 
Nuno Godinho
Nuno GodinhoNuno Godinho
Nuno Godinho
 
Connect Webinar24
Connect Webinar24Connect Webinar24
Connect Webinar24
 
A Service Oriented Architecture For Order Processing In The I B M Supp...
A  Service  Oriented  Architecture For  Order  Processing In The  I B M  Supp...A  Service  Oriented  Architecture For  Order  Processing In The  I B M  Supp...
A Service Oriented Architecture For Order Processing In The I B M Supp...
 
OOW 2012: Integrate Cloud Applications with Oracle SOA Suite
OOW 2012: Integrate Cloud Applications with Oracle SOA SuiteOOW 2012: Integrate Cloud Applications with Oracle SOA Suite
OOW 2012: Integrate Cloud Applications with Oracle SOA Suite
 
Jeffrey Richter
Jeffrey RichterJeffrey Richter
Jeffrey Richter
 
Siebel Resume Arquitecture
Siebel Resume ArquitectureSiebel Resume Arquitecture
Siebel Resume Arquitecture
 
HCLT Whitepaper: Multi- Tenancy on Private Cloud
HCLT Whitepaper: Multi- Tenancy on Private CloudHCLT Whitepaper: Multi- Tenancy on Private Cloud
HCLT Whitepaper: Multi- Tenancy on Private Cloud
 
Servlet programming
Servlet programmingServlet programming
Servlet programming
 
WebLogic im neuen Gewand
WebLogic im neuen GewandWebLogic im neuen Gewand
WebLogic im neuen Gewand
 
Dinesh Wp Siebel Crm To Fusion Crm
Dinesh Wp  Siebel Crm To Fusion CrmDinesh Wp  Siebel Crm To Fusion Crm
Dinesh Wp Siebel Crm To Fusion Crm
 
Novell Service Desk overview
Novell Service Desk overviewNovell Service Desk overview
Novell Service Desk overview
 
Microsoft Dynamics GP 2013 - Mejoras
Microsoft Dynamics GP 2013 - MejorasMicrosoft Dynamics GP 2013 - Mejoras
Microsoft Dynamics GP 2013 - Mejoras
 
Resume
ResumeResume
Resume
 
10 - Architetture Software - More architectural styles
10 - Architetture Software - More architectural styles10 - Architetture Software - More architectural styles
10 - Architetture Software - More architectural styles
 
Easy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applicationsEasy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applications
 

Kürzlich hochgeladen

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Kürzlich hochgeladen (20)

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

Web Presentation Patterns

  • 1. Unit 7: Design Patterns and Frameworks (cont.)  Other Web presentation layer issues:  Design Pattern: Context Object  Web Presentation layer refactoring: Synchronizer Token  Session state management  Web presentation/Business layers integration  Integration patterns with remote business layer:  Service Locator  Business Delegate  Business layer architectural patterns  Transaction Script  Domain Model  Table Module dsbw 2011/2012 q1 1
  • 2. Context Object  Problem: You want to avoid using protocol-specific system information outside of its relevant context.  For example, web components receive protocol-specific HTTP requests. Sharing HTTP requests with other components both within and outside the presentation tier exposes these components to protocol specifics.  Forces:  You have components and services that need access to system information.  You want to decouple application components and services from the protocol specifics of system information.  You want to expose only the relevant APIs within a context.  Solution: Use a Context Object to encapsulate state in a protocol- independent way to be shared throughout your application dsbw 2011/2012 q1 2
  • 3. Context Object: Structure Example: dsbw 2011/2012 q1 3
  • 4. Context Object: Sequence Diagram dsbw 2011/2012 q1 4
  • 5. Synchronizer Token  Problem: Clients make duplicate resource requests that should be monitored and controlled, or clients access certain views out of order by returning to previously bookmarked pages.  Forces:  You want to control the order or flow of the requests.  You want to control duplicate request submissions from a client. Such duplicate submissions may occur when the user clicks the Back or Stop browser buttons and resubmits a form  Solution: Use a Synchronizer Token to monitor and control the request flow and client access to certain resources. dsbw 2011/2012 q1 5
  • 6. Synchronizer Token: Mechanics  Create one or more helper classes responsible for generating and comparing one-time-use, unique tokens.  The component managing this activity delegates to these helpers, managing the temporary storage of a fresh token for each client submission.  A copy of the token is stored per user on the server and on the client browser. The token is typically stored on the client browser as a hidden field and on the server in a user session.  Add logic to check whether the token arriving with the client request matches the token in the user session. dsbw 2011/2012 q1 6
  • 7. Session State Management Solution Implementation Benefits Drawbacks On the Client Hidden Form Fields Easy to Limited amount of HTTP Cookies implement. data URI Rewriting No problems with Security concerns load-balanced if data not server clusters encrypted On the Web HttpSession and Easy-to-use APIs Load-balanced container the like server clusters require special treatments On a DB Stored in a DB Sharable Penalizes DB table Recoverable performance dsbw 2011/2012 q1 7
  • 8. Web Presentation/Business Layers Integration Web Container Web Presentation Layer Business Layer Data Source Layer Web server  Local procedure calls between web presentation and business components  Direct access to the controllers in the business layer dsbw 2011/2012 q1 8
  • 9. Web Presentation/Business Layers Integration Web Container Application Server Business Layer Web Presentation Layer Data Source Layer Web server  Remote communication between web presentation and business components:  Communication protocols and/or middleware for distributed components  Name and/or directory services to locate remote components  DTOs to transfer data between remote components dsbw 2011/2012 q1 9
  • 10. Service Locator  Problem: You want to transparently locate business components and services in a uniform manner.  Forces:  You want to use a lookup mechanism to locate business components and other services.  You want to centralize and reuse the implementation of lookup mechanisms for application clients.  You want to encapsulate vendor dependencies for registry implementations, and hide the dependency and complexity from the clients.  You want to avoid performance overhead related to initial context creation and service lookups.  You want to reestablish a connection to a previously accessed component and service  Solution: Use a Service Locator to implement and encapsulate service and component lookup. dsbw 2011/2012 q1 10
  • 11. Service Locator: Structure  Target: the service or component that the Client is looking up  IntialContext: the starting point in the lookup and creation process.  RegistryService: the registry implementation that holds the references to the services or components that are registered as service providers for Clients  Cache: holds onto references that have been previously looked up. dsbw 2011/2012 q1 11
  • 12. Service Locator: Sequence Diagram dsbw 2011/2012 q1 12
  • 13. Business Delegate  Problem: You want to hide clients (Web presentation components) from the complexity of remote communication with business service components.  Forces:  You want to access the business layer components from your Web presentation layer components.  You want to minimize coupling between clients and the business services, thus hiding the underlying implementation details of the service, such as lookup and access.  You want to avoid unnecessary invocation of remote services.  You want to translate network exceptions into application or user exceptions.  You want to hide the details of service creation, reconfiguration, and invocation retries from the clients.  Solution: Use a Business Delegate to encapsulate access to a business service. dsbw 2011/2012 q1 13
  • 15. Business Delegate: Sequence Diagram dsbw 2011/2012 q1 15
  • 16. “Classic” J2EE Architecture Web Container J2EE Servlets / Web Classes Server Business Interface Business Delegate RMI EJB Container J2EE Server Session EJB (Same or Separate JVM Entity EJB (optional) DBMS Legacy System dsbw 2011/2012 q1 16
  • 17. Business Layer Architectural Patterns Architectural Description Benefits Drawbacks Pattern Transaction A single procedure for Simple paradigm Duplicated code as Script each action that a user Works well with several transactions might want to do: takes RDBMS need to do similar the input from the things presentation, processes it, and stores data in the database. Domain Model Conceptual Model Pure OO: reuse, Object-Relational objects become Business inheritance, impedance Layer components polymorphism, etc. mismatch. Design Patterns Data Mapper. Table Module Third way solution: OO Takes advantage Not so easy to business layer with of many Data implement than coarse objects that Access APIs Transaction Script correspond to DB tables (ADO.NET, JDO, Not so powerful JDBC, …) than Domain Model dsbw 2011/2012 q1 17
  • 18. Transaction Script: Example : WebPresLayer : DataSourceLayer : NewPostTrans execute( ) insert? = false findAuthorsByName(name) : RecordSet next() alt insertInToAuthors(name, password) [empty RecordSet] insert? = true get("password") insert? = “passwords match” opt insertInToPosts(title, content, author) [insert?] dsbw 2011/2012 q1 18
  • 19. Domain Model: Example : WebPresLayer authorsDict : Dictionary Post Author title : String : NewPostTrans name : String date : Date password : String 1 0..* content : String execute( ) get(name) opt (name, password) a : Author [author didn’t exist] put(name, a) newPost(password, title, content ) checkPassword(password) opt [passwordOK] p : Post ap dsbw 2011/2012 q1 19
  • 20. Table Module: Example : WebPresLayer : Authors : Posts : DataSourceLayer : NewPostTrans execute( ) newPost(...) findAuthorsByName(name ) : RecordSet next() insertInToAuthors(name, password) get("password") addNewPost(title, content, authorName) insertInToPosts(...) dsbw 2011/2012 q1 20
  • 21. Business Layer Architectural Patterns dsbw 2011/2012 q1 21
  • 22. References  Books  ALUR, Deepak et al. Core J2EE Patterns: Best Practices and Design Strategies, 2on Edition, Prentice Hall PTR, 2003.  FOWLER, Martin Patterns of Enterprise Application Architecture, Addison Wesley, 2002.  JOHNSON, Rod and HOELLER Juergen. Expert One-on-One J2EE Development without EJB, Willey Publishing, 2004  Web sites  www.corej2eepatterns.com  java.sun.com/blueprints/corej2eepatterns/ dsbw 2011/2012 q1 22