something like....
public synchronized boolean init()
{
String driver = null;
String rootDatabase = null;
m_error = null;
boolean success = false;
try
{
rootDatabase = "xmldb:xindice-embed:///db/"
driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
Class c = Class.forName(driver);
m_dataBase = (Database) c.newInstance();
DatabaseManager.registerDatabase(m_dataBase);
Collection root = DatabaseManager.getCollection( rootDatabase );
if ( root != null )
{
success = true;
}
}
catch (XMLDBException e)
{
}
catch (Exception e)
{
}
return success;
}
-----Original Message-----
From: Steven Shand [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 3:06 PM
To: [email protected]
Subject: embedded or server, a wee bit confused!
I'm having a look at Xindice and like what I see so far. However I'm
pretty confused with the different modes of operation.
I skipped the version 1.0 downloads and went straight to 1.1b4. I did
this primarily because I was led to believe that the architecture was
different with versions 1.1 onwards. I didn't really want to look at
version 1.0 if things were changing. Am I right?
My use case is this. My application is a web application running
successfully under 2.2 and 2.3 spec servlet containers(tomcat in this
example). Ideally, I would like to avoid running Xindice as an
additional webapp. I hoped I would be able to run Xindice inside my
webapp.
I copied classes and dependant jar files into my webapp, copied
relevant sections of web.xml into my web.xml and when starting tomcat,
I get messages telling me the server has successfully started and my db
directory gets created. All seems fine but this is where the confusion
starts!! I'm not sure how to connect. Most of the problems seem to
arise from somewhere in code that is hard-coded to expect the server to
be running with the url mapping of /xindice.....
As I've read more of the docs and mail archives, it appears that I
probably shouldn't be running the db from the servlet but running in
standalone mode! But the docs also state:
' Starting from 1.1, Xindice is not a standalone server anymore. '
So, to cut a long story short, is it possible to embed Xindice into my
existing webapp. If so, should I be using the
'org.apache.xindice.client.xmldb.DatabaseImpl' driver or the
'org.apache.xindice.client.xmldb.embed.DatabaseImpl'? And what would
the connection url look like?
I hope this makes some sense and someone can help me out or point me in
the right direction!!!
Steven Shand.