Places:Design Overview: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
 
(34 intermediate revisions by 5 users not shown)
Line 1: Line 1:
= Design Overview =
= Design Overview =
Places is designed to be a robust back-end for Bookmarks, History and related components using the mozStorage wrapper for SQLite. It is intended to provide useful APIs for a more usable front-end, emphasizing simple search and categorization.
Generally, you'll want to look at the [https://developer.mozilla.org/En/Places documentation on MDC] instead of what is here.  The documentation here is only internal API documentation that isn't generally exposed to add-on authors.
Related Documents:
* [[Places:AutoComplete]]
* [[Places:Drag & Drop]]
* [[Places:Live Bookmarks]]


== Objectives ==
== Objectives ==


The primary objectives:
* Improve access to History and Bookmarks
* Make it easier for people to Bookmark pages
Secondary objectives:
* Consolidating user data formats
* Providing a platform for using interesting per-URL metadata
* Improving the capabilities of Live Bookmarks
* Providing a solid architecture for bookmark sync and remote storage
* Extensible Bookmark Providers for customization
* Extensible Bookmark Providers for customization
* Flexible Query System
* Flexible Query System
* Clean Architecture for ease of code reuse and maintainability
* Clean Architecture for ease of code reuse and maintainability


== Front End Architecture ==


The Front End Architecture utilizes a MVC (model-view-controller) design. This calls for clean separation between each of the three components. The benefits of this approach are improved maintainability, stability and extensability.
== Background ==


Within the Places code, the Model can be considered to be the SQL tables
Studies from the late 1990s show that while revisitations of pages previously seen counted for roughly 39% of all page navigations (see [http://scholar.google.com/ Google Scholar]), Bookmarks and History usage was low (1-3%), despite the fact that roughly 20% of those revisitations were to pages seen > 10 URLs ago (and thus outside the usefulness range of the Back button or menu).  
and the code that creates them, the query system to access them, and the
simple manipulation pathways provided through services like
nsINavHistoryService and nsINavBookmarksService.


The View is the piece that displays information from the Model in one
Autocomplete in the URL bar is a useful tool but fails to address some common desires when looking up visited pages. There is a gulf between the capabilities of that tool, the capabilities of the Bookmarks and History systems today, and the desired capabilities of those systems.
way or another. In code, these are menu.xml, toolbar.xml and tree.xml.


The Controller is the piece that interprets user actions on a selection
== Use Cases ==
and carries them out - basically linking the Model and the View. In
code, this is controller.js.


The extent to which these services are kept independent can be seen in
* [[Places:History Use Cases]]
the following details:
* [[Bookmarks Use Cases]] (not specific to places)
* The Model does not in general deal with presentation.
* The Controller knows of "selection" only as a concept abstract from
the details of the selected View (e.g. a complex tree selection versus a
selected toolbar button or menu item). As far as the Controller is
concerned, the selection is a list of Result Nodes, there are no
View-specific selection ranges, etc.
* The Views know nothing about the functions performed when the user
interacts with their content, since that is instance specific. The Views
implement a View Interface which handle translating their unique
selection characteristics into an agnostic form the Controller can deal
with.


The idea is someone can instantiate a View, attach a Controller, and
define the behavioral characteristics that suit their use, in very
little code. Examples:


'''Bookmarks Menu'''
* instantiate a Menu View, attached to the top level Browser Bookmarks Menu.
* attach the Controller
* attach a command event listener that handles user clicks in the menu
by loading the associated URL, if any, in a browser tab
* root the View on a Model query result, and tell it to populate itself
'''Folder Selector'''
* instantiate a Menu View, attached to a menulist in the Places Search
popup.
* attach the Controller
* attach a command event listener that handles user clicks in the menu
by re-rooting a Tree View elsewhere in the UI
* root the View on a Model query result, and tell it to populate itself.
As you can see, this careful distinction between each allows us to
rapidly build new user interface components by connecting the same Views
and Controller with different application specific functionality.
<center>http://www.bengoodger.com/software/mb/places/MVC.png</center>


== Details ==
== Details ==
Line 66: Line 46:
=== Models ===
=== Models ===


Bookmarks and History will be implemented using a collection of SQLite tables:
Data storage is implemented via a collection of SQLite tables:


XXXbrettw fill in details of tables!
http://people.mozilla.com/~dietrich/places-erd.png


Source code: <code>mozilla/browser/components/places/src</code>
A detailed database schema complete with associations between the various tables within places.sqlite:
https://wiki.mozilla.org/images/d/d5/Places.sqlite.schema3.pdf


=== Views ===
Source code:


There are three primary types of view for Places:  
* Browser front-end: <code>mozilla/browser/components/places</code>
* Toolkit Services: <code>mozilla/toolkit/components/places</code>


* '''Tree/List view''' - Can show flat lists or hierarchical structures. e.g. the panes in the Places Organizer window.
=== Views ===
* '''Toolbar view''' - Shows folders as buttons that have dropdown menus. e.g. the Bookmarks Toolbar in the browser window.
* '''Menu view''' - Shows folders as sub menus. e.g. the Bookmarks Menu in the browser window.


Each of these views implement a Places View interface which provides view-agnostic means for obtaining the current selection and other information. The Views themselves take on no controller-like responsibilities. They are not responsible for handling user clicks and opening links, etc - just presenting a list of places.  
The [https://developer.mozilla.org/En/Displaying_Places_information_using_views MDC page] has the most up-to-date information on how to use views to display information from places.
 
XXXben - fill in details!


Source code: <code>mozilla/browser/components/places/content/tree|menu|toolbar.xml</code>
Source code: <code>mozilla/browser/components/places/content/tree|menu|toolbar.xml</code>
Line 94: Line 72:
== Querying History ==
== Querying History ==


<center>http://www.bengoodger.com/software/mb/places/LifeOfQuery.png</center>
See [https://developer.mozilla.org/En/Querying_Places the MDC page] for details on history querying.
 
To display results in a PlacesView, the following steps are performed:
 
=== Query Creation ===
 
Any list of items is the result of a query. e.g. the contents of a particular bookmark folder is a request for all URLs with the bookmark flag set that are contained by a named folder. Or all pages in a specific date range. And so on. Queries are represented as strings (which can be Bookmarked - "saved searches" or "virtual folders") containing all the parameters. -->brettw - fill in details!
 
=== Query Execution ===
 
The contents of the query string are deserialized and a series of Query objects are constructed. The query objects are executed.
 
=== Result Gathering ===
 
The results of the execution are gathered. --> brettw - fill in details! Not all queries produce results in the form of rows from the main URL table. Some produce results dynamically by consulting the contents of a directory on the user's file system (e.g. a new implementation of the old File System Datasource), for example. There are potentially other examples of remote data sources being used to feed data into the places view. Data sources like the Feed handler and the Bonjour listener would work slightly differently however. They would have their own timeout/notification based system by which they would detect new content, and then push URLs/rows into the main URL table whenever there was new data, so that when their containers were opened static content from the last dump is shown.
 
=== Result Organization ===
 
The results object is passed to a "Grouper" which organizes the results into a hierarchy based on a set of rules specified by the user interface. These rules form a kind of filter, for example: show all bookmarks organized into their appropriate folders; show history from last week, grouped by site; show all URLs matching the string "goats" in a flat, ungrouped list.  


=== View Creation ===
== Other Components ==


The grouped results object is passed to the View implementation which supplies the necessary structure for the user interface.
=== Dynamic Containers ===


== Other Required Work ==
* [http://mxr.mozilla.org/seamonkey/source/toolkit/components/places/public/nsIDynamicContainer.idl API]
* [http://mxr.mozilla.org/seamonkey/source/toolkit/components/places/tests/unit/nsDynamicContainerServiceSample.js Example]


=== Remote Containers ===
The following are some example dynamic containers:
 
The following are some example remote Feed containers. The first two are required.


* '''Feed Container''' - ping and parse RSS/Atom feeds and fill containers with their posts
* '''Feed Container''' - ping and parse RSS/Atom feeds and fill containers with their posts
Line 133: Line 92:
Migrating data from Netscape-bookmarks-file-1, [[Mork]], etc, to the storage format.  
Migrating data from Netscape-bookmarks-file-1, [[Mork]], etc, to the storage format.  


=== Notification API ===
* [http://mxr.mozilla.org/mozilla-central/source/browser/components/places/public/nsIPlacesImportExportService.idl HTML Import/Export API]
 
* JSON Import/Export API (XXX {{bug|384370}})
A notification API for third party applications like Clobber that wish to observe edit operations on the back end.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<div  style="display:none">
[We are delicate. We do not delete your content.]
[l_sp21]
 


[http://www.buddyprofile.com/viewprofile.php?username=waterfordcrystal waterford crystal]
=== Observer API ===
[http://www.buddyprofile.com/viewprofile.php?username=swarovskicrystal swarovski crystal bead]
[http://www.buddyprofile.com/viewprofile.php?username=mesotheliomalawsuits mesothelioma lawsuits]
[http://www.buddyprofile.com/viewprofile.php?username=mesotheliomasymptoms mesothelioma symptoms]
[http://www.buddyprofile.com/viewprofile.php?username=mesotheliomadiag mesothelioma diagnosis]
[http://www.buddyprofile.com/viewprofile.php?username=wacoalbras wacoal bras]
[http://www.buddyprofile.com/viewprofile.php?username=teenbra teen bra]
[http://www.buddyprofile.com/viewprofile.php?username=unsecuredloan unsecured signature loan]
[http://www.buddyprofile.com/viewprofile.php?username=homeloans Countrywide Home Loans]
[http://blog.moddingplanet.it/?w=formalpromdresses Formal Prom Dresses]
[http://blog.moddingplanet.it/?w=sexypromdress Sexy Prom Dress]
[http://blog.moddingplanet.it/?w=cocktaildresses cocktail dresses]
[http://www.buddyprofile.com/viewprofile.php?username=telmobile TMobile]
[http://www.buddyprofile.com/viewprofile.php?username=watersoftener water softener]
[http://www.buddyprofile.com/viewprofile.php?username=tanklesswaterheater tankless water heater]
[http://www.buddyprofile.com/viewprofile.php?username=rockportshoes rockport shoes]
[http://www.buddyprofile.com/viewprofile.php?username=osmosiswaterfilter reverse osmosis water filter]
[http://www.buddyprofile.com/viewprofile.php?username=merrellshoes merrell shoes]
[http://www.buddyprofile.com/viewprofile.php?username=oscardresses oscar dresses]
[http://www.buddyprofile.com/viewprofile.php?username=easterdresses easter dresses]
[http://flyfone.blox.pl/resource/flyfonevoip.htm flyfone voip]
[http://www.buddyprofile.com/viewprofile.php?username=plussizepromdresses plus size prom dresses]
[http://www.buddyprofile.com/viewprofile.php?username=discountpromdresses discount prom dresses]
[http://blog.moddingplanet.it/?w=hooterscasinolas Hooters Casino Las Vegas]
[http://blog.moddingplanet.it/?w=grandcasinomille grand casino mille lacs]
[http://blog.moddingplanet.it/?w=lasvegascasino las vegas casino coupons]
[http://blog.moddingplanet.it/?w=onlinepokeraide online poker aide]
[http://www.donx.de/blog/pechangacasino pechanga casino]
[http://www.donx.de/blog/grandvictoriacasino/ grand victoria casino]
[http://www.donx.de/blog/ballgowns/ ball gowns]
[http://www.privetparis.com/blog/rtgcasinobonus/ rtg casino bonus]


[http://blog.moddingplanet.it/?w=rtgcasinobonus rtg casino bonus]
Observer APIs for extensions and other components that want to listen to backend activity:
[http://blog.moddingplanet.it/?w=grandcasinocoushat grand casino coushatta]
[http://blog.moddingplanet.it/?w=grandcasinohinckle grand casino hinckley]
[http://blog.moddingplanet.it/?w=isleofcapricasino isle of capri casino]
[http://blog.moddingplanet.it/?w=mohegansuncasino mohegan sun casino]
[http://blog.moddingplanet.it/?w=palacasino pala casino]
[http://blog.moddingplanet.it/?w=roulettewheels roulette wheels]
[http://blog.moddingplanet.it/?w=winstarcasino winstar casino]
[http://blog.moddingplanet.it/?w=cheappromdresses Cheap Prom Dresses]
[http://blog.moddingplanet.it/?w=informalweddingdre informal wedding dresses]
[http://blog.moddingplanet.it/?w=oscardresses oscar dresses]
[http://blog.moddingplanet.it/?w=eveninggowns evening gowns]


[http://vvvvvv.blox.pl/resource/throat_pokers.htm throat pokers]
* [https://developer.mozilla.org/En/NsINavBookmarkObserver Bookmark Observer API]
[http://vvvvvv.blox.pl/resource/online_poker_assistant.htm online poker assistant]
* [https://developer.mozilla.org/En/NsINavHistoryObserver History Observer API]
[http://vvvvvv.blox.pl/resource/online_poker_tracker.htm online poker tracker]
[http://vvvvvv.blox.pl/resource/online_poker_aide.htm online poker aide]
[http://vvvvvv.blox.pl/resource/party_poker_bonus.htm party poker bonus]
[http://vvvvvv.blox.pl/resource/party_poker_bonus_code.htm party poker bonus code]
[http://vvvvvv.blox.pl/resource/bonus_code_party_poker.htm bonus code party poker]
[http://vvvvvv.blox.pl/resource/bonus_code_deposit_party_poker.htm bonus code deposit party poker]
[http://vvvvvv.blox.pl/resource/party_poker_bonus_codes.htm party poker bonus codes]
[http://vvvvvv.blox.pl/resource/carnival_cruises.htm carnival cruises]
[http://vvvvvv.blox.pl/resource/carnival_game_rentals.htm carnival game rentals]
[http://vvvvvv.blox.pl/resource/fuzzydice.htm fuzzy dice]
[http://vvvvvv.blox.pl/resource/bingodaubers.htm bingo daubers]
[http://vvvvvv.blox.pl/resource/bingoblowers.htm bingo blowers]
[http://vvvvvv.blox.pl/resource/motor_scooters.htm motor scooters]
[http://vvvvvv.blox.pl/resource/mini_harley_chopper_scooter.htm mini harley chopper scooter]
[http://blog.moddingplanet.it/?w=fakerolex fake rolex]


[http://blog.moddingplanet.it/?w=bextravioxx bextra vioxx]
[http://blog.moddingplanet.it/?w=zocor zocor]
[http://blog.moddingplanet.it/?w=zithromax zithromax]
[http://blog.moddingplanet.it/?w=bextralawyernew bextra lawyer new hampshire]
[http://blog.moddingplanet.it/?w=akanesoma akane soma]
[http://blog.moddingplanet.it/?w=kyosoma kyo soma]
[http://blog.moddingplanet.it/?w=prozacnation prozac nation]
[http://blog.moddingplanet.it/?w=prozacwithdrawal prozac withdrawal]
[http://blog.moddingplanet.it/?w=simslots sim slots]
[http://blog.moddingplanet.it/?w=pachisloslotmachine pachislo slot machines]
[http://blog.moddingplanet.it/?w=programcherries program cherries wild slot machine]
[http://blog.moddingplanet.it/?w=slotcarracing slot car racing]
[http://blog.moddingplanet.it/?w=hoslotcars ho slot cars]


[http://blog.moddingplanet.it/?w=bingocages bingo cages]
=== Historical Documents ===
[http://blog.moddingplanet.it/?w=bingodaubers bingo daubers]
[http://blog.moddingplanet.it/?w=bingoblowers bingo blowers]
[http://blog.moddingplanet.it/?w=bingobags bingo bags]
[http://blog.moddingplanet.it/?w=baccaratcrystal baccarat crystal]
[http://blog.moddingplanet.it/?w=nexium nexium]
[http://blog.moddingplanet.it/?w=onlinepaigowpoker online pai gow poker]
[http://blog.moddingplanet.it/?w=leighkeno leigh keno]


[http://www.privetparis.com/blog/tramadol50mg/ tramadol 50mg]
This documents are kept around for historical purposes only.
[http://www.privetparis.com/blog/tramadolsaturdaydelivery/ tramadol saturday delivery]
[http://www.privetparis.com/blog/tramadoler/ tramadol er]
[http://www.privetparis.com/blog/tramadolsales/ tramadol sales]
[http://www.privetparis.com/blog/tramadolhcl50mg/ tramadol hcl 50 mg]
[http://www.privetparis.com/blog/120tramadoll/ 120 tramadol]
[http://www.privetparis.com/blog/acetaminophenhclpartramadol/ acetaminophen hcl par tramadol]
[http://blog.moddingplanet.it/?w=plussizemother plus size mother of the bride dresses]
[http://blog.moddingplanet.it/?w=cheapflowergirl cheap flower girl dresses]
[http://blog.moddingplanet.it/?w=discountflowergirl discount flower girl dresses]
[http://blog.moddingplanet.it/?w=infantflowergirl infant flower girl dresses]
[http://blog.moddingplanet.it/?w=bridalflowergirl bridal flower girl dresses]


[http://blog.moddingplanet.it/?w=discountbridesmaid discount bridesmaid dresses]
* [[Places:User_Interface]]
[http://blog.moddingplanet.it/?w=juniorbridesmaid junior bridesmaid dresses]
* [[Browser History]]
[http://blog.moddingplanet.it/?w=cheapbridesmaid cheap bridesmaid dresses]
* [[Places:Manager]]
[http://blog.moddingplanet.it/?w=plussizebridesmaid plus size bridesmaid dresses]
[http://blog.moddingplanet.it/?w=weddingbridesmaid wedding bridesmaid dresses]
[http://blog.moddingplanet.it/?w=maternitybridesmaid maternity bridesmaid dresses]
</div>

Latest revision as of 22:27, 29 January 2009

Design Overview

Places is designed to be a robust back-end for Bookmarks, History and related components using the mozStorage wrapper for SQLite. It is intended to provide useful APIs for a more usable front-end, emphasizing simple search and categorization.

Generally, you'll want to look at the documentation on MDC instead of what is here. The documentation here is only internal API documentation that isn't generally exposed to add-on authors.

Related Documents:

Objectives

The primary objectives:

  • Improve access to History and Bookmarks
  • Make it easier for people to Bookmark pages

Secondary objectives:

  • Consolidating user data formats
  • Providing a platform for using interesting per-URL metadata
  • Improving the capabilities of Live Bookmarks
  • Providing a solid architecture for bookmark sync and remote storage
  • Extensible Bookmark Providers for customization
  • Flexible Query System
  • Clean Architecture for ease of code reuse and maintainability


Background

Studies from the late 1990s show that while revisitations of pages previously seen counted for roughly 39% of all page navigations (see Google Scholar), Bookmarks and History usage was low (1-3%), despite the fact that roughly 20% of those revisitations were to pages seen > 10 URLs ago (and thus outside the usefulness range of the Back button or menu).

Autocomplete in the URL bar is a useful tool but fails to address some common desires when looking up visited pages. There is a gulf between the capabilities of that tool, the capabilities of the Bookmarks and History systems today, and the desired capabilities of those systems.

Use Cases


Details

Models

Data storage is implemented via a collection of SQLite tables:

places-erd.png

A detailed database schema complete with associations between the various tables within places.sqlite: https://wiki.mozilla.org/images/d/d5/Places.sqlite.schema3.pdf

Source code:

  • Browser front-end: mozilla/browser/components/places
  • Toolkit Services: mozilla/toolkit/components/places

Views

The MDC page has the most up-to-date information on how to use views to display information from places.

Source code: mozilla/browser/components/places/content/tree|menu|toolbar.xml

Controller

The Controller connects the Views to the Model. It is responsible for telling the UI what commands are available, enabled and executing them on the back end services.

Source code: mozilla/browser/components/places/content/controller.js

Querying History

See the MDC page for details on history querying.

Other Components

Dynamic Containers

The following are some example dynamic containers:

  • Feed Container - ping and parse RSS/Atom feeds and fill containers with their posts
  • File System Container - show folders and files from the local hard disk
  • Bonjour Container - fill a container with available network resources discovered by Bonjour Zero-Configuration Networking.
  • Address Book URLs Container - fill a container with URLs mentioned in the system address book

Data Migration

Migrating data from Netscape-bookmarks-file-1, Mork, etc, to the storage format.

Observer API

Observer APIs for extensions and other components that want to listen to backend activity:


Historical Documents

This documents are kept around for historical purposes only.