Importing items
April 15th, 2005 at 4:04 pm (3 years, 3 months ago) by Andi Vajda under chandlerdbNow that items can be created in a null repository view, how about persisting them ? By definition, a null repository view, is not capable of persisting items. In the context of Phillip Eby’s Schema API proposal, items are persisted in python code and instantiated into the null repository view upon python’s loading of the module.
Items can now be imported from one view into another, within the same repository or not. This is a rather tricky operation as a given item can only exist once in a given repository and some items, such as schema, should be copied upon export while others should be moved. Items are very interconnected, it makes little sense to import them in isolation. It is essential that bi-directional references be maintained when an item is imported. Currently, item import works as follows:- a transitive closure of all items connected to the item being imported is computed, excluding items for which there is a match in the importing view. Items are matched in the importing view first by UUID, then by path, if not anonymous. While this is correct for schema items, this is very preliminary and not good enough for regular, anonymous items. For that, it is maybe time to revive the notion of exportable addresses first introduced by Lisa Dusseault a year ago and for which an implementation using ref collection-based paths was subsequently proposed and completed.
- items marked as COPYEXPORT are copied instead of being moved. The copies are instantiated in the importing view using their ‘export’ cloud.
- items instances being moved to the new view are fixed up for differences in repository persistence implementations, as is the case with ref collections, children collections or lobs.
- items instances being moved are reconnected to the items matching in the importing view.
- items instances being moved are reconnected to the items that were copied upon import.
- items instances being moved are re-parented in the importing view matching the original view’s structure.
Importing an item is done by invoking the new importItem() API defined on the RepositoryView class, or also, when the item is in a null repository view, by connecting it via a bi-directional ref to an item in another view.








