On Sat, 12 Jul 2003 00:36:15 -0400, Vadim Gritsenko wrote:

> 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.

Isn't this more a problem with the batch file? Can't it define a
XINDICE_TOOL_HOME for it's bin tool resolution?

> 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.

I think the scenario you are painting is flawed though. It looks to me
that the value of PROP_XINDICE_HOME is used when the config file doesn't
specify an absolute path for the DBROOT parameter. In the case where you
want to run multiple databases then you should specify them as absolute or
know that they will be based on the value of POP_XINDICE_HOME or failing
that the current directory of the vm. I think fixing the batch files
resolution of binary components is a better way to go. 

>               if (!dbrootDir.isAbsolute()) {
> -                     dbrootDir = new 
> File(System.getProperty(PROP_XINDICE_HOME), dbroot);
> +
>               dbrootDir = new File(config.getAttribute("base"), dbroot);

What happens if base doesn't exist? It will always be in the directory the
vm was started in ... in think. I don't like this.

>  
>                       config = new 
> Configuration(DOMParser.toDocument(configXMLFile),
>                       false);
> +                     base = new 
> File(configFile).getAbsoluteFile().getParent();

What happens when base comes back null, which is possible with
getParent()? 

-k.

Reply via email to