Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (1) –A structural design pattern.

Slides:



Advertisements
Similar presentations
What is RMI? Remote Method Invocation –A true distributed computing application interface for Java, written to provide easy access to objects existing.
Advertisements

CS 210 Proxy Pattern Nov 14 th, Revisit the Gumball machine example The same example covered in the State pattern Now we want to add some monitor.
Remote Method Invocation
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Composite Design Pattern (1) –A structural design pattern.
Remote Object Invocation
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Development Software Life Cycle UML Diagrams.
Design Patterns: Proxy Jason Jacob. What is a Proxy? A Proxy is basically a representative between the Client and the Component. It gives the Client a.
Integration case study Week 8 – Lecture 1. Enrolment request (Workstation) Application server Database server Database New University Student Record System.
Design Patterns Part IV (TIC++V2:C10) Yingcai Xiao 10/01/08.
Communication in Distributed Systems –Part 2
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 4 Image Slides.
Copyright © The McGraw-Hill Companies, Inc
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter N - 1 Abstract Superclasses and Abstract Methods When.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 2 Image Slides.
Proxy Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
Chapter 8 Traffic-Analysis Techniques. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 8-1.
Client/Server Software Architectures Yonglei Tao.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Façade Design Pattern (1) –A structural design pattern.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Factory Method Design Pattern (1) –A creational design.
Smart Reference Proxy Provides additional actions whenever an object is referenced (e.g., counting the number of references to the object) Firewall Proxy.
1 The Proxy Design Pattern Problem: Defer the cost of object creation and init. until actually used Applicability (possible contexts): – Virtual Proxy:
Team 5: The Infinite Loops Gloria Berumen Patricia Martinez Jose Roberto Salcido Michelle Soto Jose Luis Yanez Omar Zorrilla Design Pattern.
In the name of Allah The Proxy Pattern Elham moazzen.
17.16 Synthesis of Thyroid Hormone (TH) Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Slide number: 1.
Client Call Back Client Call Back is useful for multiple clients to keep up to date about changes on the server Example: One auction server and several.
Object Oriented Software Engineering Chapter 16 and 17 review 2014/06/03.
Distributed Objects and Middleware. Sockets and Ports Source: G. Coulouris et al., Distributed Systems: Concepts and Design.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 43 Remote Method Invocation.
Structural Design Patterns
Where Do Surrogates Fit into This Proxy Pattern Observer Pattern Visitor Pattern By Kurt Rehwinkel.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns V More Structural Patterns.
02 - Structural Design Patterns – 2 Moshe Fresko Bar-Ilan University תשס"ח 2008.
The Proxy Pattern SE-2811 Dr. Mark L. Hornick 1. The Proxy Pattern has many variations, but in general: The Proxy Pattern uses an proxy object as a surrogate.
Chapter 36 More Object Design with GoF Patterns 1CS6359 Fall 2011 John Cole.
Proxy, Observer, Symbolic Links Rebecca Chernoff.
08 - StructuralCSC4071 Structural Patterns concerned with how classes and objects are composed to form larger structures –Adapter interface converter Bridge.
Structural Patterns1 Nour El Kadri SEG 3202 Software Design and Architecture Notes based on U of T Design Patterns class.
Proxy.
Proxy Design Pattern By:Diksha Agarwal.
Eric Tryon Brian Clark Christopher McKeowen. System Architecture The architecture can be broken down to three different basic layers Stub/skeleton layer.
Seminar on Service Oriented Architecture Distributed Systems Architectural Models From Coulouris, 5 th Ed. SOA Seminar Coulouris 5Ed.1.
Remote Method Invocation by James Hunt, Joel Dominic, and Adam Mcculloch.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Proxy Pattern defined The Proxy Pattern provides a surrogate or placeholder for another object to control access to it by creating a representative object.
CS 210 Proxy Pattern Nov 16 th, RMI – A quick review A simple, easy to understand tutorial is located here:
Chapter 8 Object Design Reuse and Patterns. More Patterns Abstract Factory: Provide manufacturer independence Builder: Hide a complex creation process.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Three Statics of Structures Reactions.
Proxy Pattern. What’s a Proxy? A remote proxy acts as a local representative of a remote object Remote Object: instantiated in a different JVM heap (a.
The Proxy Pattern (Structural) ©SoftMoore ConsultingSlide 1.
Remote Method Invocation A Client Server Approach.
Java Distributed Object Model A remote object is one whose methods can be invoked from another JVM on a different host. It implements one or more remote.
Chapter 13 Transportation Demand Analysis. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display
Week 9, Day 1 Proxy SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1.
Software Design and Architecture Muhammad Nasir Structural Design Patterns
EMI is partially funded by the European Commission under Grant Agreement RI Common Authentication Library Daniel Kouril, for the CaNL PT EGI CF.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 29 Remote Method.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Design Patterns – Group 2 Iterator, Proxy, Adapter, Decorator.
RMI (Java RMI) P 460 in text UUIDs / system wide references Transparent: all objects either by ref. or by value. Not efficient, especially int, bool, etc.
Dynamic Proxy Proxy: Addition to the Java 1.3 reflection package:
Behavioral Design Patterns
Remote Method Invocation
What is RMI? Remote Method Invocation
Extending Java RMI for Dynamic Reconfiguration
Software Design Lecture : 38.
15. Proxy SE2811 Software Component Design
Proxy Pattern Definition of “Proxy”: Authority or power to act for another Original Gang of Four pattern, much used Stands in for a “real object” (similar.
Presentation transcript:

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (1) –A structural design pattern –Intent Provide a surrogate or placeholder for another object to control access to it

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (2) –Problem Situation I: Wish to control access to an object because: –Housekeeping activities are required –Protection levels exist –Objects sit in different address spaces –Actual object too expensive to build immediately Situation II: Wish to provide transparent management of services –The client “thinks” it is using the actual service when rather it is using a proxy for the actual service

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (3) –Non-software example (1) Toll-free numbers –Client dials the “800” area code just like they would for a real area code –Proxy records billing information and connects to actual area code

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (4) –Non-software example (2) Checks –Check is a proxy for the actual funds in the bank

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (5) –Abstract Description Object Proxy Pattern Notice the “is-a” and “has-a” relations again.

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (6) –Abstract Description Sequence Diagram (typical proxy application)

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (7) –Consequences Isolates RealSubject from client –Forces controllable indirection Costs indirection –True for all delegation models May require duplicate information in Proxy and RealSubject –Must support same “properties” –These must be supported even before instantiation of RealSubject

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (8) –Consequences Creates second class dependent on Subject interface –Unavoidable in this pattern Client may need to be aware of Proxy –For example, extra failure modes –Example: java.rmi.MarshalException in RMI

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (9) –Implementation Issues Three basic types of proxies 1. Remote Proxy »Proxy used to “hide” the location of RealSubject »Example: RMI implementation 2. Virtual Proxy »Performs optimizations »Example: Image rendering in HTML

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (10) –Implementation Issues Three basic types of proxies 3. Housekeeping Proxy »Performs additional maintenance duties »Example: Cache Proxy »Example: Protection Proxy

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (11) –Implementation Issues Proxy can be written independent of RealSubject –Use Subject interface in definition of Proxy –Difficult (or impossible) if Proxy stores redundant information

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (12) –Common Variations Firewall Proxy (a protection proxy) –Protects targets from bad clients (or vice versa) Synchronization Proxy (a housekeeping proxy) –Provides multiple accesses to a target object Smart Reference Proxy (a housekeeping proxy) –Provides additional actions whenever a target object is referenced Copy-on-Write Proxy (a virtual proxy) –Defers cloning an object until required

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (13) –Java API Usage java.rmi library “Remote Method Invocation” Allows objects in separate virtual machines to be used as if local (language specific) Uses “stub and skeleton” to handle communication