You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Steven Shand <de...@intrallect.com> on 2004/04/23 21:05:48 UTC
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.
Re: embedded or server, a wee bit confused!
Posted by Steven Shand <de...@intrallect.com>.
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
>
Re: embedded or server, a wee bit confused!
Posted by Vadim Gritsenko <va...@reverycodes.com>.
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