On Mar 21, 2007, at 11:53 AM, Heikki Toivonen wrote:

Morgen Sagen wrote:
I realized this morning that we need to solve the following problem:
Any item that is created "out of the box" on a clean repository -- in
other words, every item that is created by an update( ) call within an installParcel( ) -- should not be dumped. If they are, then we'll get

For the encrypted passwords to work I am relying on the repository
always having a dummy password object. I create this on first startup.
This is needed to check that the master password the user has entered is
correct. So I would need this to be dumped as well, but when reloaded,
the dummy from the dump should replace the dummy in the repository. I do
this with save & restore settings. Would this be possible with dump &
reload?

--
  Heikki Toivonen

Short answer: yes

Long answer:

For any parcel data such as preferences or this dummy password, we should just have each parcel define a record type which contains fields for whatever information that parcel needs to dump/reload. The translator's job is to convert the parcel data to records and vice versa. So in the case of this dummy password, it's probably enough to define a record type like this:


# tweak the text size max as needed
text256 = eim.TextType(size=256)

class PasswordRecord(eim.Record):
   URI = "http://osafoundation.org/eim/framework/password/password/0";

   uuid = eim.key(schema.UUID)
   ciphertext = eim.field(text256)
   iv = eim.field(text256)
   salt = eim.field(text256)

class PasswordParcelRecord(eim.Record):
   URI = "http://osafoundation.org/eim/framework/password/parcel/0";

   dummyPassword = eim.field(schema.UUID)


Next, when it's time to dump, we iterate all schema.Items and pass them to the translator for export (skipping the ones that live under //parcels). Whenever we export a Password item, we yield a PasswordRecord. Until we have a fancy mechanism for parcels to register with the translator, we should just have the DumpTranslator.finishExport( ) yield a PasswordRecord for the dummy password (which it finds via schema.ns( ) ), plus a PasswordParcelRecord (which contains the UUID of the dummy).

At reload time, the importer for the PasswordRecord type would recreate the Password items, and finally the PasswordParcelRecord importer would assign the appropriate Password item to schema.ns ('osaf.framework.password', view).passwordPrefs.dummyPassword explicitly. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "chandler-dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/chandler-dev

Reply via email to