Hi! I would like to contribute to Xindice and especially I would like to contribute a two resolvers that implement versioning, like CVS, but for XML/XIndice.
I am pretty new to Java and I wonder if I can get some pointers on how to implement this and where to start. Here is my first thoughts on how I want to implement things. I would find it great if I can get pointers by some of you guys what you think about it. To enable versioning on a database the following configuration will be used: <xindice> <root-collection dbroot="./db/" name="db"> <queryengine> <resolver autoindex="false" versioning-collection="version" class="org.apache.xindice.core.query.XPathVersionedQueryResolver" /> <resolver versioning-collection="version" class="org.apache.xindice.core.xupdate.XUpdateVersionedQueryResolver" /> </queryengine> </root-collection> </xindice> Upon initialization the system will create the versioning collection specified by the "versioning-collection" attribute, this collection then only stores versioning information. The _version_-collection then holds all information needed to extract different revisions and versions from the database, while the db (root-collection) actually just is unchanged, it's a view of HEAD/TRUNK. When a client queries something from the versioned collection XPathVersionedQueryResolver add attributes to the result including revision and branch information (something like version:info="HEAD:1.43"). When a client updates the a versioned collection the XUpdateVersionedQueryResolver saves the XUpdate snippet in the versioning-collection. When a client wants to get an old revision the XPathVersionedQueryResolver just "combines" all xupdate-snippets from the versioning-collection and returns a document, I would want to use a special hierarchy in the versioning collection to enable to just use XPath to get different versions: (Of course this is not the final design, I have not even started coding, but I would like to start a discussion about this) Consider a collection "db" with an attached versioning collection called "version", the db-collection initially contains: <product> <name>My Product</name> <price currency="USD">32.00</price> </product> while the version collection contains (abbreviated for readability): <branch name="HEAD"> <revision rev="1.1"> <info> <comment>Initial version</comment> </info> <data> <product> <name>My Product</name> <price currency="USD">32.00</price> </product> </data> </revision> </branch> When the client changes the price from 32.00 to let's say 30.00, the version collection contains (abbreviated for readability): <branch name="HEAD"> <revision rev="1.1"> <info> <comment>Initial version</comment> </info> <data> <product> <name>My Product</name> <price currency="USD">32.00</price> </product> </data> </revision> <revision rev="1.2"> <info> <comment>Change price</comment> </info> <data> <xupdate:update select="/product[1]/price"> 30.00 </xupdate:update> </data> </revision> </branch> To get a get a special version of a document, one would use the following XPath expression: /product[1]/[EMAIL PROTECTED]'HEAD']/[EMAIL PROTECTED]'1.2']/complete (I have not yet really figured out a XPath format) As you can see the complete tag does not really exist in the database, but it should be generated on-the-fly by combining all preceding revisions. Likewise the XPath expression: /product[1]/[EMAIL PROTECTED]'HEAD']/[EMAIL PROTECTED]'1.2']/diff/[EMAIL PROTECTED]"HEAD"]/[EMAIL PROTECTED]'1.1'] Would generate a xml with the differences between HEAD 1.1 and HEAD 1.2 of /product[1]. I wouldn't want this email to become very long, so I will just stop here, I do really look forward to your opinions though. Regards, Mikael Olenfalk