Interceptor CS562 Spring 2002 Jan 29 2002 Anand Krishnan Morgan Deters Venkita Subramonian.

Slides:



Advertisements
Similar presentations
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 9 Distributed Systems Architectures Slide 1 1 Chapter 9 Distributed Systems Architectures.
Advertisements

Broker Pattern Pattern-Oriented Software Architecture (POSA 1)
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB JavaForum.
Distributed Systems Architectures
Design Patterns CS is not simply about programming
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
1 FM Overview of Adaptation. 2 FM RAPIDware: Component-Based Design of Adaptive and Dependable Middleware Project Investigators: Philip McKinley, Kurt.
Course Instructor: Aisha Azeem
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Behavioral Patterns  Behavioral patterns are patterns whose purpose is to facilitate the work of algorithmic calculations and communication between classes.
Software Engineering Muhammad Fahad Khan
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse.
Chapter 7: Architecture Design Omar Meqdadi SE 273 Lecture 7 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Design Patterns.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 12 Slide 1 Distributed Systems Architectures.
Institute of Computer and Communication Network Engineering OFC/NFOEC, 6-10 March 2011, Los Angeles, CA Lessons Learned From Implementing a Path Computation.
An Introduction to Software Architecture
Pattern Oriented Software Architecture for Networked Objects Based on the book By Douglas Schmidt Michael Stal Hans Roehnert Frank Buschmann.
©Ian Sommerville 2000 Software Engineering, 6th edition. Slide 1 Component-based development l Building software from reusable components l Objectives.
Odyssey A Reuse Environment based on Domain Models Prepared By: Mahmud Gabareen Eliad Cohen.
E81 CSE 532S: Advanced Multi-Paradigm Software Development Venkita Subramonian, Christopher Gill, Guandong Wang, Zhenning Hu, Zhenghui Xie Department of.
POAD Book: Chapter 8 POAD: Analysis Phase Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Chapter 6 Architectural Design.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
SCALABLE EVOLUTION OF HIGHLY AVAILABLE SYSTEMS BY ABHISHEK ASOKAN 8/6/2004.
Explore Patterns in Context-Aware Applications --Using Reactor Pattern to Develop In/Out Board Fall 2002 Yu Du.
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.
Architectural pattern: Interceptor Source: POSA II pp 109 – 140POSA II Environment: developing frameworks that can be extended transparently Recurring.
Unit 4 Object-Oriented Design Patterns NameStudent Number CAI XIANGHT082182A KYAW THU LINHT082238Y LI PENGFEIHT082220L NAUNG NAUNG LATTHT082195L PLATHOTTAM.
Design Patterns CSIS 3701: Advanced Object Oriented Programming.
IS473 Distributed Systems CHAPTER 5 Distributed Objects & Remote Invocation.
Introduction to Java Beans CIS 421 Web-based Java Programming.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VIII Chain of Responsibility, Strategy, State.
Introducing Allors Applications, Tools & Platform.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 18 Slide 1 Software Reuse.
Dynamic and Selective Combination of Extension in Component-based Applications Eddy Truyen, Bart Vanhaute, Wouter Joosen, Pierre Verbaeten, Bo N. Jørgensen.
Object Oriented Programming.  Interface  Event Handling.
Architectural pattern: Reactor Source: POSA II pp 179 – 214POSA II Environment: an application that receives multiple requests simultaneously but may process.
1 Object Oriented Logic Programming as an Agent Building Infrastructure Oct 12, 2002 Copyright © 2002, Paul Tarau Paul Tarau University of North Texas.
Java EE Patterns Dan Bugariu.  What is Java EE ?  What is a Pattern ?
Concordia University Department of Computer Science and Software Engineering Click to edit Master title style ADVANCED PROGRAMMING PRACTICES Model View.
Pattern Bridge. Definition Bridge is the structural pattern that separates abstraction from the implementation so that both of them can be changed independently.
Advanced Object-oriented Design Patterns Creational Design Patterns.
Secure middleware patterns E.B.Fernandez. Middleware security Architectures have been studied and several patterns exist Security aspects have not been.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
E81 CSE 532S: Advanced Multi-Paradigm Software Development Venkita Subramonian, Christopher Gill, Ying Huang, Marc Sentany Department of Computer Science.
CS 5150 Software Engineering Lecture 16 Program Design 3.
E81 CSE 532S: Advanced Multi-Paradigm Software Development Venkita Subramonian, Christopher Gill, Huang-Ming Huang, Shih-Ling Chen, Sajeeva Pallemulle.
Topic 4: Distributed Objects Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
Leveraging ColdSpring to build a robust Flex applications Chris Scott, Cynergy Systems.
Interceptor Pattern A&D Eva P.O.S.A 2 By bbum.. Agenda Service Access and Configuration Service Access and Configuration Issues Issues Example Example.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
1 Distributed Systems Architectures Distributed object architectures Reference: ©Ian Sommerville 2000 Software Engineering, 6th edition.
Observer Pattern Context:
The Role of Reflection in Next Generation Middleware
Design Patterns: MORE Examples
Software Design Refinement Using Design Patterns
POAD Book: Chapter 8 POAD: Analysis Phase
Review: Java GUI Programming
Observer Design Pattern
Ch > 28.4.
Inheritance B.Ramamurthy 11/7/2018 B.Ramamurthy.
Interpreter Style Examples
A Pattern Language for Software Architecture
Patterns.
Design and Implementation
An Introduction to Software Architecture
Advanced ProgramMING Practices
Advanced ProgramMING Practices
Presentation transcript:

Interceptor CS562 Spring 2002 Jan Anand Krishnan Morgan Deters Venkita Subramonian

Discussion Topics Interceptor definition Motivating Examples Problem definition and solutions Implementation details Scope for Generic Programming Relationship with other patterns

Interceptor Architectural pattern Allows services to be transparently added to a framework Services triggered automatically when certain events occur

Problem –How to integrate out-of-band tasks with in-band tasks transparently ?

Example 1 – Java event model public class Demo extends JApplet { public void init() { bHandler = new ButtonHandler(); button = new JButton("Click Me"); getContentPane().add(button, BorderLayout.CENTER); button.addActionListener(bHandler); } public class ButtonHandler implements ActionListener void actionPerformed(ActionEvent e) { Toolkit.getDefaultToolkit().beep(); } Applet Framework Button clicked Action Listener Some action ActionEvent

Example 2 – Unix signals void catch_int(int sig_num) { signal(SIGINT, catch_int); printf("Don't do that"); fflush(stdout); } main() { ….. signal(SIGINT, catch_int); for ( ;; ) pause(); } OS Framework Ctrl + C signal handler Some action Signal info

Example 3 - Database Triggers CREATE TRIGGER print_salary_changes BEFORE UPDATE ON emp FOR EACH ROW WHEN (new.empno > 0) DECLARE sal_diff number; BEGIN sal_diff := new.sal - old.sal; dbms_output.put('Old salary: ' || :old.sal); dbms_output.put(' New salary: ' || :new.sal); dbms_output.put(' Difference ' || sal_diff); END; UPDATE emp SET sal = sal WHERE deptno = 10 Trigger will fire once for each row that is updated, and it prints the new and old salaries, and the difference. Database Framework Update Request Before Update Trigger After Update Trigger Result

Example 4 – CORBA ORB In-band tasks –Connection management with peer ORB –Request/reply marshaling/demarshaling –Demultiplexing requests to objects Out-of-band tasks –Added at interceptor points –Security, Fault Tolerance ORB Security Service Fault Tolerance Service

Solution Problem –How to integrate out-of-band tasks with in-band tasks transparently ? Solution –Out-of-band tasks register with framework via specific interfaces get triggered by framework on certain events are provided access to framework internals via specific interfaces

UML Class Diagram implement * implement z4 Application Concrete Interceptor

UML Class Diagram implement * implement Application Concrete Interceptor

UML Class Diagram register implement * implement Application Concrete Interceptor Dispatcher

UML Class Diagram register implement * event / trigger implement Application Concrete Interceptor Dispatcher Concrete Framework

UML Class Diagram register instantiateimplement * event / trigger implement Application Concrete Interceptor Dispatcher Concrete Framework Context Object (CO)

UML Class Diagram register instantiateimplement * event / trigger * notify (CO) implement Application Concrete Interceptor Dispatcher Concrete Framework Context Object (CO)

UML Class Diagram register instantiateimplement * event / trigger * notify (CO) (CO) 1.. * implement Application Concrete Interceptor Dispatcher Concrete Framework Context Object (CO)

UML Class Diagram Application Concrete Interceptor Dispatcher Concrete Framework Context Object (CO)

Implementation Model Internal Behavior of Concrete Framework Identify and model interception points –Identify concrete framework state transitions –Partition interception points into reader / writer sets –Integrate them into state machine model –Partition them into disjoint interception groups Specify the context object –context object semantics –number of context object types –strategy for passing context objects to interceptors Per-registration / Per-event

Implementation Specify the interceptors Specify the dispatchers –interceptor registration interface –dispatcher callback interface Implement CallBack mechanisms in Concrete Framework Implement Concrete Interceptors

Interceptor Themes A priori knowledge of engineering context –Have you covered all the bases? Flexibility –How much influence can the Interceptor have? Performance –How simple can the Interceptor model be? "in-band" vs. "out-of-band“ –Are the concerns that Interceptors realize orthogonal?

Generic Interceptors? Templatization of context object? –Use context_traits to achieve compile-time negotiation of dispatcher & interceptor

Interceptors as a Language Construct Interception becomes 1 st class language concern Interception points are language constructs –Variable mutation, method execution, object instantiation, etc... Concrete Framework need not be specially prepared for extension –This is a major consequence Aspect-Oriented Programming (AOP)

Interceptors and AOP Join Points –Language constructs (execution/data, static/dynamic) –Correspond to interception points Aspect –Collection of (possibly abstract) Interceptors –Specifies the join points to operate on –Attach advice to a particular place in execution (or piece of data) in the system, reflectively reason about its place in the system

Interceptors as a Language Construct: Examples Component Configurator –Infrequently-used features (e.g., backward-compatible protocol support) can be loaded, unloaded without the application being aware of it Customization –Quality of Service –Fault-Tolerance

+ Separation of Concerns + (Future) Flexibility + Reusability/Portability − Efficiency/Heterogenity − Evil Interceptors Consequences

Interceptor Variants Bind Interceptor - Fault Tolerance Client Request Interceptor - Load Balancing Interceptor Proxy / Delegator - Customized Service Portable Interceptor Strategies –Single Interceptor Per Dispatcher –Interceptor Factory –Implicit Interceptor Registration Component Configurator Pattern similar (partly) to AOP -- AOP languages can differ load from a library at runtime, Concrete Framework creates the Interceptors

Relationships to Other Patterns Chain of Responsibility (single handler) Observer/Publisher-Subscriber (notification) Template Method (localized interception) –Interceptor reaches across multiple layers Pipes & Filters Reflection