r3 - 26 Feb 2004 - 10:29:43 - MikeTYou are here: OSAF >  Projects Web  >  ChandlerHome > DeveloperDocumentation > HowToWriteAParcelTutorial > PersistenceInChandler

Persistence in Chandler

@@@ Make more positive

An important Chandler concept is persistence. Persistence saves developers from having to read in and write out data files, do garbage collection, and manage memory limits on their own by automatically storing objects in an object database.

Almost every object in the Model (the ParcelViewer subclass, e.g. FooView) is persisted. However, you need to be a little bit careful because not all Python objects can be persisted. In particular, C pointers can't be persisted. C pointers are just addresses in memory, and the contents of what is at a memory location change pretty wildly as time goes on.

One particular place where you need to be careful is with Views. Because wxWindows objects use C pointers, the model can't keep track of the View (the wxParcelViewer subclass, e.g. wxFooView) in an instance variable. Views must be regenerated every time.

Fortunately, the Model can access the View dynamically by importing app from Application, then calling

      app.association[id(self)]

(association is a global dictionary that associates a Model with its wx counterpart.)

In general, you can't persist an object that has a pointer to a C object that is wrapped in a Python data type. Two of the most common such objects are Python lists and Python dictionaries. Use <nopPersistentList and PersistentDict instead.

Under the hood

The repository itself is implemented on top of Sleepycat's dbxml and Berkeley DB. We've also integrated Lucene, to use as a full text search engine. More information on the repository project can be found at Repository Framework.

While it is possible that we will use something else for the underlying object store, the developer-level model should not change.

-- DuckySherwood - 20 Apr 2003

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r3 < r2 < r1 | More topic actions
 
Open Source Applications Foundation
Except where otherwise noted, this site and its content are licensed by OSAF under an Creative Commons License, Attribution Only 3.0.
See list of page contributors for attributions.