You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Akhil Anil <ak...@gmail.com> on 2013/07/15 14:36:10 UTC

Enhancing Widget Support for jQuery TUSCANY-4077

As an learning step for enhancing the widget support, I'm looking
through files like WidgetImplementation.java,
DojoJavaScriptComponentGeneratorImpl.java. Is there anything else I
should look on for? We can implement the jquery support just lyk
json-rpc rt? If yes I'll try to put up how the composite file addition
looks like. Please, correct me if I'm wrong.

-- 

Thanks and regards....

May God Bless us!

*AkH!L.*

*http://akhilspassion.blogspot.com*

Re: Enhancing Widget Support for jQuery TUSCANY-4077

Posted by Akhil Anil <ak...@gmail.com>.
Hi Luciano,

I've written the final draft of my proposal at
https://cwiki.apache.org/confluence/display/COMDEV/Proposal+For+Tuscany+-+Akhil+Anil

I'm very much looking forward to be a part of contributing to open source.
Kindly, review my final draft and advice me if any changes have to be done
to improve the the chances of getting selected.

Thankyou so much,


On 18 July 2013 20:54, Luciano Resende <lu...@gmail.com> wrote:

>
>
>
> On Thu, Jul 18, 2013 at 6:25 AM, Akhil Anil <ak...@gmail.com> wrote:
>
>> Hi,
>>
>> public interface *ComponentJavaScriptGenerator *{
>>    /**
>>      ** Return the QName that identify the Component script generator*
>> *     * This is used to identify different generators supporting
>> different JavaScript frameworks*
>>      *
>>      * @return The QName
>>      */
>>     QName getQName();
>> ...
>> }
>>
>> There is already this field QName in ComponentJavaScriptGenerator that is
>> defined in DojoJavaScriptComponentGeneratorImpl as
>>
>> *private static final QName NAME = new QName("
>> http://tuscany.apache.org/xmlns/sca/1.1",
>> "component.script.generator.dojo");*
>> *
>> *
>> As mentioned in the comments (marked in red), its for supporting
>> different JS frameworks. Can we bring this out into the *.composite files
>> and present it as a configuration option to the user. But I'm confused as
>> of how to do it rt now. I'm gonna look all over the samples to find if such
>> examples are there for technologies other than js. Any suggestions on where
>> to look?
>>
>>
> I didn't remember that we already had something on the models, we can
> definetly reuse stuff that is already there.
>
>
>> BTW, is there any specific format for the proposal? Is there an example
>> available?
>>
>>
> http://community.apache.org/mentoringprogramme-icfoss-pilot.html
>
>
>>
>> On 17 July 2013 11:14, Luciano Resende <lu...@gmail.com> wrote:
>>
>>>
>>>
>>>
>>> On Tue, Jul 16, 2013 at 10:41 PM, Akhil Anil <ak...@gmail.com>wrote:
>>>
>>>> Hi,
>>>>
>>>> That's great advice.Thanks! I'm reading through the store.js and also
>>>> saw the dojo.js alongwith it. I'll do as u said. BTW, where do a tuscany
>>>> user configure the application to use dojo or jquery.  I dont see it
>>>> configured anywhere in the store example. Where can we add such a
>>>> configuration. Just quote me project file names, search keywords or links
>>>> for any of my trivial queries. I'll dig out the rest.
>>>>
>>>>
>>>>
>>> Right now, as we only support dojo, there is no configuration, it just
>>> expects that the right dependencies are available in the classpath. Having
>>> said that, when we start supporting two, we might want to look for
>>> something more intelligent.
>>>
>>> --
>>> Luciano Resende
>>> http://people.apache.org/~lresende
>>> http://twitter.com/lresende1975
>>> http://lresende.blogspot.com/
>>>
>>
>>
>>
>> --
>>
>> Thanks and regards....
>>
>> May God Bless us!
>>
>> *AkH!L.*
>>
>> *http://akhilspassion.blogspot.com*
>>
>
>
>
> --
> Luciano Resende
> http://people.apache.org/~lresende
> http://twitter.com/lresende1975
> http://lresende.blogspot.com/
>



-- 

Thanks and regards....

May God Bless us!

*AkH!L.*

*http://akhilspassion.blogspot.com*

Re: Enhancing Widget Support for jQuery TUSCANY-4077

Posted by Luciano Resende <lu...@gmail.com>.
On Thu, Jul 18, 2013 at 6:25 AM, Akhil Anil <ak...@gmail.com> wrote:

> Hi,
>
> public interface *ComponentJavaScriptGenerator *{
>    /**
>      ** Return the QName that identify the Component script generator*
> *     * This is used to identify different generators supporting
> different JavaScript frameworks*
>      *
>      * @return The QName
>      */
>     QName getQName();
> ...
> }
>
> There is already this field QName in ComponentJavaScriptGenerator that is
> defined in DojoJavaScriptComponentGeneratorImpl as
>
> *private static final QName NAME = new QName("
> http://tuscany.apache.org/xmlns/sca/1.1",
> "component.script.generator.dojo");*
> *
> *
> As mentioned in the comments (marked in red), its for supporting different
> JS frameworks. Can we bring this out into the *.composite files and present
> it as a configuration option to the user. But I'm confused as of how to do
> it rt now. I'm gonna look all over the samples to find if such examples are
> there for technologies other than js. Any suggestions on where to look?
>
>
I didn't remember that we already had something on the models, we can
definetly reuse stuff that is already there.


> BTW, is there any specific format for the proposal? Is there an example
> available?
>
>
http://community.apache.org/mentoringprogramme-icfoss-pilot.html


>
> On 17 July 2013 11:14, Luciano Resende <lu...@gmail.com> wrote:
>
>>
>>
>>
>> On Tue, Jul 16, 2013 at 10:41 PM, Akhil Anil <ak...@gmail.com>wrote:
>>
>>> Hi,
>>>
>>> That's great advice.Thanks! I'm reading through the store.js and also
>>> saw the dojo.js alongwith it. I'll do as u said. BTW, where do a tuscany
>>> user configure the application to use dojo or jquery.  I dont see it
>>> configured anywhere in the store example. Where can we add such a
>>> configuration. Just quote me project file names, search keywords or links
>>> for any of my trivial queries. I'll dig out the rest.
>>>
>>>
>>>
>> Right now, as we only support dojo, there is no configuration, it just
>> expects that the right dependencies are available in the classpath. Having
>> said that, when we start supporting two, we might want to look for
>> something more intelligent.
>>
>> --
>> Luciano Resende
>> http://people.apache.org/~lresende
>> http://twitter.com/lresende1975
>> http://lresende.blogspot.com/
>>
>
>
>
> --
>
> Thanks and regards....
>
> May God Bless us!
>
> *AkH!L.*
>
> *http://akhilspassion.blogspot.com*
>



-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/

Re: Enhancing Widget Support for jQuery TUSCANY-4077

Posted by Akhil Anil <ak...@gmail.com>.
Hi,

public interface *ComponentJavaScriptGenerator *{
   /**
     ** Return the QName that identify the Component script generator*
*     * This is used to identify different generators supporting different
JavaScript frameworks*
     *
     * @return The QName
     */
    QName getQName();
...
}

There is already this field QName in ComponentJavaScriptGenerator that is
defined in DojoJavaScriptComponentGeneratorImpl as

*private static final QName NAME = new QName("
http://tuscany.apache.org/xmlns/sca/1.1",
"component.script.generator.dojo");*
*
*
As mentioned in the comments (marked in red), its for supporting different
JS frameworks. Can we bring this out into the *.composite files and present
it as a configuration option to the user. But I'm confused as of how to do
it rt now. I'm gonna look all over the samples to find if such examples are
there for technologies other than js. Any suggestions on where to look?

BTW, is there any specific format for the proposal? Is there an example
available?


On 17 July 2013 11:14, Luciano Resende <lu...@gmail.com> wrote:

>
>
>
> On Tue, Jul 16, 2013 at 10:41 PM, Akhil Anil <ak...@gmail.com>wrote:
>
>> Hi,
>>
>> That's great advice.Thanks! I'm reading through the store.js and also saw
>> the dojo.js alongwith it. I'll do as u said. BTW, where do a tuscany user
>> configure the application to use dojo or jquery.  I dont see it configured
>> anywhere in the store example. Where can we add such a configuration. Just
>> quote me project file names, search keywords or links for any of my trivial
>> queries. I'll dig out the rest.
>>
>>
>>
> Right now, as we only support dojo, there is no configuration, it just
> expects that the right dependencies are available in the classpath. Having
> said that, when we start supporting two, we might want to look for
> something more intelligent.
>
> --
> Luciano Resende
> http://people.apache.org/~lresende
> http://twitter.com/lresende1975
> http://lresende.blogspot.com/
>



-- 

Thanks and regards....

May God Bless us!

*AkH!L.*

*http://akhilspassion.blogspot.com*

Re: Enhancing Widget Support for jQuery TUSCANY-4077

Posted by Luciano Resende <lu...@gmail.com>.
On Tue, Jul 16, 2013 at 10:41 PM, Akhil Anil <ak...@gmail.com> wrote:

> Hi,
>
> That's great advice.Thanks! I'm reading through the store.js and also saw
> the dojo.js alongwith it. I'll do as u said. BTW, where do a tuscany user
> configure the application to use dojo or jquery.  I dont see it configured
> anywhere in the store example. Where can we add such a configuration. Just
> quote me project file names, search keywords or links for any of my trivial
> queries. I'll dig out the rest.
>
>
>
Right now, as we only support dojo, there is no configuration, it just
expects that the right dependencies are available in the classpath. Having
said that, when we start supporting two, we might want to look for
something more intelligent.

-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/

Re: Enhancing Widget Support for jQuery TUSCANY-4077

Posted by Akhil Anil <ak...@gmail.com>.
Hi,

That's great advice.Thanks! I'm reading through the store.js and also saw
the dojo.js alongwith it. I'll do as u said. BTW, where do a tuscany user
configure the application to use dojo or jquery.  I dont see it configured
anywhere in the store example. Where can we add such a configuration. Just
quote me project file names, search keywords or links for any of my trivial
queries. I'll dig out the rest.


On 17 July 2013 06:24, Luciano Resende <lu...@gmail.com> wrote:

>
> On Tue, Jul 16, 2013 at 5:36 PM, Akhil Anil <ak...@gmail.com> wrote:
>
>> I researched about writing jQuery plugins. We could generate one plugin
>> file to handle the tuscany calls, they could easly make calls to the
>> backed. I've updated the proposal page with some ideas I have. Please have
>> a look and if I'm in the right direction.
>>
>>
>> https://cwiki.apache.org/confluence/display/COMDEV/Proposal+For+Tuscany+-+Akhil+Anil
>>
>>
>>
>
> Here are some comments
>
> 1. Add the jquery option to implementation.widget to handle jquery codes
> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
> xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
> targetNamespace="http://store"
> name="store">
>
> <component name="store">
> <t:implementation.widget location="contents/store.html"/>
> <service name="Widget">
> <t:binding.http/>
> </service>
> <reference name="catalog" target="Catalog">
> <t:binding.jquery/>
> </reference>
> ...
> </component>
>
> .....
> </composite>
>
> <lresende>
> We are not building a new binding for jquery. The idea is to modify
> implementation widget, which currently generates javascript code based on
> Dojo, to also be able to generate code based on jQuery. If you look at
> implementation-widget-runtime-dojo, we will need something like
> implementation-widget-runtime-jquery. Here are some of the places we
> genrate js code [2] And here are some extensions we build for dojo [3]
>
> [1]
> https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/modules/implementation-widget-runtime-dojo/
> [2]
> https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/modules/implementation-widget-runtime-dojo/src/main/java/org/apache/tuscany/sca/implementation/widget/dojo/DojoJavaScriptComponentGeneratorImpl.java
> [3]
> https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/modules/web-javascript-dojo/src/main/resources/tuscany/
>
> </lresende>
>
> 2. Include a generated jQuery plugin
> <!-- one js include per sca component -->
> <script type="text/javascript" src="jQuery.tuscany.js"></script>jQuery
> plugins extends the core jQuery nature [1] . This file would be generated
> by a generator function in the server side.
>
> [1] Book Reference : jQuery in Action, Chapter 8
>
>
> <lresende>
> I'm not sure if we need a jQuery plugin, we might be able to use the
> jQuery existing stuff such as $.ajax
> </lresende>
>
>
> 3. Defining html In Resources
> The user can write everything in under jQuery syntax and we will have code
> to handle it in the generated plugin file.
>
> For Eg:
>
> var ref2 = $.tuscanyReferenceCall.("catalog");
>
> var ref2 = $.tuscanyReferenceCall.("shoppingCart");
>
>
> <lresende>
>    We should not have to change the application in order to use jQuery, we
> should be able to swap the jars in the classpath, or have some kind of
> switch on the composite file, but the application stays the same. The idea
> is basically enable applications that are already using dojo, to use dojo,
> but the ones that use jquery, use jquery, and not have two js frameworks
> just because of Tuscany.
> </lresende>
>
>
> As next step, try to use js debugger and see what goes on on the client
> side of store sample application, particularly on the generated store.js
> file.
>
>
> --
> Luciano Resende
> http://people.apache.org/~lresende
> http://twitter.com/lresende1975
> http://lresende.blogspot.com/
>



-- 

Thanks and regards....

May God Bless us!

*AkH!L.*

*http://akhilspassion.blogspot.com*

Re: Enhancing Widget Support for jQuery TUSCANY-4077

Posted by Luciano Resende <lu...@gmail.com>.
On Tue, Jul 16, 2013 at 5:36 PM, Akhil Anil <ak...@gmail.com> wrote:

> I researched about writing jQuery plugins. We could generate one plugin
> file to handle the tuscany calls, they could easly make calls to the
> backed. I've updated the proposal page with some ideas I have. Please have
> a look and if I'm in the right direction.
>
>
> https://cwiki.apache.org/confluence/display/COMDEV/Proposal+For+Tuscany+-+Akhil+Anil
>
>
>

Here are some comments

1. Add the jquery option to implementation.widget to handle jquery codes
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
targetNamespace="http://store"
name="store">

<component name="store">
<t:implementation.widget location="contents/store.html"/>
<service name="Widget">
<t:binding.http/>
</service>
<reference name="catalog" target="Catalog">
<t:binding.jquery/>
</reference>
...
</component>

.....
</composite>

<lresende>
We are not building a new binding for jquery. The idea is to modify
implementation widget, which currently generates javascript code based on
Dojo, to also be able to generate code based on jQuery. If you look at
implementation-widget-runtime-dojo, we will need something like
implementation-widget-runtime-jquery. Here are some of the places we
genrate js code [2] And here are some extensions we build for dojo [3]

[1]
https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/modules/implementation-widget-runtime-dojo/
[2]
https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/modules/implementation-widget-runtime-dojo/src/main/java/org/apache/tuscany/sca/implementation/widget/dojo/DojoJavaScriptComponentGeneratorImpl.java
[3]
https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/modules/web-javascript-dojo/src/main/resources/tuscany/

</lresende>

2. Include a generated jQuery plugin
<!-- one js include per sca component -->
<script type="text/javascript" src="jQuery.tuscany.js"></script>jQuery
plugins extends the core jQuery nature [1] . This file would be generated
by a generator function in the server side.

[1] Book Reference : jQuery in Action, Chapter 8


<lresende>
I'm not sure if we need a jQuery plugin, we might be able to use the jQuery
existing stuff such as $.ajax
</lresende>


3. Defining html In Resources
The user can write everything in under jQuery syntax and we will have code
to handle it in the generated plugin file.

For Eg:

var ref2 = $.tuscanyReferenceCall.("catalog");

var ref2 = $.tuscanyReferenceCall.("shoppingCart");


<lresende>
   We should not have to change the application in order to use jQuery, we
should be able to swap the jars in the classpath, or have some kind of
switch on the composite file, but the application stays the same. The idea
is basically enable applications that are already using dojo, to use dojo,
but the ones that use jquery, use jquery, and not have two js frameworks
just because of Tuscany.
</lresende>


As next step, try to use js debugger and see what goes on on the client
side of store sample application, particularly on the generated store.js
file.

-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/

Re: Enhancing Widget Support for jQuery TUSCANY-4077

Posted by Akhil Anil <ak...@gmail.com>.
I researched about writing jQuery plugins. We could generate one plugin
file to handle the tuscany calls, they could easly make calls to the
backed. I've updated the proposal page with some ideas I have. Please have
a look and if I'm in the right direction.

https://cwiki.apache.org/confluence/display/COMDEV/Proposal+For+Tuscany+-+Akhil+Anil


On 15 July 2013 23:33, Luciano Resende <lu...@gmail.com> wrote:

>
>
>
> On Mon, Jul 15, 2013 at 5:36 AM, Akhil Anil <ak...@gmail.com> wrote:
>
>> As an learning step for enhancing the widget support, I'm looking
>> through files like WidgetImplementation.java,
>> DojoJavaScriptComponentGeneratorImpl.java. Is there anything else I
>> should look on for? We can implement the jquery support just lyk
>> json-rpc rt? If yes I'll try to put up how the composite file addition
>> looks like. Please, correct me if I'm wrong.
>>
>>
> Take a look at the Widget Implementation
>
> http://tuscany.apache.org/sca-java-implementationwidget.html
>
> We should be able to use jQuery as the javascript client to communicate
> with the backend. And it should be plugable (e.g. some people will use
> dojo, others jquery)
>
> --
> Luciano Resende
> http://people.apache.org/~lresende
> http://twitter.com/lresende1975
> http://lresende.blogspot.com/
>



-- 

Thanks and regards....

May God Bless us!

*AkH!L.*

*http://akhilspassion.blogspot.com*

Re: Enhancing Widget Support for jQuery TUSCANY-4077

Posted by Luciano Resende <lu...@gmail.com>.
On Mon, Jul 15, 2013 at 5:36 AM, Akhil Anil <ak...@gmail.com> wrote:

> As an learning step for enhancing the widget support, I'm looking
> through files like WidgetImplementation.java,
> DojoJavaScriptComponentGeneratorImpl.java. Is there anything else I
> should look on for? We can implement the jquery support just lyk
> json-rpc rt? If yes I'll try to put up how the composite file addition
> looks like. Please, correct me if I'm wrong.
>
>
Take a look at the Widget Implementation

http://tuscany.apache.org/sca-java-implementationwidget.html

We should be able to use jQuery as the javascript client to communicate
with the backend. And it should be plugable (e.g. some people will use
dojo, others jquery)

-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/