You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br> on 2004/02/04 18:03:29 UTC

[PATCH] Initializing Velocity action modules

-- 
Leandro Rodrigo Saad Cruz
IT - Inter Business Tecnologia e Servicos (IB)
http://www.ibnetwork.com.br
http://db.apache.org/ojb
http://xingu.sourceforge.net


Re: [PATCH] Initializing Velocity action modules

Posted by Scott Eade <se...@backstagetech.com.au>.
Eric Pugh wrote:

>Did this ever get committed to 2.4?   I am looking at this, and would like
>to use it...
>
Yes :-)

How about those ASL 2.0 patches :-)

Cheers,

Scott

-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


RE: [PATCH] Initializing Velocity action modules

Posted by Eric Pugh <ep...@upstate.com>.
Did this ever get committed to 2.4?   I am looking at this, and would like
to use it...

> -----Original Message-----
> From: Daniel L. Rall [mailto:dlr@apache.org]
> Sent: Tuesday, February 10, 2004 8:51 PM
> To: Turbine Developers List
> Subject: Re: [PATCH] Initializing Velocity action modules
>
>
> Treating modules as components might work out nicely.  Dealing
> with only a
> single set of lifecylce APIs will reduce the overall complexity
> and learning
> curve.
>
> Leandro Rodrigo Saad Cruz wrote:
> > This is just a little enhacement. When I write webapps with turbine I
> > usually initialize my modules to get a handle to a ComponentManager or
> > any other component that I'd like to use inside that module.
> > IMHO, turbine could be changed to handle all modules as Components,
> > handling their life cycle and life style.
> >
> >
> > On Wed, 2004-02-04 at 19:58, Scott Eade wrote:
> >
> >>Can you please provide a reason for this for the change log.
>
>
>
> ---------------------------------------------------------------------
> 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


Re: [PATCH] Initializing Velocity action modules

Posted by "Daniel L. Rall" <dl...@apache.org>.
Treating modules as components might work out nicely.  Dealing with only a 
single set of lifecylce APIs will reduce the overall complexity and learning 
curve.

Leandro Rodrigo Saad Cruz wrote:
> This is just a little enhacement. When I write webapps with turbine I
> usually initialize my modules to get a handle to a ComponentManager or
> any other component that I'd like to use inside that module.
> IMHO, turbine could be changed to handle all modules as Components,
> handling their life cycle and life style.
> 
> 
> On Wed, 2004-02-04 at 19:58, Scott Eade wrote:
> 
>>Can you please provide a reason for this for the change log.



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: [PATCH] Initializing Velocity action modules

Posted by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br>.
This is just a little enhacement. When I write webapps with turbine I
usually initialize my modules to get a handle to a ComponentManager or
any other component that I'd like to use inside that module.
IMHO, turbine could be changed to handle all modules as Components,
handling their life cycle and life style.


On Wed, 2004-02-04 at 19:58, Scott Eade wrote:
> Can you please provide a reason for this for the change log.
> 
> Thanks,
> 
> Scott
-- 
Leandro Rodrigo Saad Cruz
IT - Inter Business Tecnologia e Servicos (IB)
http://www.ibnetwork.com.br
http://db.apache.org/ojb
http://xingu.sourceforge.net



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: [PATCH] Initializing Velocity action modules

Posted by Scott Eade <se...@backstagetech.com.au>.
Can you please provide a reason for this for the change log.

Thanks,

Scott

-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au


Leandro Rodrigo Saad Cruz wrote:

>------------------------------------------------------------------------
>
>Index: src/java/org/apache/turbine/modules/actions/VelocityAction.java
>===================================================================
>RCS file: /home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/modules/actions/VelocityAction.java,v
>retrieving revision 1.7
>diff -u -b -B -r1.7 VelocityAction.java
>--- src/java/org/apache/turbine/modules/actions/VelocityAction.java	28 Sep 2003 17:35:03 -0000	1.7
>+++ src/java/org/apache/turbine/modules/actions/VelocityAction.java	4 Feb 2004 16:58:42 -0000
>@@ -83,6 +83,12 @@
>   {
>     doPerform(data, getContext(data));
>   }
>+	
>+	public void initialize()
>+		throws Exception
>+	{
>+			initialized = true;
>+	}
> 
>   /**
>    * You SHOULD override this method and implement it in your
>  
>
>------------------------------------------------------------------------
>
>Index: src/java/org/apache/turbine/util/velocity/VelocityActionEvent.java
>===================================================================
>RCS file: /home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/util/velocity/VelocityActionEvent.java,v
>retrieving revision 1.19
>diff -u -b -B -r1.19 VelocityActionEvent.java
>--- src/java/org/apache/turbine/util/velocity/VelocityActionEvent.java	28 Sep 2003 17:35:45 -0000	1.19
>+++ src/java/org/apache/turbine/util/velocity/VelocityActionEvent.java	4 Feb 2004 16:58:56 -0000
>@@ -90,6 +90,8 @@
>     private static final Class [] methodParams
>             = new Class [] { RunData.class, Context.class };
> 
>+	protected boolean initialized = false; 
>+
>     /**
>      * You need to implement this in your classes that extend this
>      * class.
>@@ -100,6 +102,9 @@
>     public abstract void doPerform(RunData data)
>             throws Exception;
> 
>+	protected abstract void initialize()
>+		throws Exception;
>+
>     /**
>      * This overrides the default Action.perform() to execute the
>      * doEvent() method.  If that fails, then it will execute the
>@@ -113,6 +118,10 @@
>     {
>         try
>         {
>+        	if(!initialized)
>+        	{
>+        		initialize();
>+        	}
>             executeEvents(data, TurbineVelocity.getContext(data));
>         }
>         catch (NoSuchMethodException e)
>
>  
>
>------------------------------------------------------------------------
>

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org