xml-xindice-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Shand <de...@intrallect.com>
Subject Re: embedded or server, a wee bit confused!
Date Fri, 23 Apr 2004 21:10:53 GMT
Fantastic Vladim,

that was exactly the info I was after.
I owe you a beer!

Steven.

On 23 Apr 2004, at 21:57, Vadim Gritsenko wrote:

> Steven Shand wrote:
>
>> 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.
>
>
> Good start.
>
>
>> 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?
>
>
> Yes.
>
>
>> 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.
>
>
> It's totally possible.
>
>
>> 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!!
>
>
> You started an Xindice servlet, which starts database and waits 
> ("listens") for external clients requests. You, actually, do not need 
> this, but you can use it in this mode also.
>
>
>> 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.  '
>
>
> It means it does not comes with own socket listener, but runs on top 
> of any other servlet engine.
>
>
>> 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?
>
>
> You have got three (ok, four) options now.
>
> 1. You already have Xindice servlet running in the same JVM as your 
> application. It means that external clients (which know the URL) as 
> well as your application can all connect to this DB instance. For your 
> app, use driver class 
> org.apache.xindice.client.xmldb.managed.DatabaseImpl and connection 
> URL xindice-managed:///db/
>
> External clients can connect using xmlrpc driver, URL 
> xindice://host:port/db/, and you need to specify correct 
> PROP_SERVICE_LOCATION on driver instance (see javadoc).
>
>
> 2. You can use driver class 
> org.apache.xindice.client.xmldb.embed.DatabaseImpl, with 
> setProperty(PROP_XINDICE_MANAGED, "true"), and URL 
> xindice-embed:///db/
> This configuraiton is identical to the first one. Check source of 
> managed.DatabaseImpl and see for yourself - it is extended from 
> embed.DatabaseImpl.
>
> 3. You can remove Xindice servlet from your web.xml and use embedded 
> driver. Driver class 
> org.apache.xindice.client.xmldb.embed.DatabaseImpl, URL 
> xindice-embed:///db/ . No properties has to be set.
> In this scenario, database will be loaded on first access. You have to 
> shutdown database on your app shutdown (shutdown() method on 
> CollectionImpl).
>
> 4. Same as 3, but you can write code which starts and stops database 
> yourself, and use managed driver. This is similar to 1, but instead of 
> Xindice servlet you have own code. Example code is in 
> org.apache.xindice.server.ManagedServer
>
>
> See documentation (javadoc) for drivers for other properties.
>
>
> Vadim
>


Mime
View raw message