Vadim Gritsenko wrote:
Kevin Ross wrote:
Now, how about that ' XINDICE_HOME catch 22' patch? ;)
Almost ready! There is one issue though. There were some recent changes in the CollectionManager and I feel that those broke something. Change I'm talking about is here, on the last page:
http://cvs.apache.org/viewcvs.cgi/xml-xindice/java/src/org/apache/xindice/core/CollectionManager.java.diff?r1=1.10&r2=1.11&diff_format=h
With this change, during initialization of the 'system' (and 'meta') collection, col.setConfig(cfg) for nested collections (like SysConfig, SysSymbols) is being called way before collection sets its own root via setCollectionRoot() in Collection.setConfig() method, around line 1358.
The result of such behavior is not pretty. Here is resulting directory structure:
$HOME $HOME/bin $HOME/bin/Metas $HOME/bin/Metas/Metas.tbl $HOME/bin/SysConfig/SysConfig.tbl $HOME/bin/SysSymbols/SysSymbols.tbl $HOME/db $HOME/db/meta $HOME/db/system ...
Result was achived by doing: "xindice lc -l -c /db -d ..\config\system.xml" in the $HOME/bin directory.
Patch is quite simple and attached. Once applied, I'll send next patch - for catch 22 problem :)
Vadim
Index: java/src/org/apache/xindice/core/Collection.java =================================================================== RCS file: /home/cvspublic/xml-xindice/java/src/org/apache/xindice/core/Collection.java,v retrieving revision 1.22 diff -u -r1.22 Collection.java --- java/src/org/apache/xindice/core/Collection.java 15 Jul 2003 15:44:35 -0000 1.22 +++ java/src/org/apache/xindice/core/Collection.java 30 Jul 2003 00:37:56 -0000 @@ -920,7 +914,7 @@ * insertBinary inserts a new binary object into a Xindice Collection. * * @param docKey The document Key - * @param document The document to insert + * @param bytes The document to insert * @throws DBException if inline-metadata is not enabled, the key is * already in the database, or an error occurs while saving. */ @@ -1334,8 +1328,6 @@ } public void setConfig(Configuration config) throws XindiceException { - super.setConfig(config); - name = config.getAttribute(NAME); compressed = config.getBooleanAttribute(COMPRESSED, true); @@ -1366,8 +1358,13 @@ log.debug(localDebugHeader + "collection root=<" + getCollectionRoot().toString() + ">"); } - if (config.getBooleanAttribute(CACHE, true)) + // Init super now, when collectionRoot is known. Otherwise child collections + // created in unexpected places + super.setConfig(config); + + if (config.getBooleanAttribute(CACHE, true)) { documentCache = getDatabase().getDocumentCache(); + } // If no Filer is defined, skip Symbols and Indexes Configuration filerConfig = config.getChild(FILER); @@ -1514,8 +1511,7 @@ return; } - if (log.isInfoEnabled()) - log.info("Updating modified time for this collection's meta"); + log.info("Updating modified time for this collection's meta"); long now = System.currentTimeMillis(); if (null == meta) { meta = new MetaData(MetaData.COLLECTION, getCanonicalName(), now, now); @@ -1524,12 +1520,14 @@ // this collection already has a meta. so update its modified time. meta.setContext(0, now); } + try { metacol.setCollectionMeta(this, meta); } catch (DBException e) { - if (log.isWarnEnabled()) + if (log.isWarnEnabled()) { log.warn("Error setting the collection meta. " + e); + } return; } }