SlideShare a Scribd company logo
1 of 2
Download to read offline
Structural Relationship between Content Resolver
and Content Provider of Android - an example of
Proxy Design Pattern
by

Somenath Mukhopadhyay
som.mukhopadhyay@gmail.com
As i was digging into the source code of Content Provider and Content Resolver, i found a nice
structural relationship among the two and it closely resembles the Proxy Pattern of the GoF
book. We need Proxy Pattern whenever there is a need of a sophisticated reference to an object
other than the simple pointer.
The class diagram of the Proxy Pattern is something similar to the following:

What it actually does is that it adds a level of indirection when accessing an object. Whenever a
client needs to interact with an object of a RealSubject, it instead interacts with a Proxy of it. The
proxy forwards the request to the RealSubject.
Now let us dig into the source code of Content Resolver and Content Provider to understand
how it resembles the Proxy Pattern. The Content Provider offers the client of it all of the CRUD
(create, read, update & delete) functionalities. Internally what it does it forwards these
functionalities to the Content Provider. There is an one to one mapping between the CRUD
functions of the Content Resolver with the Content Providers. A simplistic version of the
structural relationship between the Content Resolver and the Content Provider can be depicted
as follows.

Whenever the client calls any of the above functions on the ContentResolver, it just gets a
reference to the appropriate Content Provider by the function called aquireProvider and then
delegates that function to that of the ContentProvider. In each of these CRUD functions, the
ContentResolver also manages the lifecycle of the ContentProvider it acquires through a
function called releaseProvider.
Thus we can say that to a client, the ContentResolver works as a proxy of ContentProviders.

More Related Content

Viewers also liked

Content provider in_android
Content provider in_androidContent provider in_android
Content provider in_androidPRITI TELMORE
 
Implementation of a state machine for a longrunning background task in androi...
Implementation of a state machine for a longrunning background task in androi...Implementation of a state machine for a longrunning background task in androi...
Implementation of a state machine for a longrunning background task in androi...Somenath Mukhopadhyay
 
android content providers
android content providersandroid content providers
android content providersDeepa Rani
 
Day 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIDay 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIAhsanul Karim
 
Android Training (Content Provider)
Android Training (Content Provider)Android Training (Content Provider)
Android Training (Content Provider)Khaled Anaqwa
 

Viewers also liked (6)

Content provider in_android
Content provider in_androidContent provider in_android
Content provider in_android
 
Implementation of a state machine for a longrunning background task in androi...
Implementation of a state machine for a longrunning background task in androi...Implementation of a state machine for a longrunning background task in androi...
Implementation of a state machine for a longrunning background task in androi...
 
android content providers
android content providersandroid content providers
android content providers
 
Day 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIDay 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts API
 
Observer pattern
Observer patternObserver pattern
Observer pattern
 
Android Training (Content Provider)
Android Training (Content Provider)Android Training (Content Provider)
Android Training (Content Provider)
 

Similar to Structural Relationship between Content Resolver and Content Provider of Android - an example of Proxy Design Pattern

Colloquim Report on Crawler - 1 Dec 2014
Colloquim Report on Crawler - 1 Dec 2014Colloquim Report on Crawler - 1 Dec 2014
Colloquim Report on Crawler - 1 Dec 2014Sunny Gupta
 
React Libraries For Every Purpose Your Business Needs In 2022
React Libraries For Every Purpose Your Business Needs In 2022React Libraries For Every Purpose Your Business Needs In 2022
React Libraries For Every Purpose Your Business Needs In 2022Narola Infotech
 
Colloquim Report - Rotto Link Web Crawler
Colloquim Report - Rotto Link Web CrawlerColloquim Report - Rotto Link Web Crawler
Colloquim Report - Rotto Link Web CrawlerAkshay Pratap Singh
 
7 Tools To Make React Development Faster and More Efficient
7 Tools To Make React Development Faster and More Efficient7 Tools To Make React Development Faster and More Efficient
7 Tools To Make React Development Faster and More EfficientNarola Infotech
 
Maximize Development Efficiency with ReactJS.pdf
Maximize Development Efficiency with ReactJS.pdfMaximize Development Efficiency with ReactJS.pdf
Maximize Development Efficiency with ReactJS.pdfBOSC Tech Labs
 
Tutor-marked assignment TMA 03 Printable page generated Saturd.docx
Tutor-marked assignment TMA 03 Printable page generated Saturd.docxTutor-marked assignment TMA 03 Printable page generated Saturd.docx
Tutor-marked assignment TMA 03 Printable page generated Saturd.docxjuliennehar
 
Case Study: Putting The Watson Developer Cloud to Work - by Doron Katz & Luci...
Case Study: Putting The Watson Developer Cloud to Work - by Doron Katz & Luci...Case Study: Putting The Watson Developer Cloud to Work - by Doron Katz & Luci...
Case Study: Putting The Watson Developer Cloud to Work - by Doron Katz & Luci...Carlos Tomas
 
Humantics | Optimizing Your Content Strategy in an Entity-Driven World
Humantics | Optimizing Your Content Strategy in an Entity-Driven WorldHumantics | Optimizing Your Content Strategy in an Entity-Driven World
Humantics | Optimizing Your Content Strategy in an Entity-Driven WorldGrant Simmons
 
Frontend Development Bootcamp - React [Online & Offline] In Bangla
Frontend Development Bootcamp - React [Online & Offline] In BanglaFrontend Development Bootcamp - React [Online & Offline] In Bangla
Frontend Development Bootcamp - React [Online & Offline] In BanglaStack Learner
 
Rdf Based User Interfaces
Rdf Based User InterfacesRdf Based User Interfaces
Rdf Based User Interfacesvladungureanu
 
React js - The Core Concepts
React js - The Core ConceptsReact js - The Core Concepts
React js - The Core ConceptsDivyang Bhambhani
 
Techpaathshala ReactJS .pdf
Techpaathshala ReactJS .pdfTechpaathshala ReactJS .pdf
Techpaathshala ReactJS .pdfTechpaathshala
 
RDFa: introduction, comparison with microdata and microformats and how to use it
RDFa: introduction, comparison with microdata and microformats and how to use itRDFa: introduction, comparison with microdata and microformats and how to use it
RDFa: introduction, comparison with microdata and microformats and how to use itJose Luis Lopez Pino
 
JavaScript Doesn't Have to be Evil | Digital Olympus
JavaScript Doesn't Have to be Evil | Digital OlympusJavaScript Doesn't Have to be Evil | Digital Olympus
JavaScript Doesn't Have to be Evil | Digital OlympusOnely
 
Migration to a JS Framework without Losing Your Rankings and Mind
Migration to a JS Framework without Losing Your Rankings and MindMigration to a JS Framework without Losing Your Rankings and Mind
Migration to a JS Framework without Losing Your Rankings and MindMaria Cieślak
 
How Can the Hermes Engine Help React Native Apps.docx.pdf
How Can the Hermes Engine Help React Native Apps.docx.pdfHow Can the Hermes Engine Help React Native Apps.docx.pdf
How Can the Hermes Engine Help React Native Apps.docx.pdfTechugo
 

Similar to Structural Relationship between Content Resolver and Content Provider of Android - an example of Proxy Design Pattern (20)

Colloquim Report on Crawler - 1 Dec 2014
Colloquim Report on Crawler - 1 Dec 2014Colloquim Report on Crawler - 1 Dec 2014
Colloquim Report on Crawler - 1 Dec 2014
 
React Libraries For Every Purpose Your Business Needs In 2022
React Libraries For Every Purpose Your Business Needs In 2022React Libraries For Every Purpose Your Business Needs In 2022
React Libraries For Every Purpose Your Business Needs In 2022
 
Colloquim Report - Rotto Link Web Crawler
Colloquim Report - Rotto Link Web CrawlerColloquim Report - Rotto Link Web Crawler
Colloquim Report - Rotto Link Web Crawler
 
7 Tools To Make React Development Faster and More Efficient
7 Tools To Make React Development Faster and More Efficient7 Tools To Make React Development Faster and More Efficient
7 Tools To Make React Development Faster and More Efficient
 
Maximize Development Efficiency with ReactJS.pdf
Maximize Development Efficiency with ReactJS.pdfMaximize Development Efficiency with ReactJS.pdf
Maximize Development Efficiency with ReactJS.pdf
 
Tutor-marked assignment TMA 03 Printable page generated Saturd.docx
Tutor-marked assignment TMA 03 Printable page generated Saturd.docxTutor-marked assignment TMA 03 Printable page generated Saturd.docx
Tutor-marked assignment TMA 03 Printable page generated Saturd.docx
 
Case Study: Putting The Watson Developer Cloud to Work - by Doron Katz & Luci...
Case Study: Putting The Watson Developer Cloud to Work - by Doron Katz & Luci...Case Study: Putting The Watson Developer Cloud to Work - by Doron Katz & Luci...
Case Study: Putting The Watson Developer Cloud to Work - by Doron Katz & Luci...
 
Humantics | Optimizing Your Content Strategy in an Entity-Driven World
Humantics | Optimizing Your Content Strategy in an Entity-Driven WorldHumantics | Optimizing Your Content Strategy in an Entity-Driven World
Humantics | Optimizing Your Content Strategy in an Entity-Driven World
 
Grant Simmons - Advanced Search Summit Napa 2021
Grant Simmons - Advanced Search Summit Napa 2021Grant Simmons - Advanced Search Summit Napa 2021
Grant Simmons - Advanced Search Summit Napa 2021
 
Frontend Development Bootcamp - React [Online & Offline] In Bangla
Frontend Development Bootcamp - React [Online & Offline] In BanglaFrontend Development Bootcamp - React [Online & Offline] In Bangla
Frontend Development Bootcamp - React [Online & Offline] In Bangla
 
ProofConceptPattern
ProofConceptPatternProofConceptPattern
ProofConceptPattern
 
Rdf Based User Interfaces
Rdf Based User InterfacesRdf Based User Interfaces
Rdf Based User Interfaces
 
React js - The Core Concepts
React js - The Core ConceptsReact js - The Core Concepts
React js - The Core Concepts
 
Techpaathshala ReactJS .pdf
Techpaathshala ReactJS .pdfTechpaathshala ReactJS .pdf
Techpaathshala ReactJS .pdf
 
Angular vs.pdf
Angular vs.pdfAngular vs.pdf
Angular vs.pdf
 
RDFa: introduction, comparison with microdata and microformats and how to use it
RDFa: introduction, comparison with microdata and microformats and how to use itRDFa: introduction, comparison with microdata and microformats and how to use it
RDFa: introduction, comparison with microdata and microformats and how to use it
 
JavaScript Doesn't Have to be Evil | Digital Olympus
JavaScript Doesn't Have to be Evil | Digital OlympusJavaScript Doesn't Have to be Evil | Digital Olympus
JavaScript Doesn't Have to be Evil | Digital Olympus
 
Migration to a JS Framework without Losing Your Rankings and Mind
Migration to a JS Framework without Losing Your Rankings and MindMigration to a JS Framework without Losing Your Rankings and Mind
Migration to a JS Framework without Losing Your Rankings and Mind
 
Copy of React_JS_Notes.pdf
Copy of React_JS_Notes.pdfCopy of React_JS_Notes.pdf
Copy of React_JS_Notes.pdf
 
How Can the Hermes Engine Help React Native Apps.docx.pdf
How Can the Hermes Engine Help React Native Apps.docx.pdfHow Can the Hermes Engine Help React Native Apps.docx.pdf
How Can the Hermes Engine Help React Native Apps.docx.pdf
 

More from Somenath Mukhopadhyay

Significance of private inheritance in C++...
Significance of private inheritance in C++...Significance of private inheritance in C++...
Significance of private inheritance in C++...Somenath Mukhopadhyay
 
Arranging the words of a text lexicographically trie
Arranging the words of a text lexicographically   trieArranging the words of a text lexicographically   trie
Arranging the words of a text lexicographically trieSomenath Mukhopadhyay
 
Generic asynchronous HTTP utility for android
Generic asynchronous HTTP utility for androidGeneric asynchronous HTTP utility for android
Generic asynchronous HTTP utility for androidSomenath Mukhopadhyay
 
Java concurrency model - The Future Task
Java concurrency model - The Future TaskJava concurrency model - The Future Task
Java concurrency model - The Future TaskSomenath Mukhopadhyay
 
Memory layout in C++ vis a-vis polymorphism and padding bits
Memory layout in C++ vis a-vis polymorphism and padding bitsMemory layout in C++ vis a-vis polymorphism and padding bits
Memory layout in C++ vis a-vis polymorphism and padding bitsSomenath Mukhopadhyay
 
Developing an Android REST client to determine POI using asynctask and integr...
Developing an Android REST client to determine POI using asynctask and integr...Developing an Android REST client to determine POI using asynctask and integr...
Developing an Android REST client to determine POI using asynctask and integr...Somenath Mukhopadhyay
 
How to create your own background for google docs
How to create your own background for google docsHow to create your own background for google docs
How to create your own background for google docsSomenath Mukhopadhyay
 
The Designing of a Software System from scratch with the help of OOAD & UML -...
The Designing of a Software System from scratch with the help of OOAD & UML -...The Designing of a Software System from scratch with the help of OOAD & UML -...
The Designing of a Software System from scratch with the help of OOAD & UML -...Somenath Mukhopadhyay
 
Flow of events during Media Player creation in Android
Flow of events during Media Player creation in AndroidFlow of events during Media Player creation in Android
Flow of events during Media Player creation in AndroidSomenath Mukhopadhyay
 
Tackling circular dependency in Java
Tackling circular dependency in JavaTackling circular dependency in Java
Tackling circular dependency in JavaSomenath Mukhopadhyay
 
Implementation of composite design pattern in android view and widgets
Implementation of composite design pattern in android view and widgetsImplementation of composite design pattern in android view and widgets
Implementation of composite design pattern in android view and widgetsSomenath Mukhopadhyay
 
Exception Handling in the C++ Constructor
Exception Handling in the C++ ConstructorException Handling in the C++ Constructor
Exception Handling in the C++ ConstructorSomenath Mukhopadhyay
 
Active object of Symbian in the lights of client server architecture
Active object of Symbian in the lights of client server architectureActive object of Symbian in the lights of client server architecture
Active object of Symbian in the lights of client server architectureSomenath Mukhopadhyay
 
Android Asynctask Internals vis-a-vis half-sync half-async design pattern
Android Asynctask Internals vis-a-vis half-sync half-async design patternAndroid Asynctask Internals vis-a-vis half-sync half-async design pattern
Android Asynctask Internals vis-a-vis half-sync half-async design patternSomenath Mukhopadhyay
 

More from Somenath Mukhopadhyay (20)

Significance of private inheritance in C++...
Significance of private inheritance in C++...Significance of private inheritance in C++...
Significance of private inheritance in C++...
 
Arranging the words of a text lexicographically trie
Arranging the words of a text lexicographically   trieArranging the words of a text lexicographically   trie
Arranging the words of a text lexicographically trie
 
Generic asynchronous HTTP utility for android
Generic asynchronous HTTP utility for androidGeneric asynchronous HTTP utility for android
Generic asynchronous HTTP utility for android
 
Copy on write
Copy on writeCopy on write
Copy on write
 
Java concurrency model - The Future Task
Java concurrency model - The Future TaskJava concurrency model - The Future Task
Java concurrency model - The Future Task
 
Memory layout in C++ vis a-vis polymorphism and padding bits
Memory layout in C++ vis a-vis polymorphism and padding bitsMemory layout in C++ vis a-vis polymorphism and padding bits
Memory layout in C++ vis a-vis polymorphism and padding bits
 
Developing an Android REST client to determine POI using asynctask and integr...
Developing an Android REST client to determine POI using asynctask and integr...Developing an Android REST client to determine POI using asynctask and integr...
Developing an Android REST client to determine POI using asynctask and integr...
 
Uml training
Uml trainingUml training
Uml training
 
How to create your own background for google docs
How to create your own background for google docsHow to create your own background for google docs
How to create your own background for google docs
 
The Designing of a Software System from scratch with the help of OOAD & UML -...
The Designing of a Software System from scratch with the help of OOAD & UML -...The Designing of a Software System from scratch with the help of OOAD & UML -...
The Designing of a Software System from scratch with the help of OOAD & UML -...
 
Flow of events during Media Player creation in Android
Flow of events during Media Player creation in AndroidFlow of events during Media Player creation in Android
Flow of events during Media Player creation in Android
 
Tackling circular dependency in Java
Tackling circular dependency in JavaTackling circular dependency in Java
Tackling circular dependency in Java
 
Implementation of composite design pattern in android view and widgets
Implementation of composite design pattern in android view and widgetsImplementation of composite design pattern in android view and widgets
Implementation of composite design pattern in android view and widgets
 
Exception Handling in the C++ Constructor
Exception Handling in the C++ ConstructorException Handling in the C++ Constructor
Exception Handling in the C++ Constructor
 
Active object of Symbian in the lights of client server architecture
Active object of Symbian in the lights of client server architectureActive object of Symbian in the lights of client server architecture
Active object of Symbian in the lights of client server architecture
 
Android services internals
Android services internalsAndroid services internals
Android services internals
 
Android Asynctask Internals vis-a-vis half-sync half-async design pattern
Android Asynctask Internals vis-a-vis half-sync half-async design patternAndroid Asynctask Internals vis-a-vis half-sync half-async design pattern
Android Asynctask Internals vis-a-vis half-sync half-async design pattern
 
Composite Pattern
Composite PatternComposite Pattern
Composite Pattern
 
Bridge Pattern
Bridge PatternBridge Pattern
Bridge Pattern
 
Test Driven Development and JUnit
Test Driven Development and JUnitTest Driven Development and JUnit
Test Driven Development and JUnit
 

Structural Relationship between Content Resolver and Content Provider of Android - an example of Proxy Design Pattern