Hi Scott,
Thanks for redirecting my query, I wasn't sure where it belonged,
I was beginning to wonder if I would ever regain control of this thread! ;-)
I just had a brief skim over the Pull machansim - very interesting.
If I read this correctly, what I was originally proposing wasn't so much
'wrong', but the Pull mechanism really is the cleaner and more appropriate
way to put utility methods in the context, right?
And yes, I am still looking for ammo to target ASP lovers! :)
Actually, the situation is nowhere as tense as it was ; they
are continuing to do prototyping of charts using ASP,
and i am building the server stuff in Turbine.
The problem is that as soon I as I mention Java or Velocity to the guy doing
the pages his eyes glaze over.. He's a wizard with the frontend, but has found
the velocity tough going for a number of reasons, not all his doing. :-/
Back to the topic, I'm not sure what you mean by Javadoc comment, I suspect
you're mis-interpreting my annotations to the code in my posting as Javadoc.
Never done any Javadoc in my life!
Thanks for your help Scott, your a champ.
Regards,
Patrick.
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, July 30, 2001 10:41 AM
> Subject: Question about Velocity methods and lookup tables.
>
>
> > G'day all,
> > I have a utility class that has many useful methods that I use
> > when building my context data structures. Now the
> > time has come when I would like to call getCompanyName()
> > from within my template.
> >
> > This is a cutdown version of my class:
> >
> > ------------------< class starts >-------------------------
> >
> > //******************************
> > //* Class for helper functions
> > //******************************
> >
> > [ imports cut ]
> >
> > public class helperFuncs {
> >
> > private static final String CLASS = "helperFuncs:";
> >
> > /***************************************************************
> > getCompanyName:
> > Params: ASX code - A string select statement
> > Returns: Long name of company if it exists,
> > otherwise empty string.
> > ***************************************************************/
> >
> > public static String getCompanyName(String asxCode )
> > {
> > final String METHOD = "getCompanyName:";
> > ResultSet rset = null;
> > String name;
> >
> > [ body cut ]
> >
> > return name;
> >
> > } //end function
> >
> > } //End class
> > ------------------< class ends >-------------------------
> >
> >
> > Is it is as simple as putting a reference to the helperFuncs
> > class into the velocity context?
> >
> > Also, are there any efficiency/multithreading issues when
> > putting a utility class into the context? The reason I ask
> > is because this class (helperFuncs) is used heavily throughout my
> > Turbine web application.
> >
> > Another question I have is that the code that I cut out above was
> > doing a simple 1 row select from a lookup table. This goes on
> > many times per screen. I suspect it would make much more sense
> > to put this into a HashMap as the keys are unique and
> > there are only about 1400 values, rather than continually acessing
> > the database. Is it just a matter of populating the HashMap in the
> > constructor for class helperFuncs? What scope would the HashMap need?
> >
> > Thanks in advance,
> >
> > Patrick Saunders.
> >
>
> Patrick,
>
> Note: Replying to the turbine list as it is more appropriate.
>
> What you need to do is to have a look at the pull service stuff at:
> http://jakarta.apache.org/turbine/services/pull-service.html
>
> Using this you can create your own tool that is always available
> in the context. You can define tools at different scopes and the
> threading issues dependent on the scope you decide to use. In
> your case you may be able to define a global scope tool that
> refreshes it's list of companies say once a day but retains the
> hashmap of stock codes/company names in memory.
>
> Pull tools are actually quite easy to implement and the time
> required to get the idea is very worthwhile.
>
> This is definitely one of the major plusses of turbine. You can
> define a set of pull tools and then your template designers can
> just use them wherever necessary (are you still looking for ammo
> to get those ASP worshippers off your back? :-) ).
>
> BTW: What's with the odd JavaDoc comment? Why not just
> use the proper tags?
>
> Hope this helps,
>
> Scott
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]