xml-xindice-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David J. Thomson" <dthom...@eecs.tufts.edu>
Subject Multiple concurrent collections with embedded
Date Wed, 07 May 2003 19:30:12 GMT

I'm a little confused about how to handle "sessions" for Xindice. I have a
class called XMLDB, which handles all methods that query the Xindice

I instantiate the class and set the path to the embedded database
dynamically for each session that comes in through the "xindice.home"
property, since each might be using a different database.

The problem is that when I try to get a new collection with
"DatabaseManager.getCollection(String name)", it returns null, but only
when the databases are different.

Will the DatabaseMananger not allow two embedded collections to be loaded
at once when they are phyically distinct? In the code below, it shows that
the xindice.home is set properly and uses a different database when I
print out the property before calling getCollection().

This all seems to work fine for multiple sessions with the same database,
but not when the database is different. Please see the comment inside
the initGlobal() method. Any ideas?



// Begin code  for XMLDB.java

Collection sc = null;  // Collection used for each XMLDB object created by
			//each thread

XPathQueryService xp_service = null; // Query service used for ""
Database maindb = null;		// Database used for each session

public XMLDB(Hashtable session) {

System.setProperty( "xindice.home",
		System.out.println("XMLDB Set as:



public void initGlobal() {

try {
         String driver =
         Class c = Class.forName(driver);

         maindb = (Database) c.newInstance();

	   sc =
	 try {
	 xp_service =(XPathQueryService)
sc.getService("XPathQueryService", "1.0");

	 } catch (NullPointerException npe) {

		 System.out.println("Why in the world is this null?");
		// This is only null when the database is different, as
		// determined by xindice.home!!!

      }catch (XMLDBException e) {
         System.err.println("XML:DB Exception occured " + e.errorCode);
      catch (InstantiationException ie) {
      catch (ClassNotFoundException cnfe) {
      catch (IllegalAccessException iae) {


View raw message