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 Tankut Koray <tk...@aselsan.com.tr> on 2002/10/06 16:21:03 UTC

Embedded Server

Hi,

I wan to run Xindice server from my app. How to do this?

Tankut Koray

Re: Embedded Server

Posted by Tankut Koray <tk...@aselsan.com.tr>.
It is two line of code:

System.setProperty( "xindice.home", "path/to/xindice");
new Kernel("path/to/config/system.xml");

thats all,

Tankut Koray
----- Original Message -----
From: <G....@Bradford.ac.uk>
To: <xi...@xml.apache.org>
Sent: Tuesday, October 08, 2002 11:03 AM
Subject: Re: Embedded Server


> Tankut,
>
> Is it possible to get a copy of the main Java application? I just want to
see
> how this has worked.
>
> Thanks
> Gul
>
>
>
>
> Quoting Tankut Koray <tk...@aselsan.com.tr>:
>
> > Thanks,
> >
> > It worked when I set the "xindice.home" system property.
> >
> > Now, I have another question,
> >
> > When I close my app using ctrl+c, it will close without calling
> > kernel.shutdown. So is this cause any problems in xindice like
> > unclosed
> > files? I mean when I restart my app after doing ctrl+c, am I going to
> > find
> > the server as it was before? ( maybe this looks silly but let me ask:)
> >
> > Tankut
> >
> >
> > ----- Original Message -----
> > From: "Øyvind Vestavik" <Oy...@idi.ntnu.no>
> > To: <xi...@xml.apache.org>
> > Sent: Tuesday, October 08, 2002 9:51 AM
> > Subject: Re: Embedded Server
> >
> >
> > >
> > > The server depends on the environment variables JAVA_HOME and
> > > XINDICE_HOME which you set when you first set up xindice.
> > >
> > > Basicly what the startup.bat and start.sh scripts does is to build
> > > variables for XINDICE_HOME, classpath and so on, and passing them on
> > to
> > > the org.apache.xindice.server.Xindice class with the call below
> > (from
> > > startup.sh) which starts the server.
> > >
> > > java -Xms16m -Xmx168m -Dxindice.home="$XINDICE_HOME" $VMPROPS
> > -classpath
> > > "$CLASSPATH" org.apache.xindice.server.Xindice
> > >
> > > What you have to do to start the server from javacode is basicly to
> > > rebuild the variables from the script and passing them on in the call
> > like
> > > before.
> > >
> > > I'm not sure if the server is going to run in a process other that
> > our
> > > java-app, but I think it will be just one process. Your database can
> > still
> > > be accessed from outside. To make the database exclusive to your
> > > application is a much bigger task.
> > >
> > > vennlig hilsen
> > > Øyvind
> > >
> > > "The truth shall set you free, but first it will piss you off"
> > >
> > > Øyvind Vestavik
> > > Øvre Møllenberggt 44b
> > > 7014 Trondheim
> > > oyvindve@idi.ntnu.no
> > > 41422911
> > >
> > > On Mon, 7 Oct 2002, Tankut Koray wrote:
> > >
> > > > Hi,
> > > > I am trying to write a Java application that uses Xindice. So
> > instead of
> > > > starting the server by hand I am trying to run Xindice through my
> > class.
> > I
> > > > tried creating a new Kernel object with a absolute path to
> > system.xml
> > but
> > > > there is something wrong with directories(I think)
> > > >
> > > > Tankut Koray
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: "Øyvind Vestavik" <Oy...@idi.ntnu.no>
> > > > To: <xi...@xml.apache.org>
> > > > Sent: Monday, October 07, 2002 5:29 PM
> > > > Subject: Re: Embedded Server
> > > >
> > > >
> > > > >
> > > > > Depends on what you mean by "app".
> > > > > Please tell us what exactly you want to do..
> > > > >
> > > > > vennlig hilsen
> > > > > Øyvind
> > > > >
> > > > > "The truth shall set you free, but first it will piss you off"
> > > > >
> > > > > Øyvind Vestavik
> > > > > Øvre Møllenberggt 44b
> > > > > 7014 Trondheim
> > > > > oyvindve@idi.ntnu.no
> > > > > 41422911
> > > > >
> > > > > On Sun, 6 Oct 2002, Tankut Koray wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I wan to run Xindice server from my app. How to do this?
> > > > > >
> > > > > > Tankut Koray
> > > > > >
> > > > >
> > > >
> > >
> >
> >
>
>
> -------------------------------------------------
> This mail sent through IMP: webmail.brad.ac.uk


Re: Embedded Server

Posted by G....@Bradford.ac.uk.
Tankut,

Is it possible to get a copy of the main Java application? I just want to see 
how this has worked.

Thanks
Gul




Quoting Tankut Koray <tk...@aselsan.com.tr>:

> Thanks,
> 
> It worked when I set the "xindice.home" system property.
> 
> Now, I have another question,
> 
> When I close my app using ctrl+c, it will close without calling
> kernel.shutdown. So is this cause any problems in xindice like
> unclosed
> files? I mean when I restart my app after doing ctrl+c, am I going to
> find
> the server as it was before? ( maybe this looks silly but let me ask:)
> 
> Tankut
> 
> 
> ----- Original Message -----
> From: "Øyvind Vestavik" <Oy...@idi.ntnu.no>
> To: <xi...@xml.apache.org>
> Sent: Tuesday, October 08, 2002 9:51 AM
> Subject: Re: Embedded Server
> 
> 
> >
> > The server depends on the environment variables JAVA_HOME and
> > XINDICE_HOME which you set when you first set up xindice.
> >
> > Basicly what the startup.bat and start.sh scripts does is to build
> > variables for XINDICE_HOME, classpath and so on, and passing them on
> to
> > the org.apache.xindice.server.Xindice class with the call below
> (from
> > startup.sh) which starts the server.
> >
> > java -Xms16m -Xmx168m -Dxindice.home="$XINDICE_HOME" $VMPROPS
> -classpath
> > "$CLASSPATH" org.apache.xindice.server.Xindice
> >
> > What you have to do to start the server from javacode is basicly to
> > rebuild the variables from the script and passing them on in the call
> like
> > before.
> >
> > I'm not sure if the server is going to run in a process other that
> our
> > java-app, but I think it will be just one process. Your database can
> still
> > be accessed from outside. To make the database exclusive to your
> > application is a much bigger task.
> >
> > vennlig hilsen
> > Øyvind
> >
> > "The truth shall set you free, but first it will piss you off"
> >
> > Øyvind Vestavik
> > Øvre Møllenberggt 44b
> > 7014 Trondheim
> > oyvindve@idi.ntnu.no
> > 41422911
> >
> > On Mon, 7 Oct 2002, Tankut Koray wrote:
> >
> > > Hi,
> > > I am trying to write a Java application that uses Xindice. So
> instead of
> > > starting the server by hand I am trying to run Xindice through my
> class.
> I
> > > tried creating a new Kernel object with a absolute path to
> system.xml
> but
> > > there is something wrong with directories(I think)
> > >
> > > Tankut Koray
> > >
> > >
> > > ----- Original Message -----
> > > From: "Øyvind Vestavik" <Oy...@idi.ntnu.no>
> > > To: <xi...@xml.apache.org>
> > > Sent: Monday, October 07, 2002 5:29 PM
> > > Subject: Re: Embedded Server
> > >
> > >
> > > >
> > > > Depends on what you mean by "app".
> > > > Please tell us what exactly you want to do..
> > > >
> > > > vennlig hilsen
> > > > Øyvind
> > > >
> > > > "The truth shall set you free, but first it will piss you off"
> > > >
> > > > Øyvind Vestavik
> > > > Øvre Møllenberggt 44b
> > > > 7014 Trondheim
> > > > oyvindve@idi.ntnu.no
> > > > 41422911
> > > >
> > > > On Sun, 6 Oct 2002, Tankut Koray wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I wan to run Xindice server from my app. How to do this?
> > > > >
> > > > > Tankut Koray
> > > > >
> > > >
> > >
> >
> 
> 


-------------------------------------------------
This mail sent through IMP: webmail.brad.ac.uk

Re: Embedded Server

Posted by Øyvind Vestavik <Oy...@idi.ntnu.no>.
Sorry about that. I thought you ment you had set XINDICE manually

vennlig hilsen
Øyvind

"The truth shall set you free, but first it will piss you off"

Øyvind Vestavik
Øvre Møllenberggt 44b
7014 Trondheim
oyvindve@idi.ntnu.no
41422911

On Tue, 8 Oct 2002, Øyvind Vestavik wrote:

>
> I may have misunderstood your question, but if the point was to distribute
> your application with XINDICE embedded without having to force the users
> of your program to set the XINDICE_HOME env variable, than you also has to
> change the java startup call, exchanging "JAVA_HOME with some path local
> to the internal packaging in your program, so that it points to the
> mainclass of XINDICE.
>
> vennlig hilsen
> Øyvind
>
> "The truth shall set you free, but first it will piss you off"
>
> Øyvind Vestavik
> Øvre Møllenberggt 44b
> 7014 Trondheim
> oyvindve@idi.ntnu.no
> 41422911
>
> On Mon, 7 Oct 2002, Tankut Koray wrote:
>
> > Thanks,
> >
> > It worked when I set the "xindice.home" system property.
> >
> > Now, I have another question,
> >
> > When I close my app using ctrl+c, it will close without calling
> > kernel.shutdown. So is this cause any problems in xindice like unclosed
> > files? I mean when I restart my app after doing ctrl+c, am I going to find
> > the server as it was before? ( maybe this looks silly but let me ask:)
> >
> > Tankut
> >
> >
> > ----- Original Message -----
> > From: "Øyvind Vestavik" <Oy...@idi.ntnu.no>
> > To: <xi...@xml.apache.org>
> > Sent: Tuesday, October 08, 2002 9:51 AM
> > Subject: Re: Embedded Server
> >
> >
> > >
> > > The server depends on the environment variables JAVA_HOME and
> > > XINDICE_HOME which you set when you first set up xindice.
> > >
> > > Basicly what the startup.bat and start.sh scripts does is to build
> > > variables for XINDICE_HOME, classpath and so on, and passing them on to
> > > the org.apache.xindice.server.Xindice class with the call below (from
> > > startup.sh) which starts the server.
> > >
> > > java -Xms16m -Xmx168m -Dxindice.home="$XINDICE_HOME" $VMPROPS -classpath
> > > "$CLASSPATH" org.apache.xindice.server.Xindice
> > >
> > > What you have to do to start the server from javacode is basicly to
> > > rebuild the variables from the script and passing them on in the call like
> > > before.
> > >
> > > I'm not sure if the server is going to run in a process other that our
> > > java-app, but I think it will be just one process. Your database can still
> > > be accessed from outside. To make the database exclusive to your
> > > application is a much bigger task.
> > >
> > > vennlig hilsen
> > > Øyvind
> > >
> > > "The truth shall set you free, but first it will piss you off"
> > >
> > > Øyvind Vestavik
> > > Øvre Møllenberggt 44b
> > > 7014 Trondheim
> > > oyvindve@idi.ntnu.no
> > > 41422911
> > >
> > > On Mon, 7 Oct 2002, Tankut Koray wrote:
> > >
> > > > Hi,
> > > > I am trying to write a Java application that uses Xindice. So instead of
> > > > starting the server by hand I am trying to run Xindice through my class.
> > I
> > > > tried creating a new Kernel object with a absolute path to system.xml
> > but
> > > > there is something wrong with directories(I think)
> > > >
> > > > Tankut Koray
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: "Øyvind Vestavik" <Oy...@idi.ntnu.no>
> > > > To: <xi...@xml.apache.org>
> > > > Sent: Monday, October 07, 2002 5:29 PM
> > > > Subject: Re: Embedded Server
> > > >
> > > >
> > > > >
> > > > > Depends on what you mean by "app".
> > > > > Please tell us what exactly you want to do..
> > > > >
> > > > > vennlig hilsen
> > > > > Øyvind
> > > > >
> > > > > "The truth shall set you free, but first it will piss you off"
> > > > >
> > > > > Øyvind Vestavik
> > > > > Øvre Møllenberggt 44b
> > > > > 7014 Trondheim
> > > > > oyvindve@idi.ntnu.no
> > > > > 41422911
> > > > >
> > > > > On Sun, 6 Oct 2002, Tankut Koray wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I wan to run Xindice server from my app. How to do this?
> > > > > >
> > > > > > Tankut Koray
> > > > > >
> > > > >
> > > >
> > >
> >
>


Re: Embedded Server

Posted by Øyvind Vestavik <Oy...@idi.ntnu.no>.
I may have misunderstood your question, but if the point was to distribute
your application with XINDICE embedded without having to force the users
of your program to set the XINDICE_HOME env variable, than you also has to
change the java startup call, exchanging "JAVA_HOME with some path local
to the internal packaging in your program, so that it points to the
mainclass of XINDICE.

vennlig hilsen
Øyvind

"The truth shall set you free, but first it will piss you off"

Øyvind Vestavik
Øvre Møllenberggt 44b
7014 Trondheim
oyvindve@idi.ntnu.no
41422911

On Mon, 7 Oct 2002, Tankut Koray wrote:

> Thanks,
>
> It worked when I set the "xindice.home" system property.
>
> Now, I have another question,
>
> When I close my app using ctrl+c, it will close without calling
> kernel.shutdown. So is this cause any problems in xindice like unclosed
> files? I mean when I restart my app after doing ctrl+c, am I going to find
> the server as it was before? ( maybe this looks silly but let me ask:)
>
> Tankut
>
>
> ----- Original Message -----
> From: "Øyvind Vestavik" <Oy...@idi.ntnu.no>
> To: <xi...@xml.apache.org>
> Sent: Tuesday, October 08, 2002 9:51 AM
> Subject: Re: Embedded Server
>
>
> >
> > The server depends on the environment variables JAVA_HOME and
> > XINDICE_HOME which you set when you first set up xindice.
> >
> > Basicly what the startup.bat and start.sh scripts does is to build
> > variables for XINDICE_HOME, classpath and so on, and passing them on to
> > the org.apache.xindice.server.Xindice class with the call below (from
> > startup.sh) which starts the server.
> >
> > java -Xms16m -Xmx168m -Dxindice.home="$XINDICE_HOME" $VMPROPS -classpath
> > "$CLASSPATH" org.apache.xindice.server.Xindice
> >
> > What you have to do to start the server from javacode is basicly to
> > rebuild the variables from the script and passing them on in the call like
> > before.
> >
> > I'm not sure if the server is going to run in a process other that our
> > java-app, but I think it will be just one process. Your database can still
> > be accessed from outside. To make the database exclusive to your
> > application is a much bigger task.
> >
> > vennlig hilsen
> > Øyvind
> >
> > "The truth shall set you free, but first it will piss you off"
> >
> > Øyvind Vestavik
> > Øvre Møllenberggt 44b
> > 7014 Trondheim
> > oyvindve@idi.ntnu.no
> > 41422911
> >
> > On Mon, 7 Oct 2002, Tankut Koray wrote:
> >
> > > Hi,
> > > I am trying to write a Java application that uses Xindice. So instead of
> > > starting the server by hand I am trying to run Xindice through my class.
> I
> > > tried creating a new Kernel object with a absolute path to system.xml
> but
> > > there is something wrong with directories(I think)
> > >
> > > Tankut Koray
> > >
> > >
> > > ----- Original Message -----
> > > From: "Øyvind Vestavik" <Oy...@idi.ntnu.no>
> > > To: <xi...@xml.apache.org>
> > > Sent: Monday, October 07, 2002 5:29 PM
> > > Subject: Re: Embedded Server
> > >
> > >
> > > >
> > > > Depends on what you mean by "app".
> > > > Please tell us what exactly you want to do..
> > > >
> > > > vennlig hilsen
> > > > Øyvind
> > > >
> > > > "The truth shall set you free, but first it will piss you off"
> > > >
> > > > Øyvind Vestavik
> > > > Øvre Møllenberggt 44b
> > > > 7014 Trondheim
> > > > oyvindve@idi.ntnu.no
> > > > 41422911
> > > >
> > > > On Sun, 6 Oct 2002, Tankut Koray wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I wan to run Xindice server from my app. How to do this?
> > > > >
> > > > > Tankut Koray
> > > > >
> > > >
> > >
> >
>


Re: Embedded Server

Posted by Tankut Koray <tk...@aselsan.com.tr>.
Thanks,

It worked when I set the "xindice.home" system property.

Now, I have another question,

When I close my app using ctrl+c, it will close without calling
kernel.shutdown. So is this cause any problems in xindice like unclosed
files? I mean when I restart my app after doing ctrl+c, am I going to find
the server as it was before? ( maybe this looks silly but let me ask:)

Tankut


----- Original Message -----
From: "Øyvind Vestavik" <Oy...@idi.ntnu.no>
To: <xi...@xml.apache.org>
Sent: Tuesday, October 08, 2002 9:51 AM
Subject: Re: Embedded Server


>
> The server depends on the environment variables JAVA_HOME and
> XINDICE_HOME which you set when you first set up xindice.
>
> Basicly what the startup.bat and start.sh scripts does is to build
> variables for XINDICE_HOME, classpath and so on, and passing them on to
> the org.apache.xindice.server.Xindice class with the call below (from
> startup.sh) which starts the server.
>
> java -Xms16m -Xmx168m -Dxindice.home="$XINDICE_HOME" $VMPROPS -classpath
> "$CLASSPATH" org.apache.xindice.server.Xindice
>
> What you have to do to start the server from javacode is basicly to
> rebuild the variables from the script and passing them on in the call like
> before.
>
> I'm not sure if the server is going to run in a process other that our
> java-app, but I think it will be just one process. Your database can still
> be accessed from outside. To make the database exclusive to your
> application is a much bigger task.
>
> vennlig hilsen
> Øyvind
>
> "The truth shall set you free, but first it will piss you off"
>
> Øyvind Vestavik
> Øvre Møllenberggt 44b
> 7014 Trondheim
> oyvindve@idi.ntnu.no
> 41422911
>
> On Mon, 7 Oct 2002, Tankut Koray wrote:
>
> > Hi,
> > I am trying to write a Java application that uses Xindice. So instead of
> > starting the server by hand I am trying to run Xindice through my class.
I
> > tried creating a new Kernel object with a absolute path to system.xml
but
> > there is something wrong with directories(I think)
> >
> > Tankut Koray
> >
> >
> > ----- Original Message -----
> > From: "Øyvind Vestavik" <Oy...@idi.ntnu.no>
> > To: <xi...@xml.apache.org>
> > Sent: Monday, October 07, 2002 5:29 PM
> > Subject: Re: Embedded Server
> >
> >
> > >
> > > Depends on what you mean by "app".
> > > Please tell us what exactly you want to do..
> > >
> > > vennlig hilsen
> > > Øyvind
> > >
> > > "The truth shall set you free, but first it will piss you off"
> > >
> > > Øyvind Vestavik
> > > Øvre Møllenberggt 44b
> > > 7014 Trondheim
> > > oyvindve@idi.ntnu.no
> > > 41422911
> > >
> > > On Sun, 6 Oct 2002, Tankut Koray wrote:
> > >
> > > > Hi,
> > > >
> > > > I wan to run Xindice server from my app. How to do this?
> > > >
> > > > Tankut Koray
> > > >
> > >
> >
>


Re: Embedded Server

Posted by Øyvind Vestavik <Oy...@idi.ntnu.no>.
The server depends on the environment variables JAVA_HOME and
XINDICE_HOME which you set when you first set up xindice.

Basicly what the startup.bat and start.sh scripts does is to build
variables for XINDICE_HOME, classpath and so on, and passing them on to
the org.apache.xindice.server.Xindice class with the call below (from
startup.sh) which starts the server.

java -Xms16m -Xmx168m -Dxindice.home="$XINDICE_HOME" $VMPROPS -classpath
"$CLASSPATH" org.apache.xindice.server.Xindice

What you have to do to start the server from javacode is basicly to
rebuild the variables from the script and passing them on in the call like
before.

I'm not sure if the server is going to run in a process other that our
java-app, but I think it will be just one process. Your database can still
be accessed from outside. To make the database exclusive to your
application is a much bigger task.

vennlig hilsen
Øyvind

"The truth shall set you free, but first it will piss you off"

Øyvind Vestavik
Øvre Møllenberggt 44b
7014 Trondheim
oyvindve@idi.ntnu.no
41422911

On Mon, 7 Oct 2002, Tankut Koray wrote:

> Hi,
> I am trying to write a Java application that uses Xindice. So instead of
> starting the server by hand I am trying to run Xindice through my class. I
> tried creating a new Kernel object with a absolute path to system.xml but
> there is something wrong with directories(I think)
>
> Tankut Koray
>
>
> ----- Original Message -----
> From: "Øyvind Vestavik" <Oy...@idi.ntnu.no>
> To: <xi...@xml.apache.org>
> Sent: Monday, October 07, 2002 5:29 PM
> Subject: Re: Embedded Server
>
>
> >
> > Depends on what you mean by "app".
> > Please tell us what exactly you want to do..
> >
> > vennlig hilsen
> > Øyvind
> >
> > "The truth shall set you free, but first it will piss you off"
> >
> > Øyvind Vestavik
> > Øvre Møllenberggt 44b
> > 7014 Trondheim
> > oyvindve@idi.ntnu.no
> > 41422911
> >
> > On Sun, 6 Oct 2002, Tankut Koray wrote:
> >
> > > Hi,
> > >
> > > I wan to run Xindice server from my app. How to do this?
> > >
> > > Tankut Koray
> > >
> >
>


Re: Embedded Server

Posted by Tankut Koray <tk...@aselsan.com.tr>.
Hi,
I am trying to write a Java application that uses Xindice. So instead of
starting the server by hand I am trying to run Xindice through my class. I
tried creating a new Kernel object with a absolute path to system.xml but
there is something wrong with directories(I think)

Tankut Koray


----- Original Message -----
From: "Øyvind Vestavik" <Oy...@idi.ntnu.no>
To: <xi...@xml.apache.org>
Sent: Monday, October 07, 2002 5:29 PM
Subject: Re: Embedded Server


>
> Depends on what you mean by "app".
> Please tell us what exactly you want to do..
>
> vennlig hilsen
> Øyvind
>
> "The truth shall set you free, but first it will piss you off"
>
> Øyvind Vestavik
> Øvre Møllenberggt 44b
> 7014 Trondheim
> oyvindve@idi.ntnu.no
> 41422911
>
> On Sun, 6 Oct 2002, Tankut Koray wrote:
>
> > Hi,
> >
> > I wan to run Xindice server from my app. How to do this?
> >
> > Tankut Koray
> >
>


Re: Embedded Server

Posted by Øyvind Vestavik <Oy...@idi.ntnu.no>.
Depends on what you mean by "app".
Please tell us what exactly you want to do..

vennlig hilsen
Øyvind

"The truth shall set you free, but first it will piss you off"

Øyvind Vestavik
Øvre Møllenberggt 44b
7014 Trondheim
oyvindve@idi.ntnu.no
41422911

On Sun, 6 Oct 2002, Tankut Koray wrote:

> Hi,
>
> I wan to run Xindice server from my app. How to do this?
>
> Tankut Koray
>


RE: Embedded Server

Posted by Nicolai Wadström <ni...@yahoo.se>.
Hi,

provided you have all the required classes in the path setup:

To start:


String						cfgfile	= "/usr/yourapp/db/cfg/database.cfg";
org.apache.xindice.server.Kernel		dbkernel = new
org.apache.xindice.server.Kernel( cfgfile, false );



To shutdown:

dbkernel.shutDown( 0, false );


To find out more read on the 'org.apache.xindice.server.Kernel' class in the
JavaDocs.

// Nicolai


-----Original Message-----
From: Tankut Koray [mailto:tkoray@aselsan.com.tr]
Sent: den 6 oktober 2002 16:21
To: xindice-users@xml.apache.org
Cc: xindice-dev@xml.apache.org
Subject: Embedded Server


Hi,

I wan to run Xindice server from my app. How to do this?

Tankut Koray

_____________________________________________________
Följ VM på nära håll på Yahoo!s officielle VM-sajt www.yahoo.se/vm2002
Håll dig ajour med nyheter och resultat, med vinnare och förlorare...