You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Dishara Wijewardana <dd...@gmail.com> on 2012/07/08 20:11:11 UTC

GSoC 2012 JSR 223 impl TODOs status

TODOs

- Mainly cover basic functionality + spec compatibility (i.e throwing
different exceptions in different scenarios and etc ) on following major
classes  through unit tests.

VelocityBindings
VelocityScriptContext
VelocityScriptEngine
VelocityScriptEngineFactory

- Add complete javadoc comments to whole API. And move unnecessary comments
to inner comments.

- Writing documentation on how to use JSR 223 API . Some Hello world
example  on JSR 223 would be nice in documentation.

- Examples to include, probably based on velocity tools.

Hi claude, please add anything if I have missed.

-- 
Thanks
/Dishara

Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Dishara Wijewardana <dd...@gmail.com>.
On Thu, Aug 9, 2012 at 6:32 PM, Claude Brisson <cl...@renegat.net> wrote:

> On Tue, 7 Aug 2012 23:26:53 +0530
> Dishara Wijewardana <dd...@gmail.com> wrote:
>
> >
> > I think I got you ;-). I have commited the fix which sets and gets
> > the file name as a context attribute. And if we are doing so we have
> > to recommend users to provide the file name of the template (which is
> > on classpath) when providing the script itself.
> >
> > I also got the point of caching and will commit when the fix is ready
> > and tests passed.
> >
>
> You are right, if we're not given the script filename, we cannot do any
> caching. Please forget this for now and come back to what you had -what
> I had in mind was not to use geTemplate(), but to use a specific
> Velocity resource loader.
>
+1 and done.

>
> I looked at your VelocityScriptEngine implementation, and I have some
> remarks:
>
>  - you can factorize eval(String,ScriptContext) and
>    eval(Reader,ScriptContext) with a StringReader.
>
> Done

>  - when an exception is thrown, its stack trace should be displayed on
>    the stream returned by scriptContext.getErrorWriter()
>
> Done

>  - when scriptContext.getWriter() is null, the default writer shoud be
>    System.out (right now, the output is lost...).
>
> Done

>  - "return new ScriptException(exp)" should be:
>     throw new ScriptException(exp)
>
> Done

> That's all I see for now.
>
>   Claude
>



-- 
Thanks
/Dishara

Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Claude Brisson <cl...@renegat.net>.
On Tue, 7 Aug 2012 23:26:53 +0530
Dishara Wijewardana <dd...@gmail.com> wrote:

> 
> I think I got you ;-). I have commited the fix which sets and gets
> the file name as a context attribute. And if we are doing so we have
> to recommend users to provide the file name of the template (which is
> on classpath) when providing the script itself.
> 
> I also got the point of caching and will commit when the fix is ready
> and tests passed.
> 

You are right, if we're not given the script filename, we cannot do any
caching. Please forget this for now and come back to what you had -what
I had in mind was not to use geTemplate(), but to use a specific
Velocity resource loader.

I looked at your VelocityScriptEngine implementation, and I have some
remarks:

 - you can factorize eval(String,ScriptContext) and
   eval(Reader,ScriptContext) with a StringReader.

 - when an exception is thrown, its stack trace should be displayed on
   the stream returned by scriptContext.getErrorWriter()

 - when scriptContext.getWriter() is null, the default writer shoud be
   System.out (right now, the output is lost...).

 - "return new ScriptException(exp)" should be:
    throw new ScriptException(exp)

That's all I see for now.

  Claude

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


Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Dishara Wijewardana <dd...@gmail.com>.
On Tue, Aug 7, 2012 at 12:42 AM, Dishara Wijewardana <
ddwijewardana@gmail.com> wrote:

>
>
> On Tue, Aug 7, 2012 at 12:10 AM, Claude Brisson <cl...@renegat.net>wrote:
>
>> > > By use of the appropriate velocityEngine.evaluate() method that
>> > > takes the template as a String. It will bypass Velocity's internal
>> > > cache, but our first goal is to respect the API, then to try to
>> > > optimize.
>> > >
>> > > Speaking about it, since the engine has access to the filename, we
>> > > could try to still use the cache. Velocity's cache is here to not
>> > > only bypass the actual reading of the file, but also the parsing
>> > > process - and since the OS will already cache the file in memory,
>> > > it's the parsing of the template which is the most interesting to
>> > > avoid via the caching mechanism. Here, we're given the content of
>> > > the file at the same time as its name (via the special property
>> > > "javax.script.filename"). So we can still do some caching, by just
>> > > ignoring the newly provided content when the filename is present in
>> > > the cache.
>> > >
>> > > For this to work properly, we may have to implement our own
>> > > Velocity ResourceLoader.w
>> > >
>> >
>> > So what you basically intending is to provide an additional context
>> > parameter which has the file name of the template(so that to read it
>> > inside evaluate method and use that for
>> > velocityEngine.getTemplate(filename) ) while providing the script it
>> > self to the evaluate method ?
>>
>> See page 151 of the specs. There is a bunch of reserved property names.
>> Populating them is optional (and not always meaningful), but for our
>> caching problem, systematically filling javax.script.filename with the
>> template filename looks appropriate.
>>
>> We don't want to use the getTemplate() method, since we are already
>> given a String or a Reader towards the template. But since we also know
>> the filename it comes from, we can cache and reuse the parsed template
>> each time we get the same filename.
>>
>> Few clarifications,
>
> "since we are already given a String or a Reader towards the template" you
> meant passing String or reader to
> velocityEngine.evaluate(velocityContext, outPut, fileName, reader); ?
>
> currently what I do is
>
>                 Template template = velocityEngine.getTemplate(vm-name);
>                 template.merge(velocityContext, outPut);
>
> If I do not use velocityEngine.getTemplate(vm-name) how could I do
> the  template.merge(velocityContext, outPut); step . I think this merge
> call is the one which enrich the writer with the rendered output which we
> at the end used to print.
>
> Please correct me if I am wrong.
>

I think I got you ;-). I have commited the fix which sets and gets the file
name as a context attribute. And if we are doing so we have to recommend
users to provide the file name of the template (which is on classpath) when
providing the script itself.

I also got the point of caching and will commit when the fix is ready and
tests passed.


>
>
>> GSOC officials say <<Monday, 13 August is our soft
>> "pencils down" date. We suggest that students have completed their
>> projects by this date and spend a week writing documentation and
>> wrapping up their projects. We require that students stop all coding on
>> 20 August.>>
>>
>> It's one week from now. I think that trying to achieve this last
>> feature (Velocity resource caching based only on the filename) is a
>> reachable goal.
>>
>
> ++1
>
>
>>
>>
>>   Claude
>>
>
>
>
> --
> Thanks
> /Dishara
>
>


-- 
Thanks
/Dishara

Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Dishara Wijewardana <dd...@gmail.com>.
On Tue, Aug 7, 2012 at 12:10 AM, Claude Brisson <cl...@renegat.net> wrote:

> > > By use of the appropriate velocityEngine.evaluate() method that
> > > takes the template as a String. It will bypass Velocity's internal
> > > cache, but our first goal is to respect the API, then to try to
> > > optimize.
> > >
> > > Speaking about it, since the engine has access to the filename, we
> > > could try to still use the cache. Velocity's cache is here to not
> > > only bypass the actual reading of the file, but also the parsing
> > > process - and since the OS will already cache the file in memory,
> > > it's the parsing of the template which is the most interesting to
> > > avoid via the caching mechanism. Here, we're given the content of
> > > the file at the same time as its name (via the special property
> > > "javax.script.filename"). So we can still do some caching, by just
> > > ignoring the newly provided content when the filename is present in
> > > the cache.
> > >
> > > For this to work properly, we may have to implement our own
> > > Velocity ResourceLoader.w
> > >
> >
> > So what you basically intending is to provide an additional context
> > parameter which has the file name of the template(so that to read it
> > inside evaluate method and use that for
> > velocityEngine.getTemplate(filename) ) while providing the script it
> > self to the evaluate method ?
>
> See page 151 of the specs. There is a bunch of reserved property names.
> Populating them is optional (and not always meaningful), but for our
> caching problem, systematically filling javax.script.filename with the
> template filename looks appropriate.
>
> We don't want to use the getTemplate() method, since we are already
> given a String or a Reader towards the template. But since we also know
> the filename it comes from, we can cache and reuse the parsed template
> each time we get the same filename.
>
> Few clarifications,

"since we are already given a String or a Reader towards the template" you
meant passing String or reader to
velocityEngine.evaluate(velocityContext, outPut, fileName, reader); ?

currently what I do is

                Template template = velocityEngine.getTemplate(vm-name);
                template.merge(velocityContext, outPut);

If I do not use velocityEngine.getTemplate(vm-name) how could I do
the  template.merge(velocityContext, outPut); step . I think this merge
call is the one which enrich the writer with the rendered output which we
at the end used to print.

Please correct me if I am wrong.


> GSOC officials say <<Monday, 13 August is our soft
> "pencils down" date. We suggest that students have completed their
> projects by this date and spend a week writing documentation and
> wrapping up their projects. We require that students stop all coding on
> 20 August.>>
>
> It's one week from now. I think that trying to achieve this last
> feature (Velocity resource caching based only on the filename) is a
> reachable goal.
>

++1


>
>
>   Claude
>



-- 
Thanks
/Dishara

Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Claude Brisson <cl...@renegat.net>.
> > By use of the appropriate velocityEngine.evaluate() method that
> > takes the template as a String. It will bypass Velocity's internal
> > cache, but our first goal is to respect the API, then to try to
> > optimize.
> >
> > Speaking about it, since the engine has access to the filename, we
> > could try to still use the cache. Velocity's cache is here to not
> > only bypass the actual reading of the file, but also the parsing
> > process - and since the OS will already cache the file in memory,
> > it's the parsing of the template which is the most interesting to
> > avoid via the caching mechanism. Here, we're given the content of
> > the file at the same time as its name (via the special property
> > "javax.script.filename"). So we can still do some caching, by just
> > ignoring the newly provided content when the filename is present in
> > the cache.
> >
> > For this to work properly, we may have to implement our own
> > Velocity ResourceLoader.w
> >
> 
> So what you basically intending is to provide an additional context
> parameter which has the file name of the template(so that to read it
> inside evaluate method and use that for
> velocityEngine.getTemplate(filename) ) while providing the script it
> self to the evaluate method ?

See page 151 of the specs. There is a bunch of reserved property names.
Populating them is optional (and not always meaningful), but for our
caching problem, systematically filling javax.script.filename with the
template filename looks appropriate.

We don't want to use the getTemplate() method, since we are already
given a String or a Reader towards the template. But since we also know
the filename it comes from, we can cache and reuse the parsed template
each time we get the same filename.

GSOC officials say <<Monday, 13 August is our soft
"pencils down" date. We suggest that students have completed their
projects by this date and spend a week writing documentation and
wrapping up their projects. We require that students stop all coding on
20 August.>>

It's one week from now. I think that trying to achieve this last
feature (Velocity resource caching based only on the filename) is a
reachable goal.


  Claude

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


Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Dishara Wijewardana <dd...@gmail.com>.
On Sun, Aug 5, 2012 at 12:03 AM, Claude Brisson <cl...@renegat.net> wrote:

> > > Could this example be more generic? For instance, context could be
> > > read from a flat properties file.
> > >
> >
> > I think you meant the javax.script.ScriptContext used in this code
> > which can be get from ScriptEngine. This cannot obtain from a
> > properties file. Because this is how JSR 223 API is expected to
> > behave. And once you obtain the context from the engine you can
> > modify it by adding attributes, writers, readers and removing them.
>
> No, sorry, I meant the Velocity context. For instance, if I have a flat
> file that contains
>   foo = bar
> this would typically call velocityScriptEngine.put("foo","bar").
>
> > >> Also, concerning ScriptEngine.eval(String): the String argument
> > >> should be the content of the script itself, not the filename of
> > >> the script.
> > >>
> > >> This can be done I think. I will do the necessary changes and
> > >> commit when
> > > all tests get passed.
> > >
> >
> > One question. This has fixed (I have the patch but not comited yet)
> > except for the velocity tooling related scenario .Suppose we pass a
> > script of the .vm file to engine.
> > But internally how to obtain the template.
> > (velocityEngine.getTemplate(String)) . This method should provide the
> > template name(assuming script is in the classspath).
> > How do we deal with this when we provide the script itself ?
>


> >
>
> By use of the appropriate velocityEngine.evaluate() method that takes
> the template as a String. It will bypass Velocity's internal cache, but
> our first goal is to respect the API, then to try to optimize.
>
> Speaking about it, since the engine has access to the filename, we
> could try to still use the cache. Velocity's cache is here to not
> only bypass the actual reading of the file, but also the parsing
> process - and since the OS will already cache the file in memory,
> it's the parsing of the template which is the most interesting to
> avoid via the caching mechanism. Here, we're given the content of the
> file at the same time as its name (via the special property
> "javax.script.filename"). So we can still do some caching, by just
> ignoring the newly provided content when the filename is present in the
> cache.
>
> For this to work properly, we may have to implement our own
> Velocity ResourceLoader.w
>

So what you basically intending is to provide an additional context
parameter which has the file name of the template(so that to read it inside
evaluate method and use that for velocityEngine.getTemplate(filename)
) while providing the script it self to the evaluate method ?

>
> Did you follow my idea, Dishara? Are you ok with it?
>
>
>   Claude
>
>
>


-- 
Thanks
/Dishara

Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Claude Brisson <cl...@renegat.net>.
> > Could this example be more generic? For instance, context could be
> > read from a flat properties file.
> >  
> 
> I think you meant the javax.script.ScriptContext used in this code
> which can be get from ScriptEngine. This cannot obtain from a
> properties file. Because this is how JSR 223 API is expected to
> behave. And once you obtain the context from the engine you can
> modify it by adding attributes, writers, readers and removing them.

No, sorry, I meant the Velocity context. For instance, if I have a flat
file that contains
  foo = bar
this would typically call velocityScriptEngine.put("foo","bar"). 

> >> Also, concerning ScriptEngine.eval(String): the String argument
> >> should be the content of the script itself, not the filename of
> >> the script.
> >>
> >> This can be done I think. I will do the necessary changes and
> >> commit when
> > all tests get passed.
> >
> 
> One question. This has fixed (I have the patch but not comited yet)
> except for the velocity tooling related scenario .Suppose we pass a
> script of the .vm file to engine.
> But internally how to obtain the template.
> (velocityEngine.getTemplate(String)) . This method should provide the
> template name(assuming script is in the classspath).
> How do we deal with this when we provide the script itself ?
> 

By use of the appropriate velocityEngine.evaluate() method that takes
the template as a String. It will bypass Velocity's internal cache, but
our first goal is to respect the API, then to try to optimize.

Speaking about it, since the engine has access to the filename, we
could try to still use the cache. Velocity's cache is here to not
only bypass the actual reading of the file, but also the parsing
process - and since the OS will already cache the file in memory,
it's the parsing of the template which is the most interesting to
avoid via the caching mechanism. Here, we're given the content of the
file at the same time as its name (via the special property
"javax.script.filename"). So we can still do some caching, by just
ignoring the newly provided content when the filename is present in the
cache.

For this to work properly, we may have to implement our own
Velocity ResourceLoader.

Did you follow my idea, Dishara? Are you ok with it?


  Claude



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


Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Dishara Wijewardana <dd...@gmail.com>.
On Sat, Aug 4, 2012 at 9:41 PM, Dishara Wijewardana <ddwijewardana@gmail.com
> wrote:

>
>
> On Sat, Aug 4, 2012 at 6:02 PM, Claude Brisson <cl...@renegat.net> wrote:
>
>> Could this example be more generic? For instance, context could be read
>> from a flat properties file.
>>
>
> I think you meant the javax.script.ScriptContext used in this code which
> can be get from ScriptEngine. This cannot obtain from a properties file.
> Because this is how JSR 223 API is expected to behave. And once you obtain
> the context from the engine you can modify it by adding attributes,
> writers, readers and removing them.
>
>
>>
>> Also, concerning ScriptEngine.eval(String): the String argument should
>> be the content of the script itself, not the filename of the script.
>>
>> This can be done I think. I will do the necessary changes and commit when
> all tests get passed.
>

One question. This has fixed (I have the patch but not comited yet) except
for the velocity tooling related scenario .Suppose we pass a script of the
.vm file to engine.
But internally how to obtain the template.
(velocityEngine.getTemplate(String)) . This method should provide the
template name(assuming script is in the classspath).
How do we deal with this when we provide the script itself ?



>
>>   Claude
>>
>> On Sat, 4 Aug 2012 01:03:56 +0530
>> Dishara Wijewardana <dd...@gmail.com> wrote:
>>
>> > On Wed, Aug 1, 2012 at 11:13 AM, Dishara Wijewardana <
>> > ddwijewardana@gmail.com> wrote:
>> >
>> > > Hi Claude
>> > >
>> > > I think now I was able to get the code what you expected. And I just
>> > > basically added the template merging stuff to script engine code and
>> > > the flow went successfully ;-).
>> > > Here is how to deal with tools with the JSR 223 API.
>> > >
>> > Hi Claude,
>> > Can you verify this code whether it meets your expectations ?
>> >
>> >
>> > >          ScriptEngineManager manager = new ScriptEngineManager();
>> > >          manager.registerEngineName("velocity", new
>> > > VelocityScriptEngineFactory());
>> > >          engine = manager.getEngineByName("velocity");
>> > >
>> > >         ScriptContext context = engine.getContext();
>> > >
>> > >         Properties properties = new Properties();
>> > >         properties.put("resource.loader", "class");
>> > >         properties.put("class.resource.loader.description",
>> > > "Template Class Loader");
>> > >         properties.put("class.resource.loader.class",
>> > >                 "org.apache.velocity.runtime.resource.loader.
>> > > ClasspathResourceLoader");
>> > >
>> > >         CustomEvent event = new CustomEvent("MyEvent");
>> > >         context.getBindings(ScriptContext.ENGINE_SCOPE).put("event",
>> > > event);
>> > >         context.setAttribute(VelocityScriptEngine.VELOCITY_PROPERTIES,
>> > > properties, ScriptContext.ENGINE_SCOPE);
>> > >
>> > >         Writer writer = new StringWriter();
>> > >         context.setWriter(writer);
>> > >         engine.eval("eventtool.vm");
>> > >         System.out.println("####### Tools output
>> > > #########\n"+writer);
>> > >
>> > >
>> > > On Wed, Aug 1, 2012 at 12:34 AM, Dishara Wijewardana <
>> > > ddwijewardana@gmail.com> wrote:
>> > >
>> > >>
>> > >>
>> > >> On Mon, Jul 30, 2012 at 12:40 AM, Claude Brisson
>> > >> <cl...@renegat.net>wrote:
>> > >>
>> > >>> On Sun, 29 Jul 2012 23:57:22 +0530
>> > >>> Dishara Wijewardana <dd...@gmail.com> wrote:
>> > >>>
>> > >>> > On Sun, Jul 29, 2012 at 10:20 PM, Claude Brisson
>> > >>> > <cl...@renegat.net> wrote:
>> > >>> >
>> > >>> > > Pardon me if I'm all wrong with that, but I really thought
>> > >>> > > that in the context of the JSR 223 API, templates themselves
>> > >>> > > were considered as scripts.
>> > >>> > >
>> > >>> > > This API is a wrapper around a scripting engine, that
>> > >>> > > evaluates scripts, which in our case are Velocity templates.
>> > >>> >
>> > >>> > My question is how do we manage following methods . We need to
>> > >>> > pass a template instance or a wrapper of it in to JSR 223
>> > >>> > ScriptEngine . How to achieve this without having extensive
>> > >>> > methods in ScriptEngine API?
>> > >>> >
>> > >>> > template.merge(context, writer);
>> > >>> > ve.getTemplate(vmTemplateFile);
>> > >>>
>> > >>> The Velocity context corresponds to the JSR 223 Bindings.
>> > >>> Populating it should not be a problem.
>> > >>>
>> > >>> The evaluation itself should gather the getTemplate() step and the
>> > >>> merge() step, or use one of the VelocityEngine.evaluate() method,
>> > >>> this is already what you did in VelocityScriptEngine.eval()
>> > >>> method.
>> > >>
>> > >>
>> > >> I think now I understood what you really meant. Will provide the
>> > >> client code ASAP and also I think I have to change the
>> > >> engine.eval() method in JSR223 API.
>> > >>
>> > >>
>> > >>
>> > >>> So I
>> > >>> really don't understand why you would need other methods. But
>> > >>> maybe I'm still missing something...
>> > >>>
>> > >>> Oh, by the way, I still saw some method comments like the
>> > >>> following one in your code:
>> > >>>     /**
>> > >>>      * Added creation inside sync block to avoid creating two
>> > >>> factories from a engine by two parallel threads at the same time.
>> > >>>      * Also the additional null check out from sync block is to
>> > >>> avoid every  thread to get blocked inside it even there is an
>> > >>> already created factory. */
>> > >>>
>> > >>> so I recall you that such comments may be useful when reading the
>> > >>> code, but they should be inside the method, not as a javadoc
>> > >>> comment. Javadoc users don't care about such details. Could you
>> > >>> please do something about that?
>> > >>
>> > >>
>> > >> I thought I cleared all. Sorry for the inconvenience caused. Will
>> > >> clean them all and update.
>> > >>
>> > > Done.
>> > >
>> > >>
>> > >>
>> > >>>
>> > >>>
>> > >>>   Claude
>> > >>>
>> > >>>
>> > >>> >
>> > >>> > >
>> > >>> > >   Claude
>> > >>> > >
>> > >>> > > On Sun, 29 Jul 2012 00:52:08 +0530
>> > >>> > > Dishara Wijewardana <dd...@gmail.com> wrote:
>> > >>> > >
>> > >>> > > > On Sat, Jul 28, 2012 at 12:53 PM, Claude Brisson
>> > >>> > > > <cl...@renegat.net> wrote:
>> > >>> > > >
>> > >>> > > > > On Sat, 28 Jul 2012 11:47:35 +0530
>> > >>> > > > > Dishara Wijewardana <dd...@gmail.com> wrote:
>> > >>> > > > >
>> > >>> > > > > > On Fri, Jul 27, 2012 at 2:20 PM, Claude Brisson
>> > >>> > > > > > <cl...@renegat.net> wrote:
>> > >>> > > > > >
>> > >>> > > > > > > Well, ok, but it's still not what I asked for: I
>> > >>> > > > > > > meant a command line tool that would, of course, use
>> > >>> > > > > > > your JSR 223 API classes.
>> > >>> > > > > > >
>> > >>> > > > > > HI Claude,
>> > >>> > > > > > Sorry for the inconvenience  I made. So what you meant
>> > >>> > > > > > is do the above similar kind of thing (a client code)
>> > >>> > > > > > which would not directly goes through the velocity API
>> > >>> > > > > > but through JSR223 API ? If so in that case we would
>> > >>> > > > > > need to add additional methods to the JSR API ? IS that
>> > >>> > > > > > OK ? Is it what you expected ?
>> > >>> > > > >
>> > >>> > > > > Well, the API is meant to be used, and a command line
>> > >>> > > > > wrapper seems to me one of the simplest things we could
>> > >>> > > > > do as an example.
>> > >>> > > > >
>> > >>> > > > > Why would you need additional methods to the JSR 223 API?
>> > >>> > > > > Which methods?
>> > >>> > > > >
>> > >>> > > > JSR223 API doesn't have a concept like templates which is in
>> > >>> > > > velocity. Hence it does not have getTemplate() method.
>> > >>> > > > ( because I have simply to execute a similar example as
>> > >>> > > > given through jsr 223 API, need a getTemplate() )
>> > >>> > > >
>> > >>> > > > >
>> > >>> > > > >
>> > >>> > > > >   Claude
>> > >>> > > > >
>> > >>> > > > > >
>> > >>> > > > > > >   Claude
>> > >>> > > > > > >
>> > >>> > > > > > > On Fri, 27 Jul 2012 00:00:31 +0530
>> > >>> > > > > > > Dishara Wijewardana <dd...@gmail.com> wrote:
>> > >>> > > > > > >
>> > >>> > > > > > > > Hi Claude,
>> > >>> > > > > > > > I was finally able to got a simple code
>> > >>> > > > > > > > working :-) .
>> > >>> > > > > > > >
>> > >>> > > > > > > > public class Main {
>> > >>> > > > > > > >
>> > >>> > > > > > > >     public static void main(String[] args) throws
>> > >>> > > > > > > > Exception { VelocityContext context = new
>> > >>> > > > > > > > VelocityContext(); Writer writer = new
>> > >>> > > > > > > > StringWriter();
>> > >>> > > > > > > >
>> > >>> > > > > > > >         CustomEvent event = new
>> > >>> > > > > > > > CustomEvent("subash"); context.put("event", event);
>> > >>> > > > > > > >         Template template =
>> > >>> > > > > > > > createTemplate("eventtool.vm");
>> > >>> > > > > > > >
>> > >>> > > > > > > >         template.merge(context, writer);
>> > >>> > > > > > > >         System.out.println(writer);
>> > >>> > > > > > > >         writer.close();
>> > >>> > > > > > > >     }
>> > >>> > > > > > > >
>> > >>> > > > > > > >     private static Template createTemplate(String
>> > >>> > > > > > > > vmTemplateFile) throws Exception {
>> > >>> > > > > > > >         VelocityEngine ve = new VelocityEngine();
>> > >>> > > > > > > >         Properties properties = new Properties();
>> > >>> > > > > > > >         properties.put("resource.loader", "class");
>> > >>> > > > > > > >
>> > >>> > > properties.put("class.resource.loader.description","Template
>> > >>> > > > > > > > Class Loader");
>> > >>> > > > > > > >         properties.put("class.resource.loader.class",
>> > >>> > > > > > > >
>> > >>> > > > > > > >
>> > >>> > > > >
>> > >>>
>> "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
>> > >>> > > > > > > >         ve.init(properties);
>> > >>> > > > > > > >         return ve.getTemplate(vmTemplateFile);
>> > >>> > > > > > > >     }
>> > >>> > > > > > > >
>> > >>> > > > > > > >
>> > >>> > > > > > >
>> > >>> > > > >
>> > >>> > >
>> > >>>
>>  ---------------------------------------------------------------------------------------------------------------------------------
>> > >>> > > > > > > >
>> > >>> > > > > > > > And here is the template and the out put.
>> > >>> > > > > > > >
>> > >>> > > > > > > > *eventtool.vm*
>> > >>> > > > > > > >
>> > >>> > > > > > > > $event;
>> > >>> > > > > > > >
>> > >>> > > > > > > > Event Created by $event.getName()
>> > >>> > > > > > > > Event Created on $event.getDate()
>> > >>> > > > > > > >
>> > >>> > > > > > > >
>> > >>> > > > > > > > *Output*
>> > >>> > > > > > > > *
>> > >>> > > > > > > > *
>> > >>> > > > > > > > This is a test event template: created bysubash on
>> > >>> > > > > > > > Thu Jul 26 23:57:25 IST 2012;
>> > >>> > > > > > > >
>> > >>> > > > > > > > Event Created by subash
>> > >>> > > > > > > > Event Created on Thu Jul 26 23:57:25 IST 2012
>> > >>> > > > > > > >
>> > >>> > > > > > > >
>> > >>> > > > > > > >
>> > >>> > > > > > > > On Sun, Jul 22, 2012 at 4:54 PM, Claude Brisson
>> > >>> > > > > > > > <cl...@renegat.net> wrote:
>> > >>> > > > > > > >
>> > >>> > > > > > > > > > Did you mean Velocity maven plugin tool[1] as
>> > >>> > > > > > > > > > the command line tool ? If not can you please
>> > >>> > > > > > > > > > direct me to a link to find the example to
>> > >>> > > > > > > > > > follow. Because in the documentation page there
>> > >>> > > > > > > > > > are links to XML tool, View tool, JSP tool and
>> > >>> > > > > > > > > > etc. And couldn't find "command line tool"
>> > >>> > > > > > > > > > thing . Correct me if I am looking for
>> > >>> > > > > > > > > > irrelevant.
>> > >>> > > > > > > > > >
>> > >>> > > > > > > > > > [1] -
>> > >>> > > > > > > > > >
>> > >>> > > > > > > > >
>> > >>> > > > > > >
>> > >>> > > > >
>> > >>> > >
>> > >>>
>> http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html
>> > >>> > > > > > > > >
>> > >>> > > > > > > > > No, when I say "command line tool", I only mean a
>> > >>> > > > > > > > > plain old Java object with a "main(String
>> > >>> > > > > > > > > args[])" method, that you can call from the
>> > >>> > > > > > > > > command line...
>> > >>> > > > > > > > >
>> > >>> > > > > > > > >
>> > >>> > > > > > > > >   Claude
>> > >>> > > > > > > > >
>> > >>> > > > > > > >
>> > >>> > > > > > > >
>> > >>> > > > > > > >
>> > >>> > > > > > >
>> > >>> > > > > > >
>> > >>> > > > > >
>> > >>> > > > > >
>> > >>> > > > >
>> > >>> > > > >
>> > >>> > > >
>> > >>> > > >
>> > >>> > >
>> > >>> > >
>> > >>> >
>> > >>> >
>> > >>>
>> > >>>
>> > >>
>> > >>
>> > >> --
>> > >> Thanks
>> > >> /Dishara
>> > >>
>> > >>
>> > >
>> > >
>> > > --
>> > > Thanks
>> > > /Dishara
>> > >
>> > >
>> >
>> >
>>
>>
>
>
> --
> Thanks
> /Dishara
>
>


-- 
Thanks
/Dishara

Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Dishara Wijewardana <dd...@gmail.com>.
On Sat, Aug 4, 2012 at 6:02 PM, Claude Brisson <cl...@renegat.net> wrote:

> Could this example be more generic? For instance, context could be read
> from a flat properties file.
>

I think you meant the javax.script.ScriptContext used in this code which
can be get from ScriptEngine. This cannot obtain from a properties file.
Because this is how JSR 223 API is expected to behave. And once you obtain
the context from the engine you can modify it by adding attributes,
writers, readers and removing them.


>
> Also, concerning ScriptEngine.eval(String): the String argument should
> be the content of the script itself, not the filename of the script.
>
> This can be done I think. I will do the necessary changes and commit when
all tests get passed.

>
>   Claude
>
> On Sat, 4 Aug 2012 01:03:56 +0530
> Dishara Wijewardana <dd...@gmail.com> wrote:
>
> > On Wed, Aug 1, 2012 at 11:13 AM, Dishara Wijewardana <
> > ddwijewardana@gmail.com> wrote:
> >
> > > Hi Claude
> > >
> > > I think now I was able to get the code what you expected. And I just
> > > basically added the template merging stuff to script engine code and
> > > the flow went successfully ;-).
> > > Here is how to deal with tools with the JSR 223 API.
> > >
> > Hi Claude,
> > Can you verify this code whether it meets your expectations ?
> >
> >
> > >          ScriptEngineManager manager = new ScriptEngineManager();
> > >          manager.registerEngineName("velocity", new
> > > VelocityScriptEngineFactory());
> > >          engine = manager.getEngineByName("velocity");
> > >
> > >         ScriptContext context = engine.getContext();
> > >
> > >         Properties properties = new Properties();
> > >         properties.put("resource.loader", "class");
> > >         properties.put("class.resource.loader.description",
> > > "Template Class Loader");
> > >         properties.put("class.resource.loader.class",
> > >                 "org.apache.velocity.runtime.resource.loader.
> > > ClasspathResourceLoader");
> > >
> > >         CustomEvent event = new CustomEvent("MyEvent");
> > >         context.getBindings(ScriptContext.ENGINE_SCOPE).put("event",
> > > event);
> > >         context.setAttribute(VelocityScriptEngine.VELOCITY_PROPERTIES,
> > > properties, ScriptContext.ENGINE_SCOPE);
> > >
> > >         Writer writer = new StringWriter();
> > >         context.setWriter(writer);
> > >         engine.eval("eventtool.vm");
> > >         System.out.println("####### Tools output
> > > #########\n"+writer);
> > >
> > >
> > > On Wed, Aug 1, 2012 at 12:34 AM, Dishara Wijewardana <
> > > ddwijewardana@gmail.com> wrote:
> > >
> > >>
> > >>
> > >> On Mon, Jul 30, 2012 at 12:40 AM, Claude Brisson
> > >> <cl...@renegat.net>wrote:
> > >>
> > >>> On Sun, 29 Jul 2012 23:57:22 +0530
> > >>> Dishara Wijewardana <dd...@gmail.com> wrote:
> > >>>
> > >>> > On Sun, Jul 29, 2012 at 10:20 PM, Claude Brisson
> > >>> > <cl...@renegat.net> wrote:
> > >>> >
> > >>> > > Pardon me if I'm all wrong with that, but I really thought
> > >>> > > that in the context of the JSR 223 API, templates themselves
> > >>> > > were considered as scripts.
> > >>> > >
> > >>> > > This API is a wrapper around a scripting engine, that
> > >>> > > evaluates scripts, which in our case are Velocity templates.
> > >>> >
> > >>> > My question is how do we manage following methods . We need to
> > >>> > pass a template instance or a wrapper of it in to JSR 223
> > >>> > ScriptEngine . How to achieve this without having extensive
> > >>> > methods in ScriptEngine API?
> > >>> >
> > >>> > template.merge(context, writer);
> > >>> > ve.getTemplate(vmTemplateFile);
> > >>>
> > >>> The Velocity context corresponds to the JSR 223 Bindings.
> > >>> Populating it should not be a problem.
> > >>>
> > >>> The evaluation itself should gather the getTemplate() step and the
> > >>> merge() step, or use one of the VelocityEngine.evaluate() method,
> > >>> this is already what you did in VelocityScriptEngine.eval()
> > >>> method.
> > >>
> > >>
> > >> I think now I understood what you really meant. Will provide the
> > >> client code ASAP and also I think I have to change the
> > >> engine.eval() method in JSR223 API.
> > >>
> > >>
> > >>
> > >>> So I
> > >>> really don't understand why you would need other methods. But
> > >>> maybe I'm still missing something...
> > >>>
> > >>> Oh, by the way, I still saw some method comments like the
> > >>> following one in your code:
> > >>>     /**
> > >>>      * Added creation inside sync block to avoid creating two
> > >>> factories from a engine by two parallel threads at the same time.
> > >>>      * Also the additional null check out from sync block is to
> > >>> avoid every  thread to get blocked inside it even there is an
> > >>> already created factory. */
> > >>>
> > >>> so I recall you that such comments may be useful when reading the
> > >>> code, but they should be inside the method, not as a javadoc
> > >>> comment. Javadoc users don't care about such details. Could you
> > >>> please do something about that?
> > >>
> > >>
> > >> I thought I cleared all. Sorry for the inconvenience caused. Will
> > >> clean them all and update.
> > >>
> > > Done.
> > >
> > >>
> > >>
> > >>>
> > >>>
> > >>>   Claude
> > >>>
> > >>>
> > >>> >
> > >>> > >
> > >>> > >   Claude
> > >>> > >
> > >>> > > On Sun, 29 Jul 2012 00:52:08 +0530
> > >>> > > Dishara Wijewardana <dd...@gmail.com> wrote:
> > >>> > >
> > >>> > > > On Sat, Jul 28, 2012 at 12:53 PM, Claude Brisson
> > >>> > > > <cl...@renegat.net> wrote:
> > >>> > > >
> > >>> > > > > On Sat, 28 Jul 2012 11:47:35 +0530
> > >>> > > > > Dishara Wijewardana <dd...@gmail.com> wrote:
> > >>> > > > >
> > >>> > > > > > On Fri, Jul 27, 2012 at 2:20 PM, Claude Brisson
> > >>> > > > > > <cl...@renegat.net> wrote:
> > >>> > > > > >
> > >>> > > > > > > Well, ok, but it's still not what I asked for: I
> > >>> > > > > > > meant a command line tool that would, of course, use
> > >>> > > > > > > your JSR 223 API classes.
> > >>> > > > > > >
> > >>> > > > > > HI Claude,
> > >>> > > > > > Sorry for the inconvenience  I made. So what you meant
> > >>> > > > > > is do the above similar kind of thing (a client code)
> > >>> > > > > > which would not directly goes through the velocity API
> > >>> > > > > > but through JSR223 API ? If so in that case we would
> > >>> > > > > > need to add additional methods to the JSR API ? IS that
> > >>> > > > > > OK ? Is it what you expected ?
> > >>> > > > >
> > >>> > > > > Well, the API is meant to be used, and a command line
> > >>> > > > > wrapper seems to me one of the simplest things we could
> > >>> > > > > do as an example.
> > >>> > > > >
> > >>> > > > > Why would you need additional methods to the JSR 223 API?
> > >>> > > > > Which methods?
> > >>> > > > >
> > >>> > > > JSR223 API doesn't have a concept like templates which is in
> > >>> > > > velocity. Hence it does not have getTemplate() method.
> > >>> > > > ( because I have simply to execute a similar example as
> > >>> > > > given through jsr 223 API, need a getTemplate() )
> > >>> > > >
> > >>> > > > >
> > >>> > > > >
> > >>> > > > >   Claude
> > >>> > > > >
> > >>> > > > > >
> > >>> > > > > > >   Claude
> > >>> > > > > > >
> > >>> > > > > > > On Fri, 27 Jul 2012 00:00:31 +0530
> > >>> > > > > > > Dishara Wijewardana <dd...@gmail.com> wrote:
> > >>> > > > > > >
> > >>> > > > > > > > Hi Claude,
> > >>> > > > > > > > I was finally able to got a simple code
> > >>> > > > > > > > working :-) .
> > >>> > > > > > > >
> > >>> > > > > > > > public class Main {
> > >>> > > > > > > >
> > >>> > > > > > > >     public static void main(String[] args) throws
> > >>> > > > > > > > Exception { VelocityContext context = new
> > >>> > > > > > > > VelocityContext(); Writer writer = new
> > >>> > > > > > > > StringWriter();
> > >>> > > > > > > >
> > >>> > > > > > > >         CustomEvent event = new
> > >>> > > > > > > > CustomEvent("subash"); context.put("event", event);
> > >>> > > > > > > >         Template template =
> > >>> > > > > > > > createTemplate("eventtool.vm");
> > >>> > > > > > > >
> > >>> > > > > > > >         template.merge(context, writer);
> > >>> > > > > > > >         System.out.println(writer);
> > >>> > > > > > > >         writer.close();
> > >>> > > > > > > >     }
> > >>> > > > > > > >
> > >>> > > > > > > >     private static Template createTemplate(String
> > >>> > > > > > > > vmTemplateFile) throws Exception {
> > >>> > > > > > > >         VelocityEngine ve = new VelocityEngine();
> > >>> > > > > > > >         Properties properties = new Properties();
> > >>> > > > > > > >         properties.put("resource.loader", "class");
> > >>> > > > > > > >
> > >>> > > properties.put("class.resource.loader.description","Template
> > >>> > > > > > > > Class Loader");
> > >>> > > > > > > >         properties.put("class.resource.loader.class",
> > >>> > > > > > > >
> > >>> > > > > > > >
> > >>> > > > >
> > >>>
> "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
> > >>> > > > > > > >         ve.init(properties);
> > >>> > > > > > > >         return ve.getTemplate(vmTemplateFile);
> > >>> > > > > > > >     }
> > >>> > > > > > > >
> > >>> > > > > > > >
> > >>> > > > > > >
> > >>> > > > >
> > >>> > >
> > >>>
>  ---------------------------------------------------------------------------------------------------------------------------------
> > >>> > > > > > > >
> > >>> > > > > > > > And here is the template and the out put.
> > >>> > > > > > > >
> > >>> > > > > > > > *eventtool.vm*
> > >>> > > > > > > >
> > >>> > > > > > > > $event;
> > >>> > > > > > > >
> > >>> > > > > > > > Event Created by $event.getName()
> > >>> > > > > > > > Event Created on $event.getDate()
> > >>> > > > > > > >
> > >>> > > > > > > >
> > >>> > > > > > > > *Output*
> > >>> > > > > > > > *
> > >>> > > > > > > > *
> > >>> > > > > > > > This is a test event template: created bysubash on
> > >>> > > > > > > > Thu Jul 26 23:57:25 IST 2012;
> > >>> > > > > > > >
> > >>> > > > > > > > Event Created by subash
> > >>> > > > > > > > Event Created on Thu Jul 26 23:57:25 IST 2012
> > >>> > > > > > > >
> > >>> > > > > > > >
> > >>> > > > > > > >
> > >>> > > > > > > > On Sun, Jul 22, 2012 at 4:54 PM, Claude Brisson
> > >>> > > > > > > > <cl...@renegat.net> wrote:
> > >>> > > > > > > >
> > >>> > > > > > > > > > Did you mean Velocity maven plugin tool[1] as
> > >>> > > > > > > > > > the command line tool ? If not can you please
> > >>> > > > > > > > > > direct me to a link to find the example to
> > >>> > > > > > > > > > follow. Because in the documentation page there
> > >>> > > > > > > > > > are links to XML tool, View tool, JSP tool and
> > >>> > > > > > > > > > etc. And couldn't find "command line tool"
> > >>> > > > > > > > > > thing . Correct me if I am looking for
> > >>> > > > > > > > > > irrelevant.
> > >>> > > > > > > > > >
> > >>> > > > > > > > > > [1] -
> > >>> > > > > > > > > >
> > >>> > > > > > > > >
> > >>> > > > > > >
> > >>> > > > >
> > >>> > >
> > >>>
> http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html
> > >>> > > > > > > > >
> > >>> > > > > > > > > No, when I say "command line tool", I only mean a
> > >>> > > > > > > > > plain old Java object with a "main(String
> > >>> > > > > > > > > args[])" method, that you can call from the
> > >>> > > > > > > > > command line...
> > >>> > > > > > > > >
> > >>> > > > > > > > >
> > >>> > > > > > > > >   Claude
> > >>> > > > > > > > >
> > >>> > > > > > > >
> > >>> > > > > > > >
> > >>> > > > > > > >
> > >>> > > > > > >
> > >>> > > > > > >
> > >>> > > > > >
> > >>> > > > > >
> > >>> > > > >
> > >>> > > > >
> > >>> > > >
> > >>> > > >
> > >>> > >
> > >>> > >
> > >>> >
> > >>> >
> > >>>
> > >>>
> > >>
> > >>
> > >> --
> > >> Thanks
> > >> /Dishara
> > >>
> > >>
> > >
> > >
> > > --
> > > Thanks
> > > /Dishara
> > >
> > >
> >
> >
>
>


-- 
Thanks
/Dishara

Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Claude Brisson <cl...@renegat.net>.
Could this example be more generic? For instance, context could be read
from a flat properties file.

Also, concerning ScriptEngine.eval(String): the String argument should
be the content of the script itself, not the filename of the script.


  Claude

On Sat, 4 Aug 2012 01:03:56 +0530
Dishara Wijewardana <dd...@gmail.com> wrote:

> On Wed, Aug 1, 2012 at 11:13 AM, Dishara Wijewardana <
> ddwijewardana@gmail.com> wrote:
> 
> > Hi Claude
> >
> > I think now I was able to get the code what you expected. And I just
> > basically added the template merging stuff to script engine code and
> > the flow went successfully ;-).
> > Here is how to deal with tools with the JSR 223 API.
> >
> Hi Claude,
> Can you verify this code whether it meets your expectations ?
> 
> 
> >          ScriptEngineManager manager = new ScriptEngineManager();
> >          manager.registerEngineName("velocity", new
> > VelocityScriptEngineFactory());
> >          engine = manager.getEngineByName("velocity");
> >
> >         ScriptContext context = engine.getContext();
> >
> >         Properties properties = new Properties();
> >         properties.put("resource.loader", "class");
> >         properties.put("class.resource.loader.description",
> > "Template Class Loader");
> >         properties.put("class.resource.loader.class",
> >                 "org.apache.velocity.runtime.resource.loader.
> > ClasspathResourceLoader");
> >
> >         CustomEvent event = new CustomEvent("MyEvent");
> >         context.getBindings(ScriptContext.ENGINE_SCOPE).put("event",
> > event);
> >         context.setAttribute(VelocityScriptEngine.VELOCITY_PROPERTIES,
> > properties, ScriptContext.ENGINE_SCOPE);
> >
> >         Writer writer = new StringWriter();
> >         context.setWriter(writer);
> >         engine.eval("eventtool.vm");
> >         System.out.println("####### Tools output
> > #########\n"+writer);
> >
> >
> > On Wed, Aug 1, 2012 at 12:34 AM, Dishara Wijewardana <
> > ddwijewardana@gmail.com> wrote:
> >
> >>
> >>
> >> On Mon, Jul 30, 2012 at 12:40 AM, Claude Brisson
> >> <cl...@renegat.net>wrote:
> >>
> >>> On Sun, 29 Jul 2012 23:57:22 +0530
> >>> Dishara Wijewardana <dd...@gmail.com> wrote:
> >>>
> >>> > On Sun, Jul 29, 2012 at 10:20 PM, Claude Brisson
> >>> > <cl...@renegat.net> wrote:
> >>> >
> >>> > > Pardon me if I'm all wrong with that, but I really thought
> >>> > > that in the context of the JSR 223 API, templates themselves
> >>> > > were considered as scripts.
> >>> > >
> >>> > > This API is a wrapper around a scripting engine, that
> >>> > > evaluates scripts, which in our case are Velocity templates.
> >>> >
> >>> > My question is how do we manage following methods . We need to
> >>> > pass a template instance or a wrapper of it in to JSR 223
> >>> > ScriptEngine . How to achieve this without having extensive
> >>> > methods in ScriptEngine API?
> >>> >
> >>> > template.merge(context, writer);
> >>> > ve.getTemplate(vmTemplateFile);
> >>>
> >>> The Velocity context corresponds to the JSR 223 Bindings.
> >>> Populating it should not be a problem.
> >>>
> >>> The evaluation itself should gather the getTemplate() step and the
> >>> merge() step, or use one of the VelocityEngine.evaluate() method,
> >>> this is already what you did in VelocityScriptEngine.eval()
> >>> method.
> >>
> >>
> >> I think now I understood what you really meant. Will provide the
> >> client code ASAP and also I think I have to change the
> >> engine.eval() method in JSR223 API.
> >>
> >>
> >>
> >>> So I
> >>> really don't understand why you would need other methods. But
> >>> maybe I'm still missing something...
> >>>
> >>> Oh, by the way, I still saw some method comments like the
> >>> following one in your code:
> >>>     /**
> >>>      * Added creation inside sync block to avoid creating two
> >>> factories from a engine by two parallel threads at the same time.
> >>>      * Also the additional null check out from sync block is to
> >>> avoid every  thread to get blocked inside it even there is an
> >>> already created factory. */
> >>>
> >>> so I recall you that such comments may be useful when reading the
> >>> code, but they should be inside the method, not as a javadoc
> >>> comment. Javadoc users don't care about such details. Could you
> >>> please do something about that?
> >>
> >>
> >> I thought I cleared all. Sorry for the inconvenience caused. Will
> >> clean them all and update.
> >>
> > Done.
> >
> >>
> >>
> >>>
> >>>
> >>>   Claude
> >>>
> >>>
> >>> >
> >>> > >
> >>> > >   Claude
> >>> > >
> >>> > > On Sun, 29 Jul 2012 00:52:08 +0530
> >>> > > Dishara Wijewardana <dd...@gmail.com> wrote:
> >>> > >
> >>> > > > On Sat, Jul 28, 2012 at 12:53 PM, Claude Brisson
> >>> > > > <cl...@renegat.net> wrote:
> >>> > > >
> >>> > > > > On Sat, 28 Jul 2012 11:47:35 +0530
> >>> > > > > Dishara Wijewardana <dd...@gmail.com> wrote:
> >>> > > > >
> >>> > > > > > On Fri, Jul 27, 2012 at 2:20 PM, Claude Brisson
> >>> > > > > > <cl...@renegat.net> wrote:
> >>> > > > > >
> >>> > > > > > > Well, ok, but it's still not what I asked for: I
> >>> > > > > > > meant a command line tool that would, of course, use
> >>> > > > > > > your JSR 223 API classes.
> >>> > > > > > >
> >>> > > > > > HI Claude,
> >>> > > > > > Sorry for the inconvenience  I made. So what you meant
> >>> > > > > > is do the above similar kind of thing (a client code)
> >>> > > > > > which would not directly goes through the velocity API
> >>> > > > > > but through JSR223 API ? If so in that case we would
> >>> > > > > > need to add additional methods to the JSR API ? IS that
> >>> > > > > > OK ? Is it what you expected ?
> >>> > > > >
> >>> > > > > Well, the API is meant to be used, and a command line
> >>> > > > > wrapper seems to me one of the simplest things we could
> >>> > > > > do as an example.
> >>> > > > >
> >>> > > > > Why would you need additional methods to the JSR 223 API?
> >>> > > > > Which methods?
> >>> > > > >
> >>> > > > JSR223 API doesn't have a concept like templates which is in
> >>> > > > velocity. Hence it does not have getTemplate() method.
> >>> > > > ( because I have simply to execute a similar example as
> >>> > > > given through jsr 223 API, need a getTemplate() )
> >>> > > >
> >>> > > > >
> >>> > > > >
> >>> > > > >   Claude
> >>> > > > >
> >>> > > > > >
> >>> > > > > > >   Claude
> >>> > > > > > >
> >>> > > > > > > On Fri, 27 Jul 2012 00:00:31 +0530
> >>> > > > > > > Dishara Wijewardana <dd...@gmail.com> wrote:
> >>> > > > > > >
> >>> > > > > > > > Hi Claude,
> >>> > > > > > > > I was finally able to got a simple code
> >>> > > > > > > > working :-) .
> >>> > > > > > > >
> >>> > > > > > > > public class Main {
> >>> > > > > > > >
> >>> > > > > > > >     public static void main(String[] args) throws
> >>> > > > > > > > Exception { VelocityContext context = new
> >>> > > > > > > > VelocityContext(); Writer writer = new
> >>> > > > > > > > StringWriter();
> >>> > > > > > > >
> >>> > > > > > > >         CustomEvent event = new
> >>> > > > > > > > CustomEvent("subash"); context.put("event", event);
> >>> > > > > > > >         Template template =
> >>> > > > > > > > createTemplate("eventtool.vm");
> >>> > > > > > > >
> >>> > > > > > > >         template.merge(context, writer);
> >>> > > > > > > >         System.out.println(writer);
> >>> > > > > > > >         writer.close();
> >>> > > > > > > >     }
> >>> > > > > > > >
> >>> > > > > > > >     private static Template createTemplate(String
> >>> > > > > > > > vmTemplateFile) throws Exception {
> >>> > > > > > > >         VelocityEngine ve = new VelocityEngine();
> >>> > > > > > > >         Properties properties = new Properties();
> >>> > > > > > > >         properties.put("resource.loader", "class");
> >>> > > > > > > >
> >>> > > properties.put("class.resource.loader.description","Template
> >>> > > > > > > > Class Loader");
> >>> > > > > > > >         properties.put("class.resource.loader.class",
> >>> > > > > > > >
> >>> > > > > > > >
> >>> > > > >
> >>> "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
> >>> > > > > > > >         ve.init(properties);
> >>> > > > > > > >         return ve.getTemplate(vmTemplateFile);
> >>> > > > > > > >     }
> >>> > > > > > > >
> >>> > > > > > > >
> >>> > > > > > >
> >>> > > > >
> >>> > >
> >>>  ---------------------------------------------------------------------------------------------------------------------------------
> >>> > > > > > > >
> >>> > > > > > > > And here is the template and the out put.
> >>> > > > > > > >
> >>> > > > > > > > *eventtool.vm*
> >>> > > > > > > >
> >>> > > > > > > > $event;
> >>> > > > > > > >
> >>> > > > > > > > Event Created by $event.getName()
> >>> > > > > > > > Event Created on $event.getDate()
> >>> > > > > > > >
> >>> > > > > > > >
> >>> > > > > > > > *Output*
> >>> > > > > > > > *
> >>> > > > > > > > *
> >>> > > > > > > > This is a test event template: created bysubash on
> >>> > > > > > > > Thu Jul 26 23:57:25 IST 2012;
> >>> > > > > > > >
> >>> > > > > > > > Event Created by subash
> >>> > > > > > > > Event Created on Thu Jul 26 23:57:25 IST 2012
> >>> > > > > > > >
> >>> > > > > > > >
> >>> > > > > > > >
> >>> > > > > > > > On Sun, Jul 22, 2012 at 4:54 PM, Claude Brisson
> >>> > > > > > > > <cl...@renegat.net> wrote:
> >>> > > > > > > >
> >>> > > > > > > > > > Did you mean Velocity maven plugin tool[1] as
> >>> > > > > > > > > > the command line tool ? If not can you please
> >>> > > > > > > > > > direct me to a link to find the example to
> >>> > > > > > > > > > follow. Because in the documentation page there
> >>> > > > > > > > > > are links to XML tool, View tool, JSP tool and
> >>> > > > > > > > > > etc. And couldn't find "command line tool"
> >>> > > > > > > > > > thing . Correct me if I am looking for
> >>> > > > > > > > > > irrelevant.
> >>> > > > > > > > > >
> >>> > > > > > > > > > [1] -
> >>> > > > > > > > > >
> >>> > > > > > > > >
> >>> > > > > > >
> >>> > > > >
> >>> > >
> >>> http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html
> >>> > > > > > > > >
> >>> > > > > > > > > No, when I say "command line tool", I only mean a
> >>> > > > > > > > > plain old Java object with a "main(String
> >>> > > > > > > > > args[])" method, that you can call from the
> >>> > > > > > > > > command line...
> >>> > > > > > > > >
> >>> > > > > > > > >
> >>> > > > > > > > >   Claude
> >>> > > > > > > > >
> >>> > > > > > > >
> >>> > > > > > > >
> >>> > > > > > > >
> >>> > > > > > >
> >>> > > > > > >
> >>> > > > > >
> >>> > > > > >
> >>> > > > >
> >>> > > > >
> >>> > > >
> >>> > > >
> >>> > >
> >>> > >
> >>> >
> >>> >
> >>>
> >>>
> >>
> >>
> >> --
> >> Thanks
> >> /Dishara
> >>
> >>
> >
> >
> > --
> > Thanks
> > /Dishara
> >
> >
> 
> 


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


Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Dishara Wijewardana <dd...@gmail.com>.
On Wed, Aug 1, 2012 at 11:13 AM, Dishara Wijewardana <
ddwijewardana@gmail.com> wrote:

> Hi Claude
>
> I think now I was able to get the code what you expected. And I just
> basically added the template merging stuff to script engine code and
> the flow went successfully ;-).
> Here is how to deal with tools with the JSR 223 API.
>
Hi Claude,
Can you verify this code whether it meets your expectations ?


>          ScriptEngineManager manager = new ScriptEngineManager();
>          manager.registerEngineName("velocity", new
> VelocityScriptEngineFactory());
>          engine = manager.getEngineByName("velocity");
>
>         ScriptContext context = engine.getContext();
>
>         Properties properties = new Properties();
>         properties.put("resource.loader", "class");
>         properties.put("class.resource.loader.description", "Template
> Class Loader");
>         properties.put("class.resource.loader.class",
>                 "org.apache.velocity.runtime.resource.loader.
> ClasspathResourceLoader");
>
>         CustomEvent event = new CustomEvent("MyEvent");
>         context.getBindings(ScriptContext.ENGINE_SCOPE).put("event",
> event);
>         context.setAttribute(VelocityScriptEngine.VELOCITY_PROPERTIES,
> properties, ScriptContext.ENGINE_SCOPE);
>
>         Writer writer = new StringWriter();
>         context.setWriter(writer);
>         engine.eval("eventtool.vm");
>         System.out.println("####### Tools output #########\n"+writer);
>
>
> On Wed, Aug 1, 2012 at 12:34 AM, Dishara Wijewardana <
> ddwijewardana@gmail.com> wrote:
>
>>
>>
>> On Mon, Jul 30, 2012 at 12:40 AM, Claude Brisson <cl...@renegat.net>wrote:
>>
>>> On Sun, 29 Jul 2012 23:57:22 +0530
>>> Dishara Wijewardana <dd...@gmail.com> wrote:
>>>
>>> > On Sun, Jul 29, 2012 at 10:20 PM, Claude Brisson <cl...@renegat.net>
>>> > wrote:
>>> >
>>> > > Pardon me if I'm all wrong with that, but I really thought that in
>>> > > the context of the JSR 223 API, templates themselves were
>>> > > considered as scripts.
>>> > >
>>> > > This API is a wrapper around a scripting engine, that evaluates
>>> > > scripts, which in our case are Velocity templates.
>>> >
>>> > My question is how do we manage following methods . We need to pass a
>>> > template instance or a wrapper of it in to JSR 223 ScriptEngine . How
>>> > to achieve this without having extensive methods in ScriptEngine API?
>>> >
>>> > template.merge(context, writer);
>>> > ve.getTemplate(vmTemplateFile);
>>>
>>> The Velocity context corresponds to the JSR 223 Bindings. Populating it
>>> should not be a problem.
>>>
>>> The evaluation itself should gather the getTemplate() step and the
>>> merge() step, or use one of the VelocityEngine.evaluate() method, this
>>> is already what you did in VelocityScriptEngine.eval() method.
>>
>>
>> I think now I understood what you really meant. Will provide the client
>> code ASAP and also I think I have to change the engine.eval() method
>> in JSR223 API.
>>
>>
>>
>>> So I
>>> really don't understand why you would need other methods. But maybe I'm
>>> still missing something...
>>>
>>> Oh, by the way, I still saw some method comments like the following one
>>> in your code:
>>>     /**
>>>      * Added creation inside sync block to avoid creating two factories
>>> from a engine by two parallel threads at the same time.
>>>      * Also the additional null check out from sync block is to avoid
>>> every  thread to get blocked inside it even there is an already created
>>> factory. */
>>>
>>> so I recall you that such comments may be useful when reading the code,
>>> but they should be inside the method, not as a javadoc comment. Javadoc
>>> users don't care about such details. Could you please do something
>>> about that?
>>
>>
>> I thought I cleared all. Sorry for the inconvenience caused. Will clean
>> them all and update.
>>
> Done.
>
>>
>>
>>>
>>>
>>>   Claude
>>>
>>>
>>> >
>>> > >
>>> > >   Claude
>>> > >
>>> > > On Sun, 29 Jul 2012 00:52:08 +0530
>>> > > Dishara Wijewardana <dd...@gmail.com> wrote:
>>> > >
>>> > > > On Sat, Jul 28, 2012 at 12:53 PM, Claude Brisson
>>> > > > <cl...@renegat.net> wrote:
>>> > > >
>>> > > > > On Sat, 28 Jul 2012 11:47:35 +0530
>>> > > > > Dishara Wijewardana <dd...@gmail.com> wrote:
>>> > > > >
>>> > > > > > On Fri, Jul 27, 2012 at 2:20 PM, Claude Brisson
>>> > > > > > <cl...@renegat.net> wrote:
>>> > > > > >
>>> > > > > > > Well, ok, but it's still not what I asked for: I meant a
>>> > > > > > > command line tool that would, of course, use your JSR 223
>>> > > > > > > API classes.
>>> > > > > > >
>>> > > > > > HI Claude,
>>> > > > > > Sorry for the inconvenience  I made. So what you meant is do
>>> > > > > > the above similar kind of thing (a client code) which would
>>> > > > > > not directly goes through the velocity API but through JSR223
>>> > > > > > API ? If so in that case we would need to add additional
>>> > > > > > methods to the JSR API ? IS that OK ? Is it what you
>>> > > > > > expected ?
>>> > > > >
>>> > > > > Well, the API is meant to be used, and a command line wrapper
>>> > > > > seems to me one of the simplest things we could do as an
>>> > > > > example.
>>> > > > >
>>> > > > > Why would you need additional methods to the JSR 223 API? Which
>>> > > > > methods?
>>> > > > >
>>> > > > JSR223 API doesn't have a concept like templates which is in
>>> > > > velocity. Hence it does not have getTemplate() method. ( because
>>> > > > I have simply to execute a similar example as given through jsr
>>> > > > 223 API, need a getTemplate() )
>>> > > >
>>> > > > >
>>> > > > >
>>> > > > >   Claude
>>> > > > >
>>> > > > > >
>>> > > > > > >   Claude
>>> > > > > > >
>>> > > > > > > On Fri, 27 Jul 2012 00:00:31 +0530
>>> > > > > > > Dishara Wijewardana <dd...@gmail.com> wrote:
>>> > > > > > >
>>> > > > > > > > Hi Claude,
>>> > > > > > > > I was finally able to got a simple code working :-) .
>>> > > > > > > >
>>> > > > > > > > public class Main {
>>> > > > > > > >
>>> > > > > > > >     public static void main(String[] args) throws
>>> > > > > > > > Exception { VelocityContext context = new
>>> > > > > > > > VelocityContext(); Writer writer = new StringWriter();
>>> > > > > > > >
>>> > > > > > > >         CustomEvent event = new CustomEvent("subash");
>>> > > > > > > >         context.put("event", event);
>>> > > > > > > >         Template template =
>>> > > > > > > > createTemplate("eventtool.vm");
>>> > > > > > > >
>>> > > > > > > >         template.merge(context, writer);
>>> > > > > > > >         System.out.println(writer);
>>> > > > > > > >         writer.close();
>>> > > > > > > >     }
>>> > > > > > > >
>>> > > > > > > >     private static Template createTemplate(String
>>> > > > > > > > vmTemplateFile) throws Exception {
>>> > > > > > > >         VelocityEngine ve = new VelocityEngine();
>>> > > > > > > >         Properties properties = new Properties();
>>> > > > > > > >         properties.put("resource.loader", "class");
>>> > > > > > > >
>>> > > properties.put("class.resource.loader.description","Template
>>> > > > > > > > Class Loader");
>>> > > > > > > >         properties.put("class.resource.loader.class",
>>> > > > > > > >
>>> > > > > > > >
>>> > > > >
>>> "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
>>> > > > > > > >         ve.init(properties);
>>> > > > > > > >         return ve.getTemplate(vmTemplateFile);
>>> > > > > > > >     }
>>> > > > > > > >
>>> > > > > > > >
>>> > > > > > >
>>> > > > >
>>> > >
>>>  ---------------------------------------------------------------------------------------------------------------------------------
>>> > > > > > > >
>>> > > > > > > > And here is the template and the out put.
>>> > > > > > > >
>>> > > > > > > > *eventtool.vm*
>>> > > > > > > >
>>> > > > > > > > $event;
>>> > > > > > > >
>>> > > > > > > > Event Created by $event.getName()
>>> > > > > > > > Event Created on $event.getDate()
>>> > > > > > > >
>>> > > > > > > >
>>> > > > > > > > *Output*
>>> > > > > > > > *
>>> > > > > > > > *
>>> > > > > > > > This is a test event template: created bysubash on Thu
>>> > > > > > > > Jul 26 23:57:25 IST 2012;
>>> > > > > > > >
>>> > > > > > > > Event Created by subash
>>> > > > > > > > Event Created on Thu Jul 26 23:57:25 IST 2012
>>> > > > > > > >
>>> > > > > > > >
>>> > > > > > > >
>>> > > > > > > > On Sun, Jul 22, 2012 at 4:54 PM, Claude Brisson
>>> > > > > > > > <cl...@renegat.net> wrote:
>>> > > > > > > >
>>> > > > > > > > > > Did you mean Velocity maven plugin tool[1] as the
>>> > > > > > > > > > command line tool ? If not can you please direct me
>>> > > > > > > > > > to a link to find the example to follow. Because in
>>> > > > > > > > > > the documentation page there are links to XML tool,
>>> > > > > > > > > > View tool, JSP tool and etc. And couldn't find
>>> > > > > > > > > > "command line tool" thing . Correct me if I am
>>> > > > > > > > > > looking for irrelevant.
>>> > > > > > > > > >
>>> > > > > > > > > > [1] -
>>> > > > > > > > > >
>>> > > > > > > > >
>>> > > > > > >
>>> > > > >
>>> > >
>>> http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html
>>> > > > > > > > >
>>> > > > > > > > > No, when I say "command line tool", I only mean a plain
>>> > > > > > > > > old Java object with a "main(String args[])" method,
>>> > > > > > > > > that you can call from the command line...
>>> > > > > > > > >
>>> > > > > > > > >
>>> > > > > > > > >   Claude
>>> > > > > > > > >
>>> > > > > > > >
>>> > > > > > > >
>>> > > > > > > >
>>> > > > > > >
>>> > > > > > >
>>> > > > > >
>>> > > > > >
>>> > > > >
>>> > > > >
>>> > > >
>>> > > >
>>> > >
>>> > >
>>> >
>>> >
>>>
>>>
>>
>>
>> --
>> Thanks
>> /Dishara
>>
>>
>
>
> --
> Thanks
> /Dishara
>
>


-- 
Thanks
/Dishara

Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Dishara Wijewardana <dd...@gmail.com>.
Hi Claude

I think now I was able to get the code what you expected. And I just
basically added the template merging stuff to script engine code and
the flow went successfully ;-).
Here is how to deal with tools with the JSR 223 API.

         ScriptEngineManager manager = new ScriptEngineManager();
         manager.registerEngineName("velocity", new
VelocityScriptEngineFactory());
         engine = manager.getEngineByName("velocity");

        ScriptContext context = engine.getContext();

        Properties properties = new Properties();
        properties.put("resource.loader", "class");
        properties.put("class.resource.loader.description", "Template Class
Loader");
        properties.put("class.resource.loader.class",
                "org.apache.velocity.runtime.resource.loader.
ClasspathResourceLoader");

        CustomEvent event = new CustomEvent("MyEvent");
        context.getBindings(ScriptContext.ENGINE_SCOPE).put("event", event);
        context.setAttribute(VelocityScriptEngine.VELOCITY_PROPERTIES,
properties, ScriptContext.ENGINE_SCOPE);
        Writer writer = new StringWriter();
        context.setWriter(writer);
        engine.eval("eventtool.vm");
        System.out.println("####### Tools output #########\n"+writer);


On Wed, Aug 1, 2012 at 12:34 AM, Dishara Wijewardana <
ddwijewardana@gmail.com> wrote:

>
>
> On Mon, Jul 30, 2012 at 12:40 AM, Claude Brisson <cl...@renegat.net>wrote:
>
>> On Sun, 29 Jul 2012 23:57:22 +0530
>> Dishara Wijewardana <dd...@gmail.com> wrote:
>>
>> > On Sun, Jul 29, 2012 at 10:20 PM, Claude Brisson <cl...@renegat.net>
>> > wrote:
>> >
>> > > Pardon me if I'm all wrong with that, but I really thought that in
>> > > the context of the JSR 223 API, templates themselves were
>> > > considered as scripts.
>> > >
>> > > This API is a wrapper around a scripting engine, that evaluates
>> > > scripts, which in our case are Velocity templates.
>> >
>> > My question is how do we manage following methods . We need to pass a
>> > template instance or a wrapper of it in to JSR 223 ScriptEngine . How
>> > to achieve this without having extensive methods in ScriptEngine API?
>> >
>> > template.merge(context, writer);
>> > ve.getTemplate(vmTemplateFile);
>>
>> The Velocity context corresponds to the JSR 223 Bindings. Populating it
>> should not be a problem.
>>
>> The evaluation itself should gather the getTemplate() step and the
>> merge() step, or use one of the VelocityEngine.evaluate() method, this
>> is already what you did in VelocityScriptEngine.eval() method.
>
>
> I think now I understood what you really meant. Will provide the client
> code ASAP and also I think I have to change the engine.eval() method
> in JSR223 API.
>
>
>
>> So I
>> really don't understand why you would need other methods. But maybe I'm
>> still missing something...
>>
>> Oh, by the way, I still saw some method comments like the following one
>> in your code:
>>     /**
>>      * Added creation inside sync block to avoid creating two factories
>> from a engine by two parallel threads at the same time.
>>      * Also the additional null check out from sync block is to avoid
>> every  thread to get blocked inside it even there is an already created
>> factory. */
>>
>> so I recall you that such comments may be useful when reading the code,
>> but they should be inside the method, not as a javadoc comment. Javadoc
>> users don't care about such details. Could you please do something
>> about that?
>
>
> I thought I cleared all. Sorry for the inconvenience caused. Will clean
> them all and update.
>
Done.

>
>
>>
>>
>>   Claude
>>
>>
>> >
>> > >
>> > >   Claude
>> > >
>> > > On Sun, 29 Jul 2012 00:52:08 +0530
>> > > Dishara Wijewardana <dd...@gmail.com> wrote:
>> > >
>> > > > On Sat, Jul 28, 2012 at 12:53 PM, Claude Brisson
>> > > > <cl...@renegat.net> wrote:
>> > > >
>> > > > > On Sat, 28 Jul 2012 11:47:35 +0530
>> > > > > Dishara Wijewardana <dd...@gmail.com> wrote:
>> > > > >
>> > > > > > On Fri, Jul 27, 2012 at 2:20 PM, Claude Brisson
>> > > > > > <cl...@renegat.net> wrote:
>> > > > > >
>> > > > > > > Well, ok, but it's still not what I asked for: I meant a
>> > > > > > > command line tool that would, of course, use your JSR 223
>> > > > > > > API classes.
>> > > > > > >
>> > > > > > HI Claude,
>> > > > > > Sorry for the inconvenience  I made. So what you meant is do
>> > > > > > the above similar kind of thing (a client code) which would
>> > > > > > not directly goes through the velocity API but through JSR223
>> > > > > > API ? If so in that case we would need to add additional
>> > > > > > methods to the JSR API ? IS that OK ? Is it what you
>> > > > > > expected ?
>> > > > >
>> > > > > Well, the API is meant to be used, and a command line wrapper
>> > > > > seems to me one of the simplest things we could do as an
>> > > > > example.
>> > > > >
>> > > > > Why would you need additional methods to the JSR 223 API? Which
>> > > > > methods?
>> > > > >
>> > > > JSR223 API doesn't have a concept like templates which is in
>> > > > velocity. Hence it does not have getTemplate() method. ( because
>> > > > I have simply to execute a similar example as given through jsr
>> > > > 223 API, need a getTemplate() )
>> > > >
>> > > > >
>> > > > >
>> > > > >   Claude
>> > > > >
>> > > > > >
>> > > > > > >   Claude
>> > > > > > >
>> > > > > > > On Fri, 27 Jul 2012 00:00:31 +0530
>> > > > > > > Dishara Wijewardana <dd...@gmail.com> wrote:
>> > > > > > >
>> > > > > > > > Hi Claude,
>> > > > > > > > I was finally able to got a simple code working :-) .
>> > > > > > > >
>> > > > > > > > public class Main {
>> > > > > > > >
>> > > > > > > >     public static void main(String[] args) throws
>> > > > > > > > Exception { VelocityContext context = new
>> > > > > > > > VelocityContext(); Writer writer = new StringWriter();
>> > > > > > > >
>> > > > > > > >         CustomEvent event = new CustomEvent("subash");
>> > > > > > > >         context.put("event", event);
>> > > > > > > >         Template template =
>> > > > > > > > createTemplate("eventtool.vm");
>> > > > > > > >
>> > > > > > > >         template.merge(context, writer);
>> > > > > > > >         System.out.println(writer);
>> > > > > > > >         writer.close();
>> > > > > > > >     }
>> > > > > > > >
>> > > > > > > >     private static Template createTemplate(String
>> > > > > > > > vmTemplateFile) throws Exception {
>> > > > > > > >         VelocityEngine ve = new VelocityEngine();
>> > > > > > > >         Properties properties = new Properties();
>> > > > > > > >         properties.put("resource.loader", "class");
>> > > > > > > >
>> > > properties.put("class.resource.loader.description","Template
>> > > > > > > > Class Loader");
>> > > > > > > >         properties.put("class.resource.loader.class",
>> > > > > > > >
>> > > > > > > >
>> > > > >
>> "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
>> > > > > > > >         ve.init(properties);
>> > > > > > > >         return ve.getTemplate(vmTemplateFile);
>> > > > > > > >     }
>> > > > > > > >
>> > > > > > > >
>> > > > > > >
>> > > > >
>> > >
>>  ---------------------------------------------------------------------------------------------------------------------------------
>> > > > > > > >
>> > > > > > > > And here is the template and the out put.
>> > > > > > > >
>> > > > > > > > *eventtool.vm*
>> > > > > > > >
>> > > > > > > > $event;
>> > > > > > > >
>> > > > > > > > Event Created by $event.getName()
>> > > > > > > > Event Created on $event.getDate()
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > *Output*
>> > > > > > > > *
>> > > > > > > > *
>> > > > > > > > This is a test event template: created bysubash on Thu
>> > > > > > > > Jul 26 23:57:25 IST 2012;
>> > > > > > > >
>> > > > > > > > Event Created by subash
>> > > > > > > > Event Created on Thu Jul 26 23:57:25 IST 2012
>> > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > On Sun, Jul 22, 2012 at 4:54 PM, Claude Brisson
>> > > > > > > > <cl...@renegat.net> wrote:
>> > > > > > > >
>> > > > > > > > > > Did you mean Velocity maven plugin tool[1] as the
>> > > > > > > > > > command line tool ? If not can you please direct me
>> > > > > > > > > > to a link to find the example to follow. Because in
>> > > > > > > > > > the documentation page there are links to XML tool,
>> > > > > > > > > > View tool, JSP tool and etc. And couldn't find
>> > > > > > > > > > "command line tool" thing . Correct me if I am
>> > > > > > > > > > looking for irrelevant.
>> > > > > > > > > >
>> > > > > > > > > > [1] -
>> > > > > > > > > >
>> > > > > > > > >
>> > > > > > >
>> > > > >
>> > >
>> http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html
>> > > > > > > > >
>> > > > > > > > > No, when I say "command line tool", I only mean a plain
>> > > > > > > > > old Java object with a "main(String args[])" method,
>> > > > > > > > > that you can call from the command line...
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > >   Claude
>> > > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > >
>> > > > > >
>> > > > >
>> > > > >
>> > > >
>> > > >
>> > >
>> > >
>> >
>> >
>>
>>
>
>
> --
> Thanks
> /Dishara
>
>


-- 
Thanks
/Dishara

Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Dishara Wijewardana <dd...@gmail.com>.
On Mon, Jul 30, 2012 at 12:40 AM, Claude Brisson <cl...@renegat.net> wrote:

> On Sun, 29 Jul 2012 23:57:22 +0530
> Dishara Wijewardana <dd...@gmail.com> wrote:
>
> > On Sun, Jul 29, 2012 at 10:20 PM, Claude Brisson <cl...@renegat.net>
> > wrote:
> >
> > > Pardon me if I'm all wrong with that, but I really thought that in
> > > the context of the JSR 223 API, templates themselves were
> > > considered as scripts.
> > >
> > > This API is a wrapper around a scripting engine, that evaluates
> > > scripts, which in our case are Velocity templates.
> >
> > My question is how do we manage following methods . We need to pass a
> > template instance or a wrapper of it in to JSR 223 ScriptEngine . How
> > to achieve this without having extensive methods in ScriptEngine API?
> >
> > template.merge(context, writer);
> > ve.getTemplate(vmTemplateFile);
>
> The Velocity context corresponds to the JSR 223 Bindings. Populating it
> should not be a problem.
>
> The evaluation itself should gather the getTemplate() step and the
> merge() step, or use one of the VelocityEngine.evaluate() method, this
> is already what you did in VelocityScriptEngine.eval() method.


I think now I understood what you really meant. Will provide the client
code ASAP and also I think I have to change the engine.eval() method
in JSR223 API.



> So I
> really don't understand why you would need other methods. But maybe I'm
> still missing something...
>
> Oh, by the way, I still saw some method comments like the following one
> in your code:
>     /**
>      * Added creation inside sync block to avoid creating two factories
> from a engine by two parallel threads at the same time.
>      * Also the additional null check out from sync block is to avoid
> every  thread to get blocked inside it even there is an already created
> factory. */
>
> so I recall you that such comments may be useful when reading the code,
> but they should be inside the method, not as a javadoc comment. Javadoc
> users don't care about such details. Could you please do something
> about that?


I thought I cleared all. Sorry for the inconvenience caused. Will clean
them all and update.


>
>
>   Claude
>
>
> >
> > >
> > >   Claude
> > >
> > > On Sun, 29 Jul 2012 00:52:08 +0530
> > > Dishara Wijewardana <dd...@gmail.com> wrote:
> > >
> > > > On Sat, Jul 28, 2012 at 12:53 PM, Claude Brisson
> > > > <cl...@renegat.net> wrote:
> > > >
> > > > > On Sat, 28 Jul 2012 11:47:35 +0530
> > > > > Dishara Wijewardana <dd...@gmail.com> wrote:
> > > > >
> > > > > > On Fri, Jul 27, 2012 at 2:20 PM, Claude Brisson
> > > > > > <cl...@renegat.net> wrote:
> > > > > >
> > > > > > > Well, ok, but it's still not what I asked for: I meant a
> > > > > > > command line tool that would, of course, use your JSR 223
> > > > > > > API classes.
> > > > > > >
> > > > > > HI Claude,
> > > > > > Sorry for the inconvenience  I made. So what you meant is do
> > > > > > the above similar kind of thing (a client code) which would
> > > > > > not directly goes through the velocity API but through JSR223
> > > > > > API ? If so in that case we would need to add additional
> > > > > > methods to the JSR API ? IS that OK ? Is it what you
> > > > > > expected ?
> > > > >
> > > > > Well, the API is meant to be used, and a command line wrapper
> > > > > seems to me one of the simplest things we could do as an
> > > > > example.
> > > > >
> > > > > Why would you need additional methods to the JSR 223 API? Which
> > > > > methods?
> > > > >
> > > > JSR223 API doesn't have a concept like templates which is in
> > > > velocity. Hence it does not have getTemplate() method. ( because
> > > > I have simply to execute a similar example as given through jsr
> > > > 223 API, need a getTemplate() )
> > > >
> > > > >
> > > > >
> > > > >   Claude
> > > > >
> > > > > >
> > > > > > >   Claude
> > > > > > >
> > > > > > > On Fri, 27 Jul 2012 00:00:31 +0530
> > > > > > > Dishara Wijewardana <dd...@gmail.com> wrote:
> > > > > > >
> > > > > > > > Hi Claude,
> > > > > > > > I was finally able to got a simple code working :-) .
> > > > > > > >
> > > > > > > > public class Main {
> > > > > > > >
> > > > > > > >     public static void main(String[] args) throws
> > > > > > > > Exception { VelocityContext context = new
> > > > > > > > VelocityContext(); Writer writer = new StringWriter();
> > > > > > > >
> > > > > > > >         CustomEvent event = new CustomEvent("subash");
> > > > > > > >         context.put("event", event);
> > > > > > > >         Template template =
> > > > > > > > createTemplate("eventtool.vm");
> > > > > > > >
> > > > > > > >         template.merge(context, writer);
> > > > > > > >         System.out.println(writer);
> > > > > > > >         writer.close();
> > > > > > > >     }
> > > > > > > >
> > > > > > > >     private static Template createTemplate(String
> > > > > > > > vmTemplateFile) throws Exception {
> > > > > > > >         VelocityEngine ve = new VelocityEngine();
> > > > > > > >         Properties properties = new Properties();
> > > > > > > >         properties.put("resource.loader", "class");
> > > > > > > >
> > > properties.put("class.resource.loader.description","Template
> > > > > > > > Class Loader");
> > > > > > > >         properties.put("class.resource.loader.class",
> > > > > > > >
> > > > > > > >
> > > > >
> "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
> > > > > > > >         ve.init(properties);
> > > > > > > >         return ve.getTemplate(vmTemplateFile);
> > > > > > > >     }
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> > >
>  ---------------------------------------------------------------------------------------------------------------------------------
> > > > > > > >
> > > > > > > > And here is the template and the out put.
> > > > > > > >
> > > > > > > > *eventtool.vm*
> > > > > > > >
> > > > > > > > $event;
> > > > > > > >
> > > > > > > > Event Created by $event.getName()
> > > > > > > > Event Created on $event.getDate()
> > > > > > > >
> > > > > > > >
> > > > > > > > *Output*
> > > > > > > > *
> > > > > > > > *
> > > > > > > > This is a test event template: created bysubash on Thu
> > > > > > > > Jul 26 23:57:25 IST 2012;
> > > > > > > >
> > > > > > > > Event Created by subash
> > > > > > > > Event Created on Thu Jul 26 23:57:25 IST 2012
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > On Sun, Jul 22, 2012 at 4:54 PM, Claude Brisson
> > > > > > > > <cl...@renegat.net> wrote:
> > > > > > > >
> > > > > > > > > > Did you mean Velocity maven plugin tool[1] as the
> > > > > > > > > > command line tool ? If not can you please direct me
> > > > > > > > > > to a link to find the example to follow. Because in
> > > > > > > > > > the documentation page there are links to XML tool,
> > > > > > > > > > View tool, JSP tool and etc. And couldn't find
> > > > > > > > > > "command line tool" thing . Correct me if I am
> > > > > > > > > > looking for irrelevant.
> > > > > > > > > >
> > > > > > > > > > [1] -
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html
> > > > > > > > >
> > > > > > > > > No, when I say "command line tool", I only mean a plain
> > > > > > > > > old Java object with a "main(String args[])" method,
> > > > > > > > > that you can call from the command line...
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >   Claude
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


-- 
Thanks
/Dishara

Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Claude Brisson <cl...@renegat.net>.
On Sun, 29 Jul 2012 23:57:22 +0530
Dishara Wijewardana <dd...@gmail.com> wrote:

> On Sun, Jul 29, 2012 at 10:20 PM, Claude Brisson <cl...@renegat.net>
> wrote:
> 
> > Pardon me if I'm all wrong with that, but I really thought that in
> > the context of the JSR 223 API, templates themselves were
> > considered as scripts.
> >
> > This API is a wrapper around a scripting engine, that evaluates
> > scripts, which in our case are Velocity templates.
> 
> My question is how do we manage following methods . We need to pass a
> template instance or a wrapper of it in to JSR 223 ScriptEngine . How
> to achieve this without having extensive methods in ScriptEngine API?
> 
> template.merge(context, writer);
> ve.getTemplate(vmTemplateFile);

The Velocity context corresponds to the JSR 223 Bindings. Populating it
should not be a problem.

The evaluation itself should gather the getTemplate() step and the
merge() step, or use one of the VelocityEngine.evaluate() method, this
is already what you did in VelocityScriptEngine.eval() method. So I
really don't understand why you would need other methods. But maybe I'm
still missing something...

Oh, by the way, I still saw some method comments like the following one
in your code:
    /**
     * Added creation inside sync block to avoid creating two factories
from a engine by two parallel threads at the same time.
     * Also the additional null check out from sync block is to avoid
every  thread to get blocked inside it even there is an already created
factory. */

so I recall you that such comments may be useful when reading the code,
but they should be inside the method, not as a javadoc comment. Javadoc
users don't care about such details. Could you please do something
about that?


  Claude


> 
> >
> >   Claude
> >
> > On Sun, 29 Jul 2012 00:52:08 +0530
> > Dishara Wijewardana <dd...@gmail.com> wrote:
> >
> > > On Sat, Jul 28, 2012 at 12:53 PM, Claude Brisson
> > > <cl...@renegat.net> wrote:
> > >
> > > > On Sat, 28 Jul 2012 11:47:35 +0530
> > > > Dishara Wijewardana <dd...@gmail.com> wrote:
> > > >
> > > > > On Fri, Jul 27, 2012 at 2:20 PM, Claude Brisson
> > > > > <cl...@renegat.net> wrote:
> > > > >
> > > > > > Well, ok, but it's still not what I asked for: I meant a
> > > > > > command line tool that would, of course, use your JSR 223
> > > > > > API classes.
> > > > > >
> > > > > HI Claude,
> > > > > Sorry for the inconvenience  I made. So what you meant is do
> > > > > the above similar kind of thing (a client code) which would
> > > > > not directly goes through the velocity API but through JSR223
> > > > > API ? If so in that case we would need to add additional
> > > > > methods to the JSR API ? IS that OK ? Is it what you
> > > > > expected ?
> > > >
> > > > Well, the API is meant to be used, and a command line wrapper
> > > > seems to me one of the simplest things we could do as an
> > > > example.
> > > >
> > > > Why would you need additional methods to the JSR 223 API? Which
> > > > methods?
> > > >
> > > JSR223 API doesn't have a concept like templates which is in
> > > velocity. Hence it does not have getTemplate() method. ( because
> > > I have simply to execute a similar example as given through jsr
> > > 223 API, need a getTemplate() )
> > >
> > > >
> > > >
> > > >   Claude
> > > >
> > > > >
> > > > > >   Claude
> > > > > >
> > > > > > On Fri, 27 Jul 2012 00:00:31 +0530
> > > > > > Dishara Wijewardana <dd...@gmail.com> wrote:
> > > > > >
> > > > > > > Hi Claude,
> > > > > > > I was finally able to got a simple code working :-) .
> > > > > > >
> > > > > > > public class Main {
> > > > > > >
> > > > > > >     public static void main(String[] args) throws
> > > > > > > Exception { VelocityContext context = new
> > > > > > > VelocityContext(); Writer writer = new StringWriter();
> > > > > > >
> > > > > > >         CustomEvent event = new CustomEvent("subash");
> > > > > > >         context.put("event", event);
> > > > > > >         Template template =
> > > > > > > createTemplate("eventtool.vm");
> > > > > > >
> > > > > > >         template.merge(context, writer);
> > > > > > >         System.out.println(writer);
> > > > > > >         writer.close();
> > > > > > >     }
> > > > > > >
> > > > > > >     private static Template createTemplate(String
> > > > > > > vmTemplateFile) throws Exception {
> > > > > > >         VelocityEngine ve = new VelocityEngine();
> > > > > > >         Properties properties = new Properties();
> > > > > > >         properties.put("resource.loader", "class");
> > > > > > >
> > properties.put("class.resource.loader.description","Template
> > > > > > > Class Loader");
> > > > > > >         properties.put("class.resource.loader.class",
> > > > > > >
> > > > > > >
> > > > "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
> > > > > > >         ve.init(properties);
> > > > > > >         return ve.getTemplate(vmTemplateFile);
> > > > > > >     }
> > > > > > >
> > > > > > >
> > > > > >
> > > >
> >  ---------------------------------------------------------------------------------------------------------------------------------
> > > > > > >
> > > > > > > And here is the template and the out put.
> > > > > > >
> > > > > > > *eventtool.vm*
> > > > > > >
> > > > > > > $event;
> > > > > > >
> > > > > > > Event Created by $event.getName()
> > > > > > > Event Created on $event.getDate()
> > > > > > >
> > > > > > >
> > > > > > > *Output*
> > > > > > > *
> > > > > > > *
> > > > > > > This is a test event template: created bysubash on Thu
> > > > > > > Jul 26 23:57:25 IST 2012;
> > > > > > >
> > > > > > > Event Created by subash
> > > > > > > Event Created on Thu Jul 26 23:57:25 IST 2012
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Sun, Jul 22, 2012 at 4:54 PM, Claude Brisson
> > > > > > > <cl...@renegat.net> wrote:
> > > > > > >
> > > > > > > > > Did you mean Velocity maven plugin tool[1] as the
> > > > > > > > > command line tool ? If not can you please direct me
> > > > > > > > > to a link to find the example to follow. Because in
> > > > > > > > > the documentation page there are links to XML tool,
> > > > > > > > > View tool, JSP tool and etc. And couldn't find
> > > > > > > > > "command line tool" thing . Correct me if I am
> > > > > > > > > looking for irrelevant.
> > > > > > > > >
> > > > > > > > > [1] -
> > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html
> > > > > > > >
> > > > > > > > No, when I say "command line tool", I only mean a plain
> > > > > > > > old Java object with a "main(String args[])" method,
> > > > > > > > that you can call from the command line...
> > > > > > > >
> > > > > > > >
> > > > > > > >   Claude
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
> 
> 


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


Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Dishara Wijewardana <dd...@gmail.com>.
On Sun, Jul 29, 2012 at 10:20 PM, Claude Brisson <cl...@renegat.net> wrote:

> Pardon me if I'm all wrong with that, but I really thought that in the
> context of the JSR 223 API, templates themselves were considered as
> scripts.
>
> This API is a wrapper around a scripting engine, that evaluates
> scripts, which in our case are Velocity templates.

My question is how do we manage following methods . We need to pass a
template instance or a wrapper of it in to JSR 223 ScriptEngine . How to
achieve this without having extensive methods in ScriptEngine API?

template.merge(context, writer);
ve.getTemplate(vmTemplateFile);


>
>   Claude
>
> On Sun, 29 Jul 2012 00:52:08 +0530
> Dishara Wijewardana <dd...@gmail.com> wrote:
>
> > On Sat, Jul 28, 2012 at 12:53 PM, Claude Brisson <cl...@renegat.net>
> > wrote:
> >
> > > On Sat, 28 Jul 2012 11:47:35 +0530
> > > Dishara Wijewardana <dd...@gmail.com> wrote:
> > >
> > > > On Fri, Jul 27, 2012 at 2:20 PM, Claude Brisson
> > > > <cl...@renegat.net> wrote:
> > > >
> > > > > Well, ok, but it's still not what I asked for: I meant a command
> > > > > line tool that would, of course, use your JSR 223 API classes.
> > > > >
> > > > HI Claude,
> > > > Sorry for the inconvenience  I made. So what you meant is do the
> > > > above similar kind of thing (a client code) which would not
> > > > directly goes through the velocity API but through JSR223 API ?
> > > > If so in that case we would need to add additional methods to the
> > > > JSR API ? IS that OK ? Is it what you expected ?
> > >
> > > Well, the API is meant to be used, and a command line wrapper seems
> > > to me one of the simplest things we could do as an example.
> > >
> > > Why would you need additional methods to the JSR 223 API? Which
> > > methods?
> > >
> > JSR223 API doesn't have a concept like templates which is in velocity.
> > Hence it does not have getTemplate() method. ( because I have simply
> > to execute a similar example as given through jsr 223 API, need a
> > getTemplate() )
> >
> > >
> > >
> > >   Claude
> > >
> > > >
> > > > >   Claude
> > > > >
> > > > > On Fri, 27 Jul 2012 00:00:31 +0530
> > > > > Dishara Wijewardana <dd...@gmail.com> wrote:
> > > > >
> > > > > > Hi Claude,
> > > > > > I was finally able to got a simple code working :-) .
> > > > > >
> > > > > > public class Main {
> > > > > >
> > > > > >     public static void main(String[] args) throws Exception {
> > > > > >         VelocityContext context = new VelocityContext();
> > > > > >         Writer writer = new StringWriter();
> > > > > >
> > > > > >         CustomEvent event = new CustomEvent("subash");
> > > > > >         context.put("event", event);
> > > > > >         Template template = createTemplate("eventtool.vm");
> > > > > >
> > > > > >         template.merge(context, writer);
> > > > > >         System.out.println(writer);
> > > > > >         writer.close();
> > > > > >     }
> > > > > >
> > > > > >     private static Template createTemplate(String
> > > > > > vmTemplateFile) throws Exception {
> > > > > >         VelocityEngine ve = new VelocityEngine();
> > > > > >         Properties properties = new Properties();
> > > > > >         properties.put("resource.loader", "class");
> > > > > >
> properties.put("class.resource.loader.description","Template
> > > > > > Class Loader");
> > > > > >         properties.put("class.resource.loader.class",
> > > > > >
> > > > > >
> > > "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
> > > > > >         ve.init(properties);
> > > > > >         return ve.getTemplate(vmTemplateFile);
> > > > > >     }
> > > > > >
> > > > > >
> > > > >
> > >
>  ---------------------------------------------------------------------------------------------------------------------------------
> > > > > >
> > > > > > And here is the template and the out put.
> > > > > >
> > > > > > *eventtool.vm*
> > > > > >
> > > > > > $event;
> > > > > >
> > > > > > Event Created by $event.getName()
> > > > > > Event Created on $event.getDate()
> > > > > >
> > > > > >
> > > > > > *Output*
> > > > > > *
> > > > > > *
> > > > > > This is a test event template: created bysubash on Thu Jul 26
> > > > > > 23:57:25 IST 2012;
> > > > > >
> > > > > > Event Created by subash
> > > > > > Event Created on Thu Jul 26 23:57:25 IST 2012
> > > > > >
> > > > > >
> > > > > >
> > > > > > On Sun, Jul 22, 2012 at 4:54 PM, Claude Brisson
> > > > > > <cl...@renegat.net> wrote:
> > > > > >
> > > > > > > > Did you mean Velocity maven plugin tool[1] as the command
> > > > > > > > line tool ? If not can you please direct me to a link to
> > > > > > > > find the example to follow. Because in the documentation
> > > > > > > > page there are links to XML tool, View tool, JSP tool and
> > > > > > > > etc. And couldn't find "command line tool" thing .
> > > > > > > > Correct me if I am looking for irrelevant.
> > > > > > > >
> > > > > > > > [1] -
> > > > > > > >
> > > > > > >
> > > > >
> > >
> http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html
> > > > > > >
> > > > > > > No, when I say "command line tool", I only mean a plain old
> > > > > > > Java object with a "main(String args[])" method, that you
> > > > > > > can call from the command line...
> > > > > > >
> > > > > > >
> > > > > > >   Claude
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


-- 
Thanks
/Dishara

Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Claude Brisson <cl...@renegat.net>.
Pardon me if I'm all wrong with that, but I really thought that in the
context of the JSR 223 API, templates themselves were considered as
scripts.

This API is a wrapper around a scripting engine, that evaluates
scripts, which in our case are Velocity templates.


  Claude

On Sun, 29 Jul 2012 00:52:08 +0530
Dishara Wijewardana <dd...@gmail.com> wrote:

> On Sat, Jul 28, 2012 at 12:53 PM, Claude Brisson <cl...@renegat.net>
> wrote:
> 
> > On Sat, 28 Jul 2012 11:47:35 +0530
> > Dishara Wijewardana <dd...@gmail.com> wrote:
> >
> > > On Fri, Jul 27, 2012 at 2:20 PM, Claude Brisson
> > > <cl...@renegat.net> wrote:
> > >
> > > > Well, ok, but it's still not what I asked for: I meant a command
> > > > line tool that would, of course, use your JSR 223 API classes.
> > > >
> > > HI Claude,
> > > Sorry for the inconvenience  I made. So what you meant is do the
> > > above similar kind of thing (a client code) which would not
> > > directly goes through the velocity API but through JSR223 API ?
> > > If so in that case we would need to add additional methods to the
> > > JSR API ? IS that OK ? Is it what you expected ?
> >
> > Well, the API is meant to be used, and a command line wrapper seems
> > to me one of the simplest things we could do as an example.
> >
> > Why would you need additional methods to the JSR 223 API? Which
> > methods?
> >
> JSR223 API doesn't have a concept like templates which is in velocity.
> Hence it does not have getTemplate() method. ( because I have simply
> to execute a similar example as given through jsr 223 API, need a
> getTemplate() )
> 
> >
> >
> >   Claude
> >
> > >
> > > >   Claude
> > > >
> > > > On Fri, 27 Jul 2012 00:00:31 +0530
> > > > Dishara Wijewardana <dd...@gmail.com> wrote:
> > > >
> > > > > Hi Claude,
> > > > > I was finally able to got a simple code working :-) .
> > > > >
> > > > > public class Main {
> > > > >
> > > > >     public static void main(String[] args) throws Exception {
> > > > >         VelocityContext context = new VelocityContext();
> > > > >         Writer writer = new StringWriter();
> > > > >
> > > > >         CustomEvent event = new CustomEvent("subash");
> > > > >         context.put("event", event);
> > > > >         Template template = createTemplate("eventtool.vm");
> > > > >
> > > > >         template.merge(context, writer);
> > > > >         System.out.println(writer);
> > > > >         writer.close();
> > > > >     }
> > > > >
> > > > >     private static Template createTemplate(String
> > > > > vmTemplateFile) throws Exception {
> > > > >         VelocityEngine ve = new VelocityEngine();
> > > > >         Properties properties = new Properties();
> > > > >         properties.put("resource.loader", "class");
> > > > >         properties.put("class.resource.loader.description","Template
> > > > > Class Loader");
> > > > >         properties.put("class.resource.loader.class",
> > > > >
> > > > >
> > "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
> > > > >         ve.init(properties);
> > > > >         return ve.getTemplate(vmTemplateFile);
> > > > >     }
> > > > >
> > > > >
> > > >
> >  ---------------------------------------------------------------------------------------------------------------------------------
> > > > >
> > > > > And here is the template and the out put.
> > > > >
> > > > > *eventtool.vm*
> > > > >
> > > > > $event;
> > > > >
> > > > > Event Created by $event.getName()
> > > > > Event Created on $event.getDate()
> > > > >
> > > > >
> > > > > *Output*
> > > > > *
> > > > > *
> > > > > This is a test event template: created bysubash on Thu Jul 26
> > > > > 23:57:25 IST 2012;
> > > > >
> > > > > Event Created by subash
> > > > > Event Created on Thu Jul 26 23:57:25 IST 2012
> > > > >
> > > > >
> > > > >
> > > > > On Sun, Jul 22, 2012 at 4:54 PM, Claude Brisson
> > > > > <cl...@renegat.net> wrote:
> > > > >
> > > > > > > Did you mean Velocity maven plugin tool[1] as the command
> > > > > > > line tool ? If not can you please direct me to a link to
> > > > > > > find the example to follow. Because in the documentation
> > > > > > > page there are links to XML tool, View tool, JSP tool and
> > > > > > > etc. And couldn't find "command line tool" thing .
> > > > > > > Correct me if I am looking for irrelevant.
> > > > > > >
> > > > > > > [1] -
> > > > > > >
> > > > > >
> > > >
> > http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html
> > > > > >
> > > > > > No, when I say "command line tool", I only mean a plain old
> > > > > > Java object with a "main(String args[])" method, that you
> > > > > > can call from the command line...
> > > > > >
> > > > > >
> > > > > >   Claude
> > > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
> 
> 


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


Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Dishara Wijewardana <dd...@gmail.com>.
On Sat, Jul 28, 2012 at 12:53 PM, Claude Brisson <cl...@renegat.net> wrote:

> On Sat, 28 Jul 2012 11:47:35 +0530
> Dishara Wijewardana <dd...@gmail.com> wrote:
>
> > On Fri, Jul 27, 2012 at 2:20 PM, Claude Brisson <cl...@renegat.net>
> > wrote:
> >
> > > Well, ok, but it's still not what I asked for: I meant a command
> > > line tool that would, of course, use your JSR 223 API classes.
> > >
> > HI Claude,
> > Sorry for the inconvenience  I made. So what you meant is do the above
> > similar kind of thing (a client code) which would not directly goes
> > through the velocity API but through JSR223 API ? If so in that case
> > we would need to add additional methods to the JSR API ? IS that OK ?
> > Is it what you expected ?
>
> Well, the API is meant to be used, and a command line wrapper seems to
> me one of the simplest things we could do as an example.
>
> Why would you need additional methods to the JSR 223 API? Which methods?
>
JSR223 API doesn't have a concept like templates which is in velocity.
Hence it does not have getTemplate() method. ( because I have simply to
execute a similar example as given through jsr 223 API, need a getTemplate()
)

>
>
>   Claude
>
> >
> > >   Claude
> > >
> > > On Fri, 27 Jul 2012 00:00:31 +0530
> > > Dishara Wijewardana <dd...@gmail.com> wrote:
> > >
> > > > Hi Claude,
> > > > I was finally able to got a simple code working :-) .
> > > >
> > > > public class Main {
> > > >
> > > >     public static void main(String[] args) throws Exception {
> > > >         VelocityContext context = new VelocityContext();
> > > >         Writer writer = new StringWriter();
> > > >
> > > >         CustomEvent event = new CustomEvent("subash");
> > > >         context.put("event", event);
> > > >         Template template = createTemplate("eventtool.vm");
> > > >
> > > >         template.merge(context, writer);
> > > >         System.out.println(writer);
> > > >         writer.close();
> > > >     }
> > > >
> > > >     private static Template createTemplate(String vmTemplateFile)
> > > > throws Exception {
> > > >         VelocityEngine ve = new VelocityEngine();
> > > >         Properties properties = new Properties();
> > > >         properties.put("resource.loader", "class");
> > > >         properties.put("class.resource.loader.description","Template
> > > > Class Loader");
> > > >         properties.put("class.resource.loader.class",
> > > >
> > > >
> "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
> > > >         ve.init(properties);
> > > >         return ve.getTemplate(vmTemplateFile);
> > > >     }
> > > >
> > > >
> > >
>  ---------------------------------------------------------------------------------------------------------------------------------
> > > >
> > > > And here is the template and the out put.
> > > >
> > > > *eventtool.vm*
> > > >
> > > > $event;
> > > >
> > > > Event Created by $event.getName()
> > > > Event Created on $event.getDate()
> > > >
> > > >
> > > > *Output*
> > > > *
> > > > *
> > > > This is a test event template: created bysubash on Thu Jul 26
> > > > 23:57:25 IST 2012;
> > > >
> > > > Event Created by subash
> > > > Event Created on Thu Jul 26 23:57:25 IST 2012
> > > >
> > > >
> > > >
> > > > On Sun, Jul 22, 2012 at 4:54 PM, Claude Brisson
> > > > <cl...@renegat.net> wrote:
> > > >
> > > > > > Did you mean Velocity maven plugin tool[1] as the command line
> > > > > > tool ? If not can you please direct me to a link to find the
> > > > > > example to follow. Because in the documentation page there are
> > > > > > links to XML tool, View tool, JSP tool and etc. And couldn't
> > > > > > find "command line tool" thing . Correct me if I am looking
> > > > > > for irrelevant.
> > > > > >
> > > > > > [1] -
> > > > > >
> > > > >
> > >
> http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html
> > > > >
> > > > > No, when I say "command line tool", I only mean a plain old Java
> > > > > object with a "main(String args[])" method, that you can call
> > > > > from the command line...
> > > > >
> > > > >
> > > > >   Claude
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


-- 
Thanks
/Dishara

Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Claude Brisson <cl...@renegat.net>.
On Sat, 28 Jul 2012 11:47:35 +0530
Dishara Wijewardana <dd...@gmail.com> wrote:

> On Fri, Jul 27, 2012 at 2:20 PM, Claude Brisson <cl...@renegat.net>
> wrote:
> 
> > Well, ok, but it's still not what I asked for: I meant a command
> > line tool that would, of course, use your JSR 223 API classes.
> >
> HI Claude,
> Sorry for the inconvenience  I made. So what you meant is do the above
> similar kind of thing (a client code) which would not directly goes
> through the velocity API but through JSR223 API ? If so in that case
> we would need to add additional methods to the JSR API ? IS that OK ?
> Is it what you expected ?

Well, the API is meant to be used, and a command line wrapper seems to
me one of the simplest things we could do as an example.

Why would you need additional methods to the JSR 223 API? Which methods?


  Claude

> 
> >   Claude
> >
> > On Fri, 27 Jul 2012 00:00:31 +0530
> > Dishara Wijewardana <dd...@gmail.com> wrote:
> >
> > > Hi Claude,
> > > I was finally able to got a simple code working :-) .
> > >
> > > public class Main {
> > >
> > >     public static void main(String[] args) throws Exception {
> > >         VelocityContext context = new VelocityContext();
> > >         Writer writer = new StringWriter();
> > >
> > >         CustomEvent event = new CustomEvent("subash");
> > >         context.put("event", event);
> > >         Template template = createTemplate("eventtool.vm");
> > >
> > >         template.merge(context, writer);
> > >         System.out.println(writer);
> > >         writer.close();
> > >     }
> > >
> > >     private static Template createTemplate(String vmTemplateFile)
> > > throws Exception {
> > >         VelocityEngine ve = new VelocityEngine();
> > >         Properties properties = new Properties();
> > >         properties.put("resource.loader", "class");
> > >         properties.put("class.resource.loader.description","Template
> > > Class Loader");
> > >         properties.put("class.resource.loader.class",
> > >
> > > "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
> > >         ve.init(properties);
> > >         return ve.getTemplate(vmTemplateFile);
> > >     }
> > >
> > >
> >  ---------------------------------------------------------------------------------------------------------------------------------
> > >
> > > And here is the template and the out put.
> > >
> > > *eventtool.vm*
> > >
> > > $event;
> > >
> > > Event Created by $event.getName()
> > > Event Created on $event.getDate()
> > >
> > >
> > > *Output*
> > > *
> > > *
> > > This is a test event template: created bysubash on Thu Jul 26
> > > 23:57:25 IST 2012;
> > >
> > > Event Created by subash
> > > Event Created on Thu Jul 26 23:57:25 IST 2012
> > >
> > >
> > >
> > > On Sun, Jul 22, 2012 at 4:54 PM, Claude Brisson
> > > <cl...@renegat.net> wrote:
> > >
> > > > > Did you mean Velocity maven plugin tool[1] as the command line
> > > > > tool ? If not can you please direct me to a link to find the
> > > > > example to follow. Because in the documentation page there are
> > > > > links to XML tool, View tool, JSP tool and etc. And couldn't
> > > > > find "command line tool" thing . Correct me if I am looking
> > > > > for irrelevant.
> > > > >
> > > > > [1] -
> > > > >
> > > >
> > http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html
> > > >
> > > > No, when I say "command line tool", I only mean a plain old Java
> > > > object with a "main(String args[])" method, that you can call
> > > > from the command line...
> > > >
> > > >
> > > >   Claude
> > > >
> > >
> > >
> > >
> >
> >
> 
> 


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


Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Dishara Wijewardana <dd...@gmail.com>.
On Fri, Jul 27, 2012 at 2:20 PM, Claude Brisson <cl...@renegat.net> wrote:

> Well, ok, but it's still not what I asked for: I meant a command line
> tool that would, of course, use your JSR 223 API classes.
>
HI Claude,
Sorry for the inconvenience  I made. So what you meant is do the above
similar kind of thing (a client code) which would not directly goes through
the velocity API but through JSR223 API ? If so in that case we would need
to add additional methods to the JSR API ? IS that OK ?
Is it what you expected ?


>   Claude
>
> On Fri, 27 Jul 2012 00:00:31 +0530
> Dishara Wijewardana <dd...@gmail.com> wrote:
>
> > Hi Claude,
> > I was finally able to got a simple code working :-) .
> >
> > public class Main {
> >
> >     public static void main(String[] args) throws Exception {
> >         VelocityContext context = new VelocityContext();
> >         Writer writer = new StringWriter();
> >
> >         CustomEvent event = new CustomEvent("subash");
> >         context.put("event", event);
> >         Template template = createTemplate("eventtool.vm");
> >
> >         template.merge(context, writer);
> >         System.out.println(writer);
> >         writer.close();
> >     }
> >
> >     private static Template createTemplate(String vmTemplateFile)
> > throws Exception {
> >         VelocityEngine ve = new VelocityEngine();
> >         Properties properties = new Properties();
> >         properties.put("resource.loader", "class");
> >         properties.put("class.resource.loader.description","Template
> > Class Loader");
> >         properties.put("class.resource.loader.class",
> >
> > "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
> >         ve.init(properties);
> >         return ve.getTemplate(vmTemplateFile);
> >     }
> >
> >
>  ---------------------------------------------------------------------------------------------------------------------------------
> >
> > And here is the template and the out put.
> >
> > *eventtool.vm*
> >
> > $event;
> >
> > Event Created by $event.getName()
> > Event Created on $event.getDate()
> >
> >
> > *Output*
> > *
> > *
> > This is a test event template: created bysubash on Thu Jul 26
> > 23:57:25 IST 2012;
> >
> > Event Created by subash
> > Event Created on Thu Jul 26 23:57:25 IST 2012
> >
> >
> >
> > On Sun, Jul 22, 2012 at 4:54 PM, Claude Brisson <cl...@renegat.net>
> > wrote:
> >
> > > > Did you mean Velocity maven plugin tool[1] as the command line
> > > > tool ? If not can you please direct me to a link to find the
> > > > example to follow. Because in the documentation page there are
> > > > links to XML tool, View tool, JSP tool and etc. And couldn't find
> > > > "command line tool" thing . Correct me if I am looking for
> > > > irrelevant.
> > > >
> > > > [1] -
> > > >
> > >
> http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html
> > >
> > > No, when I say "command line tool", I only mean a plain old Java
> > > object with a "main(String args[])" method, that you can call from
> > > the command line...
> > >
> > >
> > >   Claude
> > >
> >
> >
> >
>
>


-- 
Thanks
/Dishara

Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Claude Brisson <cl...@renegat.net>.
Well, ok, but it's still not what I asked for: I meant a command line
tool that would, of course, use your JSR 223 API classes.

  Claude

On Fri, 27 Jul 2012 00:00:31 +0530
Dishara Wijewardana <dd...@gmail.com> wrote:

> Hi Claude,
> I was finally able to got a simple code working :-) .
> 
> public class Main {
> 
>     public static void main(String[] args) throws Exception {
>         VelocityContext context = new VelocityContext();
>         Writer writer = new StringWriter();
> 
>         CustomEvent event = new CustomEvent("subash");
>         context.put("event", event);
>         Template template = createTemplate("eventtool.vm");
> 
>         template.merge(context, writer);
>         System.out.println(writer);
>         writer.close();
>     }
> 
>     private static Template createTemplate(String vmTemplateFile)
> throws Exception {
>         VelocityEngine ve = new VelocityEngine();
>         Properties properties = new Properties();
>         properties.put("resource.loader", "class");
>         properties.put("class.resource.loader.description","Template
> Class Loader");
>         properties.put("class.resource.loader.class",
> 
> "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
>         ve.init(properties);
>         return ve.getTemplate(vmTemplateFile);
>     }
> 
>  ---------------------------------------------------------------------------------------------------------------------------------
> 
> And here is the template and the out put.
> 
> *eventtool.vm*
> 
> $event;
> 
> Event Created by $event.getName()
> Event Created on $event.getDate()
> 
> 
> *Output*
> *
> *
> This is a test event template: created bysubash on Thu Jul 26
> 23:57:25 IST 2012;
> 
> Event Created by subash
> Event Created on Thu Jul 26 23:57:25 IST 2012
> 
> 
> 
> On Sun, Jul 22, 2012 at 4:54 PM, Claude Brisson <cl...@renegat.net>
> wrote:
> 
> > > Did you mean Velocity maven plugin tool[1] as the command line
> > > tool ? If not can you please direct me to a link to find the
> > > example to follow. Because in the documentation page there are
> > > links to XML tool, View tool, JSP tool and etc. And couldn't find
> > > "command line tool" thing . Correct me if I am looking for
> > > irrelevant.
> > >
> > > [1] -
> > >
> > http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html
> >
> > No, when I say "command line tool", I only mean a plain old Java
> > object with a "main(String args[])" method, that you can call from
> > the command line...
> >
> >
> >   Claude
> >
> 
> 
> 


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


Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Dishara Wijewardana <dd...@gmail.com>.
Hi Claude,
I was finally able to got a simple code working :-) .

public class Main {

    public static void main(String[] args) throws Exception {
        VelocityContext context = new VelocityContext();
        Writer writer = new StringWriter();

        CustomEvent event = new CustomEvent("subash");
        context.put("event", event);
        Template template = createTemplate("eventtool.vm");

        template.merge(context, writer);
        System.out.println(writer);
        writer.close();
    }

    private static Template createTemplate(String vmTemplateFile) throws
Exception {
        VelocityEngine ve = new VelocityEngine();
        Properties properties = new Properties();
        properties.put("resource.loader", "class");
        properties.put("class.resource.loader.description","Template Class
Loader");
        properties.put("class.resource.loader.class",

"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
        ve.init(properties);
        return ve.getTemplate(vmTemplateFile);
    }

 ---------------------------------------------------------------------------------------------------------------------------------

And here is the template and the out put.

*eventtool.vm*

$event;

Event Created by $event.getName()
Event Created on $event.getDate()


*Output*
*
*
This is a test event template: created bysubash on Thu Jul 26 23:57:25 IST
2012;

Event Created by subash
Event Created on Thu Jul 26 23:57:25 IST 2012



On Sun, Jul 22, 2012 at 4:54 PM, Claude Brisson <cl...@renegat.net> wrote:

> > Did you mean Velocity maven plugin tool[1] as the command line tool ?
> > If not can you please direct me to a link to find the example to
> > follow. Because in the documentation page there are links to XML
> > tool, View tool, JSP tool and etc. And couldn't find "command line
> > tool" thing . Correct me if I am looking for irrelevant.
> >
> > [1] -
> >
> http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html
>
> No, when I say "command line tool", I only mean a plain old Java object
> with a "main(String args[])" method, that you can call from the command
> line...
>
>
>   Claude
>



-- 
Thanks
/Dishara

Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Claude Brisson <cl...@renegat.net>.
> Did you mean Velocity maven plugin tool[1] as the command line tool ?
> If not can you please direct me to a link to find the example to
> follow. Because in the documentation page there are links to XML
> tool, View tool, JSP tool and etc. And couldn't find "command line
> tool" thing . Correct me if I am looking for irrelevant.
> 
> [1] -
> http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html

No, when I say "command line tool", I only mean a plain old Java object
with a "main(String args[])" method, that you can call from the command
line...


  Claude

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


Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Dishara Wijewardana <dd...@gmail.com>.
On Thu, Jul 19, 2012 at 8:00 PM, Claude Brisson <cl...@renegat.net> wrote:

> I am on vacations this week, and a bit busy, so not very reactive...
>
> I think that the first thing to do is the most easier example we can
> find: a command line tool to generate a text output from a template and
> a properties file.
>
Hi Claude,

Did you mean Velocity maven plugin tool[1] as the command line tool ? If
not can you please direct me to a link to find the example to follow.
Because in the documentation page there are links to XML tool, View tool,
JSP tool and etc. And couldn't find "command line tool" thing . Correct me
if I am looking for irrelevant.

[1] -
http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html



> Once this is done, we'll have a look at something more difficult.
>
> Meantime, you can also continue to look at the tools subproject source
> code, and to see what would be the easiest way for the JSR 223 API user
> to access standard tools in the Velocity context.


>
>   Claude
>
>
> On Sun, 15 Jul 2012 17:14:26 +0530
> Dishara Wijewardana <dd...@gmail.com> wrote:
>
> > On Sun, Jul 8, 2012 at 11:45 PM, Dishara Wijewardana <
> > ddwijewardana@gmail.com> wrote:
> >
> > > Hi all,
> > >
> > > On Sun, Jul 8, 2012 at 11:41 PM, Dishara Wijewardana <
> > > ddwijewardana@gmail.com> wrote:
> > >
> > >> TODOs
> > >>
> > >> - Mainly cover basic functionality + spec compatibility (i.e
> > >> throwing different exceptions in different scenarios and etc ) on
> > >> following major classes  through unit tests.
> > >>
> > >> VelocityBindings
> > >> VelocityScriptContext
> > >> VelocityScriptEngine
> > >> VelocityScriptEngineFactory
> > >>
> > >
> > > Finished. Yet some more tests to cover engine.eval() is required.
> > >
> > >
> > >> - Add complete javadoc comments to whole API. And move unnecessary
> > >> comments to inner comments.
> > >>
> > >>
> > > Finished.
> > >
> > >
> > >>  - Writing documentation on how to use JSR 223 API . Some Hello
> > >> world example  on JSR 223 would be nice in documentation.
> > >>
> > >>
> > > How about writing a wiki on this like an article. (we can get sample
> > > codes on best practices on using JSR 223, from the simple test
> > > framework I have implemented )
> > > Any idea ?
> > >
> > >
> > >> - Examples to include, probably based on velocity tools.
> > >>
> > >
> > Hi Claude,
> > I have tried velocity tools samples on tomcat and have some
> > understanding. Can you elaborate more on what is the example/s which
> > should implement. For example, is it some new use case based  on
> > velocity tools like existing sample or is it some example which has
> > both velocity tools and JSR 223 API (if this is the case I have no
> > clear idea of this yet) ?
> >
> >
> >
> > > Not yet started.
> > >
> > >>
> > >> Hi claude, please add anything if I have missed.
> > >>
> > >> --
> > >> Thanks
> > >> /Dishara
> > >>
> > >>
> > >
> > >
> > > --
> > > Thanks
> > > /Dishara
> > >
> > >
> >
> >
>
>


-- 
Thanks
/Dishara

Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Claude Brisson <cl...@renegat.net>.
I am on vacations this week, and a bit busy, so not very reactive...

I think that the first thing to do is the most easier example we can
find: a command line tool to generate a text output from a template and
a properties file.

Once this is done, we'll have a look at something more difficult.

Meantime, you can also continue to look at the tools subproject source
code, and to see what would be the easiest way for the JSR 223 API user
to access standard tools in the Velocity context.


  Claude


On Sun, 15 Jul 2012 17:14:26 +0530
Dishara Wijewardana <dd...@gmail.com> wrote:

> On Sun, Jul 8, 2012 at 11:45 PM, Dishara Wijewardana <
> ddwijewardana@gmail.com> wrote:
> 
> > Hi all,
> >
> > On Sun, Jul 8, 2012 at 11:41 PM, Dishara Wijewardana <
> > ddwijewardana@gmail.com> wrote:
> >
> >> TODOs
> >>
> >> - Mainly cover basic functionality + spec compatibility (i.e
> >> throwing different exceptions in different scenarios and etc ) on
> >> following major classes  through unit tests.
> >>
> >> VelocityBindings
> >> VelocityScriptContext
> >> VelocityScriptEngine
> >> VelocityScriptEngineFactory
> >>
> >
> > Finished. Yet some more tests to cover engine.eval() is required.
> >
> >
> >> - Add complete javadoc comments to whole API. And move unnecessary
> >> comments to inner comments.
> >>
> >>
> > Finished.
> >
> >
> >>  - Writing documentation on how to use JSR 223 API . Some Hello
> >> world example  on JSR 223 would be nice in documentation.
> >>
> >>
> > How about writing a wiki on this like an article. (we can get sample
> > codes on best practices on using JSR 223, from the simple test
> > framework I have implemented )
> > Any idea ?
> >
> >
> >> - Examples to include, probably based on velocity tools.
> >>
> >
> Hi Claude,
> I have tried velocity tools samples on tomcat and have some
> understanding. Can you elaborate more on what is the example/s which
> should implement. For example, is it some new use case based  on
> velocity tools like existing sample or is it some example which has
> both velocity tools and JSR 223 API (if this is the case I have no
> clear idea of this yet) ?
> 
> 
> 
> > Not yet started.
> >
> >>
> >> Hi claude, please add anything if I have missed.
> >>
> >> --
> >> Thanks
> >> /Dishara
> >>
> >>
> >
> >
> > --
> > Thanks
> > /Dishara
> >
> >
> 
> 


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


Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Dishara Wijewardana <dd...@gmail.com>.
On Sun, Jul 8, 2012 at 11:45 PM, Dishara Wijewardana <
ddwijewardana@gmail.com> wrote:

> Hi all,
>
> On Sun, Jul 8, 2012 at 11:41 PM, Dishara Wijewardana <
> ddwijewardana@gmail.com> wrote:
>
>> TODOs
>>
>> - Mainly cover basic functionality + spec compatibility (i.e throwing
>> different exceptions in different scenarios and etc ) on following major
>> classes  through unit tests.
>>
>> VelocityBindings
>> VelocityScriptContext
>> VelocityScriptEngine
>> VelocityScriptEngineFactory
>>
>
> Finished. Yet some more tests to cover engine.eval() is required.
>
>
>> - Add complete javadoc comments to whole API. And move unnecessary
>> comments to inner comments.
>>
>>
> Finished.
>
>
>>  - Writing documentation on how to use JSR 223 API . Some Hello world
>> example  on JSR 223 would be nice in documentation.
>>
>>
> How about writing a wiki on this like an article. (we can get sample
> codes on best practices on using JSR 223, from the simple test framework I
> have implemented )
> Any idea ?
>
>
>> - Examples to include, probably based on velocity tools.
>>
>
Hi Claude,
I have tried velocity tools samples on tomcat and have some understanding.
Can you elaborate more on what is the example/s which should implement.
For example, is it some new use case based  on velocity tools like existing
sample or is it some example which has both velocity tools and JSR 223 API
(if this is the case I have no clear idea of this yet) ?



> Not yet started.
>
>>
>> Hi claude, please add anything if I have missed.
>>
>> --
>> Thanks
>> /Dishara
>>
>>
>
>
> --
> Thanks
> /Dishara
>
>


-- 
Thanks
/Dishara

Re: GSoC 2012 JSR 223 impl TODOs status

Posted by Dishara Wijewardana <dd...@gmail.com>.
Hi all,

On Sun, Jul 8, 2012 at 11:41 PM, Dishara Wijewardana <
ddwijewardana@gmail.com> wrote:

> TODOs
>
> - Mainly cover basic functionality + spec compatibility (i.e throwing
> different exceptions in different scenarios and etc ) on following major
> classes  through unit tests.
>
> VelocityBindings
> VelocityScriptContext
> VelocityScriptEngine
> VelocityScriptEngineFactory
>

Finished. Yet some more tests to cover engine.eval() is required.


> - Add complete javadoc comments to whole API. And move unnecessary
> comments to inner comments.
>
>
Finished.


> - Writing documentation on how to use JSR 223 API . Some Hello world
> example  on JSR 223 would be nice in documentation.
>
>
How about writing a wiki on this like an article. (we can get sample
codes on best practices on using JSR 223, from the simple test framework I
have implemented )
Any idea ?


> - Examples to include, probably based on velocity tools.
>
Not yet started.

>
> Hi claude, please add anything if I have missed.
>
> --
> Thanks
> /Dishara
>
>


-- 
Thanks
/Dishara