You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@airavata.apache.org by Supun Nakandala <su...@gmail.com> on 2014/03/17 19:37:09 UTC

Integrating a thrift javascript client sdk with angularjs

Hi All,

I was able to do successful POC on the $subject (the source code is
available at [1]). I implemented a simple thrift API (thrift descriptor
[2]) for echo function. The server side was implemented in java and for the
client side I used javascript.

Important points WRT to thrift
    ->Thrift javascript client can be used only against a http server. So I
wrapped the EchoServiceHandler.java[3] inside EchoServlet.java[4] and
deployed in tomcat server.
    ->Thrift client sdk currently supports only AJAX based communication.

Important points WRT to thrift client and angular integration
    ->Thrift js client can be used for the communication with the server
within angular. But the problem is, since thrift client is not part of
angular, when we do the ajax communication and update the model the changes
will not be updated in the DOM. The reason is angular is not aware of the
events triggered outside of the framework. But this can be overcome by
wrapping thrift client inside an angular service and using promises in
angular to notify the success of ajax calls and then manually updating the
DOM.

The thrift client that I created for this service can be found at[5]. This
thrift client is wrapped inside this angular service[6] and that service is
used in controller [7]. I have also attached screen shots of the demo.

Hope Shameera, Sanchit, Viknes or Vijayendra can provide feedback on this
POC and evaluate whether this POC is sound enough to guaranty that web
based experiment builder can be integrated with the thrift client sdk.

Thank you.
Supun Nakandala

[1] - https://github.com/scnakandala/echo_service
[2] - https://github.com/scnakandala/echo_service/blob/master/Echo.thrift
[3] -
https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServiceHandler.java
[4] -
https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServlet.java
[5] -
https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/lib/echo_service/echo_client.js

[6] -
https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/services.js

[7] -
https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/controllers.js

Re: Integrating a thrift javascript client sdk with angularjs

Posted by Supun Nakandala <su...@gmail.com>.
Hi Vijayendra,


On Wed, Mar 19, 2014 at 9:48 PM, Vijayendra Grampurohit <
vijayendra.sdm@gmail.com> wrote:

> Hi All
>
> @Shameera : It would be better if we come up with new javascript client in
> AngularJS instead of  wraping exiting javaScript client as angular
> service. We faced lot of issues last time doing this. Do you remember?
>
> Currently I am looking into Thrift API.
>
> Can we have a concrete plan on
> 1) Integrating different modules. For this we have to rewrite the
> Javascript API in Angularjs.
> 2) writing thrift client in Angularjs
>
 Can you explain more on this. According to what I found and what I
experimented the Thrift JS client is auto generated by the thrift framework
and all the data model classes and communication is handled by thrift
itself.

>
> Regards
> Vijayendra
>
>
>
>
>
> On Wed, Mar 19, 2014 at 8:50 AM, Suresh Marru <sm...@apache.org> wrote:
>
>> Hi Supun,
>>
>> Since there are no further comments on this thread, I would encourage you
>> to start working on the GSoC proposal. Just start a proposal on google
>> melegenge portal, make it publicly readable and share it on the dev list
>> for comments.
>>
>> Suresh
>> On Mar 17, 2014, at 3:24 PM, Suresh Marru <sm...@apache.org> wrote:
>>
>> > Thanks Supun for taking the initiative. I echo Shameera that this seem
>> to be a good working stop-gap strategy. But I am not knowledgable enough to
>> judge on this topic and would like to listen critical feedback from others.
>> >
>> > Suresh
>> >
>> > On Mar 17, 2014, at 2:58 PM, Shameera Rathnayaka <
>> shameerainfo@gmail.com> wrote:
>> >
>> >> Hi Supun,
>> >>
>> >> This is great, I too found this $scope.apply()[1] would solve our
>> issue . And i was going to follow this[2] and come up with a sample demo
>> but you already have done it :) (didn't check it, will do).  For now we can
>> wrap exiting javaScript client as angular service and use it inside the
>> angular. But for long run It would be good to use Thrift generated JS
>> client instead exiting JS client. @Sanchit and all WDYT?
>> >>
>> >> [1]
>> https://github.com/angular/angular.js/wiki/When-to-use-$scope.$apply%28%29
>> >> [2] http://jimhoskins.com/2012/12/17/angularjs-and-apply.html
>> >>
>> >>
>> >> Thanks,
>> >> Shameera.
>> >>
>> >>
>> >>
>> >>
>> >> On Tue, Mar 18, 2014 at 12:07 AM, Supun Nakandala <
>> supun.nakandala@gmail.com> wrote:
>> >> Hi All,
>> >>
>> >> I was able to do successful POC on the $subject (the source code is
>> available at [1]). I implemented a simple thrift API (thrift descriptor
>> [2]) for echo function. The server side was implemented in java and for the
>> client side I used javascript.
>> >>
>> >> Important points WRT to thrift
>> >>    ->Thrift javascript client can be used only against a http server.
>> So I wrapped the EchoServiceHandler.java[3] inside EchoServlet.java[4] and
>> deployed in tomcat server.
>> >>    ->Thrift client sdk currently supports only AJAX based
>> communication.
>> >>
>> >> Important points WRT to thrift client and angular integration
>> >>    ->Thrift js client can be used for the communication with the
>> server within angular. But the problem is, since thrift client is not part
>> of angular, when we do the ajax communication and update the model the
>> changes will not be updated in the DOM. The reason is angular is not aware
>> of the events triggered outside of the framework. But this can be overcome
>> by wrapping thrift client inside an angular service and using promises in
>> angular to notify the success of ajax calls and then manually updating the
>> DOM.
>> >>
>> >> The thrift client that I created for this service can be found at[5].
>> This thrift client is wrapped inside this angular service[6] and that
>> service is used in controller [7]. I have also attached screen shots of the
>> demo.
>> >>
>> >> Hope Shameera, Sanchit, Viknes or Vijayendra can provide feedback on
>> this POC and evaluate whether this POC is sound enough to guaranty that web
>> based experiment builder can be integrated with the thrift client sdk.
>> >>
>> >> Thank you.
>> >> Supun Nakandala
>> >>
>> >> [1] - https://github.com/scnakandala/echo_service
>> >> [2] -
>> https://github.com/scnakandala/echo_service/blob/master/Echo.thrift
>> >> [3] -
>> https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServiceHandler.java
>> >> [4] -
>> https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServlet.java
>> >> [5] -
>> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/lib/echo_service/echo_client.js
>> >>
>> >> [6] -
>> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/services.js
>> >>
>> >> [7] -
>> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/controllers.js
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> Best Regards,
>> >> Shameera Rathnayaka.
>> >>
>> >> email: shameera AT apache.org , shameerainfo AT gmail.com
>> >> Blog : http://shameerarathnayaka.blogspot.com/
>> >
>>
>>
>


-- 
Thank you
Supun Nakandala
Dept. Computer Science and Engineering
University of Moratuwa

Re: Integrating a thrift javascript client sdk with angularjs

Posted by Supun Nakandala <su...@gmail.com>.
Hi All,


On Thu, Mar 20, 2014 at 1:22 AM, Suresh Marru <sm...@apache.org> wrote:

> Hi Supun, Sanchit, Vijayendra,
>
> As Mentores we should not dictate what projects you write proposals, but
> let me summarize all the projects and let you come to a consensus of who
> does what.
>
> * Re-architecting Airavata Data Management  -- Sachith is working on this
> proposal.
> * EC2 provider to be updated and ported to use JClouds - I see Nipun is
> working on a proposal
> * Integrating Airavata with GenApp (presented on gsoc hangout)  - Nadeem
> is working on this proposal
>
> Supun already has a proposal submitted for refactoring the web ui and
> xbaya.
>
> Here are the fuzzy boarders:
>
> * Web UI from last year has six gsoc projects (including the admin
> dashboard). This year they should not amount to more than a project or two
> to update them to directly use thrift API and integrate with the a separate
> Airavata Web UI builds.
>
> * XBaya is a beast. It has too many parts. Supun has touched on this, but
> it does not hurt to have a project fully focused on it/
>
> * The Thrift Client - Server Security/Identity Server is an idea for some
> one to pick up. With the deadline less than 48 hours, I am worried it may
> be too late. But on a good side, this can be modeled on how Evernote has
> been implementing their own security (dev.evernote.com) and if some
> spends enough time on thrift developer list, it should not be too hard to
> mimic for Airavata. I will be happy to work with any one interested to
> explain this project.
>
> I am more interested about working on the project "Add Security
capabilities to Airavata Thrift services and Clients". I am working on
submitting a proposal for that project. Hope Sanchith and Vijayendra can
continue on working on the proposals for WebUI in Airavata.


> Suresh
>
> On Mar 19, 2014, at 2:54 PM, Vijayendra Grampurohit <
> vijayendra.sdm@gmail.com> wrote:
>
> > Hi Suresh
> >
> > Yes. I and sanchit were thinking of writing the proposal. As the
> individual projects overlap and finally have to work together as a single
> unit, I think it would be appropriate to divide the work and project.
> >
> >
> > Regards
> > Vijayendra
> >
> >
> > On Wed, Mar 19, 2014 at 10:34 PM, Suresh Marru <sm...@apache.org>
> wrote:
> > Hi Vijayendra,
> >
> > Are you planning to write a proposal?
> >
> > Suresh
> >
> > On Mar 19, 2014, at 12:21 PM, Vijayendra Grampurohit <
> vijayendra.sdm@gmail.com> wrote:
> >
> > > Hi Suresh
> > >
> > > Can you tell us more about the division of the project into sub
> modules? It would be helpful in writing the proposal.
> > >
> > > Regards
> > > Vijayendra
> > >
> > >
> > > On Wed, Mar 19, 2014 at 9:48 PM, Vijayendra Grampurohit <
> vijayendra.sdm@gmail.com> wrote:
> > > Hi All
> > >
> > > @Shameera : It would be better if we come up with new javascript
> client in AngularJS instead of  wraping exiting javaScript client as
> angular service. We faced lot of issues last time doing this. Do you
> remember?
> > >
> > > Currently I am looking into Thrift API.
> > >
> > > Can we have a concrete plan on
> > > 1) Integrating different modules. For this we have to rewrite the
> Javascript API in Angularjs.
> > > 2) writing thrift client in Angularjs
> > >
> > >
> > > Regards
> > > Vijayendra
> > >
> > >
> > >
> > >
> > >
> > > On Wed, Mar 19, 2014 at 8:50 AM, Suresh Marru <sm...@apache.org>
> wrote:
> > > Hi Supun,
> > >
> > > Since there are no further comments on this thread, I would encourage
> you to start working on the GSoC proposal. Just start a proposal on google
> melegenge portal, make it publicly readable and share it on the dev list
> for comments.
> > >
> > > Suresh
> > > On Mar 17, 2014, at 3:24 PM, Suresh Marru <sm...@apache.org> wrote:
> > >
> > > > Thanks Supun for taking the initiative. I echo Shameera that this
> seem to be a good working stop-gap strategy. But I am not knowledgable
> enough to judge on this topic and would like to listen critical feedback
> from others.
> > > >
> > > > Suresh
> > > >
> > > > On Mar 17, 2014, at 2:58 PM, Shameera Rathnayaka <
> shameerainfo@gmail.com> wrote:
> > > >
> > > >> Hi Supun,
> > > >>
> > > >> This is great, I too found this $scope.apply()[1] would solve our
> issue . And i was going to follow this[2] and come up with a sample demo
> but you already have done it :) (didn't check it, will do).  For now we can
> wrap exiting javaScript client as angular service and use it inside the
> angular. But for long run It would be good to use Thrift generated JS
> client instead exiting JS client. @Sanchit and all WDYT?
> > > >>
> > > >> [1]
> https://github.com/angular/angular.js/wiki/When-to-use-$scope.$apply%28%29
> > > >> [2] http://jimhoskins.com/2012/12/17/angularjs-and-apply.html
> > > >>
> > > >>
> > > >> Thanks,
> > > >> Shameera.
> > > >>
> > > >>
> > > >>
> > > >>
> > > >> On Tue, Mar 18, 2014 at 12:07 AM, Supun Nakandala <
> supun.nakandala@gmail.com> wrote:
> > > >> Hi All,
> > > >>
> > > >> I was able to do successful POC on the $subject (the source code is
> available at [1]). I implemented a simple thrift API (thrift descriptor
> [2]) for echo function. The server side was implemented in java and for the
> client side I used javascript.
> > > >>
> > > >> Important points WRT to thrift
> > > >>    ->Thrift javascript client can be used only against a http
> server. So I wrapped the EchoServiceHandler.java[3] inside
> EchoServlet.java[4] and deployed in tomcat server.
> > > >>    ->Thrift client sdk currently supports only AJAX based
> communication.
> > > >>
> > > >> Important points WRT to thrift client and angular integration
> > > >>    ->Thrift js client can be used for the communication with the
> server within angular. But the problem is, since thrift client is not part
> of angular, when we do the ajax communication and update the model the
> changes will not be updated in the DOM. The reason is angular is not aware
> of the events triggered outside of the framework. But this can be overcome
> by wrapping thrift client inside an angular service and using promises in
> angular to notify the success of ajax calls and then manually updating the
> DOM.
> > > >>
> > > >> The thrift client that I created for this service can be found
> at[5]. This thrift client is wrapped inside this angular service[6] and
> that service is used in controller [7]. I have also attached screen shots
> of the demo.
> > > >>
> > > >> Hope Shameera, Sanchit, Viknes or Vijayendra can provide feedback
> on this POC and evaluate whether this POC is sound enough to guaranty that
> web based experiment builder can be integrated with the thrift client sdk.
> > > >>
> > > >> Thank you.
> > > >> Supun Nakandala
> > > >>
> > > >> [1] - https://github.com/scnakandala/echo_service
> > > >> [2] -
> https://github.com/scnakandala/echo_service/blob/master/Echo.thrift
> > > >> [3] -
> https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServiceHandler.java
> > > >> [4] -
> https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServlet.java
> > > >> [5] -
> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/lib/echo_service/echo_client.js
> > > >>
> > > >> [6] -
> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/services.js
> > > >>
> > > >> [7] -
> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/controllers.js
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >> --
> > > >> Best Regards,
> > > >> Shameera Rathnayaka.
> > > >>
> > > >> email: shameera AT apache.org , shameerainfo AT gmail.com
> > > >> Blog : http://shameerarathnayaka.blogspot.com/
> > > >
> > >
> > >
> > >
> >
> >
>
>


-- 
Thank you
Supun Nakandala
Dept. Computer Science and Engineering
University of Moratuwa

Re: Integrating a thrift javascript client sdk with angularjs

Posted by Suresh Marru <sm...@apache.org>.
Hi Supun, Sanchit, Vijayendra,

As Mentores we should not dictate what projects you write proposals, but let me summarize all the projects and let you come to a consensus of who does what.

* Re-architecting Airavata Data Management  — Sachith is working on this proposal.
* EC2 provider to be updated and ported to use JClouds - I see Nipun is working on a proposal
* Integrating Airavata with GenApp (presented on gsoc hangout)  - Nadeem is working on this proposal

Supun already has a proposal submitted for refactoring the web ui and xbaya. 

Here are the fuzzy boarders:

* Web UI from last year has six gsoc projects (including the admin dashboard). This year they should not amount to more than a project or two to update them to directly use thrift API and integrate with the a separate Airavata Web UI builds. 

* XBaya is a beast. It has too many parts. Supun has touched on this, but it does not hurt to have a project fully focused on it/

* The Thrift Client - Server Security/Identity Server is an idea for some one to pick up. With the deadline less than 48 hours, I am worried it may be too late. But on a good side, this can be modeled on how Evernote has been implementing their own security (dev.evernote.com) and if some spends enough time on thrift developer list, it should not be too hard to mimic for Airavata. I will be happy to work with any one interested to explain this project.

Suresh

On Mar 19, 2014, at 2:54 PM, Vijayendra Grampurohit <vi...@gmail.com> wrote:

> Hi Suresh
> 
> Yes. I and sanchit were thinking of writing the proposal. As the individual projects overlap and finally have to work together as a single unit, I think it would be appropriate to divide the work and project.
> 
> 
> Regards
> Vijayendra
> 
> 
> On Wed, Mar 19, 2014 at 10:34 PM, Suresh Marru <sm...@apache.org> wrote:
> Hi Vijayendra,
> 
> Are you planning to write a proposal?
> 
> Suresh
> 
> On Mar 19, 2014, at 12:21 PM, Vijayendra Grampurohit <vi...@gmail.com> wrote:
> 
> > Hi Suresh
> >
> > Can you tell us more about the division of the project into sub modules? It would be helpful in writing the proposal.
> >
> > Regards
> > Vijayendra
> >
> >
> > On Wed, Mar 19, 2014 at 9:48 PM, Vijayendra Grampurohit <vi...@gmail.com> wrote:
> > Hi All
> >
> > @Shameera : It would be better if we come up with new javascript client in AngularJS instead of  wraping exiting javaScript client as angular service. We faced lot of issues last time doing this. Do you remember?
> >
> > Currently I am looking into Thrift API.
> >
> > Can we have a concrete plan on
> > 1) Integrating different modules. For this we have to rewrite the Javascript API in Angularjs.
> > 2) writing thrift client in Angularjs
> >
> >
> > Regards
> > Vijayendra
> >
> >
> >
> >
> >
> > On Wed, Mar 19, 2014 at 8:50 AM, Suresh Marru <sm...@apache.org> wrote:
> > Hi Supun,
> >
> > Since there are no further comments on this thread, I would encourage you to start working on the GSoC proposal. Just start a proposal on google melegenge portal, make it publicly readable and share it on the dev list for comments.
> >
> > Suresh
> > On Mar 17, 2014, at 3:24 PM, Suresh Marru <sm...@apache.org> wrote:
> >
> > > Thanks Supun for taking the initiative. I echo Shameera that this seem to be a good working stop-gap strategy. But I am not knowledgable enough to judge on this topic and would like to listen critical feedback from others.
> > >
> > > Suresh
> > >
> > > On Mar 17, 2014, at 2:58 PM, Shameera Rathnayaka <sh...@gmail.com> wrote:
> > >
> > >> Hi Supun,
> > >>
> > >> This is great, I too found this $scope.apply()[1] would solve our issue . And i was going to follow this[2] and come up with a sample demo but you already have done it :) (didn't check it, will do).  For now we can wrap exiting javaScript client as angular service and use it inside the angular. But for long run It would be good to use Thrift generated JS client instead exiting JS client. @Sanchit and all WDYT?
> > >>
> > >> [1] https://github.com/angular/angular.js/wiki/When-to-use-$scope.$apply%28%29
> > >> [2] http://jimhoskins.com/2012/12/17/angularjs-and-apply.html
> > >>
> > >>
> > >> Thanks,
> > >> Shameera.
> > >>
> > >>
> > >>
> > >>
> > >> On Tue, Mar 18, 2014 at 12:07 AM, Supun Nakandala <su...@gmail.com> wrote:
> > >> Hi All,
> > >>
> > >> I was able to do successful POC on the $subject (the source code is available at [1]). I implemented a simple thrift API (thrift descriptor [2]) for echo function. The server side was implemented in java and for the client side I used javascript.
> > >>
> > >> Important points WRT to thrift
> > >>    ->Thrift javascript client can be used only against a http server. So I wrapped the EchoServiceHandler.java[3] inside EchoServlet.java[4] and deployed in tomcat server.
> > >>    ->Thrift client sdk currently supports only AJAX based communication.
> > >>
> > >> Important points WRT to thrift client and angular integration
> > >>    ->Thrift js client can be used for the communication with the server within angular. But the problem is, since thrift client is not part of angular, when we do the ajax communication and update the model the changes will not be updated in the DOM. The reason is angular is not aware of the events triggered outside of the framework. But this can be overcome by wrapping thrift client inside an angular service and using promises in angular to notify the success of ajax calls and then manually updating the DOM.
> > >>
> > >> The thrift client that I created for this service can be found at[5]. This thrift client is wrapped inside this angular service[6] and that service is used in controller [7]. I have also attached screen shots of the demo.
> > >>
> > >> Hope Shameera, Sanchit, Viknes or Vijayendra can provide feedback on this POC and evaluate whether this POC is sound enough to guaranty that web based experiment builder can be integrated with the thrift client sdk.
> > >>
> > >> Thank you.
> > >> Supun Nakandala
> > >>
> > >> [1] - https://github.com/scnakandala/echo_service
> > >> [2] - https://github.com/scnakandala/echo_service/blob/master/Echo.thrift
> > >> [3] - https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServiceHandler.java
> > >> [4] - https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServlet.java
> > >> [5] - https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/lib/echo_service/echo_client.js
> > >>
> > >> [6] - https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/services.js
> > >>
> > >> [7] - https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/controllers.js
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> --
> > >> Best Regards,
> > >> Shameera Rathnayaka.
> > >>
> > >> email: shameera AT apache.org , shameerainfo AT gmail.com
> > >> Blog : http://shameerarathnayaka.blogspot.com/
> > >
> >
> >
> >
> 
> 


Re: Integrating a thrift javascript client sdk with angularjs

Posted by Vijayendra Grampurohit <vi...@gmail.com>.
Hi Suresh

Yes. I and sanchit were thinking of writing the proposal. As the individual
projects overlap and finally have to work together as a single unit, I
think it would be appropriate to divide the work and project.


Regards
Vijayendra


On Wed, Mar 19, 2014 at 10:34 PM, Suresh Marru <sm...@apache.org> wrote:

> Hi Vijayendra,
>
> Are you planning to write a proposal?
>
> Suresh
>
> On Mar 19, 2014, at 12:21 PM, Vijayendra Grampurohit <
> vijayendra.sdm@gmail.com> wrote:
>
> > Hi Suresh
> >
> > Can you tell us more about the division of the project into sub modules?
> It would be helpful in writing the proposal.
> >
> > Regards
> > Vijayendra
> >
> >
> > On Wed, Mar 19, 2014 at 9:48 PM, Vijayendra Grampurohit <
> vijayendra.sdm@gmail.com> wrote:
> > Hi All
> >
> > @Shameera : It would be better if we come up with new javascript client
> in AngularJS instead of  wraping exiting javaScript client as angular
> service. We faced lot of issues last time doing this. Do you remember?
> >
> > Currently I am looking into Thrift API.
> >
> > Can we have a concrete plan on
> > 1) Integrating different modules. For this we have to rewrite the
> Javascript API in Angularjs.
> > 2) writing thrift client in Angularjs
> >
> >
> > Regards
> > Vijayendra
> >
> >
> >
> >
> >
> > On Wed, Mar 19, 2014 at 8:50 AM, Suresh Marru <sm...@apache.org> wrote:
> > Hi Supun,
> >
> > Since there are no further comments on this thread, I would encourage
> you to start working on the GSoC proposal. Just start a proposal on google
> melegenge portal, make it publicly readable and share it on the dev list
> for comments.
> >
> > Suresh
> > On Mar 17, 2014, at 3:24 PM, Suresh Marru <sm...@apache.org> wrote:
> >
> > > Thanks Supun for taking the initiative. I echo Shameera that this seem
> to be a good working stop-gap strategy. But I am not knowledgable enough to
> judge on this topic and would like to listen critical feedback from others.
> > >
> > > Suresh
> > >
> > > On Mar 17, 2014, at 2:58 PM, Shameera Rathnayaka <
> shameerainfo@gmail.com> wrote:
> > >
> > >> Hi Supun,
> > >>
> > >> This is great, I too found this $scope.apply()[1] would solve our
> issue . And i was going to follow this[2] and come up with a sample demo
> but you already have done it :) (didn't check it, will do).  For now we can
> wrap exiting javaScript client as angular service and use it inside the
> angular. But for long run It would be good to use Thrift generated JS
> client instead exiting JS client. @Sanchit and all WDYT?
> > >>
> > >> [1]
> https://github.com/angular/angular.js/wiki/When-to-use-$scope.$apply%28%29
> > >> [2] http://jimhoskins.com/2012/12/17/angularjs-and-apply.html
> > >>
> > >>
> > >> Thanks,
> > >> Shameera.
> > >>
> > >>
> > >>
> > >>
> > >> On Tue, Mar 18, 2014 at 12:07 AM, Supun Nakandala <
> supun.nakandala@gmail.com> wrote:
> > >> Hi All,
> > >>
> > >> I was able to do successful POC on the $subject (the source code is
> available at [1]). I implemented a simple thrift API (thrift descriptor
> [2]) for echo function. The server side was implemented in java and for the
> client side I used javascript.
> > >>
> > >> Important points WRT to thrift
> > >>    ->Thrift javascript client can be used only against a http server.
> So I wrapped the EchoServiceHandler.java[3] inside EchoServlet.java[4] and
> deployed in tomcat server.
> > >>    ->Thrift client sdk currently supports only AJAX based
> communication.
> > >>
> > >> Important points WRT to thrift client and angular integration
> > >>    ->Thrift js client can be used for the communication with the
> server within angular. But the problem is, since thrift client is not part
> of angular, when we do the ajax communication and update the model the
> changes will not be updated in the DOM. The reason is angular is not aware
> of the events triggered outside of the framework. But this can be overcome
> by wrapping thrift client inside an angular service and using promises in
> angular to notify the success of ajax calls and then manually updating the
> DOM.
> > >>
> > >> The thrift client that I created for this service can be found at[5].
> This thrift client is wrapped inside this angular service[6] and that
> service is used in controller [7]. I have also attached screen shots of the
> demo.
> > >>
> > >> Hope Shameera, Sanchit, Viknes or Vijayendra can provide feedback on
> this POC and evaluate whether this POC is sound enough to guaranty that web
> based experiment builder can be integrated with the thrift client sdk.
> > >>
> > >> Thank you.
> > >> Supun Nakandala
> > >>
> > >> [1] - https://github.com/scnakandala/echo_service
> > >> [2] -
> https://github.com/scnakandala/echo_service/blob/master/Echo.thrift
> > >> [3] -
> https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServiceHandler.java
> > >> [4] -
> https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServlet.java
> > >> [5] -
> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/lib/echo_service/echo_client.js
> > >>
> > >> [6] -
> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/services.js
> > >>
> > >> [7] -
> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/controllers.js
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> --
> > >> Best Regards,
> > >> Shameera Rathnayaka.
> > >>
> > >> email: shameera AT apache.org , shameerainfo AT gmail.com
> > >> Blog : http://shameerarathnayaka.blogspot.com/
> > >
> >
> >
> >
>
>

Re: Integrating a thrift javascript client sdk with angularjs

Posted by Suresh Marru <sm...@apache.org>.
Hi Vijayendra,

Are you planning to write a proposal?

Suresh

On Mar 19, 2014, at 12:21 PM, Vijayendra Grampurohit <vi...@gmail.com> wrote:

> Hi Suresh
> 
> Can you tell us more about the division of the project into sub modules? It would be helpful in writing the proposal.
> 
> Regards
> Vijayendra
> 
> 
> On Wed, Mar 19, 2014 at 9:48 PM, Vijayendra Grampurohit <vi...@gmail.com> wrote:
> Hi All
> 
> @Shameera : It would be better if we come up with new javascript client in AngularJS instead of  wraping exiting javaScript client as angular service. We faced lot of issues last time doing this. Do you remember?
> 
> Currently I am looking into Thrift API. 
> 
> Can we have a concrete plan on 
> 1) Integrating different modules. For this we have to rewrite the Javascript API in Angularjs.
> 2) writing thrift client in Angularjs
> 
> 
> Regards
> Vijayendra
> 
> 
> 
> 
> 
> On Wed, Mar 19, 2014 at 8:50 AM, Suresh Marru <sm...@apache.org> wrote:
> Hi Supun,
> 
> Since there are no further comments on this thread, I would encourage you to start working on the GSoC proposal. Just start a proposal on google melegenge portal, make it publicly readable and share it on the dev list for comments.
> 
> Suresh
> On Mar 17, 2014, at 3:24 PM, Suresh Marru <sm...@apache.org> wrote:
> 
> > Thanks Supun for taking the initiative. I echo Shameera that this seem to be a good working stop-gap strategy. But I am not knowledgable enough to judge on this topic and would like to listen critical feedback from others.
> >
> > Suresh
> >
> > On Mar 17, 2014, at 2:58 PM, Shameera Rathnayaka <sh...@gmail.com> wrote:
> >
> >> Hi Supun,
> >>
> >> This is great, I too found this $scope.apply()[1] would solve our issue . And i was going to follow this[2] and come up with a sample demo but you already have done it :) (didn't check it, will do).  For now we can wrap exiting javaScript client as angular service and use it inside the angular. But for long run It would be good to use Thrift generated JS client instead exiting JS client. @Sanchit and all WDYT?
> >>
> >> [1] https://github.com/angular/angular.js/wiki/When-to-use-$scope.$apply%28%29
> >> [2] http://jimhoskins.com/2012/12/17/angularjs-and-apply.html
> >>
> >>
> >> Thanks,
> >> Shameera.
> >>
> >>
> >>
> >>
> >> On Tue, Mar 18, 2014 at 12:07 AM, Supun Nakandala <su...@gmail.com> wrote:
> >> Hi All,
> >>
> >> I was able to do successful POC on the $subject (the source code is available at [1]). I implemented a simple thrift API (thrift descriptor [2]) for echo function. The server side was implemented in java and for the client side I used javascript.
> >>
> >> Important points WRT to thrift
> >>    ->Thrift javascript client can be used only against a http server. So I wrapped the EchoServiceHandler.java[3] inside EchoServlet.java[4] and deployed in tomcat server.
> >>    ->Thrift client sdk currently supports only AJAX based communication.
> >>
> >> Important points WRT to thrift client and angular integration
> >>    ->Thrift js client can be used for the communication with the server within angular. But the problem is, since thrift client is not part of angular, when we do the ajax communication and update the model the changes will not be updated in the DOM. The reason is angular is not aware of the events triggered outside of the framework. But this can be overcome by wrapping thrift client inside an angular service and using promises in angular to notify the success of ajax calls and then manually updating the DOM.
> >>
> >> The thrift client that I created for this service can be found at[5]. This thrift client is wrapped inside this angular service[6] and that service is used in controller [7]. I have also attached screen shots of the demo.
> >>
> >> Hope Shameera, Sanchit, Viknes or Vijayendra can provide feedback on this POC and evaluate whether this POC is sound enough to guaranty that web based experiment builder can be integrated with the thrift client sdk.
> >>
> >> Thank you.
> >> Supun Nakandala
> >>
> >> [1] - https://github.com/scnakandala/echo_service
> >> [2] - https://github.com/scnakandala/echo_service/blob/master/Echo.thrift
> >> [3] - https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServiceHandler.java
> >> [4] - https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServlet.java
> >> [5] - https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/lib/echo_service/echo_client.js
> >>
> >> [6] - https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/services.js
> >>
> >> [7] - https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/controllers.js
> >>
> >>
> >>
> >>
> >>
> >> --
> >> Best Regards,
> >> Shameera Rathnayaka.
> >>
> >> email: shameera AT apache.org , shameerainfo AT gmail.com
> >> Blog : http://shameerarathnayaka.blogspot.com/
> >
> 
> 
> 


Re: Integrating a thrift javascript client sdk with angularjs

Posted by Vijayendra Grampurohit <vi...@gmail.com>.
Hi Suresh

Can you tell us more about the division of the project into sub modules? It
would be helpful in writing the proposal.

Regards
Vijayendra


On Wed, Mar 19, 2014 at 9:48 PM, Vijayendra Grampurohit <
vijayendra.sdm@gmail.com> wrote:

> Hi All
>
> @Shameera : It would be better if we come up with new javascript client in
> AngularJS instead of  wraping exiting javaScript client as angular
> service. We faced lot of issues last time doing this. Do you remember?
>
> Currently I am looking into Thrift API.
>
> Can we have a concrete plan on
> 1) Integrating different modules. For this we have to rewrite the
> Javascript API in Angularjs.
> 2) writing thrift client in Angularjs
>
>
> Regards
> Vijayendra
>
>
>
>
>
> On Wed, Mar 19, 2014 at 8:50 AM, Suresh Marru <sm...@apache.org> wrote:
>
>> Hi Supun,
>>
>> Since there are no further comments on this thread, I would encourage you
>> to start working on the GSoC proposal. Just start a proposal on google
>> melegenge portal, make it publicly readable and share it on the dev list
>> for comments.
>>
>> Suresh
>> On Mar 17, 2014, at 3:24 PM, Suresh Marru <sm...@apache.org> wrote:
>>
>> > Thanks Supun for taking the initiative. I echo Shameera that this seem
>> to be a good working stop-gap strategy. But I am not knowledgable enough to
>> judge on this topic and would like to listen critical feedback from others.
>> >
>> > Suresh
>> >
>> > On Mar 17, 2014, at 2:58 PM, Shameera Rathnayaka <
>> shameerainfo@gmail.com> wrote:
>> >
>> >> Hi Supun,
>> >>
>> >> This is great, I too found this $scope.apply()[1] would solve our
>> issue . And i was going to follow this[2] and come up with a sample demo
>> but you already have done it :) (didn't check it, will do).  For now we can
>> wrap exiting javaScript client as angular service and use it inside the
>> angular. But for long run It would be good to use Thrift generated JS
>> client instead exiting JS client. @Sanchit and all WDYT?
>> >>
>> >> [1]
>> https://github.com/angular/angular.js/wiki/When-to-use-$scope.$apply%28%29
>> >> [2] http://jimhoskins.com/2012/12/17/angularjs-and-apply.html
>> >>
>> >>
>> >> Thanks,
>> >> Shameera.
>> >>
>> >>
>> >>
>> >>
>> >> On Tue, Mar 18, 2014 at 12:07 AM, Supun Nakandala <
>> supun.nakandala@gmail.com> wrote:
>> >> Hi All,
>> >>
>> >> I was able to do successful POC on the $subject (the source code is
>> available at [1]). I implemented a simple thrift API (thrift descriptor
>> [2]) for echo function. The server side was implemented in java and for the
>> client side I used javascript.
>> >>
>> >> Important points WRT to thrift
>> >>    ->Thrift javascript client can be used only against a http server.
>> So I wrapped the EchoServiceHandler.java[3] inside EchoServlet.java[4] and
>> deployed in tomcat server.
>> >>    ->Thrift client sdk currently supports only AJAX based
>> communication.
>> >>
>> >> Important points WRT to thrift client and angular integration
>> >>    ->Thrift js client can be used for the communication with the
>> server within angular. But the problem is, since thrift client is not part
>> of angular, when we do the ajax communication and update the model the
>> changes will not be updated in the DOM. The reason is angular is not aware
>> of the events triggered outside of the framework. But this can be overcome
>> by wrapping thrift client inside an angular service and using promises in
>> angular to notify the success of ajax calls and then manually updating the
>> DOM.
>> >>
>> >> The thrift client that I created for this service can be found at[5].
>> This thrift client is wrapped inside this angular service[6] and that
>> service is used in controller [7]. I have also attached screen shots of the
>> demo.
>> >>
>> >> Hope Shameera, Sanchit, Viknes or Vijayendra can provide feedback on
>> this POC and evaluate whether this POC is sound enough to guaranty that web
>> based experiment builder can be integrated with the thrift client sdk.
>> >>
>> >> Thank you.
>> >> Supun Nakandala
>> >>
>> >> [1] - https://github.com/scnakandala/echo_service
>> >> [2] -
>> https://github.com/scnakandala/echo_service/blob/master/Echo.thrift
>> >> [3] -
>> https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServiceHandler.java
>> >> [4] -
>> https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServlet.java
>> >> [5] -
>> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/lib/echo_service/echo_client.js
>> >>
>> >> [6] -
>> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/services.js
>> >>
>> >> [7] -
>> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/controllers.js
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> Best Regards,
>> >> Shameera Rathnayaka.
>> >>
>> >> email: shameera AT apache.org , shameerainfo AT gmail.com
>> >> Blog : http://shameerarathnayaka.blogspot.com/
>> >
>>
>>
>

Re: Integrating a thrift javascript client sdk with angularjs

Posted by Subho Banerjee <su...@gmail.com>.
Hi Shameera,
I don't want to shoot down that idea outright. But I have severe
reservations with that proposal (this was one of the main problems that
Sanchit and I had in integrating the backend to the frontend).

The problem with wrapping the Thrift client is that AngularJS' $promise
framework is not aware of http requests anymore.
Most of niceties of AngularJS comes from this framework (The dynamic
changes in webpages when the underlying models change etc.).

You make a point of tightly coupling the code with angular. Without the
promise framework, if you want to maintain similar functionality as the
original AngularJS, you are looking at rewriting substantial portions of
code that are already in AngularJS (but you are choosing not to use them).
I don't think this is the way forward. The $http request will be
understandable to a Airavata developer. A custom written $promise
framework... probably not!

This is the main problem that we had integrating your wrapper from las
years GSoC into the front end. We couldn't get the promises working with
the AJAX requests that you had written (much like the Thrift client).



On Thu, Mar 20, 2014 at 1:28 AM, Shameera Rathnayaka <shameerainfo@gmail.com
> wrote:

> Hi Vijayendra,
>
> My idea is, first connect the gap what we have with our previous project
> using the suggested approach, which is write a angular service by wrapping
> the exiting JS client. But saying that, i also +1 for completely implement
> the angular service by wrapping Thrift JS client in one go. That is the
> ultimate goal here. and -1 for implement the same thing with angular $http.
> Because this is tightly couple to the angular and it require special care
> for maintain, when ever there is any API addition or change. But we can
> avoid this complexity for some extend if we go with thrift JS api.
>
> Thanks,
> Shameera.
>
>
> On Wed, Mar 19, 2014 at 9:48 PM, Vijayendra Grampurohit <
> vijayendra.sdm@gmail.com> wrote:
>
>> Hi All
>>
>> @Shameera : It would be better if we come up with new javascript client
>> in AngularJS instead of  wraping exiting javaScript client as angular
>> service. We faced lot of issues last time doing this. Do you remember?
>>
>> Currently I am looking into Thrift API.
>>
>> Can we have a concrete plan on
>> 1) Integrating different modules. For this we have to rewrite the
>> Javascript API in Angularjs.
>> 2) writing thrift client in Angularjs
>>
>>
>> Regards
>> Vijayendra
>>
>>
>>
>>
>>
>> On Wed, Mar 19, 2014 at 8:50 AM, Suresh Marru <sm...@apache.org> wrote:
>>
>>> Hi Supun,
>>>
>>> Since there are no further comments on this thread, I would encourage
>>> you to start working on the GSoC proposal. Just start a proposal on google
>>> melegenge portal, make it publicly readable and share it on the dev list
>>> for comments.
>>>
>>> Suresh
>>> On Mar 17, 2014, at 3:24 PM, Suresh Marru <sm...@apache.org> wrote:
>>>
>>> > Thanks Supun for taking the initiative. I echo Shameera that this seem
>>> to be a good working stop-gap strategy. But I am not knowledgable enough to
>>> judge on this topic and would like to listen critical feedback from others.
>>> >
>>> > Suresh
>>> >
>>> > On Mar 17, 2014, at 2:58 PM, Shameera Rathnayaka <
>>> shameerainfo@gmail.com> wrote:
>>> >
>>> >> Hi Supun,
>>> >>
>>> >> This is great, I too found this $scope.apply()[1] would solve our
>>> issue . And i was going to follow this[2] and come up with a sample demo
>>> but you already have done it :) (didn't check it, will do).  For now we can
>>> wrap exiting javaScript client as angular service and use it inside the
>>> angular. But for long run It would be good to use Thrift generated JS
>>> client instead exiting JS client. @Sanchit and all WDYT?
>>> >>
>>> >> [1]
>>> https://github.com/angular/angular.js/wiki/When-to-use-$scope.$apply%28%29
>>> >> [2] http://jimhoskins.com/2012/12/17/angularjs-and-apply.html
>>> >>
>>> >>
>>> >> Thanks,
>>> >> Shameera.
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> On Tue, Mar 18, 2014 at 12:07 AM, Supun Nakandala <
>>> supun.nakandala@gmail.com> wrote:
>>> >> Hi All,
>>> >>
>>> >> I was able to do successful POC on the $subject (the source code is
>>> available at [1]). I implemented a simple thrift API (thrift descriptor
>>> [2]) for echo function. The server side was implemented in java and for the
>>> client side I used javascript.
>>> >>
>>> >> Important points WRT to thrift
>>> >>    ->Thrift javascript client can be used only against a http server.
>>> So I wrapped the EchoServiceHandler.java[3] inside EchoServlet.java[4] and
>>> deployed in tomcat server.
>>> >>    ->Thrift client sdk currently supports only AJAX based
>>> communication.
>>> >>
>>> >> Important points WRT to thrift client and angular integration
>>> >>    ->Thrift js client can be used for the communication with the
>>> server within angular. But the problem is, since thrift client is not part
>>> of angular, when we do the ajax communication and update the model the
>>> changes will not be updated in the DOM. The reason is angular is not aware
>>> of the events triggered outside of the framework. But this can be overcome
>>> by wrapping thrift client inside an angular service and using promises in
>>> angular to notify the success of ajax calls and then manually updating the
>>> DOM.
>>> >>
>>> >> The thrift client that I created for this service can be found at[5].
>>> This thrift client is wrapped inside this angular service[6] and that
>>> service is used in controller [7]. I have also attached screen shots of the
>>> demo.
>>> >>
>>> >> Hope Shameera, Sanchit, Viknes or Vijayendra can provide feedback on
>>> this POC and evaluate whether this POC is sound enough to guaranty that web
>>> based experiment builder can be integrated with the thrift client sdk.
>>> >>
>>> >> Thank you.
>>> >> Supun Nakandala
>>> >>
>>> >> [1] - https://github.com/scnakandala/echo_service
>>> >> [2] -
>>> https://github.com/scnakandala/echo_service/blob/master/Echo.thrift
>>> >> [3] -
>>> https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServiceHandler.java
>>> >> [4] -
>>> https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServlet.java
>>> >> [5] -
>>> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/lib/echo_service/echo_client.js
>>> >>
>>> >> [6] -
>>> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/services.js
>>> >>
>>> >> [7] -
>>> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/controllers.js
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> Best Regards,
>>> >> Shameera Rathnayaka.
>>> >>
>>> >> email: shameera AT apache.org , shameerainfo AT gmail.com
>>> >> Blog : http://shameerarathnayaka.blogspot.com/
>>> >
>>>
>>>
>>
>
>
> --
> Best Regards,
> Shameera Rathnayaka.
>
> email: shameera AT apache.org , shameerainfo AT gmail.com
> Blog : http://shameerarathnayaka.blogspot.com/
>



-- 
Cheers,
Subho

Re: Integrating a thrift javascript client sdk with angularjs

Posted by Shameera Rathnayaka <sh...@gmail.com>.
Hi Vijayendra,

My idea is, first connect the gap what we have with our previous project
using the suggested approach, which is write a angular service by wrapping
the exiting JS client. But saying that, i also +1 for completely implement
the angular service by wrapping Thrift JS client in one go. That is the
ultimate goal here. and -1 for implement the same thing with angular $http.
Because this is tightly couple to the angular and it require special care
for maintain, when ever there is any API addition or change. But we can
avoid this complexity for some extend if we go with thrift JS api.

Thanks,
Shameera.


On Wed, Mar 19, 2014 at 9:48 PM, Vijayendra Grampurohit <
vijayendra.sdm@gmail.com> wrote:

> Hi All
>
> @Shameera : It would be better if we come up with new javascript client in
> AngularJS instead of  wraping exiting javaScript client as angular
> service. We faced lot of issues last time doing this. Do you remember?
>
> Currently I am looking into Thrift API.
>
> Can we have a concrete plan on
> 1) Integrating different modules. For this we have to rewrite the
> Javascript API in Angularjs.
> 2) writing thrift client in Angularjs
>
>
> Regards
> Vijayendra
>
>
>
>
>
> On Wed, Mar 19, 2014 at 8:50 AM, Suresh Marru <sm...@apache.org> wrote:
>
>> Hi Supun,
>>
>> Since there are no further comments on this thread, I would encourage you
>> to start working on the GSoC proposal. Just start a proposal on google
>> melegenge portal, make it publicly readable and share it on the dev list
>> for comments.
>>
>> Suresh
>> On Mar 17, 2014, at 3:24 PM, Suresh Marru <sm...@apache.org> wrote:
>>
>> > Thanks Supun for taking the initiative. I echo Shameera that this seem
>> to be a good working stop-gap strategy. But I am not knowledgable enough to
>> judge on this topic and would like to listen critical feedback from others.
>> >
>> > Suresh
>> >
>> > On Mar 17, 2014, at 2:58 PM, Shameera Rathnayaka <
>> shameerainfo@gmail.com> wrote:
>> >
>> >> Hi Supun,
>> >>
>> >> This is great, I too found this $scope.apply()[1] would solve our
>> issue . And i was going to follow this[2] and come up with a sample demo
>> but you already have done it :) (didn't check it, will do).  For now we can
>> wrap exiting javaScript client as angular service and use it inside the
>> angular. But for long run It would be good to use Thrift generated JS
>> client instead exiting JS client. @Sanchit and all WDYT?
>> >>
>> >> [1]
>> https://github.com/angular/angular.js/wiki/When-to-use-$scope.$apply%28%29
>> >> [2] http://jimhoskins.com/2012/12/17/angularjs-and-apply.html
>> >>
>> >>
>> >> Thanks,
>> >> Shameera.
>> >>
>> >>
>> >>
>> >>
>> >> On Tue, Mar 18, 2014 at 12:07 AM, Supun Nakandala <
>> supun.nakandala@gmail.com> wrote:
>> >> Hi All,
>> >>
>> >> I was able to do successful POC on the $subject (the source code is
>> available at [1]). I implemented a simple thrift API (thrift descriptor
>> [2]) for echo function. The server side was implemented in java and for the
>> client side I used javascript.
>> >>
>> >> Important points WRT to thrift
>> >>    ->Thrift javascript client can be used only against a http server.
>> So I wrapped the EchoServiceHandler.java[3] inside EchoServlet.java[4] and
>> deployed in tomcat server.
>> >>    ->Thrift client sdk currently supports only AJAX based
>> communication.
>> >>
>> >> Important points WRT to thrift client and angular integration
>> >>    ->Thrift js client can be used for the communication with the
>> server within angular. But the problem is, since thrift client is not part
>> of angular, when we do the ajax communication and update the model the
>> changes will not be updated in the DOM. The reason is angular is not aware
>> of the events triggered outside of the framework. But this can be overcome
>> by wrapping thrift client inside an angular service and using promises in
>> angular to notify the success of ajax calls and then manually updating the
>> DOM.
>> >>
>> >> The thrift client that I created for this service can be found at[5].
>> This thrift client is wrapped inside this angular service[6] and that
>> service is used in controller [7]. I have also attached screen shots of the
>> demo.
>> >>
>> >> Hope Shameera, Sanchit, Viknes or Vijayendra can provide feedback on
>> this POC and evaluate whether this POC is sound enough to guaranty that web
>> based experiment builder can be integrated with the thrift client sdk.
>> >>
>> >> Thank you.
>> >> Supun Nakandala
>> >>
>> >> [1] - https://github.com/scnakandala/echo_service
>> >> [2] -
>> https://github.com/scnakandala/echo_service/blob/master/Echo.thrift
>> >> [3] -
>> https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServiceHandler.java
>> >> [4] -
>> https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServlet.java
>> >> [5] -
>> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/lib/echo_service/echo_client.js
>> >>
>> >> [6] -
>> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/services.js
>> >>
>> >> [7] -
>> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/controllers.js
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> Best Regards,
>> >> Shameera Rathnayaka.
>> >>
>> >> email: shameera AT apache.org , shameerainfo AT gmail.com
>> >> Blog : http://shameerarathnayaka.blogspot.com/
>> >
>>
>>
>


-- 
Best Regards,
Shameera Rathnayaka.

email: shameera AT apache.org , shameerainfo AT gmail.com
Blog : http://shameerarathnayaka.blogspot.com/

Re: Integrating a thrift javascript client sdk with angularjs

Posted by Vijayendra Grampurohit <vi...@gmail.com>.
Hi All

@Shameera : It would be better if we come up with new javascript client in
AngularJS instead of  wraping exiting javaScript client as angular service.
We faced lot of issues last time doing this. Do you remember?

Currently I am looking into Thrift API.

Can we have a concrete plan on
1) Integrating different modules. For this we have to rewrite the
Javascript API in Angularjs.
2) writing thrift client in Angularjs


Regards
Vijayendra





On Wed, Mar 19, 2014 at 8:50 AM, Suresh Marru <sm...@apache.org> wrote:

> Hi Supun,
>
> Since there are no further comments on this thread, I would encourage you
> to start working on the GSoC proposal. Just start a proposal on google
> melegenge portal, make it publicly readable and share it on the dev list
> for comments.
>
> Suresh
> On Mar 17, 2014, at 3:24 PM, Suresh Marru <sm...@apache.org> wrote:
>
> > Thanks Supun for taking the initiative. I echo Shameera that this seem
> to be a good working stop-gap strategy. But I am not knowledgable enough to
> judge on this topic and would like to listen critical feedback from others.
> >
> > Suresh
> >
> > On Mar 17, 2014, at 2:58 PM, Shameera Rathnayaka <sh...@gmail.com>
> wrote:
> >
> >> Hi Supun,
> >>
> >> This is great, I too found this $scope.apply()[1] would solve our issue
> . And i was going to follow this[2] and come up with a sample demo but you
> already have done it :) (didn't check it, will do).  For now we can wrap
> exiting javaScript client as angular service and use it inside the angular.
> But for long run It would be good to use Thrift generated JS client instead
> exiting JS client. @Sanchit and all WDYT?
> >>
> >> [1]
> https://github.com/angular/angular.js/wiki/When-to-use-$scope.$apply%28%29
> >> [2] http://jimhoskins.com/2012/12/17/angularjs-and-apply.html
> >>
> >>
> >> Thanks,
> >> Shameera.
> >>
> >>
> >>
> >>
> >> On Tue, Mar 18, 2014 at 12:07 AM, Supun Nakandala <
> supun.nakandala@gmail.com> wrote:
> >> Hi All,
> >>
> >> I was able to do successful POC on the $subject (the source code is
> available at [1]). I implemented a simple thrift API (thrift descriptor
> [2]) for echo function. The server side was implemented in java and for the
> client side I used javascript.
> >>
> >> Important points WRT to thrift
> >>    ->Thrift javascript client can be used only against a http server.
> So I wrapped the EchoServiceHandler.java[3] inside EchoServlet.java[4] and
> deployed in tomcat server.
> >>    ->Thrift client sdk currently supports only AJAX based communication.
> >>
> >> Important points WRT to thrift client and angular integration
> >>    ->Thrift js client can be used for the communication with the server
> within angular. But the problem is, since thrift client is not part of
> angular, when we do the ajax communication and update the model the changes
> will not be updated in the DOM. The reason is angular is not aware of the
> events triggered outside of the framework. But this can be overcome by
> wrapping thrift client inside an angular service and using promises in
> angular to notify the success of ajax calls and then manually updating the
> DOM.
> >>
> >> The thrift client that I created for this service can be found at[5].
> This thrift client is wrapped inside this angular service[6] and that
> service is used in controller [7]. I have also attached screen shots of the
> demo.
> >>
> >> Hope Shameera, Sanchit, Viknes or Vijayendra can provide feedback on
> this POC and evaluate whether this POC is sound enough to guaranty that web
> based experiment builder can be integrated with the thrift client sdk.
> >>
> >> Thank you.
> >> Supun Nakandala
> >>
> >> [1] - https://github.com/scnakandala/echo_service
> >> [2] -
> https://github.com/scnakandala/echo_service/blob/master/Echo.thrift
> >> [3] -
> https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServiceHandler.java
> >> [4] -
> https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServlet.java
> >> [5] -
> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/lib/echo_service/echo_client.js
> >>
> >> [6] -
> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/services.js
> >>
> >> [7] -
> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/controllers.js
> >>
> >>
> >>
> >>
> >>
> >> --
> >> Best Regards,
> >> Shameera Rathnayaka.
> >>
> >> email: shameera AT apache.org , shameerainfo AT gmail.com
> >> Blog : http://shameerarathnayaka.blogspot.com/
> >
>
>

Re: Integrating a thrift javascript client sdk with angularjs

Posted by Suresh Marru <sm...@apache.org>.
Hi Supun,

Since there are no further comments on this thread, I would encourage you to start working on the GSoC proposal. Just start a proposal on google melegenge portal, make it publicly readable and share it on the dev list for comments. 

Suresh
On Mar 17, 2014, at 3:24 PM, Suresh Marru <sm...@apache.org> wrote:

> Thanks Supun for taking the initiative. I echo Shameera that this seem to be a good working stop-gap strategy. But I am not knowledgable enough to judge on this topic and would like to listen critical feedback from others.
> 
> Suresh
> 
> On Mar 17, 2014, at 2:58 PM, Shameera Rathnayaka <sh...@gmail.com> wrote:
> 
>> Hi Supun, 
>> 
>> This is great, I too found this $scope.apply()[1] would solve our issue . And i was going to follow this[2] and come up with a sample demo but you already have done it :) (didn't check it, will do).  For now we can wrap exiting javaScript client as angular service and use it inside the angular. But for long run It would be good to use Thrift generated JS client instead exiting JS client. @Sanchit and all WDYT?
>> 
>> [1] https://github.com/angular/angular.js/wiki/When-to-use-$scope.$apply%28%29 
>> [2] http://jimhoskins.com/2012/12/17/angularjs-and-apply.html
>> 
>> 
>> Thanks, 
>> Shameera.
>> 
>> 
>> 
>> 
>> On Tue, Mar 18, 2014 at 12:07 AM, Supun Nakandala <su...@gmail.com> wrote:
>> Hi All,
>> 
>> I was able to do successful POC on the $subject (the source code is available at [1]). I implemented a simple thrift API (thrift descriptor [2]) for echo function. The server side was implemented in java and for the client side I used javascript.
>> 
>> Important points WRT to thrift
>>    ->Thrift javascript client can be used only against a http server. So I wrapped the EchoServiceHandler.java[3] inside EchoServlet.java[4] and deployed in tomcat server.
>>    ->Thrift client sdk currently supports only AJAX based communication.
>> 
>> Important points WRT to thrift client and angular integration
>>    ->Thrift js client can be used for the communication with the server within angular. But the problem is, since thrift client is not part of angular, when we do the ajax communication and update the model the changes will not be updated in the DOM. The reason is angular is not aware of the events triggered outside of the framework. But this can be overcome by wrapping thrift client inside an angular service and using promises in angular to notify the success of ajax calls and then manually updating the DOM.
>> 
>> The thrift client that I created for this service can be found at[5]. This thrift client is wrapped inside this angular service[6] and that service is used in controller [7]. I have also attached screen shots of the demo.
>> 
>> Hope Shameera, Sanchit, Viknes or Vijayendra can provide feedback on this POC and evaluate whether this POC is sound enough to guaranty that web based experiment builder can be integrated with the thrift client sdk.
>> 
>> Thank you.
>> Supun Nakandala
>> 
>> [1] - https://github.com/scnakandala/echo_service
>> [2] - https://github.com/scnakandala/echo_service/blob/master/Echo.thrift
>> [3] - https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServiceHandler.java
>> [4] - https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServlet.java
>> [5] - https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/lib/echo_service/echo_client.js
>> 
>> [6] - https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/services.js
>> 
>> [7] - https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/controllers.js
>> 
>> 
>> 
>> 
>> 
>> -- 
>> Best Regards,
>> Shameera Rathnayaka.
>> 
>> email: shameera AT apache.org , shameerainfo AT gmail.com
>> Blog : http://shameerarathnayaka.blogspot.com/
> 


Re: Integrating a thrift javascript client sdk with angularjs

Posted by Suresh Marru <sm...@apache.org>.
Thanks Supun for taking the initiative. I echo Shameera that this seem to be a good working stop-gap strategy. But I am not knowledgable enough to judge on this topic and would like to listen critical feedback from others.

Suresh

On Mar 17, 2014, at 2:58 PM, Shameera Rathnayaka <sh...@gmail.com> wrote:

> Hi Supun, 
> 
> This is great, I too found this $scope.apply()[1] would solve our issue . And i was going to follow this[2] and come up with a sample demo but you already have done it :) (didn't check it, will do).  For now we can wrap exiting javaScript client as angular service and use it inside the angular. But for long run It would be good to use Thrift generated JS client instead exiting JS client. @Sanchit and all WDYT?
> 
> [1] https://github.com/angular/angular.js/wiki/When-to-use-$scope.$apply%28%29 
> [2] http://jimhoskins.com/2012/12/17/angularjs-and-apply.html
> 
> 
> Thanks, 
> Shameera.
> 
> 
> 
> 
> On Tue, Mar 18, 2014 at 12:07 AM, Supun Nakandala <su...@gmail.com> wrote:
> Hi All,
> 
> I was able to do successful POC on the $subject (the source code is available at [1]). I implemented a simple thrift API (thrift descriptor [2]) for echo function. The server side was implemented in java and for the client side I used javascript.
> 
> Important points WRT to thrift
>     ->Thrift javascript client can be used only against a http server. So I wrapped the EchoServiceHandler.java[3] inside EchoServlet.java[4] and deployed in tomcat server.
>     ->Thrift client sdk currently supports only AJAX based communication.
> 
> Important points WRT to thrift client and angular integration
>     ->Thrift js client can be used for the communication with the server within angular. But the problem is, since thrift client is not part of angular, when we do the ajax communication and update the model the changes will not be updated in the DOM. The reason is angular is not aware of the events triggered outside of the framework. But this can be overcome by wrapping thrift client inside an angular service and using promises in angular to notify the success of ajax calls and then manually updating the DOM.
> 
> The thrift client that I created for this service can be found at[5]. This thrift client is wrapped inside this angular service[6] and that service is used in controller [7]. I have also attached screen shots of the demo.
> 
> Hope Shameera, Sanchit, Viknes or Vijayendra can provide feedback on this POC and evaluate whether this POC is sound enough to guaranty that web based experiment builder can be integrated with the thrift client sdk.
> 
> Thank you.
> Supun Nakandala
> 
> [1] - https://github.com/scnakandala/echo_service
> [2] - https://github.com/scnakandala/echo_service/blob/master/Echo.thrift
> [3] - https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServiceHandler.java
> [4] - https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServlet.java
> [5] - https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/lib/echo_service/echo_client.js
> 
> [6] - https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/services.js
> 
> [7] - https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/controllers.js
> 
> 
> 
> 
> 
> -- 
> Best Regards,
> Shameera Rathnayaka.
> 
> email: shameera AT apache.org , shameerainfo AT gmail.com
> Blog : http://shameerarathnayaka.blogspot.com/


Re: Integrating a thrift javascript client sdk with angularjs

Posted by Shameera Rathnayaka <sh...@gmail.com>.
Hi Supun,

This is great, I too found this $scope.apply()[1] would solve our issue .
And i was going to follow this[2] and come up with a sample demo but you
already have done it :) (didn't check it, will do).  For now we can wrap
exiting javaScript client as angular service and use it inside the angular.
But for long run It would be good to use Thrift generated JS client instead
exiting JS client. @Sanchit and all WDYT?

[1]
https://github.com/angular/angular.js/wiki/When-to-use-$scope.$apply%28%29
[2] http://jimhoskins.com/2012/12/17/angularjs-and-apply.html


Thanks,
Shameera.




On Tue, Mar 18, 2014 at 12:07 AM, Supun Nakandala <supun.nakandala@gmail.com
> wrote:

> Hi All,
>
> I was able to do successful POC on the $subject (the source code is
> available at [1]). I implemented a simple thrift API (thrift descriptor
> [2]) for echo function. The server side was implemented in java and for the
> client side I used javascript.
>
> Important points WRT to thrift
>     ->Thrift javascript client can be used only against a http server. So
> I wrapped the EchoServiceHandler.java[3] inside EchoServlet.java[4] and
> deployed in tomcat server.
>     ->Thrift client sdk currently supports only AJAX based communication.
>
> Important points WRT to thrift client and angular integration
>     ->Thrift js client can be used for the communication with the server
> within angular. But the problem is, since thrift client is not part of
> angular, when we do the ajax communication and update the model the changes
> will not be updated in the DOM. The reason is angular is not aware of the
> events triggered outside of the framework. But this can be overcome by
> wrapping thrift client inside an angular service and using promises in
> angular to notify the success of ajax calls and then manually updating the
> DOM.
>
> The thrift client that I created for this service can be found at[5]. This
> thrift client is wrapped inside this angular service[6] and that service is
> used in controller [7]. I have also attached screen shots of the demo.
>
> Hope Shameera, Sanchit, Viknes or Vijayendra can provide feedback on this
> POC and evaluate whether this POC is sound enough to guaranty that web
> based experiment builder can be integrated with the thrift client sdk.
>
> Thank you.
> Supun Nakandala
>
> [1] - https://github.com/scnakandala/echo_service
> [2] - https://github.com/scnakandala/echo_service/blob/master/Echo.thrift
> [3] -
> https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServiceHandler.java
> [4] -
> https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServlet.java
> [5] -
> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/lib/echo_service/echo_client.js
>
> [6] -
> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/services.js
>
> [7] -
> https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/controllers.js
>
>
>


-- 
Best Regards,
Shameera Rathnayaka.

email: shameera AT apache.org , shameerainfo AT gmail.com
Blog : http://shameerarathnayaka.blogspot.com/