Pattern Oriented Design Group Report The Proxy Pattern

  • Slides: 23
Download presentation
Pattern Oriented Design Group Report – The Proxy Pattern Group members R 9306009 R

Pattern Oriented Design Group Report – The Proxy Pattern Group members R 9306009 R 9306022 F 9106007 F 9106017 F 9109219 F 9106225 林泓任 江坤益 梁典隆 張哲嘉 林碩晟 蔡宜家 Professor: Ku-Yaw Chang Da-Yeh University 2004/11/30 Pattern-Oriented Design

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented Design 2

Intention Provide a surrogate or placeholder for another object to control access to it.

Intention Provide a surrogate or placeholder for another object to control access to it. Client always seem to communicate "locally" and authorization is checked automatically 2004/11/30 Pattern-Oriented Design 3

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented Design 4

Introduction This pattern makes the clients of a component communicate with a representative rather

Introduction This pattern makes the clients of a component communicate with a representative rather than to the component itself Widely applicable in almost every distributed system or infrastructure for distributed systems uses the pattern to represent remote components locally Protection from unauthorized access 2004/11/30 Pattern-Oriented Design 5

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented Design 6

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented Design 8

Context You have a class that you would like to provide controlled. The Proxy

Context You have a class that you would like to provide controlled. The Proxy pattern can serve as an intermediary to make the interface for this class available. 2004/11/30 Pattern-Oriented Design 9

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented Design 10

Solution Time-Domain Graph of proxy pattern: 2004/11/30 Object Graph of proxy pattern: Pattern-Oriented Design

Solution Time-Domain Graph of proxy pattern: 2004/11/30 Object Graph of proxy pattern: Pattern-Oriented Design 11

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented Design 12

Structure 2004/11/30 Pattern-Oriented Design 13

Structure 2004/11/30 Pattern-Oriented Design 13

Structure Here's a possible object diagram of a proxy structure at run-time: 2004/11/30 Pattern-Oriented

Structure Here's a possible object diagram of a proxy structure at run-time: 2004/11/30 Pattern-Oriented Design 14

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented Design 15

Problem Inappropriate to access component directly Do not want to hard code physical location

Problem Inappropriate to access component directly Do not want to hard code physical location (e. g. TCPIP address) Need security / access control Accessing the component should be runtime-efficient, effective, and safe Access need to be transparent and simple for the clients 2004/11/30 Pattern-Oriented Design 16

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented Design 17

General Scenario Client need to do a task Client calls the method of Proxy

General Scenario Client need to do a task Client calls the method of Proxy (send a service message) Proxy internally do pre-processing such as mapping to Original Proxy sends the real service message to Original Proxy do post-processing and return results back to Client 2004/11/30 Pattern-Oriented Design 18

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented Design 19

Implementation Identify all responsibilities for dealing with access control to a component Remote Proxy

Implementation Identify all responsibilities for dealing with access control to a component Remote Proxy Protection Proxy Cache Proxy Synchronization Proxy Virtual Proxy Firewall Proxy 2004/11/30 Pattern-Oriented Design 20

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented

Outline Intention Introduction Example Context Solution Structure Problem General Scenario Implementation Consequences 2004/11/30 Pattern-Oriented Design 21

Consequences Advantages Enhanced efficiency and lower cost n Decoupling clients from the location of

Consequences Advantages Enhanced efficiency and lower cost n Decoupling clients from the location of remote server components n Separation of housekeeping code from functionality n Disadvantages Less efficiency due to indirection n Complex implementation n 2004/11/30 Pattern-Oriented Design 22

The End 2004/11/30 Pattern-Oriented Design

The End 2004/11/30 Pattern-Oriented Design