You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Youngho Cho <yo...@nannet.co.kr> on 2001/06/10 08:10:46 UTC

[patch] TurbineVelocityService.java

Hi,

I'm not sure Is it a perfect place to put Pull Objects into VelocityContext at the beginning.
when we finalize a perfect place , then we can use requestPull method as a interface method.

Thanks 

youngho

Index: TurbineVelocityService.java
===================================================================
RCS file: /home/cvspublic/jakarta-turbine/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java,v
retrieving revision 1.47
diff -u -r1.47 TurbineVelocityService.java

 @@ -208,29 +208,34 @@
          */
         Context context = (Context)
             data.getTemplateInfo().getTemplateContext(VelocityService.CONTEXT);
-        
+
         if (context == null)
         {
             context = getContext();
             context.put ( "data", data );
 
-            if (pullModelActive)
-            {
-                /*
-                 * Populate the toolbox with request scope, session scope
-                 * and persistent scope tools (global tools are already in
-                 * the toolBoxContent which has been wrapped to construct
-                 * this request-specific context).
-                 */
-                TurbinePull.populateContext(context, data);
-            }
-            
+          requestPull( context , data );
+
             data.getTemplateInfo().setTemplateContext(
                 VelocityService.CONTEXT, context);
         }
         return context;
     }
-    
+
+ public void requestPull(Context context , RunData data)
+ {
+        if (pullModelActive)
+        {
+            /*
+             * Populate the toolbox with request scope, session scope
+             * and persistent scope tools (global tools are already in
+             * the toolBoxContent which has been wrapped to construct
+             * this request-specific context).
+             */
+            TurbinePull.populateContext(context, data);
+        }
+ }
+


Re: [patch] TurbineVelocityService.java

Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Youngho Cho" <yo...@nannet.co.kr> writes:

> Hi Daniel,
> 
> > you
> > have not included patches to the VelocityService interface nor the
> > TurbineVelocity static wrapper class. 
> 
> Because I have no idea when the PullTool should be put into the Context.
> But I believe that the initial stage is not proper timing at all.

Understood.  Thanks for providing the patch you did as a code
example--it helped clarify things.  I'm not sure what the proper
timing is for the use case you speak of, either.

> > I don't mind continuing this
> > discussion if you have more questions/comments.
> > 
> Yes, when I have some answer when is proper timing, 
> then I will do again.

Great, sounds like a good plan.  :)

Dan

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


Re: [patch] TurbineVelocityService.java

Posted by Youngho Cho <yo...@nannet.co.kr>.
Hi Daniel,

> you
> have not included patches to the VelocityService interface nor the
> TurbineVelocity static wrapper class. 

Because I have no idea when the PullTool should be put into the Context.
But I believe that the initial stage is not proper timing at all.

> I don't mind continuing this
> discussion if you have more questions/comments.
> 
Yes, when I have some answer when is proper timing, 
then I will do again.

Thanks.

youngho




Re: [patch] TurbineVelocityService.java

Posted by Youngho Cho <yo...@nannet.co.kr>.
Hi Danial,

> it merely provides a hook to re-pull the PullTools into the
> context a *second* time.  Is this really what you want?  

NO.

Thanks,

youngho


Re: [patch] TurbineVelocityService.java

Posted by Daniel Rall <dl...@finemaltcoding.com>.
AFAICT the patch you provided doesn't immediately address your
concern--it merely provides a hook to re-pull the PullTools into the
context a *second* time.  Is this really what you want?  I don't like
to expand interfaces without strong reasons.  Finally, you
have not included patches to the VelocityService interface nor the
TurbineVelocity static wrapper class.  I don't mind continuing this
discussion if you have more questions/comments.

Dan


"Youngho Cho" <yo...@nannet.co.kr> writes:

> Hi Daniel,
> 
> I think that , the proper pulling timing is  just before when it need.
> In our case , it is the just before velocity use the context.
> But the orignal code , 
> when the context generates , then the pulling is happened from the begining.
> During the time period between this time and the velocity uses
> there are so many changed and it is too long time.
> For example, LoginUser action class.
> The Turbine LoginUser action class is extended from Action.
> But if we want to use it as a subclass of VelocityAction, then we have some problem
> with session / persistent scope tool.
> I have one another problem looks like this one ( suspected ) in case of request scope tool even.
> ( I'm investigateing the root cause now.)
> 
> Therefore I think that In order to change the pulling time , I am not sure where it is exactly placed, 
> to clear above issuses at this moment,
> But It is need to make requestPull method as a VelocityService method
> and call it from the right time and right place.
> ( Just before the velocity use it I think )
> 
> Thanks,
> 
> youngho.
> 
> ps : sorry for my poor English.
> 
> 
> 
> ----- Original Message ----- 
> From: Daniel Rall <dl...@finemaltcoding.com>
> To: <tu...@jakarta.apache.org>
> Sent: Tuesday, June 12, 2001 2:32 AM
> Subject: Re: [patch] TurbineVelocityService.java
> 
> 
> > Hi Youngho.  You haven't made a good enough case for inclusion of your
> > patch in CVS.  If you feel strongly about it, or just think it's the
> > Right Thing, please expand on your reasoning.
> > 
> > Thanks!
> > 
> > Daniel
> > 
> > 
> > "Youngho Cho" <yo...@nannet.co.kr> writes:
> > 
> > > Hi,
> > > 
> > > I'm not sure Is it a perfect place to put Pull Objects into VelocityContext at the beginning.
> > > when we finalize a perfect place , then we can use requestPull method as a interface method.
> > > 
> > > Thanks 
> > > 
> > > youngho
> > > 
> > > Index: TurbineVelocityService.java
> > > ===================================================================
> > > RCS file: /home/cvspublic/jakarta-turbine/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java,v
> > > retrieving revision 1.47
> > > diff -u -r1.47 TurbineVelocityService.java
> > > 
> > >  @@ -208,29 +208,34 @@
> > >           */
> > >          Context context = (Context)
> > >              data.getTemplateInfo().getTemplateContext(VelocityService.CONTEXT);
> > > -        
> > > +
> > >          if (context == null)
> > >          {
> > >              context = getContext();
> > >              context.put ( "data", data );
> > >  
> > > -            if (pullModelActive)
> > > -            {
> > > -                /*
> > > -                 * Populate the toolbox with request scope, session scope
> > > -                 * and persistent scope tools (global tools are already in
> > > -                 * the toolBoxContent which has been wrapped to construct
> > > -                 * this request-specific context).
> > > -                 */
> > > -                TurbinePull.populateContext(context, data);
> > > -            }
> > > -            
> > > +          requestPull( context , data );
> > > +
> > >              data.getTemplateInfo().setTemplateContext(
> > >                  VelocityService.CONTEXT, context);
> > >          }
> > >          return context;
> > >      }
> > > -    
> > > +
> > > + public void requestPull(Context context , RunData data)
> > > + {
> > > +        if (pullModelActive)
> > > +        {
> > > +            /*
> > > +             * Populate the toolbox with request scope, session scope
> > > +             * and persistent scope tools (global tools are already in
> > > +             * the toolBoxContent which has been wrapped to construct
> > > +             * this request-specific context).
> > > +             */
> > > +            TurbinePull.populateContext(context, 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


Re: [patch] TurbineVelocityService.java

Posted by Youngho Cho <yo...@nannet.co.kr>.
Hi Daniel,

I think that , the proper pulling timing is  just before when it need.
In our case , it is the just before velocity use the context.
But the orignal code , 
when the context generates , then the pulling is happened from the begining.
During the time period between this time and the velocity uses
there are so many changed and it is too long time.
For example, LoginUser action class.
The Turbine LoginUser action class is extended from Action.
But if we want to use it as a subclass of VelocityAction, then we have some problem
with session / persistent scope tool.
I have one another problem looks like this one ( suspected ) in case of request scope tool even.
( I'm investigateing the root cause now.)

Therefore I think that In order to change the pulling time , I am not sure where it is exactly placed, 
to clear above issuses at this moment,
But It is need to make requestPull method as a VelocityService method
and call it from the right time and right place.
( Just before the velocity use it I think )

Thanks,

youngho.

ps : sorry for my poor English.



----- Original Message ----- 
From: Daniel Rall <dl...@finemaltcoding.com>
To: <tu...@jakarta.apache.org>
Sent: Tuesday, June 12, 2001 2:32 AM
Subject: Re: [patch] TurbineVelocityService.java


> Hi Youngho.  You haven't made a good enough case for inclusion of your
> patch in CVS.  If you feel strongly about it, or just think it's the
> Right Thing, please expand on your reasoning.
> 
> Thanks!
> 
> Daniel
> 
> 
> "Youngho Cho" <yo...@nannet.co.kr> writes:
> 
> > Hi,
> > 
> > I'm not sure Is it a perfect place to put Pull Objects into VelocityContext at the beginning.
> > when we finalize a perfect place , then we can use requestPull method as a interface method.
> > 
> > Thanks 
> > 
> > youngho
> > 
> > Index: TurbineVelocityService.java
> > ===================================================================
> > RCS file: /home/cvspublic/jakarta-turbine/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java,v
> > retrieving revision 1.47
> > diff -u -r1.47 TurbineVelocityService.java
> > 
> >  @@ -208,29 +208,34 @@
> >           */
> >          Context context = (Context)
> >              data.getTemplateInfo().getTemplateContext(VelocityService.CONTEXT);
> > -        
> > +
> >          if (context == null)
> >          {
> >              context = getContext();
> >              context.put ( "data", data );
> >  
> > -            if (pullModelActive)
> > -            {
> > -                /*
> > -                 * Populate the toolbox with request scope, session scope
> > -                 * and persistent scope tools (global tools are already in
> > -                 * the toolBoxContent which has been wrapped to construct
> > -                 * this request-specific context).
> > -                 */
> > -                TurbinePull.populateContext(context, data);
> > -            }
> > -            
> > +          requestPull( context , data );
> > +
> >              data.getTemplateInfo().setTemplateContext(
> >                  VelocityService.CONTEXT, context);
> >          }
> >          return context;
> >      }
> > -    
> > +
> > + public void requestPull(Context context , RunData data)
> > + {
> > +        if (pullModelActive)
> > +        {
> > +            /*
> > +             * Populate the toolbox with request scope, session scope
> > +             * and persistent scope tools (global tools are already in
> > +             * the toolBoxContent which has been wrapped to construct
> > +             * this request-specific context).
> > +             */
> > +            TurbinePull.populateContext(context, data);
> > +        }
> > + }
> > +
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

Re: [patch] TurbineVelocityService.java

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Hi Youngho.  You haven't made a good enough case for inclusion of your
patch in CVS.  If you feel strongly about it, or just think it's the
Right Thing, please expand on your reasoning.

Thanks!

Daniel


"Youngho Cho" <yo...@nannet.co.kr> writes:

> Hi,
> 
> I'm not sure Is it a perfect place to put Pull Objects into VelocityContext at the beginning.
> when we finalize a perfect place , then we can use requestPull method as a interface method.
> 
> Thanks 
> 
> youngho
> 
> Index: TurbineVelocityService.java
> ===================================================================
> RCS file: /home/cvspublic/jakarta-turbine/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java,v
> retrieving revision 1.47
> diff -u -r1.47 TurbineVelocityService.java
> 
>  @@ -208,29 +208,34 @@
>           */
>          Context context = (Context)
>              data.getTemplateInfo().getTemplateContext(VelocityService.CONTEXT);
> -        
> +
>          if (context == null)
>          {
>              context = getContext();
>              context.put ( "data", data );
>  
> -            if (pullModelActive)
> -            {
> -                /*
> -                 * Populate the toolbox with request scope, session scope
> -                 * and persistent scope tools (global tools are already in
> -                 * the toolBoxContent which has been wrapped to construct
> -                 * this request-specific context).
> -                 */
> -                TurbinePull.populateContext(context, data);
> -            }
> -            
> +          requestPull( context , data );
> +
>              data.getTemplateInfo().setTemplateContext(
>                  VelocityService.CONTEXT, context);
>          }
>          return context;
>      }
> -    
> +
> + public void requestPull(Context context , RunData data)
> + {
> +        if (pullModelActive)
> +        {
> +            /*
> +             * Populate the toolbox with request scope, session scope
> +             * and persistent scope tools (global tools are already in
> +             * the toolBoxContent which has been wrapped to construct
> +             * this request-specific context).
> +             */
> +            TurbinePull.populateContext(context, data);
> +        }
> + }
> +

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