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/04/02 16:23:48 UTC

Re: Implementation JSR 223 on top of velocity

Hi Claude,
First of all sorry for my late response as I was away from being online
during the weekend due to a personal matter.

On Sat, Mar 31, 2012 at 3:37 PM, Claude Brisson <cl...@renegat.net> wrote:

> Hi Dishara.
>
> You'll notice in the specs that some parts are optional. Don't consider
> them if they imply a deep refactoring of Velocity (which we
> don't really want, to be honest...). For now, we're just talking
> feasibility.


+1, but in the velocity jsr223 package (which is javax.script) we better
include all the whole thing and can throw an unsupported exception for the
non critical methods.

What can we reach with simple wrappers around Velocity
> objects, with the minimum refactoring?
>

I will list them down(which will directly mapped / needs small wrap) and
share with you ASAP.
And will also give a patch for the basic jsr223 impl package structure.


>
> From this page:
>
>  http://jcp.org/aboutJava/communityprocess/final/jsr223/index.html
>
> It seems like the TCK itself is not freely available. Well, it is said
> to be "available to Qualified Not-for-Profits and Qualified
> Individuals for no charge", but certainly not open source. So you can
> use it for your own tests if you want, but we'll need to have our own
> test cases.
>

+1 for that. And we can go ahead in parallel with the TCK similar tests
coverage.


>
> > What are the main Velocity back end API will be used for this ?
>
> Mainly,
>
> org.apache.velocity.Template
> org.apache.velocity.VelocityContext
> org.apache.velocity.app.VelocityEngine
>
>
>
>  Claude
>
> On Tue, 27 Mar 2012 22:34:13 +0530
> Dishara Wijewardana <dd...@gmail.com> wrote:
>
> > On Tue, Mar 27, 2012 at 2:34 PM, Claude Brisson <cl...@renegat.net>
> > wrote:
> >
> > > Hi Dishara.
> > >
> > > We are pleased with your proposal and ready to mentor you. I'm still
> > > waiting for my mentoring request to be processed by Google and
> > > Apache, so stay tuned, I'll keep you informed.
> > >
> > >  Claude Brisson
> > >
> > >
> > Hi Claude,
> >
> > Thank you very much for the response and for the trust on me. Willing
> > to contribute to this project with great confidence.
> > I will keep in touch and also continue regarding the spec. Also I'am
> > already started looking in to velocity back end code w.r.t JSR
> > 223.(still if some specific details can be shared regarding this will
> > be useful).
> >
> > While doing so, I will also start writing a proposal.
> >
> > Thanks in Advance
> >
> >
> > > On Sun, 25 Mar 2012 21:08:29 +0530
> > > Dishara Wijewardana <dd...@gmail.com> wrote:
> > >
> > > > Hi all,
> > > > I am a student who likes to take part in GSoC 2012 and I am really
> > > > interested in implementing a JSR spec which is always an
> > > > interesting task to do.   .
> > > > I think this implementation will give a better value addition to
> > > > Velocity as it has a industry standard support in back_end and
> > > > will allows JSR 223 clients who likes Velocity to migrate without
> > > > much effort I am willing to  contribute this wonderful project
> > > > idea (which as since last couple of years as seems) and continue
> > > > the contribution further on Velocity.
> > > >
> > > > Hi Vincent,
> > > > I couldn't reach to the links you provided in the JIRA[1]
> > > > regarding this idea. I think the content has been removed .
> > > >
> > > > Hi Thomas,
> > > > But I went through the specification and also downloaded the doc.
> > > > Is it expected to implement the whole spec. I mean making
> > > > VELOCITY a 100% compliant of JSR 223 ?
> > > > It will be great if I can get to know the scope of the project and
> > > > some more detail regarding the $subject so that I can understand
> > > > the project in nutshell.
> > > > (i.e  is it expected to test the whole impl with the 223 TCK ?
> > > > What are the main Velocity back end API will be used for this ?
> > > > and etc).
> > > >
> > > > So that I can read the most important parts of the spec first and
> > > > start working on a patch before GSoC application period  ends.
> > > > Thanks in Advance
> > > >
> > > > JSR 223 spec - [2]
> > > > spec documentation - [3]
> > > >
> > > > [1] - https://issues.apache.org/jira/browse/VELOCITY-735
> > > > [2] -
> > > > http://download.oracle.com/otndocs/jcp/sjp-1_1-pr2-spec-oth-JSpec/
> > > > [3] -
> > > > http://download.oracle.com/otndocs/jcp/sjp-1_1-pr2-oth-doc-JSpec/
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


-- 
Thanks
/Dishara

Re: Implementation JSR 223 on top of velocity

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

I have submitted the proposal under ASF in GSoC 2012. Please add your
valuable feedback so that I can submit a better proposal.
Thanks

On Mon, Apr 2, 2012 at 11:44 PM, Dishara Wijewardana <
ddwijewardana@gmail.com> wrote:

>
> Hi Claude,
> I will use the same thread to update on the current API mappings and try
> to identify what additionally needs to be implement.
>
> On Mon, Apr 2, 2012 at 8:16 PM, Dishara Wijewardana <
> ddwijewardana@gmail.com> wrote:
>
>>
>>
>> On Mon, Apr 2, 2012 at 8:02 PM, Claude Brisson <cl...@renegat.net>wrote:
>>
>>> Hi Dishara.
>>>
>>> > > What can we reach with simple wrappers around Velocity
>>> > > objects, with the minimum refactoring?
>>>
>>
> List of wrappers that can be mapped to JSR 223 from Velocity.
>
>           *(JSR)
>  (Velocity Local)*
>
>    - *ScriptContext                  >                 VelocityContext*
>
>           - Direct Mappings
>           * getAttribute(java.lang.String name)  >  Object internalGet(
> String key )*
>
>           -Need wrappers
> ( Velocity currently capable of adding, removing attributes operations
> using java Maps. For JSR 223, they do have the capability to store  context
> sensitive attributes in different scopes (scope is identified as an
> integer). So we can write the *ScriptContextImpl class wrapped by * VelocityContext
> by    additionally maintaining a scope for each attribute.  Hence we can
> implement follows easily with small effort.
>
> *         getAttribute(java.lang.String name, int scope) *
> *         getAttributesScope(java.lang.String name) *
> *         removeAttribute(java.lang.String name, int scope) *
> *         setAttribute(java.lang.String name, java.lang.Object value, int
> scope) *
>
>         - New
>   JSR 223 has encapsulated readers and writers/namespacing for scripts to
> use when displaying output. Those also need to implement.(i.e )
>
>      *   setNamespace(Namespace namespace, int scope)*
> *   setReader(java.io.Reader reader)*
> *  setWriter(java.io.Writer writer)  and etc.*
> *
> *
>
>    - *ScriptEngine                      >                     Velocity
>    Engine*
>
> *         - *Direct Mapping
>           (Currently Velocity uses two script evaluation methods where it
> basically renders scripts in the form of a reader or directly as a string ,
> and both are also there in the JSR 223 spec, but in Velocity it returns the
> success of the operation  which is a boolean while JSR 223 returns the
> evaluated result content itself. Need to also change the return type also
> ;) ).
>
> *         eval(java.lang.String script)  >  evaluate( Context context,
>  Writer out,String logTag, String instring )            *
> *         eval(java.io.Reader reader)   >  evaluate(Context context,
> Writer writer,String logTag, Reader reader)*
>
>        - Need wrappers
> (In JSR spec there are additional 3 more overloaded evaluation methods
> which does evaluations based on context and namespace )
>
>        - New
>       Has a factory method to create script engines and etc
>
>
> Above are the API mappings of the two main classes I identified,  which
> will give us an understanding what needs to be implemented.
> Please add your thoughts and correct if there is anything that I am
> missing ;).
>
> Thank you.
>
>
>>  > >
>>> >
>>> > I will list them down(which will directly mapped / needs small wrap)
>>> > and share with you ASAP.
>>>
>>> Great.
>>>
>>> > And will also give a patch for the basic jsr223 impl package
>>> > structure.
>>>
>>> Thank you for your enthusiasm, but the most important is not to dive
>>> into code right away, it's to submit a nice proposal to the Google
>>> Melange website.
>>>
>>
>> +1, Already started on the proposal and will make more priority on that.
>> Thank you.
>>
>>
>>>
>>>
>>>  Claude
>>>
>>>
>>
>>
>> --
>> Thanks
>> /Dishara
>>
>>
>
>
> --
> Thanks
> /Dishara
>
>


-- 
Thanks
/Dishara

Re: Implementation JSR 223 on top of velocity

Posted by Dishara Wijewardana <dd...@gmail.com>.
Hi Claude,
I will use the same thread to update on the current API mappings and try to
identify what additionally needs to be implement.

On Mon, Apr 2, 2012 at 8:16 PM, Dishara Wijewardana <ddwijewardana@gmail.com
> wrote:

>
>
> On Mon, Apr 2, 2012 at 8:02 PM, Claude Brisson <cl...@renegat.net> wrote:
>
>> Hi Dishara.
>>
>> > > What can we reach with simple wrappers around Velocity
>> > > objects, with the minimum refactoring?
>>
>
List of wrappers that can be mapped to JSR 223 from Velocity.

          *(JSR)                                                  (Velocity
Local)*

   - *ScriptContext                  >                 VelocityContext*

          - Direct Mappings
          * getAttribute(java.lang.String name)  >  Object internalGet(
String key )*

          -Need wrappers
( Velocity currently capable of adding, removing attributes operations
using java Maps. For JSR 223, they do have the capability to store  context
sensitive attributes in different scopes (scope is identified as an
integer). So we can write the *ScriptContextImpl class wrapped by *
VelocityContext
by    additionally maintaining a scope for each attribute.  Hence we can
implement follows easily with small effort.

*         getAttribute(java.lang.String name, int scope) *
*         getAttributesScope(java.lang.String name) *
*         removeAttribute(java.lang.String name, int scope) *
*         setAttribute(java.lang.String name, java.lang.Object value, int
scope) *

        - New
  JSR 223 has encapsulated readers and writers/namespacing for scripts to
use when displaying output. Those also need to implement.(i.e )

     *   setNamespace(Namespace namespace, int scope)*
*   setReader(java.io.Reader reader)*
*  setWriter(java.io.Writer writer)  and etc.*
*
*

   - *ScriptEngine                      >                     VelocityEngine
   *

*         - *Direct Mapping
          (Currently Velocity uses two script evaluation methods where it
basically renders scripts in the form of a reader or directly as a string ,
and both are also there in the JSR 223 spec, but in Velocity it returns the
success of the operation  which is a boolean while JSR 223 returns the
evaluated result content itself. Need to also change the return type also
;) ).

*         eval(java.lang.String script)  >  evaluate( Context context,
 Writer out,String logTag, String instring )            *
*         eval(java.io.Reader reader)   >  evaluate(Context context, Writer
writer,String logTag, Reader reader)*

       - Need wrappers
(In JSR spec there are additional 3 more overloaded evaluation methods
which does evaluations based on context and namespace )

       - New
      Has a factory method to create script engines and etc


Above are the API mappings of the two main classes I identified,  which
will give us an understanding what needs to be implemented.
Please add your thoughts and correct if there is anything that I am missing
;).

Thank you.


> > >
>> >
>> > I will list them down(which will directly mapped / needs small wrap)
>> > and share with you ASAP.
>>
>> Great.
>>
>> > And will also give a patch for the basic jsr223 impl package
>> > structure.
>>
>> Thank you for your enthusiasm, but the most important is not to dive
>> into code right away, it's to submit a nice proposal to the Google
>> Melange website.
>>
>
> +1, Already started on the proposal and will make more priority on that.
> Thank you.
>
>
>>
>>
>>  Claude
>>
>>
>
>
> --
> Thanks
> /Dishara
>
>


-- 
Thanks
/Dishara

Re: Implementation JSR 223 on top of velocity

Posted by Dishara Wijewardana <dd...@gmail.com>.
On Mon, Apr 2, 2012 at 8:02 PM, Claude Brisson <cl...@renegat.net> wrote:

> Hi Dishara.
>
> > > What can we reach with simple wrappers around Velocity
> > > objects, with the minimum refactoring?
> > >
> >
> > I will list them down(which will directly mapped / needs small wrap)
> > and share with you ASAP.
>
> Great.
>
> > And will also give a patch for the basic jsr223 impl package
> > structure.
>
> Thank you for your enthusiasm, but the most important is not to dive
> into code right away, it's to submit a nice proposal to the Google
> Melange website.
>

+1, Already started on the proposal and will make more priority on that.
Thank you.


>
>
>  Claude
>
>


-- 
Thanks
/Dishara

Re: Implementation JSR 223 on top of velocity

Posted by Claude Brisson <cl...@renegat.net>.
Hi Dishara.

> > What can we reach with simple wrappers around Velocity
> > objects, with the minimum refactoring?
> >
> 
> I will list them down(which will directly mapped / needs small wrap)
> and share with you ASAP.

Great.

> And will also give a patch for the basic jsr223 impl package
> structure.

Thank you for your enthusiasm, but the most important is not to dive
into code right away, it's to submit a nice proposal to the Google
Melange website.


  Claude


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