You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Jon Scott Stevens <jo...@latchkey.com> on 2002/02/07 06:59:37 UTC

Re: cvs commit: jakarta-velocity-dvsl/src/java/org/apache/tools/dvsl DVSLTask.java

on 2/6/02 9:40 PM, "geirm@apache.org" <ge...@apache.org> wrote:

> +                VelocityContext userContext = new VelocityContext();
> +
> +                userContext.put("inputfilename", infilename);
> +                userContext.put("outputfilename", outfilename);
> +
> +                dvsl.setUserContext( userContext );

May I suggest that if you are going to go this route that you create a $dvsl
tool and add that to the context and then provide methods
getInputFilename(), getOutputFilename()?

The reason is that once you start down this route, it is easier to point
people at the javadoc for $dvsl than it is to document each and every item
you put into the context. It is also easier to keep track of what is in the
context...

-jon


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-velocity-dvsl/src/java/org/apache/tools/dvsl DVSLTask.java

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 2/7/02 12:59 AM, "Jon Scott Stevens" <jo...@latchkey.com> wrote:

> on 2/6/02 9:40 PM, "geirm@apache.org" <ge...@apache.org> wrote:
> 
>> +                VelocityContext userContext = new VelocityContext();
>> +
>> +                userContext.put("inputfilename", infilename);
>> +                userContext.put("outputfilename", outfilename);
>> +
>> +                dvsl.setUserContext( userContext );
> 
> May I suggest that if you are going to go this route that you create a $dvsl
> tool and add that to the context and then provide methods
> getInputFilename(), getOutputFilename()?
> 
> The reason is that once you start down this route, it is easier to point
> people at the javadoc for $dvsl than it is to document each and every item
> you put into the context. It is also easier to keep track of what is in the
> context...
> 

Good point, I thought about this when doing it, and needed something to test
some ideas.

The problem is that DVSL doesn't really operate on files, it operates on a
Reader and outputs to a Writer for the most part.

The Ant task is just a shell.

So the concept of 'filename' doesn't make sense to DVSL proper.

I still think that from DVSL's point of view, this is a 'user context'
issue.

Hm. :)


(Point well taken though... I don't like magic context keys either...)

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>