You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Daniel Rall <dl...@collab.net> on 2001/04/09 10:03:15 UTC
RunData initialization and TurbineConfig
Some Turbine services implementations rely on having an init(RunData)
method called on them to properly initialize. This method is
currently invoked during the first call to the Turbine servlet's
doGet() method. Since TurbineConfig never calls doGet(), the hook for
initialization of all services external to the Turbine servlet is no
longer fully functional.
TubineWebMacroService was one such example of this, a dependancy that
I removed in a recent commit.
I propose that changes like the following be made to allow
doGet()-style external initialization of Turbine:
Index: Turbine.java
===================================================================
RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/Turbine.java,v
retrieving revision 1.54
diff -u -u -r1.54 Turbine.java
--- Turbine.java 2001/04/08 12:50:53 1.54
+++ Turbine.java 2001/04/09 08:02:30
@@ -196,6 +196,31 @@
}
/**
+ * Initializes the services which need <code>RunData</code> to
+ * initialize themselves (post startup).
+ *
+ * @param data The first <code>GET</code> request.
+ */
+ public final void init(RunData data)
+ {
+ if (firstDoGet)
+ {
+ synchronized (Turbine.class)
+ {
+ if (firstDoGet)
+ {
+ log("Turbine: Starting HTTP initialization of services");
+ TurbineServices.getInstance().initServices(data);
+ log("Turbine: Completed HTTP initialization of services");
+
+ // Mark that we're done.
+ firstDoGet = false;
+ }
+ }
+ }
+ }
+
+ /**
* The <code>Servlet</code> destroy method. Invokes
* <code>ServiceBroker</code> tear down method.
*/
@@ -237,23 +262,9 @@
getServletConfig() );
// If this is the first invocation, perform some
- // initialization.
- if(firstDoGet)
- {
- synchronized(Turbine.class)
- {
- if(firstDoGet)
- {
- // Certain services need RunData to initialize
- // themselves.
- log("Turbine: doGet() Start Initializing Services!");
- TurbineServices.getInstance().initServices(data);
- log("Turbine: doGet() Finish Initializing Services!");
- // Mark that we're done.
- firstDoGet = false;
- }
- }
- }
+ // initialization. Certain services need RunData to initialize
+ // themselves.
+ init(data);
// Get the instance of the Session Validator.
SessionValidator sessionValidator = (SessionValidator)ActionLoader
Index: TurbineConfig.java
===================================================================
RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/util/TurbineConfig.java,v
retrieving revision 1.16
diff -u -u -r1.16 TurbineConfig.java
--- TurbineConfig.java 2001/04/08 19:43:25 1.16
+++ TurbineConfig.java 2001/04/09 07:40:47
@@ -107,6 +107,9 @@
/** Initialization parameters */
private Map initParams;
+ /** The Turbine servlet instance used for initialization. */
+ private Turbine turbine;
+
/**
* Constructs a new TurbineConfig.
*
@@ -150,12 +153,23 @@
{
try
{
- Turbine turbine = new Turbine();
+ turbine = new Turbine();
turbine.init(this);
}
catch (Exception e)
{
Log.error("TurbineConfig: Initialization failture", e);
+ }
+ }
+
+ /**
+ * Initialization requiring a HTTP <code>GET</code> request.
+ */
+ public void init(RunData data)
+ {
+ if (turbine != null)
+ {
+ turbine.init(data);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: RunData initialization and TurbineConfig
Posted by Daniel Rall <dl...@collab.net>.
Jason van Zyl <jv...@apache.org> writes:
> Daniel Rall wrote:
> >
> > Some Turbine services implementations rely on having an init(RunData)
> > method called on them to properly initialize. This method is
> > currently invoked during the first call to the Turbine servlet's
> > doGet() method. Since TurbineConfig never calls doGet(), the hook for
> > initialization of all services external to the Turbine servlet is no
> > longer fully functional.
> >
> > TubineWebMacroService was one such example of this, a dependancy that
> > I removed in a recent commit.
>
> Did you check a stand-alone WebMacro application when you changed
> the signature from init(RunData) to init(). I just tried a velocity
> app with with an init() instead of init(RunData) and it didn't work.
Yes, WebMacro worked fine when running Turbine in stand alone mode.
> I am trying to track down the problem with velocity. If you have
> already tested a stand-alone app, that's cool. If not, let me know
> because I have one that I can use.
Per our IRC conversion, I will revert TemplateEnginService
implementations to use init(ServletConfig) instead of init(RunData)
until post-branch, when we can make wider reaching changes.
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: RunData initialization and TurbineConfig
Posted by Jason van Zyl <jv...@apache.org>.
Daniel Rall wrote:
>
> Some Turbine services implementations rely on having an init(RunData)
> method called on them to properly initialize. This method is
> currently invoked during the first call to the Turbine servlet's
> doGet() method. Since TurbineConfig never calls doGet(), the hook for
> initialization of all services external to the Turbine servlet is no
> longer fully functional.
>
> TubineWebMacroService was one such example of this, a dependancy that
> I removed in a recent commit.
Did you check a stand-alone WebMacro application when you changed
the signature from init(RunData) to init(). I just tried a velocity
app with with an init() instead of init(RunData) and it didn't work.
I am trying to track down the problem with velocity. If you have
already tested a stand-alone app, that's cool. If not, let me know
because I have one that I can use.
--
jvz.
Jason van Zyl
jvanzyl@apache.org
http://jakarta.apache.org/velocity
http://jakarta.apache.org/turbine
http://tambora.zenplex.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: RunData initialization and TurbineConfig
Posted by Daniel Rall <dl...@collab.net>.
>From looking at TurbineServletService.getRealPath(), it looks like you
might not be using TurbineConfig to initialize the configured Turbine
services (their init(ServletConfig) methods each get called):
public String getRealPath( String uri )
{
if ( ( getServletContext() == null ) || ( uri == null ) )
return null;
return getServletContext().getRealPath( uri );
}
TurbineServletSerivce has an init(ServletConfig) method that is called
by TurbineConfig, but it also requires the init(RunData) method usually
called by the first HTTP GET request to the Turbine servlet. I added
a hook to help users of TurbineConfig invoke this init(RunData)
operation on the Services.
Daniel
Davanum Srinivas <di...@yahoo.com> writes:
> Daniel,
>
> Currently TurbineServlet.getRealPath return null when you run things from the command-line. Will
> these updates fix that problem? (Please see my sample that i already sent to the list which shows
> how to use Velocity Service from sample code).
>
> Thanks,
> dims
>
> --- Daniel Rall <dl...@collab.net> wrote:
> > Daniel Rall <dl...@collab.net> writes:
> >
> > > Some Turbine services implementations rely on having an init(RunData)
> > > method called on them to properly initialize. This method is
> > > currently invoked during the first call to the Turbine servlet's
> > > doGet() method. Since TurbineConfig never calls doGet(), the hook for
> > > initialization of all services external to the Turbine servlet is no
> > > longer fully functional.
> >
> > This was discussed a bit on IRC in #turbine. The change to fix this
> > issue now in CVS, and Jason will be testing it with the TDK. It's
> > rather meaningless to those not using Turbine in stand alone mode.
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: RunData initialization and TurbineConfig
Posted by Davanum Srinivas <di...@yahoo.com>.
Daniel,
Currently TurbineServlet.getRealPath return null when you run things from the command-line. Will
these updates fix that problem? (Please see my sample that i already sent to the list which shows
how to use Velocity Service from sample code).
Thanks,
dims
--- Daniel Rall <dl...@collab.net> wrote:
> Daniel Rall <dl...@collab.net> writes:
>
> > Some Turbine services implementations rely on having an init(RunData)
> > method called on them to properly initialize. This method is
> > currently invoked during the first call to the Turbine servlet's
> > doGet() method. Since TurbineConfig never calls doGet(), the hook for
> > initialization of all services external to the Turbine servlet is no
> > longer fully functional.
>
> This was discussed a bit on IRC in #turbine. The change to fix this
> issue now in CVS, and Jason will be testing it with the TDK. It's
> rather meaningless to those not using Turbine in stand alone mode.
>
> Daniel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
>
=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: RunData initialization and TurbineConfig
Posted by Daniel Rall <dl...@collab.net>.
Daniel Rall <dl...@collab.net> writes:
> Some Turbine services implementations rely on having an init(RunData)
> method called on them to properly initialize. This method is
> currently invoked during the first call to the Turbine servlet's
> doGet() method. Since TurbineConfig never calls doGet(), the hook for
> initialization of all services external to the Turbine servlet is no
> longer fully functional.
This was discussed a bit on IRC in #turbine. The change to fix this
issue now in CVS, and Jason will be testing it with the TDK. It's
rather meaningless to those not using Turbine in stand alone mode.
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: RunData initialization and TurbineConfig
Posted by Jason van Zyl <jv...@apache.org>.
Ilkka Priha wrote:
>
> A related question is that why e.g. TurbineVelocityService and
> TurbineTemplateService implement the init(RunData data) method even though they
> don't actually use RunData during their initialization. Could it be because of
> initialization order, or would it be reasonable to change the methods to init()?
>
I will test this again. As I am trying to get rid of all init(Object)
methods
in the services. Leaving these two as init() was causing a problem, but
some of
your cleaning up may have solved the problem and Dan said he was having
no
problem when he changed the signature from init(RunData) to init(). I
will
give this another try today.
--
jvz.
Jason van Zyl
jvanzyl@apache.org
http://jakarta.apache.org/velocity
http://jakarta.apache.org/turbine
http://tambora.zenplex.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: [OFFTOPIC] - United JavaDocs for all jakarta projects?
Posted by Daniel Rall <dl...@collab.net>.
Magnus ?or Torfason <ma...@handtolvur.is> writes:
> I was just wondering if it would not be a good idea to generate javadocs for
> all jakarta projects at the same time and make them available on the jakarta
> website.
>
> I would think the optimal longterm solution would be to autogenerate them
> using the latest cvs snapshots (is this something that would be appropriate
> for GUMP?).
>
> However, I would also be willing to generate these, maybe once per month,
> and ftp to someone who maintains the site.
This should be part of the Alexandria project proper. +1.
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
[OFFTOPIC] - United JavaDocs for all jakarta projects?
Posted by Magnus ?or Torfason <ma...@handtolvur.is>.
I was just wondering if it would not be a good idea to generate javadocs for
all jakarta projects at the same time and make them available on the jakarta
website.
I would think the optimal longterm solution would be to autogenerate them
using the latest cvs snapshots (is this something that would be appropriate
for GUMP?).
However, I would also be willing to generate these, maybe once per month,
and ftp to someone who maintains the site.
???
Magnus Torfason
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
org.apache.turbine.services.intake.model.Group
Posted by Ilkka Priha <ex...@nokia.com>.
This one doesn't compile:
"Group.java": Error #: 360 : unreported exception:
org.apache.turbine.util.TurbineException; must be caught or declared to be
thrown at line 196, column 32
Don't know whether to catch or throw, I hope that someone else can fix it.
-- Ilkka
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
RE: RunData initialization and TurbineConfig
Posted by Ilkka Priha <ex...@nokia.com>.
A related question is that why e.g. TurbineVelocityService and
TurbineTemplateService implement the init(RunData data) method even though they
don't actually use RunData during their initialization. Could it be because of
initialization order, or would it be reasonable to change the methods to init()?
-- Ilkka
-----Original Message-----
From: dlr@despot.finemaltcoding.com
[mailto:dlr@despot.finemaltcoding.com]On Behalf Of Daniel Rall
Sent: 9. huhtikuuta 2001 11:03
To: turbine-dev@jakarta.apache.org
Subject: RunData initialization and TurbineConfig
Some Turbine services implementations rely on having an init(RunData)
method called on them to properly initialize. This method is
currently invoked during the first call to the Turbine servlet's
doGet() method. Since TurbineConfig never calls doGet(), the hook for
initialization of all services external to the Turbine servlet is no
longer fully functional.
TubineWebMacroService was one such example of this, a dependancy that
I removed in a recent commit.
I propose that changes like the following be made to allow
doGet()-style external initialization of Turbine:
Index: Turbine.java
===================================================================
RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/Turbine.java,v
retrieving revision 1.54
diff -u -u -r1.54 Turbine.java
--- Turbine.java 2001/04/08 12:50:53 1.54
+++ Turbine.java 2001/04/09 08:02:30
@@ -196,6 +196,31 @@
}
/**
+ * Initializes the services which need <code>RunData</code> to
+ * initialize themselves (post startup).
+ *
+ * @param data The first <code>GET</code> request.
+ */
+ public final void init(RunData data)
+
+ if (firstDoGet)
+
+ synchronized (Turbine.class)
+
+ if (firstDoGet)
+
+ log("Turbine: Starting HTTP initialization of services");
+ TurbineServices.getInstance().initServices(data);
+ log("Turbine: Completed HTTP initialization of services");
+
+ // Mark that we're done.
+ firstDoGet = false;
+ }
+ }
+ }
+ }
+
+ /**
* The <code>Servlet</code> destroy method. Invokes
* <code>ServiceBroker</code> tear down method.
*/
@@ -237,23 +262,9 @@
getServletConfig() );
// If this is the first invocation, perform some
- // initialization.
- if(firstDoGet)
-
- synchronized(Turbine.class)
-
- if(firstDoGet)
-
- // Certain services need RunData to initialize
- // themselves.
- log("Turbine: doGet() Start Initializing Services!");
- TurbineServices.getInstance().initServices(data);
- log("Turbine: doGet() Finish Initializing Services!");
- // Mark that we're done.
- firstDoGet = false;
- }
- }
- }
+ // initialization. Certain services need RunData to initialize
+ // themselves.
+ init(data);
// Get the instance of the Session Validator.
SessionValidator sessionValidator = (SessionValidator)ActionLoader
Index: TurbineConfig.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/util/TurbineConfig.java,v
retrieving revision 1.16
diff -u -u -r1.16 TurbineConfig.java
--- TurbineConfig.java 2001/04/08 19:43:25 1.16
+++ TurbineConfig.java 2001/04/09 07:40:47
@@ -107,6 +107,9 @@
/** Initialization parameters */
private Map initParams;
+ /** The Turbine servlet instance used for initialization. */
+ private Turbine turbine;
+
/**
* Constructs a new TurbineConfig.
*
@@ -150,12 +153,23 @@
try
- Turbine turbine = new Turbine();
+ turbine = new Turbine();
turbine.init(this);
}
catch (Exception e)
Log.error("TurbineConfig: Initialization failture", e);
+ }
+ }
+
+ /**
+ * Initialization requiring a HTTP <code>GET</code> request.
+ */
+ public void init(RunData data)
+
+ if (turbine != null)
+
+ turbine.init(data);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org