You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@river.apache.org by Rupert Smith <ru...@googlemail.com> on 2012/02/02 18:00:22 UTC

HTTP class server and Reggie all-in-one embedded in application.

Hi,

At the moment I start the HTTP class server and reggie using scripts:

jini-httpd.sh
jini-reggie.sh

Which I took from the examples. These start Java processes:

java -jar ../lib-jini/classserver.jar -port 8080 -dir ../lib-jini-dl

And:

java -Djava.security.policy=jini-start.policy -jar
../lib-jini/start.jar start-reggie.config

All good, and I appreciate that there are other ways of running Jini, and
the various scripts in the examples demonstrate some of the flexibility
available, though I have not yet explored the options in much depth.

What I would like to do now, for the sake of simplicity, is to have a
single Java main() method, that laucnhes the class server, reggie, and my
"management console" application, all as a single process. Services that
can be managed, will then make themselves available through that registsry,
as and when they come online. This is the most common way in which it will
be run.

Are there any example available on doing this? Perhaps I just need to start
digging through the main() methods in classserver.jar and start.jar to get
an idea of how it is done.

Thanks for your help.

Rupert

Re: HTTP class server and Reggie all-in-one embedded in application.

Posted by Tom Hobbs <tv...@googlemail.com>.
Hi Rupert,

This can be done very easily.

Assuming you've got all your config files in known good places, the
few lines of code you'd need are something like;

//Start HTTP server
ClassServer cs = new ClassServer(HTTP_PORT, dir, trees, stoppable,  verbose);
cs.start();

//Start reggie
ServiceStarter.main(reggieConfig);

//Start management service
ServiceStarter.main(managementServiceConfig);

Have a look at the API for ConfigurationFile to see how to construct
the arguments to ServiceStarter.main

http://river.apache.org/doc/api/net/jini/config/ConfigurationFile.html

Cheers,

Tom


On Thu, Feb 2, 2012 at 5:00 PM, Rupert Smith
<ru...@googlemail.com> wrote:
> Hi,
>
> At the moment I start the HTTP class server and reggie using scripts:
>
> jini-httpd.sh
> jini-reggie.sh
>
> Which I took from the examples. These start Java processes:
>
> java -jar ../lib-jini/classserver.jar -port 8080 -dir ../lib-jini-dl
>
> And:
>
> java -Djava.security.policy=jini-start.policy -jar
> ../lib-jini/start.jar start-reggie.config
>
> All good, and I appreciate that there are other ways of running Jini, and
> the various scripts in the examples demonstrate some of the flexibility
> available, though I have not yet explored the options in much depth.
>
> What I would like to do now, for the sake of simplicity, is to have a
> single Java main() method, that laucnhes the class server, reggie, and my
> "management console" application, all as a single process. Services that
> can be managed, will then make themselves available through that registsry,
> as and when they come online. This is the most common way in which it will
> be run.
>
> Are there any example available on doing this? Perhaps I just need to start
> digging through the main() methods in classserver.jar and start.jar to get
> an idea of how it is done.
>
> Thanks for your help.
>
> Rupert