You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ron Piterman <rp...@gmx.net> on 2005/12/02 15:38:43 UTC
initializing services on startup
Hi,
how can i initialize a hivemind service on servlet startup ?
Cheers,
Ron
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: initializing services on startup
Posted by Patrick Casey <pa...@adelphia.net>.
That, I don't know unfortunately. Stuffing it into a public static
is always one approach though, albeit an end-run around the framework :).
--- Pat
> -----Original Message-----
> From: John Coleman [mailto:john.s.coleman@ntlworld.com]
> Sent: Friday, December 02, 2005 6:02 PM
> To: Tapestry users
> Subject: Re: initializing services on startup
>
> Thanks Pat, but any idea how we get that to HiveMind in some neat way?
>
> John
>
> ----- Original Message -----
> From: "Patrick Casey" <pa...@adelphia.net>
> To: "'Tapestry users'" <ta...@jakarta.apache.org>
> Sent: Friday, December 02, 2005 11:13 PM
> Subject: RE: initializing services on startup
>
>
> >
> > If you're looking to find the name of the context directory, this
> > trick usually works:
> >
> > Step 1: Override ApplicationServlet
> > Step 2: In your init method do:
> >
> >
> > public void init(ServletConfig config) throws ServletException {
> > super.init(config);
> > String temp = config.getServletContext().getRealPath("");
> > fRootDirectory = temp;
> > Log.debug("Context directory = " + fRootDirectory);
> >
> > }
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: initializing services on startup
Posted by John Coleman <jo...@ntlworld.com>.
Thanks Pat, but any idea how we get that to HiveMind in some neat way?
John
----- Original Message -----
From: "Patrick Casey" <pa...@adelphia.net>
To: "'Tapestry users'" <ta...@jakarta.apache.org>
Sent: Friday, December 02, 2005 11:13 PM
Subject: RE: initializing services on startup
>
> If you're looking to find the name of the context directory, this
> trick usually works:
>
> Step 1: Override ApplicationServlet
> Step 2: In your init method do:
>
>
> public void init(ServletConfig config) throws ServletException {
> super.init(config);
> String temp = config.getServletContext().getRealPath("");
> fRootDirectory = temp;
> Log.debug("Context directory = " + fRootDirectory);
>
> }
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: initializing services on startup
Posted by Patrick Casey <pa...@adelphia.net>.
If you're looking to find the name of the context directory, this
trick usually works:
Step 1: Override ApplicationServlet
Step 2: In your init method do:
public void init(ServletConfig config) throws ServletException {
super.init(config);
String temp = config.getServletContext().getRealPath("");
fRootDirectory = temp;
Log.debug("Context directory = " + fRootDirectory);
}
> -----Original Message-----
> From: John Coleman [mailto:john.s.coleman@ntlworld.com]
> Sent: Friday, December 02, 2005 8:50 AM
> To: Tapestry users
> Subject: Re: initializing services on startup
>
> I was almost going to ask this a while ago when I was getting into
> Cayenne.
>
> I was keen to find out the name of context directory do I could obtain
> resources in hivemind, as I was using javassist and would of liked to have
> stored ct classes in a temp directory under the context, and of located
> any
> resource off a root directory.
>
> In the end I was not storing the ct class as a file and just loaded it
> directly, and got resources by moving my class package and using the
> class.getRes' method. And I also concluded that really I should not be
> using
> anything weby in my services, as they are purely intended to do
> persistence
> and business logic, niether of which should be bound to the server.
>
> Sorry not to answer your q. Ron. I'd be interested to know why you have
> that
> requirement. And answer could also help me to.
>
> Maybe write something into your web.xml to load at start up and have that
> load your HM registry, or obtain it and pass in a reference?
>
> John
>
> ----- Original Message -----
> From: "Ron Piterman" <rp...@gmx.net>
> To: <ta...@jakarta.apache.org>
> Sent: Friday, December 02, 2005 2:38 PM
> Subject: initializing services on startup
>
>
> > Hi,
> > how can i initialize a hivemind service on servlet startup ?
> > Cheers,
> > Ron
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: initializing services on startup
Posted by John Coleman <jo...@ntlworld.com>.
I was almost going to ask this a while ago when I was getting into Cayenne.
I was keen to find out the name of context directory do I could obtain
resources in hivemind, as I was using javassist and would of liked to have
stored ct classes in a temp directory under the context, and of located any
resource off a root directory.
In the end I was not storing the ct class as a file and just loaded it
directly, and got resources by moving my class package and using the
class.getRes' method. And I also concluded that really I should not be using
anything weby in my services, as they are purely intended to do persistence
and business logic, niether of which should be bound to the server.
Sorry not to answer your q. Ron. I'd be interested to know why you have that
requirement. And answer could also help me to.
Maybe write something into your web.xml to load at start up and have that
load your HM registry, or obtain it and pass in a reference?
John
----- Original Message -----
From: "Ron Piterman" <rp...@gmx.net>
To: <ta...@jakarta.apache.org>
Sent: Friday, December 02, 2005 2:38 PM
Subject: initializing services on startup
> Hi,
> how can i initialize a hivemind service on servlet startup ?
> Cheers,
> Ron
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: initializing services on startup
Posted by Ron Piterman <rp...@gmx.net>.
Wow - thanx
Kent Tong wrote:
> Ron Piterman <rpiterman <at> gmx.net> writes:
>
>
>>Hi,
>>how can i initialize a hivemind service on servlet startup ?
>
>
> Try:
>
> <contribution configuration-id="hivemind.EagerLoad">
> <load service-id="your.service.id"/>
> </contribution>
>
> Then your service will be loaded when the registry is initialized
> which is when the servlet is started.
>
> --
> Author of a book for learning Tapestry (http://www.agileskills2.org/EWDT)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: initializing services on startup
Posted by Kent Tong <ke...@cpttm.org.mo>.
Ron Piterman <rpiterman <at> gmx.net> writes:
>
> Hi,
> how can i initialize a hivemind service on servlet startup ?
Try:
<contribution configuration-id="hivemind.EagerLoad">
<load service-id="your.service.id"/>
</contribution>
Then your service will be loaded when the registry is initialized
which is when the servlet is started.
--
Author of a book for learning Tapestry (http://www.agileskills2.org/EWDT)
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org