Dear Godmar,
as you mentioned already, the "user.home"-Property is mainly used to locate the BaseX default database settings (see .basex, .basexwin and .basexperm in your home directory). We have discussed some ideas how to make this location dynamic, e..g, move them to the directory in which a potential BaseX installation resides. For now, you could manually set the required settings (presumably the database path, DBPATH?) after initializing BaseX. This can be done e.g. via…
The BaseX API:
Context ctx = new Context(); new Set("dbpath", "/the/path/you/like").execute(ctx);
..using the c/s architecture (in which the specified database path is actually irrelevant)...
ClientSession cs = new ClientSession(...); cs.execute("set dbpath /the/path/you/like");
…or, using XQJ…
XQConnection conn = connect... conn.createExpression().executeCommand("set dbpath /...");
For any unknown, the database commands in XQJ were bound expressions and not the static context/the connection; a single call will be valid for all subsequent database calls, however.
Hope this helps, Christian
PS: reg. the location of the BaseX settings: what would be your most favorite approach?
On Sun, Jul 11, 2010 at 4:51 PM, Godmar Back godmar@gmail.com wrote:
Hi, we use BaseX in a Tomcat server on Linux. We run multiple instances of our application as different web applications in that server. A problem we encountered is that BaseX refers to the 'user.home' property when identifying the location of its .basex configuration file. This property is related to which (Linux) user started the Tomcat server, which is unrelated to the web application that needs to start a BaseX instance. We are now using a very awkward work-around: temporarily setting 'user.home' to the desired value, then touching a class in org.basex.core to force its initialization: oldUserHome = System.getProperty("user.home"); System.setProperty("user.home", basexdir); if (!org.basex.core.Prop.HOME.startsWith(basexdir)) throw new java.lang.Error("BaseX property initialization failed"); System.setProperty("user.home", oldUserHome); Could a programmatic way to initialize BaseX be provided that does depend on system properties? I understand that it will require a small amount of refactoring (given how deep this assumption is wired into the code), but it is absolutely necessary to facilitate the use of BaseX in shared environments such as Tomcat. Thanks. - Godmar
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk