Notes on Xindice 1.0 to 1.1 Upgrade for Embedded Use
----------------------------------------------------
These are my notes. This afternoon I downloaded the latest CVS of
Xindice 1.1 and upgraded from 1.0 in client-server to 1.1 embedded.
The entire process (not including download time) was about an hour
(with help from Vadim to uncover elements of my boneheadedness).
Note that my particular use of Xindice 1.0 is fairly minimal, i.e.,
I basically open the database, store and retrieve XML documents, with
most of the database functionality developed in working with my own
API (called XNode). I don't currently use querying or indexing. Yet.
The recent messages on xindice-dev about Lucene are quite interesting,
and I'm looking forward to seeing what develops in this area.
Okay, here's what I've done:
1. downloaded the latest CVS. Instructions are available from:
http://xml.apache.org/cvs.html#Access+the+Source+Tree
Anonymous:
% cvs -d :pserver:[EMAIL PROTECTED]:/home/cvspublic
login
password: anoncvs
% cvs -d :pserver:[EMAIL PROTECTED]:/home/cvspublic co xml-xindice
Non-anonymous:
% cvs -d [EMAIL PROTECTED]:/home/cvs co xml-xindice
login
password: [password]
2. I built the source:
% ant build
% ant jar-release
3. Since that worked, I substituted the new xindice 1.1 directory
for the existing xindice 1.0 directory within my project project
directory (i.e., xindice is a subdirectory of my project directory).
The ant build.xml file for my project reads the jar files found in
the $XINDICE_HOME/java/lib directory already, so no changes were
necessary here. (I've also got an eXist implementation within, so
I manage both via properties)
I moved the xindice-1.1b4-dev.jar file from the dist directory to
the $XINDICE_HOME/java/lib directory, and renamed it xindice.jar.
4. In my own application code I replaced the references as below:
// m_driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
m_driver = "org.apache.xindice.client.xmldb.embed.DatabaseImpl";
// m_root = "xmldb:xindice://localhost:4080/db/";
m_root = "xmldb:xindice-embed:///db/";
5. Given the definitions in #4 above, the guts of the code to open an
embedded database, set up a CollectionManagementService and
DatabaseInstanceManager (whose only purpose is to shut down the
database, something I probably won't do anymore now that I'm using
embedded) is as follows:
database = (Database)Class.forName(m_driver).newInstance();
database.setProperty("db-home","./xindice");
database.setProperty("db-home","./db");
database.setProperty("managed","true");
org.xmldb.api.DatabaseManager.registerDatabase(database);
rootCollection = org.xmldb.api.DatabaseManager.getCollection(m_root);
org.xmldb.api.modules.CollectionManagementService colMgmtService
= (CollectionManagementService)rootCollection.getService(
"CollectionManagementService","1.0");
org.apache.xindice.client.xmldb.services.DatabaseInstanceManager
xdbInstMgrService
=
(org.apache.xindice.client.xmldb.services.DatabaseInstanceManager)
rootCollection.getService("DatabaseInstanceManager",
Command.XMLDBAPIVERSION);
6. As a side note, I had developed a rather complex listener negotiation
scheme to handle situations where the application was opened without
the database being active, the database server being opened via a
different VM session than the client, etc. All of this code can now
be dumped due to the simplicity of using the embedded drivers, though
I might keep it around in case I decide to go back to the more complex
world of client-server (for times when I do want to make available a
remote database to a set of external clients).
After I'd debugged the small changes to my code, my application came up
and the database opened up without any difficulty. I tried creating and
deleting collections and nodes. When this worked, I quit, then subsituted
my existing, populated 1.0 'db' directory for the new directory, then
reopened my application. To my surprise, my old collections and nodes
still worked. (I do all my access to Xindice via the XNode API, so I
can't really comment on any other features such as query, indexing, etc.)
I'd like to thank once again Vadim Gritsenko for his help in getting me
up and running with 1.1. It was much less painful than I'd envisioned,
in fact, it wasn't painful at all. His hard work has been invaluable in
keeping this project alive, and if there were some kind of online applause
button, I'd be pushing it right now.
[If anyone notes any errors in the above description, please post to
the list, not to me.]
Murray
......................................................................
Murray Altheim http://kmi.open.ac.uk/people/murray/
Knowledge Media Institute
The Open University, Milton Keynes, Bucks, MK7 6AA, UK .
More than 60 influential scientists, including 20 Nobel laureates,
issued a statement yesterday asserting that the Bush administration
had systematically distorted scientific fact in the service of
policy goals on the environment, health, biomedical research and
nuclear weaponry at home and abroad. -- James Glanz, New York Times
http://www.nytimes.com/2004/02/19/politics/19RESE.html