Dear Jason,

It is the 2.1 codebase that I am using. I don't have a site I can post the
code to so will send it to you under separate cover. The service is
defensive (so server restarts are not a problem) in that it checks for the
existance of the users, permissions and roles first before initialising
them. It is just a foolproof method of returning the application to a
workable state should somebody clobber the database.

Regards

David

-----Original Message-----
From: Jason van Zyl [mailto:[EMAIL PROTECTED]]
Sent: 15 December 2001 15:32
To: Turbine Users List
Subject: Re: An init service runs twice


On 12/15/01 9:44 AM, "David Wynter" <[EMAIL PROTECTED]> wrote:

> I have a service that creates a few standard user account, roles and
> permissionsif they do not already exist in the database. It has a entry in
> TR.props fo
>
>
> # Database primer
> # This ensures that the required records exist in the database before
> # activity occurs.  It avoids the need for a stand-alone installation tool
>
services.DatabasePrimer.classname=com.roamware.rwtransform.services.Database
> Primer
>
> I out a breakpoint in it and found that it is run twice, once when the
> servlet starts (I have Tomcat load the servlet when it starts). And once
> when a user first logs in. If Turbine initialises the services for each
user
> to log in then clearly my service is in the wrong place. Is there a place
to
> put the service so that it only runs when Turbine first runs?

I take it this code is based on the services in the 2.x codebase? If you
post a link to the code I'll take a peek at it. I would actually like to try
your service that displays this behaviour in Fulcrum and see if the same
thing happens.

Have  you thought about server restarts as well? Maybe we could define a
service that left a marker somewhere to indicate that as part of it's
lifecycle it only needs to be run once. So when the service broker starts up
it will see that this service is a RunOnceService and not attempt to start
it up again.

How are you keeping the service from starting up again after a servlet
container restart?



> Thanks,
>
> David
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--

jvz.

Jason van Zyl

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to