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 <[email protected]
> wrote:

>
>
> On Mon, Apr 2, 2012 at 8:02 PM, Claude Brisson <[email protected]> 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

Reply via email to