Monday, January 7, 2008

Modules of Google Gears

When you think of offline (not connected to the network) support to web applications, you need to operate on the data/resources stored locally. Any developer who wants to provide offline capability to their applications needs to understand the Google Gears Modules, I've explained below the Gears modules based on the contents stored locally.

HTTP resources: These are mostly client/UI contents like HTML pages, css files, images, javascripts etc. Local Server Module (LSM) offers storing these resources locally. When HTTP requests are made, the browser checks if these resources are available locally, if so the local copy will be served, if not the browser will try to access the online resources. Application developers have to use the APIs in LSM to update the stored contents when they are modified in the online version.

Application/User specific data: Data varies from application to application i.e: Editor application has documents, Mail apps has messages/drafts, Feed Reader has feeds, news etc. Database Module (DM) offers SQLLite database system to store the data. You could open a database, create tables and perform CRUD (Create, Retrieve, Update and Delete) operations. Unlike LSM, DM does not have API to sync the modified data to the online version. Application developers have to take care of it.

Apart from the above two modules, there is WorkerPool Module to execute your javascript code in a separate processes.

Location of the locally stored resources/data through LSM and DM:

Fire Fox:

Linux:
/home/[username]/.mozilla/firefox/[.default]/Google Gears for Firefox/[website]/http_8080

Mac:
/Users/administrator/Library/Caches/Firefox/Profiles/[.default]/Google Gears for Firefox/[website]/http_80

Windows XP:
C:\Documents and Settings\[user]\Local Settings\Application Data\Mozilla\Firefox\Profiles\[.default]\Google Gears for Firefox\[website]\http_8080

Windows Vista:
C:\Users\[user]\AppData\Local\Mozilla\Firefox\Profiles\[.default]\Google Gears for Firefox\[website]\http_80

IE:

Windows XP:
C:\Documents and Settings\[user]\Local Settings\Application Data\Google\Google Gears for Internet Explorer\[
website]\http_8080

Windows Vista:
C:\Users\[usr]\AppData\LocalLow\Google\Google Gears for Internet Explorer\[
website]\http_80

For more details visit: http://code.google.com/apis/gears/

No comments: