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 Vadim Gritsenko <va...@verizon.net> on 2003/07/12 06:27:16 UTC
[PATCH] XTools adds user.dir to absolute paths
Hi guys,
One more issue when trying to use embedded driver from command line
tool. It always tries to prepend user.dir to the path to the config.xml
file. When path to the config.xml is absolute this is becoming ugly.
Propsed patch - check for absolute paths. Hope it gets applied.
PS I don't know why user.dir is appended in the first place; I would
remove this completely.
Vadim
Re: [PATCH] XTools adds user.dir to absolute paths
Posted by Kevin O'Neill <ke...@rocketred.com.au>.
On Sat, 12 Jul 2003 00:27:16 -0400, Vadim Gritsenko wrote:
> Hi guys,
>
> One more issue when trying to use embedded driver from command line tool.
> It always tries to prepend user.dir to the path to the config.xml file.
> When path to the config.xml is absolute this is becoming ugly.
>
> Propsed patch - check for absolute paths. Hope it gets applied.
>
> PS I don't know why user.dir is appended in the first place; I would
> remove this completely.
Becuase on my unix system I want the default directory to be /home/<user>/
rather than /. This is a good thing. Each user gets their own data store
unless they override (and the directories they talk to have the correct
permissions).
> VadimIndex: java/src/org/apache/xindice/tools/XMLTools.java
> =================================================================== RCS
> file:
> /home/cvspublic/xml-xindice/java/src/org/apache/xindice/tools/XMLTools.java,v
> retrieving revision 1.16
> diff -u -r1.16 XMLTools.java
> --- java/src/org/apache/xindice/tools/XMLTools.java 12 Dec 2002 20:51:19
> -0000 1.16 +++ java/src/org/apache/xindice/tools/XMLTools.java 12 Jul 2003
> 04:23:29 -0000 @@ -277,9 +277,12 @@
> } else if ( token.equalsIgnoreCase("-l") ||
> } token.equalsIgnoreCase("--localdb") ) {
> table.put( LOCAL, "true");
> } else if ( token.equalsIgnoreCase("-d") ||
> } token.equalsIgnoreCase("--dbconfig") ) {
> - String configFile = System.getProperty("user.dir") +
> File.separator + at.nextSwitchToken(); -
> System.setProperty(Xindice.PROP_XINDICE_CONFIGURATION, configFile); -
> table.put( DB_CONFIG, configFile); + String configFile =
> at.nextSwitchToken(); + if (!new
> File(configFile).isAbsolute()) { + configFile = new
> File(System.getProperty("user.dir"), configFile).getAbsolutePath(); +
> }
> + System.setProperty(Xindice.PROP_XINDICE_CONFIGURATION,
> configFile); + table.put(DB_CONFIG, configFile);
> } else if ( token.equalsIgnoreCase("-s") ||
> } token.equalsIgnoreCase("--namespaces") ) {
> table.put(NAMESPACES, at.nextSwitchToken());
> // Index specific options
Re: [PATCH] XTools adds user.dir to absolute paths
Posted by Vadim Gritsenko <va...@verizon.net>.
Kevin O'Neill wrote:
> On Sat, 12 Jul 2003 00:27:16 -0400, Vadim Gritsenko wrote:
>
>>PS I don't know why user.dir is appended in the first place; I would
>>remove this completely.
>
>
> Becuase on my unix system I want the default directory to be /home/<user>/
> rather than the current vm directory. This is a good thing. Each user gets
> their own data store unless they override (and the directories they talk
> to have the correct permissions).
Kevin,
I guess you understand that resolution of relative paths against
user.dir is at least surprising. In the operating system world, this is
done against current working directory (never seen other OS yet). In xml
world this is done relative to the file where path is mentioned.
In this particular scenario, when you launch a command line tool, all
the people I know (including myself) assume relative path will be
resolved against current working directory. That's why I made remark on
removing this behavior.
If you like to append user.dir, you should follow way of substitution,
i.e. by specifying in command line: $USER_HOME/relative/path. Or,
ant-like: ${user.dir}/relative/path.
Hope now you do understand what I'm talking about.
Regards,
Vadim
Re: [PATCH] XTools adds user.dir to absolute paths
Posted by Vadim Gritsenko <va...@verizon.net>.
Kevin O'Neill wrote:
> On Sat, 12 Jul 2003 00:27:16 -0400, Vadim Gritsenko wrote:
>
>>PS I don't know why user.dir is appended in the first place; I would
>>remove this completely.
>
>
> Becuase on my unix system I want the default directory to be /home/<user>/
> rather than the current vm directory. This is a good thing. Each user gets
> their own data store unless they override (and the directories they talk
> to have the correct permissions).
Kevin,
I guess you understand that resolution of relative paths against
user.dir is at least surprising. In the operating system world, this is
done against current working directory (never seen other OS yet). In xml
world this is done relative to the file where path is mentioned.
In this particular scenario, when you launch a command line tool, all
the people I know (including myself) assume relative path will be
resolved against current working directory. That's why I made remark on
removing this behavior.
If you like to append user.dir, you should follow way of substitution,
i.e. by specifying in command line: $USER_HOME/relative/path. Or,
ant-like: ${user.dir}/relative/path.
Hope now you do understand what I'm talking about.
Regards,
Vadim
Re: [PATCH] XTools adds user.dir to absolute paths
Posted by Vadim Gritsenko <va...@verizon.net>.
Kevin O'Neill wrote:
> On Sat, 12 Jul 2003 00:27:16 -0400, Vadim Gritsenko wrote:
>
>>PS I don't know why user.dir is appended in the first place; I would
>>remove this completely.
>
>
> Becuase on my unix system I want the default directory to be /home/<user>/
> rather than the current vm directory. This is a good thing. Each user gets
> their own data store unless they override (and the directories they talk
> to have the correct permissions).
Kevin,
I guess you understand that resolution of relative paths against
user.dir is at least surprising. In the operating system world, this is
done against current working directory (never seen other OS yet). In xml
world this is done relative to the file where path is mentioned.
In this particular scenario, when you launch a command line tool, all
the people I know (including myself) assume relative path will be
resolved against current working directory. That's why I made remark on
removing this behavior.
If you like to append user.dir, you should follow way of substitution,
i.e. by specifying in command line: $USER_HOME/relative/path. Or,
ant-like: ${user.dir}/relative/path.
Hope now you do understand what I'm talking about.
Regards,
Vadim
Re: [PATCH] XTools adds user.dir to absolute paths
Posted by Kevin O'Neill <ke...@rocketred.com.au>.
On Sat, 12 Jul 2003 00:27:16 -0400, Vadim Gritsenko wrote:
> Hi guys,
>
> One more issue when trying to use embedded driver from command line
> tool. It always tries to prepend user.dir to the path to the config.xml
> file. When path to the config.xml is absolute this is becoming ugly.
>
> Propsed patch - check for absolute paths. Hope it gets applied.
>
> PS I don't know why user.dir is appended in the first place; I would
> remove this completely.
Becuase on my unix system I want the default directory to be /home/<user>/
rather than the current vm directory. This is a good thing. Each user gets
their own data store unless they override (and the directories they talk
to have the correct permissions).
> VadimIndex: java/src/org/apache/xindice/tools/XMLTools.java
> =================================================================== RCS
> file:
> /home/cvspublic/xml-xindice/java/src/org/apache/xindice/tools/XMLTools.java,v
> retrieving revision 1.16
> diff -u -r1.16 XMLTools.java
> --- java/src/org/apache/xindice/tools/XMLTools.java 12 Dec 2002 20:51:19
> -0000 1.16 +++ java/src/org/apache/xindice/tools/XMLTools.java 12 Jul
> 2003 04:23:29 -0000 @@ -277,9 +277,12 @@
> } else if ( token.equalsIgnoreCase("-l") ||
> } token.equalsIgnoreCase("--localdb") ) {
> table.put( LOCAL, "true");
> } else if ( token.equalsIgnoreCase("-d") ||
> } token.equalsIgnoreCase("--dbconfig") ) {
> - String configFile = System.getProperty("user.dir") +
> File.separator + at.nextSwitchToken(); -
> System.setProperty(Xindice.PROP_XINDICE_CONFIGURATION, configFile); -
> table.put( DB_CONFIG, configFile); + String configFile
> =
> at.nextSwitchToken(); + if (!new
> File(configFile).isAbsolute()) { + configFile = new
> File(System.getProperty("user.dir"), configFile).getAbsolutePath(); +
> }
> + System.setProperty(Xindice.PROP_XINDICE_CONFIGURATION,
> configFile); + table.put(DB_CONFIG, configFile);
> } else if ( token.equalsIgnoreCase("-s") ||
> } token.equalsIgnoreCase("--namespaces") ) {
> table.put(NAMESPACES, at.nextSwitchToken());
> // Index specific options
Re: [PATCH] XTools adds user.dir to absolute paths
Posted by Murray Altheim <m....@open.ac.uk>.
Gianugo Rabellino wrote:
> Murray Altheim wrote:
>
>> My status is busy, but not too busy to do a check-in. When I first
>> joined up I had firewall problems on accessing CVS, but I don't now.
>> The only problem is that I've forgotten my password -- do you know
>> who I talk to to have it reset?
>
> I would send mail to root@apache.org asking for a pwd reset. If not,
> they can point you out to the right procedure
Okay, thanks. Will do.
>> Then I just need to know where you
>> think I should put the code. As I mentioned in one of those threads, the
>> current XNode code is at org.apache.xnode.*, not
>> org.apache.xindice.xnode.*.
>> If that's not an issue, it's an easy insert. It's not within Xindice's
>> tree because, as I said, it's not an API necessarily specific to Xindice.
>
> I'm fine with packaging, atm: we might discuss it later. I'd love to see
> it committed in our scratchpad. Are there any licensing or IP issues?
No, as I mentioned a long time ago (though I'm not expecting anyone to
remember specifically), the API was developed while I was still at Sun,
but it was done specifically to be donated to Apache (hence the apache
package name). It currently has an Apache license. There are no issues
with IP that I'm aware of.
Murray
...........................................................................
Murray Altheim http://kmi.open.ac.uk/people/murray/
Knowledge Media Institute
The Open University, Milton Keynes, Bucks, MK7 6AA, UK .
The Pentagon is planning to set up an online trading market in which
bets could be made about future terrorist attacks and other major
political developments. [...] This is under the control of retired
Admiral [and convicted felon] John Poindexter who has been involved
in another controversy recently in a plan for a sweeping electronic
intelligence operation.
-- BBC News: http://news.bbc.co.uk/1/hi/world/americas/3106559.stm
Re: [PATCH] XTools adds user.dir to absolute paths
Posted by Gianugo Rabellino <gi...@apache.org>.
Murray Altheim wrote:
> My status is busy, but not too busy to do a check-in. When I first
> joined up I had firewall problems on accessing CVS, but I don't now.
> The only problem is that I've forgotten my password -- do you know
> who I talk to to have it reset?
I would send mail to root@apache.org asking for a pwd reset. If not,
they can point you out to the right procedure
> Then I just need to know where you
> think I should put the code. As I mentioned in one of those threads, the
> current XNode code is at org.apache.xnode.*, not
> org.apache.xindice.xnode.*.
> If that's not an issue, it's an easy insert. It's not within Xindice's
> tree because, as I said, it's not an API necessarily specific to Xindice.
I'm fine with packaging, atm: we might discuss it later. I'd love to see
it committed in our scratchpad. Are there any licensing or IP issues?
Ciao,
--
Gianugo Rabellino
Pro-netics s.r.l. - http://www.pro-netics.com
Orixo, the XML business alliance - http://www.orixo.com
(Now blogging at: http://blogs.cocoondev.org/gianugo/)
Re: [PATCH] XTools adds user.dir to absolute paths
Posted by Murray Altheim <m....@open.ac.uk>.
Gianugo Rabellino wrote:
> Vadim Gritsenko wrote:
>
>> Gianugo Rabellino wrote:
>>
>>> how would you like to get involved more and help yourself? :-)
>
>> I'd like to see meta data implemented. I do see a great need of last
>> modified time for resources and ideally for query results on
>> collections too in order to provide adequate performance of xindice in
>> conjunction with cocoon.
>>
>> Is there any work going on to complete meta data support?
>
> David did a first cut at an implementation, have you seen it? However,
> metadata are my pet peeve too: the problem is that it's an issue to be
> solved in two places: here and on the XMLDB API list.
>
>> After a quick look at the API my first guess is that this can be done
>> via exposing MetadataService. Am I on the right track? I can try and
>> finish this implementation and fix here and there some other stuff as
>> well (usual disclaimer -- "if time permits" -- applies)
>
> This is a recurring issue. Please have a look at these threads:
>
> http://marc.theaimsgroup.com/?t=103839556100006&r=1&w=2
> http://marc.theaimsgroup.com/?t=104749973700007&r=1&w=2
> http://marc.theaimsgroup.com/?t=104066672500001&r=1&w=2
> http://marc.theaimsgroup.com/?t=103828933700002&r=1&w=2
> http://marc.theaimsgroup.com/?t=101402632800003&r=1&w=2
>
> And, yes, your help is *most* appreciated. :-)
Gianugo,
Current status on XNode is that I've not done anything to alter it
in almost 2 years, which is either a very good thing or maybe not.
Because it isn't built into Xindice 1.0 per se but is merely a specific
syntax and an API to access it, that simplicity means it isn't heavily
connected to Xindice, i.e., you could implement XNode in other
systems too.
My status is busy, but not too busy to do a check-in. When I first
joined up I had firewall problems on accessing CVS, but I don't now.
The only problem is that I've forgotten my password -- do you know
who I talk to to have it reset? Then I just need to know where you
think I should put the code. As I mentioned in one of those threads, the
current XNode code is at org.apache.xnode.*, not org.apache.xindice.xnode.*.
If that's not an issue, it's an easy insert. It's not within Xindice's
tree because, as I said, it's not an API necessarily specific to Xindice.
Finally, I've not modified XNode to allow inclusion of XML metadata;
everything right now is name-value pairs. But as a first crack at
things, we could call this version 1.
As I've mentioned before, I've not pushed this very hard since
I wasn't sure people want it. It works for my purposes.
But if I could get a password I would check the code in. Or I could
send it to you, if that's easier in the short term.
Murray
...........................................................................
Murray Altheim http://kmi.open.ac.uk/people/murray/
Knowledge Media Institute
The Open University, Milton Keynes, Bucks, MK7 6AA, UK .
"The current and future international political
environment severely constrains this country's
ability to conduct long-range strike missions." -- DARPA
http://news.bbc.co.uk/1/hi/world/americas/3035332.stm
Re: [PATCH] XTools adds user.dir to absolute paths
Posted by Gianugo Rabellino <gi...@apache.org>.
Vadim Gritsenko wrote:
> Gianugo Rabellino wrote:
>
>> how would you like to get involved more and help yourself? :-)
>
>
>
> I'd like to see meta data implemented. I do see a great need of last
> modified time for resources and ideally for query results on collections
> too in order to provide adequate performance of xindice in conjunction
> with cocoon.
>
> Is there any work going on to complete meta data support?
David did a first cut at an implementation, have you seen it? However,
metadata are my pet peeve too: the problem is that it's an issue to be
solved in two places: here and on the XMLDB API list.
> After a quick
> look at the API my first guess is that this can be done via exposing
> MetadataService. Am I on the right track? I can try and finish this
> implementation and fix here and there some other stuff as well (usual
> disclaimer -- "if time permits" -- applies)
This is a recurring issue. Please have a look at these threads:
http://marc.theaimsgroup.com/?t=103839556100006&r=1&w=2
http://marc.theaimsgroup.com/?t=104749973700007&r=1&w=2
http://marc.theaimsgroup.com/?t=104066672500001&r=1&w=2
http://marc.theaimsgroup.com/?t=103828933700002&r=1&w=2
http://marc.theaimsgroup.com/?t=101402632800003&r=1&w=2
And, yes, your help is *most* appreciated. :-)
Ciao,
--
Gianugo Rabellino
Pro-netics s.r.l. - http://www.pro-netics.com
Orixo, the XML business alliance - http://www.orixo.com
(Now blogging at: http://blogs.cocoondev.org/gianugo/)
Re: [PATCH] XTools adds user.dir to absolute paths
Posted by Vadim Gritsenko <va...@verizon.net>.
Gianugo Rabellino wrote:
> how would you like to get involved more and help yourself? :-)
I'd like to see meta data implemented. I do see a great need of last
modified time for resources and ideally for query results on collections
too in order to provide adequate performance of xindice in conjunction
with cocoon.
Is there any work going on to complete meta data support? After a quick
look at the API my first guess is that this can be done via exposing
MetadataService. Am I on the right track? I can try and finish this
implementation and fix here and there some other stuff as well (usual
disclaimer -- "if time permits" -- applies)
Vadim
Re: [PATCH] XTools adds user.dir to absolute paths
Posted by Gianugo Rabellino <gi...@apache.org>.
Vadim Gritsenko wrote:
> Can somebody apply the patch?
>
> Also, any comment from any committer on user.dir?
>
Vadim,
I'm sorry but I'm swamped ATM so I won't have much time to discuss your
patches (besides, this particular one applies to the embed driver which
I never used or got to know, others might be better in helping you out
here). But this said, it seems that you are giving Xindice a serious
look, and I know for certain how good you are in coding, so I would
happily apply your patches while being blindfolded: given also that
Xindice badly needs people like you, how would you like to get involved
more and help yourself? :-)
Ciao,
--
Gianugo Rabellino
Pro-netics s.r.l. - http://www.pro-netics.com
Orixo, the XML business alliance - http://www.orixo.com
(Now blogging at: http://blogs.cocoondev.org/gianugo/)
[PATCH] Fix collection initialization order, was: XTools adds user.dir
to absolute paths
Posted by Vadim Gritsenko <va...@verizon.net>.
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
Re: [PATCH][APPLIED] XTools adds user.dir to absolute paths
Posted by Vadim Gritsenko <va...@verizon.net>.
Vadim Gritsenko wrote:
> Kevin Ross wrote:
>
>> Now, how about that ' XINDICE_HOME catch 22' patch? ;)
>
Ok, here it is. In short: I found out that XINDICE_DB_HOME is already
defined in the Xindice.java and (almost) used in XindiceServlet.
Behavior is that XINDICE_DB_HOME is optional, and when present, it
overrides other preferences:
- XindiceServlet prefers /WEB-INF directory as default location.
- Embedded database impl prefers directory of the system.xml file as
default location.
All this happens only when system.xml contains relative path. Once this
patch is applied, following is possible:
set xindice_home=<xindice cvs checkout>
set xindice_db_home=<any dir>
cd %xindice_home%\bin
xindice lc -l -c /db -d ..\config\system.xml
Patch attached.
PS There is still place for improvement... Does it make sense to allow
initializing DB with arbitrary system.xml file?
PPS PROP_CMD_HOME was not used anywhere. xmlRpcDriver and
getXmlRpcDriver() too. So I took the liberty of removing them.
Vadim
Re: [PATCH][APPLIED] XTools adds user.dir to absolute paths
Posted by Vadim Gritsenko <va...@verizon.net>.
Kevin Ross wrote:
>This patch was quite simple, and should not break existing code. I saw
>no reason not to apply it.
>
Thanks, Kevin.
>Now, how about that ' XINDICE_HOME catch 22' patch? ;)
>
I'm back from vacation and (as usual, if time permits) will revisit this
thread and come up with a patch.
Vadim
RE: [PATCH][APPLIED] XTools adds user.dir to absolute paths
Posted by Kevin Ross <Ke...@iVerticalLeap.com>.
This patch was quite simple, and should not break existing code. I saw
no reason not to apply it.
Thanks Vadim.
Now, how about that ' XINDICE_HOME catch 22' patch? ;)
-Kevin Ross
-----Original Message-----
From: news [mailto:news@main.gmane.org] On Behalf Of Vadim Gritsenko
Sent: Wednesday, July 16, 2003 10:41 PM
To: xindice-dev@xml.apache.org
Subject: Re: [PATCH] XTools adds user.dir to absolute paths
Can somebody apply the patch?
Also, any comment from any committer on user.dir?
Thanks,
Vadim
Vadim Gritsenko wrote:
> Hi guys,
>
> One more issue when trying to use embedded driver from command line
> tool. It always tries to prepend user.dir to the path to the
config.xml
> file. When path to the config.xml is absolute this is becoming ugly.
>
> Propsed patch - check for absolute paths. Hope it gets applied.
>
> PS I don't know why user.dir is appended in the first place; I would
> remove this completely.
>
> Vadim
Re: [PATCH] XTools adds user.dir to absolute paths
Posted by Vadim Gritsenko <va...@verizon.net>.
Can somebody apply the patch?
Also, any comment from any committer on user.dir?
Thanks,
Vadim
Vadim Gritsenko wrote:
> Hi guys,
>
> One more issue when trying to use embedded driver from command line
> tool. It always tries to prepend user.dir to the path to the config.xml
> file. When path to the config.xml is absolute this is becoming ugly.
>
> Propsed patch - check for absolute paths. Hope it gets applied.
>
> PS I don't know why user.dir is appended in the first place; I would
> remove this completely.
>
> Vadim