[Dev] about KindCollection, KindSet and watching kinds

Andi Vajda vajda at osafoundation.org
Wed Sep 14 11:26:22 PDT 2005


This morning, I checked in a bunch of changes that add support for kind 
extents at the data model level. A kind extent is defined as the set of all 
items of a given kind, recursive to sub-kinds or not.

By default, a kind extent doesn't do much but there are several devices in the 
data model and Chandler code that leverage kind extents today to offer the 
following services:

  - If all you're interested in is knowing when an item of a given kind is
    created, deleted, or stamped (ie, its kind changed), then you should use
    the new item.watchKind(kind, methodName) API that replaces the now
    defunct 'schema' monitor.
    'methodName' should be a method of 'item' with this signature:
        def methodName(op, kind, other):
            where 'op' is either 'add' or 'remove' which means that 'other'
            became an instance of that 'kind' or a sub-kind thereof or is about
            to no longer be an instance of that 'kind' or a sub-kind thereof.

  - If all you're interested in is the above + have these notifications
    filtered or combined in some way, then use a KindSet and combine it with
    other abstract sets to suit your needs.

  - If what you're interested in is the above + have these notifications
    participate in the Collection framework from parcels.osaf.pim.collections
    and be notified - when the UI is active - of changes to attributes of items
    of a given kind, then use a KindCollection, combining it, maybe, with other
    collections from that framework.

Andi..


More information about the Dev mailing list