Download presentation
Presentation is loading. Please wait.
1
15. Proxy SE2811 Software Component Design
Dr. Rob Hasker (based on slides by Dr. Mark Hornick) 15. Proxy
2
The Proxy Pattern
3
The Proxy Pattern has many variations, but in general:
The Proxy Pattern uses an proxy object as a surrogate (aka stand-in or placeholder) that acts like another object
4
Generic Proxy Pattern: A Client programs to a Subject, which may be a RealSubject or a Proxy
5
The Stub Proxy is a (temporary) placeholder for the Real Subject
Sometimes the Real Subject is not available For example: still under development The Stub Proxy can provide implementation of the Subject interface to varying degrees: Just enough to compile without error To allow rudimentary Subject functionality To provide a complete emulation of the RealSubject
6
Stub Proxy – the Real Subject emulator
7
The Protection Proxy controls access to a resource (the Real Subject) that is restricted by access rights The Protection Proxy provides predefined access to certain functionality implemented by the Real Subject, but Purposely limited by the access rights built into the Protection Proxy For example, the ability to query (but not modify) a protected database
8
The Protection Proxy limits access to the Real Subject
9
The Virtual Proxy controls access to a resource (the Real Subject) that is expensive to create or use The Virtual Proxy provides access to all of the functionality implemented by the Real Subject, but More quicky/cheaply Acts as a surrogate until the Real Subject becomes available
10
The Virtual Proxy provides all functionality of the Real Subject
The Virtual Proxy controls access to the Real Subject, and is often responsible for creation of the Real Subject
11
The Remote Proxy provides local access to a remote resource (the Real Subject)
The Remote Proxy handles the details of accessing a remote resource Remote Access can be implemented in many different ways, using different communication protocols Simple sockets Remote Method Invocation HTTP-based (e.g. web-services) …
12
The Remote Proxy allows the Client to act as if it is accessing a local resource
13
Lab 9 Approach : RemoteProxy
14
Java Remote Method Invocation is a framework with tools that auto-generate the Remote Proxy and Skeleton Invocation Handler Java RMI requires several dedicated ports, which may be blocked by firewalls
15
Web Services involve plugins and scripts running on a web server to invoke remote methods
There are many different varieties of web service-based remote operations. A primary advantage is that port 80 (the HTTP port) can be used.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.