Hi guys,
When xindice.bat command line tool finally able to find and parse supplied config.xml file (see previous email with patch), it starts working. With one catch. It works with DB specified in XINDICE_HOME directory, which is where bin/xindice.bat lives, but not with ITS OWN database.
Changing XINDICE_HOME breaks bin/xindice.bat completely as it cannot find its stuff. Thus, catch22 situation.
Proposed patch to fix this issue is to use base directory of the config.xml file instead of looking for some environment variables.
Also, I've got the question. Is it a good idea to use environment variables for passing paths and such? My opinion is that it is not. For example, try running two xindice instances in one java VM and you are up to lots of troubles.
PS I'd not put [PATCH] in the subject as people might have other ideas on how to fix this in different / better way.
Vadim
Index: java/src/org/apache/xindice/core/Database.java =================================================================== RCS file: /home/cvspublic/xml-xindice/java/src/org/apache/xindice/core/Database.java,v retrieving revision 1.19 diff -u -r1.19 Database.java --- java/src/org/apache/xindice/core/Database.java 10 Jul 2003 21:41:05 -0000 1.19 +++ java/src/org/apache/xindice/core/Database.java 12 Jul 2003 04:32:43 -0000 @@ -162,7 +162,7 @@ String dbroot = config.getAttribute(DBROOT); File dbrootDir = new File(dbroot); if (!dbrootDir.isAbsolute()) { - dbrootDir = new File(System.getProperty(PROP_XINDICE_HOME), dbroot); + dbrootDir = new File(config.getAttribute("base"), dbroot); } setCollectionRoot(dbrootDir); log.info("Database points to " + dbrootDir.getAbsolutePath()); Index: java/src/org/apache/xindice/client/xmldb/embed/DatabaseImpl.java =================================================================== RCS file: /home/cvspublic/xml-xindice/java/src/org/apache/xindice/client/xmldb/embed/DatabaseImpl.java,v retrieving revision 1.10 diff -u -r1.10 DatabaseImpl.java --- java/src/org/apache/xindice/client/xmldb/embed/DatabaseImpl.java 10 Jul 2003 21:42:48 -0000 1.10 +++ java/src/org/apache/xindice/client/xmldb/embed/DatabaseImpl.java 12 Jul 2003 04:32:43 -0000 @@ -125,6 +125,7 @@ protected Configuration loadConfiguration() throws FileNotFoundException, XindiceException, ReadOnlyException { Configuration config; + String base = System.getProperty(Xindice.PROP_XINDICE_HOME); String configFile = System.getProperty(Xindice.PROP_XINDICE_CONFIGURATION); if (configFile != null && !configFile.equals("")) { if (log.isInfoEnabled()) { @@ -133,6 +134,7 @@ FileInputStream configXMLFile = new FileInputStream(new File(configFile)); config = new Configuration(DOMParser.toDocument(configXMLFile), false); + base = new File(configFile).getAbsoluteFile().getParent(); } else { if (log.isInfoEnabled()) { @@ -142,6 +144,7 @@ } config = config.getChild("root-collection", false); + config.setAttribute("base", base); return config; }