Vadim, I haven't reviewed your patch yet, but here's why putDocument is (or was) connected to metadata creation. When a new document is inserted, or a new collection created, the MetaData object/document is created at insert time. This is required for knowing things like "Create Time". So, previously, when putDocument was invoked, a new MetaData document was dynamically constructed with the right information in it. However, since the critical lines have been removed, the document is no longer constructed. Therefore, when you request the metadata for an existing document, the code constructs a new MetaData object and stores the document. Does that make sense?
Keep in mind that using a Service, all this may be rendered moot. In fact, I believe that there are 2 distinct metadata implementations now embedded in the core code. I don't quite understand the "InlineMetaService", but it appears that that is the only fully functional metadata implementation remaining. dave -----Original Message----- From: Vadim Gritsenko [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 29, 2003 8:47 PM To: [EMAIL PROTECTED] Subject: MetaService and Metadata [Was:RE: [PATCH] XTools adds user.dir to absolute paths] Viner, David wrote: >For the API, I'm not sure what the best way to access it is. I made an >XMLRPC api for it, which is how i access it. I can send those classes if >you're interested. If you want to go for the Service approach, I'd be all >for seeing a prototype. To be honest, I'm not sure which is more "correct". > Ideally, it should be in XML:DB API. Less then ideal case is the extenstion of the API - that's service. Least ideal way is proprietary API. At least that's my opinion. WRT to prototype - attached (patch includes some other changes as well). Tested with embed driver, xmlrpc is not tested. Comments are welcome! >As for the last mod time and the code you point out, the meta object is >constructed if it needs to be, and has its values set if they are missing. >Does that make sense? In other words, if the meta object is already there >and properly initialized, the created and modified variables are unused. > Does not work for me... All the time returns "now" even when I patched MetaData to include time into serialization / deserialization. You can try it too with attached MyMain program. Output after two runs: Collection DOES NOT Exist! Resource DOES NOT Exist! ... Resource /db/test/MyTest created time: 1059535843558 (Tue Jul 29 23:30:43 EDT 2003) Resource /db/test/MyTest modified time: 1059535843558 (Tue Jul 29 23:30:43 EDT 2003) Update Resource! Resource: <?xml version="1.0"?> <root><data modified="1059535848565" /></root> Collection /db/test created time: 0 (Wed Dec 31 19:00:00 EST 1969) Collection /db/test modified time: 1059535848575 (Tue Jul 29 23:30:48 EDT 2003) Resource /db/test/MyTest created time: 1059535848605 (Tue Jul 29 23:30:48 EDT 2003) Resource /db/test/MyTest modified time: 1059535848605 (Tue Jul 29 23:30:48 EDT 2003) Collection ALREADY Exists! Resource ALREADY Exists! Resource: <?xml version="1.0"?> <root><data modified="1059535848565" /></root> Resource /db/test/MyTest created time: 1059535870787 (Tue Jul 29 23:31:10 EDT 2003) Resource /db/test/MyTest modified time: 1059535870787 (Tue Jul 29 23:31:10 EDT 2003) Update Resource! Resource: <?xml version="1.0"?> <root><data modified="1059535875795" /></root> Collection /db/test created time: 0 (Wed Dec 31 19:00:00 EST 1969) Collection /db/test modified time: 1059535875815 (Tue Jul 29 23:31:15 EDT 2003) Resource /db/test/MyTest created time: 1059535875825 (Tue Jul 29 23:31:15 EDT 2003) Resource /db/test/MyTest modified time: 1059535875825 (Tue Jul 29 23:31:15 EDT 2003) What do I miss? >However, it appears that the codebase no longer supports the metadata >implementation that I submitted. See the commit comments >http://cvs.apache.org/viewcvs.cgi/xml-xindice/java/src/org/apache/xindice/c o >re/Collection.java?rev=1.14&content-type=text/vnd.viewcvs-markup . The >comments for putDocument now read > > /** > * This is the lowest-level method for storing a record into the backing >store. > * It does not update non-inline metadata. > */ > private void putDocument > But this putDocument is not related to MetaData? MetaData is stored just like any other regular XML document - AFAIU. Vadim