[Chandler-dev] Sharing format API proposal

Morgen Sagen morgen at osafoundation.org
Tue Sep 5 08:48:52 PDT 2006


FYI, Here are a couple questions I emailed Phillip when I first  
reviewed this proposal...


On Aug 25, 2006, at 10:44 AM, Phillip J. Eby wrote:
> At 10:33 AM 8/25/2006 -0700, Morgen Sagen wrote:
>>
>> - Under what circumstance would you pass sharing.NoChange as the UUID
>> arg into loadItemByUUID( )  ?
>
> When it's in a field in a record.  For example, if the  
> lastModifiedBy field of an itemrecord contained NoChange, the  
> example code would end up passing that through to loadItemByUUID,  
> which would then return NoChange, so the lastModifiedBy field  
> wouldn't get changed.
>
>
>> - Until we have type info encoded into the record definitions, do we
>> just assume that Cosmo has importer/exporter methods that match
>> Chandlers?
>
> I'm not entirely sure what you mean; the absence of coded type info  
> doesn't exclude other ways of documenting or transmitting type  
> information.  For example, a wire format could use something like  
> <int value="23"/> to represent a field value's type dynamically.   
> (I'm not suggesting we *do* that, of course, because it'd be  
> inefficient.)
>
>
>> - Can you step me through this situation:
>>
>> The sharing layer has just downloaded a resource from Cosmo, and this
>> resource contains a bunch of records belonging to a variety of
>> sharing.Schemas.  To process these, am I supposed to look up and
>> instantiate the appropriate sharing.Schema objects, and then call
>> startImport( ) on each of those, then call importRecord( ) for each
>> record, and finally finishImport( ) on each of the sharing.Schema
>> objects?
>
> Yes.
>
>
>> pseudo code:
>>
>> download resource
>> parse resource into records
>> scan records and build the list of sharing.Schema URLs
>> for each URL in that list:
>>     find the appropriate sharing.Schema class
>>     instantiate an object of that class
>>     call startImport( ) on that object
>> for each record:
>>     find the matching sharing.Schema object and call its  
>> importRecord (record)
>> for each instantiated sharing.Schema object:
>>     call its finishImport( )
>
> That'd be one way to do it.  You could also instantiate schema  
> objects on the fly whenever you first encounter a record of a  
> particular type, but that probably doesn't help much because you  
> need to index all the incoming records anyway to support dependency- 
> order processing.  (i.e., before calling importRecord() on a  
> record, you have to make sure you first process any records that  
> the record is dependent on.)
>



More information about the chandler-dev mailing list