Transparent Filter Objects
-
Upload
arden-foley -
Category
Documents
-
view
25 -
download
0
description
Transcript of Transparent Filter Objects
![Page 1: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/1.jpg)
Transparent Filter ObjectsTransparent Filter Objects
Rushikesh K. JoshiRushikesh K. JoshiDepartment of Computer Science & EngineeringDepartment of Computer Science & Engineering
Indian Institute of Technology, BombayIndian Institute of Technology, Bombay
Mumbai - 400 076Mumbai - 400 076
![Page 2: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/2.jpg)
About the AuthorAbout the Author
R.K. Joshi is with the Department of Computer Science and Engineering at IIT R.K. Joshi is with the Department of Computer Science and Engineering at IIT Bombay as Assistant Professor, where he has introduced a course on Object Bombay as Assistant Professor, where he has introduced a course on Object Oriented Systems. He currently teaches courses on Object Oriented Systems Oriented Systems. He currently teaches courses on Object Oriented Systems and Operating Systems. He has provided consultancy and teaching in Object and Operating Systems. He has provided consultancy and teaching in Object Oriented Technologies to academia and the Indian Industry. He has designed Oriented Technologies to academia and the Indian Industry. He has designed various programming paradigms focused on the principle of separation of various programming paradigms focused on the principle of separation of concerns, among them are the Anonymous Remote Computing (IEEE TSE, concerns, among them are the Anonymous Remote Computing (IEEE TSE, 1999) for parallel computing on loaded heterogeneous fail-stop workstations, 1999) for parallel computing on loaded heterogeneous fail-stop workstations, Filter objects (SPE 1997), and Replicated Services (JPDC 1999). Filter objects (SPE 1997), and Replicated Services (JPDC 1999).
He completed his PhD thesis from Indian Institute of Technology, Madras in He completed his PhD thesis from Indian Institute of Technology, Madras in 1996. He is with IIT Bombay since 1997. His current interests are software 1996. He is with IIT Bombay since 1997. His current interests are software architectures, paradigms for evolution, interclass and interobject relationships architectures, paradigms for evolution, interclass and interobject relationships and distributed object systems.and distributed object systems.
![Page 3: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/3.jpg)
Outline of the TalkOutline of the Talk
Messages in the conventional object modelMessages in the conventional object model The filtered message delivery modelThe filtered message delivery model The filter object programming model and its The filter object programming model and its
implementation for C++implementation for C++ Filter configurationsFilter configurations Filter Objects for CORBAFilter Objects for CORBA Filter Objects for Software EvolutionFilter Objects for Software Evolution
![Page 4: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/4.jpg)
Interacting ObjectsInteracting Objects
Objects are the building blocks in an object Objects are the building blocks in an object oriented softwareoriented software
Objects interact with each other through Objects interact with each other through message invocations on each othermessage invocations on each other
e.g. to get something done by an object o2, e.g. to get something done by an object o2, o1 invokes a method defined by o2o1 invokes a method defined by o2
o1 o2
m
![Page 5: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/5.jpg)
The Direct Delivery Message The Direct Delivery Message ModelModel
A message is directly delivered to the receiver A message is directly delivered to the receiver object specified by the source objectobject specified by the source object
e.g. {O2.m} in object o1 specifies a message e.g. {O2.m} in object o1 specifies a message invocation m on o2; o2 is identified by o1.invocation m on o2; o2 is identified by o1.
A message invocation on the receiver object is A message invocation on the receiver object is the immediate consequence of message the immediate consequence of message generation at message sourcegeneration at message source
![Page 6: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/6.jpg)
Message Control and Message Message Control and Message ProcessingProcessing
Message ProcessingMessage Processing: The actual code at the : The actual code at the receiver provides the functionality desired by the receiver provides the functionality desired by the callercaller
Message ControlMessage Control: Intermediate manipulations on : Intermediate manipulations on messagesmessages
In the direct delivery model, message In the direct delivery model, message manipulations cannot be performed on-the-fly manipulations cannot be performed on-the-fly and they must be taken care of by the message and they must be taken care of by the message processing code itselfprocessing code itself
![Page 7: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/7.jpg)
The Filtered Delivery ModelThe Filtered Delivery Model
Messages can be trapped by intermediate Messages can be trapped by intermediate filter objects which are transparentfilter objects which are transparent
Filter objects are also conventional objects Filter objects are also conventional objects and in addition to the conventional and in addition to the conventional properties of object orientation, they properties of object orientation, they possess message filtering capabilities possess message filtering capabilities
![Page 8: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/8.jpg)
Transparency Property of Filter Transparency Property of Filter ObjectsObjects
Clients are unaware of the existence of filter Clients are unaware of the existence of filter objects, i.e. clients still identify the desired objects, i.e. clients still identify the desired receiver objects as in the conventional receiver objects as in the conventional object modelobject model
Server.m mf
Object ServerObject Client Object Filter
![Page 9: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/9.jpg)
Properties of Filter ObjectsProperties of Filter Objects
Interception of upward messagesInterception of upward messages Interception of downward resultsInterception of downward results Manipulation of message argumentsManipulation of message arguments Pass and Bounce capabilitiesPass and Bounce capabilities Capabilities of conventional objectsCapabilities of conventional objects Selective FilteringSelective Filtering Dynamic binding at instance levelDynamic binding at instance level Modular developmentModular development
![Page 10: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/10.jpg)
The Core Filter Object ModelThe Core Filter Object Model
Server.m Invoke m ()
another
pass
return
bounce
downfilter
upfilter
Client
Filter
Server
![Page 11: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/11.jpg)
Interclass Filter RelationshipInterclass Filter Relationship
An instance of a class C1 that is in filter An instance of a class C1 that is in filter relationship with class C2 has the ability to relationship with class C2 has the ability to transparently intercept the messages sent to transparently intercept the messages sent to an instance of class C2. an instance of class C2.
Class Dictionary {…}Class Dictionary {…} Class Cache: filter Dictionary {….}Class Cache: filter Dictionary {….}
![Page 12: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/12.jpg)
Dynamic Plugging of Filter Dynamic Plugging of Filter ObjectsObjects
Filter relationships are statically established Filter relationships are statically established at class level but dynamically at the instance at class level but dynamically at the instance levellevel
The plug and unplug operationsThe plug and unplug operationsmain ( ) {main ( ) {
Dictionary *d=..;Dictionary *d=..;
Cache *c=..;Cache *c=..;plug d c;plug d c;
……
unplug d;unplug d;
} }
![Page 13: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/13.jpg)
Organization of a Filter Class: Organization of a Filter Class: The Filter Interface The Filter Interface
Class Dictionary {Class Dictionary {public: public: Meaning SearchWord( Word);Meaning SearchWord( Word);
}}
class Cache : filter Dictionary {class Cache : filter Dictionary {
upfilterupfilter::Meaning SearchCache(Word) filters SearchWord;Meaning SearchCache(Word) filters SearchWord;
downfilterdownfilter: : Meaning ReplaceCacheEntry (Meaning) filters SearchWord;Meaning ReplaceCacheEntry (Meaning) filters SearchWord;
publicpublic:: double hitRatio ( );double hitRatio ( );
}}
![Page 14: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/14.jpg)
An Application of Filter Objects An Application of Filter Objects (D Janaki Ram et. al, IEEE SMC march 1997)(D Janaki Ram et. al, IEEE SMC march 1997)
Piston object Crank object
Constraint object Constraint objectApparentpath
Real Path
notify
A Collaborative Designing ScenarioDESIGNER1
DESIGNER2
notify
![Page 15: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/15.jpg)
Extended Properties of Filter Extended Properties of Filter ObjectsObjects
Group FilteringGroup Filtering• Many instances of a server object may be Many instances of a server object may be
plugged with a filter object which is an instance plugged with a filter object which is an instance of a filter class in filter relationship with the of a filter class in filter relationship with the server classserver class
Layered FilteringLayered Filtering• Filters to filters may be specified to achieve Filters to filters may be specified to achieve
layered filteringlayered filtering
![Page 16: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/16.jpg)
Implementing Filter Objects for Implementing Filter Objects for C++C++
Class Server
Class AbstractFilter
Class ConcreteFilter1 Class ConcreteFilter2
filterB
filterA
filterAfilterB
filterA
filterB
serviceA
serviceB
filt
![Page 17: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/17.jpg)
Filter ConfigurationsFilter Configurations
ReplacerReplacer RouterRouter RepeaterRepeater Value TransformerValue Transformer Message TransformerMessage Transformer Request LoggerRequest Logger
![Page 18: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/18.jpg)
ReplacerReplacer
A filter member function operates as a replacement function to its A filter member function operates as a replacement function to its corresponding server member functioncorresponding server member function
FastServer | oldServer =FastServer | oldServer =
filter interface:filter interface:
funcReplacer (in) upfilters oldServer :: func (in)funcReplacer (in) upfilters oldServer :: func (in)
= [v <-- self.func (in); bounce (v); ]= [v <-- self.func (in); bounce (v); ]
client filter server
![Page 19: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/19.jpg)
RouterRouter
A filter member function operates as a router functionA filter member function operates as a router function
balancer | searchEngine =balancer | searchEngine =
filter interface:filter interface:
searchRouter (item) upfilters SearchEngine ::search (item)searchRouter (item) upfilters SearchEngine ::search (item)
= [newDest <-- self.nextDest();= [newDest <-- self.nextDest();
v<--newDest.search(item); bounce (v); ]v<--newDest.search(item); bounce (v); ]
client filter server server2
![Page 20: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/20.jpg)
RepeaterRepeater
A filter member function dispatches the filtered invocation to multiple A filter member function dispatches the filtered invocation to multiple serversservers
enrollFilter | centralEnroller =enrollFilter | centralEnroller =
filter interface:filter interface:
libEnroll (student) upfilters centralEnroller :: enroll (student)libEnroll (student) upfilters centralEnroller :: enroll (student)
= [ if (student.dept == civil) civilLib-->enroll (student);= [ if (student.dept == civil) civilLib-->enroll (student);
if (student.status == minor) minorBody-->enroll(student);if (student.status == minor) minorBody-->enroll(student);
pass; ]pass; ]
client filter server1 server2 server3
![Page 21: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/21.jpg)
Transformers and LoggerTransformers and Logger
Value TransformerValue Transformer• Message contents are changed before the message is Message contents are changed before the message is
delivered to the server e.g. to handle encryptiondelivered to the server e.g. to handle encryption Message TransformerMessage Transformer
• A different message is called on the server e.g. to A different message is called on the server e.g. to support clients that know of an older interfacesupport clients that know of an older interface
LoggerLogger• A message is invoked on a different object and the A message is invoked on a different object and the
member function is passed on to the actual server e.g. member function is passed on to the actual server e.g. to implement the decorator design patternto implement the decorator design pattern
![Page 22: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/22.jpg)
Filter Objects for Distributed Filter Objects for Distributed Object Systems Object Systems
Need-to-filter principle: A server is declared as Need-to-filter principle: A server is declared as Filterable ServerFilterable Server
A filter object cannot be plugged to a server that A filter object cannot be plugged to a server that is not declared as filterableis not declared as filterable
interface Filterable {interface Filterable {attach (in Object filter)attach (in Object filter)
detach ();detach ();
};};
interface Server : Filterable {interface Server : Filterable {
service ();service ();
}}
![Page 23: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/23.jpg)
Implementation of IDL FilterableImplementation of IDL Filterable
A standard implementation of Filterable is A standard implementation of Filterable is provided in class Filterable_impl provided in class Filterable_impl
class Filterable_impl : public Filterable_skel {class Filterable_impl : public Filterable_skel {// library implementations of attach and detach// library implementations of attach and detach
}}
![Page 24: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/24.jpg)
Implementing Filterable ServersImplementing Filterable Servers
An implementation of a filterable server An implementation of a filterable server must inherit the standard implementation of must inherit the standard implementation of IDL FilterableIDL Filterable
class Dictionary_impl : public Filterable_impl, class Dictionary_impl : public Filterable_impl, public Dictionary_skel {public Dictionary_skel {
// implementations of Dictionary IDL// implementations of Dictionary IDL
}}
![Page 25: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/25.jpg)
Implementing Filter ObjectsImplementing Filter Objects IDL precompiler generates a IDL precompiler generates a Filter Base Filter Base
InterfaceInterface for each filterable server interface for each filterable server interface The The Filter base interfaceFilter base interface is implemented by is implemented by
the filter object implementerthe filter object implementerinterface Dictionary_Filter {interface Dictionary_Filter {
// up and down filter member declarations// up and down filter member declarations
}}
A post-translator is also required to modify A post-translator is also required to modify the dispatcher the dispatcher
![Page 26: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/26.jpg)
Activation and Deactivaton of Activation and Deactivaton of Filter ObjectsFilter Objects
A CORBA Object that acquires handles to a filter A CORBA Object that acquires handles to a filter object and its corresponding filterable server object and its corresponding filterable server object may carry out the plug and unplug object may carry out the plug and unplug operationsoperationsmain ( ) {main ( ) {
……..
server_obj-->attach (filter_obj);server_obj-->attach (filter_obj);
……
server_obj-->detach ( );server_obj-->detach ( );
}}
![Page 27: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/27.jpg)
Filter Netwoks for Software Filter Netwoks for Software EvolutionEvolution
Inject a network of collaborating filter Inject a network of collaborating filter objects into an existing object oriented objects into an existing object oriented software system to satisfy evolution software system to satisfy evolution requirementsrequirements
Object1Object3
Object2
Object4
Filter Object Network
![Page 28: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/28.jpg)
Properties of the Injection Properties of the Injection ApproachApproach
No need to modify the existing code: No need to modify the existing code: Modified functionalities can be handled Modified functionalities can be handled separately by the collaborating filter objectsseparately by the collaborating filter objects
Evolution is reversible: By lifting the filter Evolution is reversible: By lifting the filter networknetwork
Original object oriented design must be Original object oriented design must be filter-awarefilter-aware
![Page 29: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/29.jpg)
An Example of Filter Based An Example of Filter Based Evolution: Evolution: Readers and WritersReaders and Writers[R.K. Joshi, PhD Thesis, IIT Madras, India, 1996][R.K. Joshi, PhD Thesis, IIT Madras, India, 1996]
Original Code (Hansen 1978)Original Code (Hansen 1978)process resource process resource
s: ints: int
proc StartRead proc StartRead when s>0 : s++; endwhen s>0 : s++; end
proc EndRead proc EndRead if s >1: s--; endif s >1: s--; end
proc StartWrite proc StartWrite when s==1: s--; endwhen s==1: s--; end
proc EndWrite proc EndWrite if s==0: s++; endif s==0: s++; end
s=1;s=1;
![Page 30: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/30.jpg)
Evolution RequirementEvolution Requirement
Solve the same problem with additional Solve the same problem with additional constraint that further reader requests constraint that further reader requests should be delayed as long as there are should be delayed as long as there are writers waiting or using the resourcewriters waiting or using the resource
A filter object based solution is provided to A filter object based solution is provided to solve this problem without modifying the solve this problem without modifying the existing codeexisting code
![Page 31: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/31.jpg)
The ApproachThe Approach
Old monitor Old reading and writing clients
Old monitor Old reading and writing clients
Injected Filter
![Page 32: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/32.jpg)
Evolution using Filter ObjectEvolution using Filter Object
process problemSolver: filter resourceprocess problemSolver: filter resource
www : intwww : int
upfilter:upfilter:
SW_Ufilter filters StartWriteSW_Ufilter filters StartWrite
SR_Ufilter filters StartReadSR_Ufilter filters StartRead
downfilter:downfilter:
EW_Dfilter filters EndWriteEW_Dfilter filters EndWrite
proc SW_Ufilter:proc SW_Ufilter: www++; pass; endwww++; pass; end
proc EW_Dfilter:proc EW_Dfilter: www---; endwww---; end
proc SR_Ufilter: proc SR_Ufilter: when www==0: pass; endwhen www==0: pass; end
www=0;www=0;
![Page 33: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/33.jpg)
Our PredictionOur Prediction
Transparent Filter Objects will be Transparent Filter Objects will be recognized as important architectural recognized as important architectural components in object oriented software components in object oriented software systems systems
Implementations of some kind of filtering Implementations of some kind of filtering capabilities will be widely available as capabilities will be widely available as through integration into today’s commercial through integration into today’s commercial object oriented software technologies.object oriented software technologies.
![Page 34: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/34.jpg)
ConclusionsConclusions
Transparent Filter Objects can be integrated into Transparent Filter Objects can be integrated into the well established model of object oriented the well established model of object oriented programming.programming.
Filter Objects are powerful tools for Software Filter Objects are powerful tools for Software EvolutionEvolution
Filter object implementations for C++ and Filter object implementations for C++ and CORBA based object oriented systems have been CORBA based object oriented systems have been designed and implemented (Recently, We have designed and implemented (Recently, We have also integrated the First Class Filter Object Model also integrated the First Class Filter Object Model into JAVA).into JAVA).
![Page 35: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/35.jpg)
Conclusions ..Conclusions ..
Some of the Filter Configurations have been Some of the Filter Configurations have been identified as elementary building blocks for identified as elementary building blocks for filter-based architectures.filter-based architectures.
Filter Configurations have interesting Filter Configurations have interesting consequences when applied to software consequences when applied to software evolution evolution
![Page 36: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/36.jpg)
Future/Ongoing WorkFuture/Ongoing Work
Further explorations on Programming Further explorations on Programming models, efficient implementation models, efficient implementation mechanisms and applications of mechanisms and applications of Transparent InterceptionTransparent Interception
Methodology for software evolution based Methodology for software evolution based on filter objectson filter objects
Understand the capabilities and limitations Understand the capabilities and limitations of filter objectsof filter objects
![Page 37: Transparent Filter Objects](https://reader036.fdocuments.us/reader036/viewer/2022062304/56812bf5550346895d906c68/html5/thumbnails/37.jpg)
Available Results on Filter Available Results on Filter ObjectsObjects
[1] Rushikesh K. Joshi, N. Vivekananda, D Janaki Ram, Software Practice and [1] Rushikesh K. Joshi, N. Vivekananda, D Janaki Ram, Software Practice and Experience, June 1997, pp. 677-699Experience, June 1997, pp. 677-699
[2] Rushikesh K. Joshi, Filter Configurations for Structuring Distributed [2] Rushikesh K. Joshi, Filter Configurations for Structuring Distributed Object Systems, To appear in Journal of Object Oriented Programming.Object Systems, To appear in Journal of Object Oriented Programming.
[3] Rushikesh K. Joshi, On-the-fly Evolution of Object Oriented Systems [3] Rushikesh K. Joshi, On-the-fly Evolution of Object Oriented Systems using Filter Objects, Technical Report, Feb. 1999, IIT Bombay. (result using Filter Objects, Technical Report, Feb. 1999, IIT Bombay. (result submitted for publication).submitted for publication).
[4] G. Sriram Reddy, Rushikesh K. Joshi, Filter Objects for Distributed Object [4] G. Sriram Reddy, Rushikesh K. Joshi, Filter Objects for Distributed Object Systems, To Appear in Journal of Object Oriented Programming (January Systems, To Appear in Journal of Object Oriented Programming (January 2001)2001)..
[5] R. K. Joshi, Modeling with Filter Objects in Distributed Systems, To be [5] R. K. Joshi, Modeling with Filter Objects in Distributed Systems, To be presented at EDO 2000, UC Davis, Nov 2-3, 2000presented at EDO 2000, UC Davis, Nov 2-3, 2000
[6] Maureen Mascarenhas, R. K. Joshi, Design and Implementation of Filter [6] Maureen Mascarenhas, R. K. Joshi, Design and Implementation of Filter Objects for JAVA, Technical Report, IIT Bombay October 2000. (result Objects for JAVA, Technical Report, IIT Bombay October 2000. (result submitted for Publication).submitted for Publication).