You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by Gianugo Rabellino <gi...@apache.org> on 2002/11/29 17:00:53 UTC

Database root directory fix

I have a fix ready to commit about the database root directory issue. I 
would go ahead but, since it's touching a core aspect of the upcoming 
release I'd like some feedback about it before changing the code.

THE PROBLEM: as of now Xindice, when started with the default 
configurations, created a ./db/ directory in the cwd. This is IMHO a bad 
solution, since if the engine is started up from different directories 
you have a new database created every time. This needs to change.

MY FIX: it follows a simple strategy:

1. if system.xml contains an absolute path, it uses it;

2. if the path is relative it checks for the existance of an 
xindice.db.home System property. On success the value of the property is 
prepended to the configuration value;

3. if there is no property, it checks to see if the war was unpacked. If 
so, it prepends the RealPath of /WEB-INF to the configured value. A 
warning is issued in the logs, notifying the user about the possible 
data loss in case of a war upgrade;

4. if all those checks fail (no absolute path, no system property, 
packed war), a ServletException is thrown and a long error message is 
logged.

If this strategy sounds good to you, the patches are ready to be 
committed: just LMK.

Ciao,

-- 
Gianugo Rabellino


Re: Database root directory fix

Posted by "Vladimir R. Bossicard" <vb...@yahoo.com>.
> You're right, I haven't considered the embedded case. In that case
> the database will go $XINDICE_HOME/db, or to ./db (whatever it is) 
> related to your pwd when launching Xindice.

if you use the XMLTools to access the db, the file passed via -u will be read
to configure the database.  Currently it's done with env. variable (ugly, I
know) but there's a discussion on the xmldb:api ml to add some configuration
to the api (like an init(config) method)

-Vladimir

=====
Vladimir R. Bossicard
Apache Xindice - http://xml.apache.org/xindice

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Re: Database root directory fix

Posted by Gianugo Rabellino <gi...@apache.org>.
James Bates wrote:
> OK. The English looks fine.
> 
> A Question though: your description works when running Xindice as a webapp, 
> but what is the behaviour in the embedded case? Surely there is no WEB-INF
> directory in such a case?

You're right, I haven't considered the embedded case. In that case
the database will go $XINDICE_HOME/db, or to ./db (whatever it is) 
related to your pwd when launching Xindice.

I'll fix the docs asap, thanks for pointing it out.

Ciao,

-- 
Gianugo Rabellino


Re: Database root directory fix

Posted by James Bates <ja...@amplexor.com>.
OK. The English looks fine.

A Question though: your description works when running Xindice as a webapp, 
but what is the behaviour in the embedded case? Surely there is no WEB-INF
directory in such a case?

James

On Thursday 05 December 2002 00:34, Gianugo Rabellino wrote:
> Gianugo Rabellino wrote:
> > James Bates wrote:
> >> Gianungo, can you update the relevant sections (chapter 2) in the
> >> Xindice internals guide (src/documentation/content/xdocs/dev) to
> >> reflect the changes you introduced?
> >
> > Definitely I will (hope to make it by tomorrow). Thanks for pointing me
> > out to the right section!
>
> OK, I just checked in the doc reflecting the changes, James please cross
> check and feel free to correct my English. :-)
>
> On a side note: I might be quite away from the list in the next few
> days. I'll be traveling quite a bit with random access to the Internet.
> I'll be back for some time over the weekend and in a more stable way on
> next Wednesday. C'ya later!
>
> Ciao,


Re: Database root directory fix

Posted by Gianugo Rabellino <gi...@apache.org>.
Gianugo Rabellino wrote:
> James Bates wrote:
> 
>> Gianungo, can you update the relevant sections (chapter 2) in the 
>> Xindice internals guide (src/documentation/content/xdocs/dev) to 
>> reflect the changes you introduced?
> 
> 
> Definitely I will (hope to make it by tomorrow). Thanks for pointing me 
> out to the right section!

OK, I just checked in the doc reflecting the changes, James please cross 
check and feel free to correct my English. :-)

On a side note: I might be quite away from the list in the next few 
days. I'll be traveling quite a bit with random access to the Internet. 
I'll be back for some time over the weekend and in a more stable way on 
next Wednesday. C'ya later!

Ciao,

-- 
Gianugo Rabellino



Re: Database root directory fix

Posted by Gianugo Rabellino <gi...@apache.org>.
James Bates wrote:

> Gianungo, can you update the relevant sections (chapter 2) in the Xindice 
> internals guide (src/documentation/content/xdocs/dev) to reflect the changes 
> you introduced?

Definitely I will (hope to make it by tomorrow). Thanks for pointing me 
out to the right section!

Ciao,

-- 
Gianugo Rabellino


Re: Database root directory fix

Posted by James Bates <ja...@amplexor.com>.
Gianungo, can you update the relevant sections (chapter 2) in the Xindice 
internals guide (src/documentation/content/xdocs/dev) to reflect the changes 
you introduced?

Otherwise, I'll do it at some later time...

James

On Saturday 30 November 2002 20:21, Gianugo Rabellino wrote:
> Gianugo Rabellino wrote:
> > I have a fix ready to commit about the database root directory issue. I
> > would go ahead but, since it's touching a core aspect of the upcoming
> > release I'd like some feedback about it before changing the code.
>
> [...]
>
> > If this strategy sounds good to you, the patches are ready to be
> > committed: just LMK.
>
> OK, I had no negative feedback so the patch has been committed. There is
> also a new FAQ entry that explains the new Xindice behaviour. LMK if you
> encounter any problem.
>
> Ciao,

Re: Database root directory fix

Posted by Gianugo Rabellino <gi...@apache.org>.
Gianugo Rabellino wrote:
> 
> I have a fix ready to commit about the database root directory issue. I 
> would go ahead but, since it's touching a core aspect of the upcoming 
> release I'd like some feedback about it before changing the code.

[...]


> If this strategy sounds good to you, the patches are ready to be 
> committed: just LMK.

OK, I had no negative feedback so the patch has been committed. There is 
also a new FAQ entry that explains the new Xindice behaviour. LMK if you 
encounter any problem.

Ciao,

-- 
Gianugo Rabellino



Re: Database root directory fix

Posted by Gianugo Rabellino <gi...@apache.org>.
Gianugo Rabellino wrote:

>>
>> P.S.  I think my patch for the fixed context name problem got lost in
>>       the discussion about the root directory.  Will you be merging with
>>       it?  Or was the patch rejected?
>>
> 
> Actually I can't even find it in my mail archive. Could you forward to 
> me the original post? I have to admit that I don't know what is that 
> patch about. :-)
> 

Whoops, it was easy to understand actually. :-) I gave it a read and 
yes, I think it's most right to apply it. Will do in the next few days: 
bug me if I forget, and thanks a lot!

Ciao,

-- 
Gianugo Rabellino



Context Name Fix (was: Re: Database root directory fix)

Posted by Michael Westbay <we...@users.sourceforge.net>.
Gianugo Rabellino-san wrote:

> Actually I can't even find it in my mail archive. Could you forward to
> me the original post? I have to admit that I don't know what is that
> patch about. :-)

It was under the unrelated subject of "Re: about writing howtos."  A short 
explanation of how I tested it was:

======
I tested it by copying dist/xindice-1.1b.war to ${TOMCAT_HOME}/webapps and 
restarting Tomcat.  Accessing http://localhost:8180/xindice-1.1b brought up 
the "THIS IS AN UGLY DEBUG TOOL!" page, and the "db" link now corretly goes 
to http://localhost:8180/xindice-1.1b?/db.

Shutdown Tomcat, rename ${TOMCAT_HOME}/webapps/xindice-1.1b to anything you 
like, and the UGLY DEBUG TOOL just works now.  (You don't have a copyright on 
that name, do you?  I kind of like it.)
======

-- 
Michael Westbay
Work: Beacon-IT http://www.beacon-it.co.jp/
Home:           http://www.seaple.icc.ne.jp/~westbay
Commentary:     http://www.japanesebaseball.com/forum/


Re: Database root directory fix

Posted by Gianugo Rabellino <gi...@apache.org>.
Michael Westbay wrote:
> Gianugo Rabellino-san wrote:
> 
> 
>>I have a fix ready to commit about the database root directory issue. I
>>would go ahead but, since it's touching a core aspect of the upcoming
>>release I'd like some feedback about it before changing the code.
>>
>>[snip]
> 
> 
> +1.  Works for me.  I think you took care of all of the issues.
> 
> P.S.  I think my patch for the fixed context name problem got lost in
>       the discussion about the root directory.  Will you be merging with
>       it?  Or was the patch rejected?
> 

Actually I can't even find it in my mail archive. Could you forward to 
me the original post? I have to admit that I don't know what is that 
patch about. :-)

TIA,

-- 
Gianugo Rabellino



Re: Database root directory fix

Posted by Michael Westbay <we...@users.sourceforge.net>.
Gianugo Rabellino-san wrote:

> I have a fix ready to commit about the database root directory issue. I
> would go ahead but, since it's touching a core aspect of the upcoming
> release I'd like some feedback about it before changing the code.
>
> [snip]

+1.  Works for me.  I think you took care of all of the issues.

P.S.  I think my patch for the fixed context name problem got lost in
      the discussion about the root directory.  Will you be merging with
      it?  Or was the patch rejected?

-- 
Michael Westbay
Work: Beacon-IT http://www.beacon-it.co.jp/
Home:           http://www.seaple.icc.ne.jp/~westbay
Commentary:     http://www.japanesebaseball.com/forum/