Hi
a few weeks ago I played with the possibility to run Xindice embedded.
Here is my aproach, if you like:
(I learnd from org.apache.xindice.server.Xindice and
org.apache.xindice.server.Kernel)
make sure your CLASSPATH contains following jars and the dot:
openorb-1.2.0.jar:xalan-2.0.1.jar:xindice.jar:xerces.jar:.
compile it, using:
javac runXindice.java
copy the dir $XINDICE_HOME/config to your actual directory, create the
dirs 'docs' and 'logs' and set the env-variable 'xindice.home' to the
location where your Xindice home is and then start the runXindice-class:
java -Dxindice.home="/home/goetzger/work/java/runXindice" runXindice
If you want access to your previously created and filled database copy the
db directory to your actual working directory as well before starting
Xindice.
The code is ocated in the attachment. Have fun
regards
Heinrich
--
http://www.xmlBlaster.org
On Fri, 22 Feb 2002, Mark A. Richman wrote:
>I haven't quite figured out how to do this. Simply, I'd like to directly
>access a collection without having to connect to a server process. This
>way, I can "embed" Xindice into my application. I expect this behavior
>to be analogous to HypersonicSQL/HSQDB's embedded mode, where there is
>no "server", but the database can be interacted with by simply
>referencing the jar file in the classpath.
>
>Thanks,
>Mark
>
>-----Original Message-----
>From: Kimbro Staken [mailto:[EMAIL PROTECTED]
>Sent: Monday, February 18, 2002 10:37 PM
>To: [email protected]
>Subject: Re: Xindice as a servlet?
>
>
>Yes it is possible, there isn't any documentation on how to do it right
>now though. I started working on some last week but i barely got
>started.
>
>There's basically two levels that you can embed at. The entire server
>framework, which brings all the services and would allow you to continue
>
>using the command line tools. And just the database,which will prevent
>the
>command line tools from working.
>
>Take a look at org.apache.xindice.server.Xindice to see how the server
>is
>started, and org.apache.xindice.server.services.XindiceService to see
>how
>the database it self is started.
>
>On Monday, February 18, 2002, at 06:02 PM, Mark A. Richman wrote:
>
>> Is there anyway to run Xindice from within a web server, say Tomcat,
>> instead of as its own standalone server? I'd like to be able to handle
>
>> client calls via a servlet, so I can incorporate Xindice into my own
>> apps.
>>
>> Thanks,
>> Mark
>>
>>
>Kimbro Staken
>XML Database Software, Consulting and Writing
>http://www.xmldatabases.org/
>
>
import java.io.*;
import org.apache.xindice.server.Xindice;
import org.apache.xindice.server.Kernel;
public class runXindice {
private static boolean isRunning = false; // is Xindice running?
private static Xindice Xdb = null; // ebedded Xindice database
private static final String ME = "runXindice ";
private static final String XindiceSystemConfig = "config/system.xml";
public static void run() throws Exception {
System.out.println(ME + "startXindice");
System.out.println();
if (isRunning) {
System.out.println(ME + "Cannot start Xindice, it's running already!");
return;
}
Xdb = new Xindice();
new Kernel(XindiceSystemConfig);
System.out.println(ME + Xdb.Title+" "+Xdb.Version+" ("+Xdb.Codename+")
startet successfully ebedded");
isRunning = true;
} // end of run
public static void main(String[] arg) {
try {
run();
} catch (Exception e) {
System.out.println("Exception: " + e.toString() );
}
} // end of main
/*
$ java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)
java -Dxindice.home="/home/goetzger/work/java/runXindice" -classpath
openorb-1.2.0.jar:xalan-2.0.1.jar:xindice.jar:xerces.jar:. runXindice
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
important for docs/ior. !!!!!!!!
*/
} // end of runXindice