Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(272)

Issue 67159: osapi rewrite to support gadgets.rpc

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 3 months ago by louiscryan
Modified:
16 years, 3 months ago
Reviewers:
awiner, shindig.remailer, Sachin Shenoy, etnu00
Base URL:
http://svn.apache.org/repos/asf/incubator/shindig/trunk/
Visibility:
Public.

Description

Rewrite of osapi to factor out the RPC transport mechanism and support a gadgets.rpc based transport in addition to the json-rpc one. This is a pretty extensive rewrite but hopefully the code is a little simpler and more extensible now. It should be fairly trivial to add a REST transport instead of the json-rpc one for instance. There is now a container-side osapi.js which container can use as a basis for exposing additional osapi services using the new gadgets.rpc transport. See /javascript/container/osapi.js. To enable this feature in your container config you can either have the set of services introspected at gadget render-time using { "gadget.features" ... { "osapi.services" : {"gadgets.rpc" : ["container.listMethods"]} } } or if you want to avoid introspection and just list out the container methods to expose and exclude "container.listMethods". E.g. { "gadget.features" ... { "osapi.services" : {"gadgets.rpc" : ["requestShareApp", "requestPermission"]} } } In your container JS to add new methods simply bind them to the osapi namespace. E.g. osapi.newservice = {}; osapi.newservice.do = function (request, callback) { callback(<data>); } will expose osapi.newservice.do inside any gadget on the page if introspection is enabled, if introspection is disabled it needs to be added to the container config. The samplecontainer is updated to support introspection In addition the container config now supports declaring the set of available methods for a json-rpc endpoint directly too so that Shindig doesnt have to call system.listMethods against each endpoint. Instead you can directly add { "gadget.features" ... { "osapi.services" : {"http://%host%/social/rpc" : ["people.get", "activities.get", ...]} } } Other minor changes.. - makeNonProxiedRequest now returns error "rc" and "text" fields - osapi introspection over gadgets.rpc can delay the gadget onload callback by a max of 300ms. - osapi.ui is removed. The sample container exposes "activities.requestCreate", "messages.requestSend", "requestShareApp", "requestPermission" as examples only. This is subject to change as these are not standardized - osapi batching supports request chaining. If the response to an osapi api call is a JSON-RPC method call, it is executed and made available under the original key Thanks to Sachin Senoy for his initial work on the gadgets.rpc transport.

Patch Set 1 #

Total comments: 34

Patch Set 2 : Updated patch #

Unified diffs Side-by-side diffs Delta from patch set Stats (+976 lines, -1411 lines) Patch
../trunk/config/container.js View 1 1 chunk +10 lines, -0 lines 0 comments Download
../trunk/features/bin/runner.sh View 1 1 chunk +1 line, -1 line 0 comments Download
../trunk/features/pom.xml View 1 1 chunk +3 lines, -3 lines 0 comments Download
../trunk/features/src/main/javascript/features/core.io/io.js View 1 1 chunk +10 lines, -2 lines 0 comments Download
../trunk/features/src/main/javascript/features/features.txt View 1 1 chunk +0 lines, -1 line 0 comments Download
../trunk/features/src/main/javascript/features/osapi.ui/feature.xml View 1 1 chunk +0 lines, -27 lines 0 comments Download
../trunk/features/src/main/javascript/features/osapi.ui/ui.js View 1 1 chunk +0 lines, -212 lines 0 comments Download
../trunk/features/src/main/javascript/features/osapi/batch.js View 1 2 chunks +95 lines, -167 lines 0 comments Download
../trunk/features/src/main/javascript/features/osapi/feature.xml View 1 1 chunk +4 lines, -4 lines 0 comments Download
../trunk/features/src/main/javascript/features/osapi/gadgetsrpctransport.js View 1 1 chunk +115 lines, -0 lines 0 comments Download
../trunk/features/src/main/javascript/features/osapi/jsonrequest.js View 1 1 chunk +0 lines, -197 lines 0 comments Download
../trunk/features/src/main/javascript/features/osapi/jsonrpctransport.js View 1 1 chunk +92 lines, -0 lines 0 comments Download
../trunk/features/src/main/javascript/features/osapi/osapi.js View 1 1 chunk +47 lines, -29 lines 0 comments Download
../trunk/features/src/main/javascript/features/osapi/peoplehelpers.js View 1 1 chunk +3 lines, -1 line 0 comments Download
../trunk/features/src/main/javascript/features/osapi/util.js View 1 1 chunk +0 lines, -59 lines 0 comments Download
../trunk/features/src/test/javascript/features/alltests.js View 1 3 chunks +5 lines, -9 lines 0 comments Download
../trunk/features/src/test/javascript/features/osapi/activitiestest.js View 1 1 chunk +0 lines, -234 lines 0 comments Download
../trunk/features/src/test/javascript/features/osapi/appdatatest.js View 1 1 chunk +0 lines, -190 lines 0 comments Download
../trunk/features/src/test/javascript/features/osapi/batchtest.js View 1 5 chunks +12 lines, -15 lines 0 comments Download
../trunk/features/src/test/javascript/features/osapi/jsonrpctransporttest.js View 1 chunk +422 lines, -0 lines 0 comments Download
../trunk/features/src/test/javascript/features/osapi/osapitest.js View 1 1 chunk +19 lines, -61 lines 0 comments Download
../trunk/features/src/test/javascript/features/osapi/peopletest.js View 1 1 chunk +0 lines, -189 lines 0 comments Download
../trunk/features/src/test/javascript/lib/testutils.js View 1 1 chunk +2 lines, -1 line 0 comments Download
../trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/render/DefaultServiceFetcher.java View 1 1 chunk +4 lines, -2 lines 0 comments Download
../trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/render/DefaultServiceFetcherTest.java View 1 2 chunks +4 lines, -2 lines 0 comments Download
../trunk/javascript/container/osapi.js View 1 1 chunk +110 lines, -0 lines 0 comments Download
../trunk/javascript/samplecontainer/examples/SocialHelloWorld.xml View 1 1 chunk +1 line, -1 line 0 comments Download
../trunk/javascript/samplecontainer/samplecontainer.html View 1 1 chunk +1 line, -0 lines 0 comments Download
../trunk/javascript/samplecontainer/samplecontainer.js View 1 1 chunk +16 lines, -0 lines 0 comments Download
../trunk/site/src/site/xdoc/developers/features/index.xml View 1 chunk +0 lines, -4 lines 0 comments Download

Messages

Total messages: 6
louiscryan
16 years, 3 months ago (2009-06-07 00:46:11 UTC) #1
awiner
Generally looks good. A few nits, a couple points in the code where I'm confused. ...
16 years, 3 months ago (2009-06-08 17:12:43 UTC) #2
Sachin Shenoy
Nice work! Looks good. Will have another look later tomorrow. http://codereview.appspot.com/67159/diff/1/20 File ../trunk/features/src/main/javascript/features/osapi/batch.js (right): http://codereview.appspot.com/67159/diff/1/20#newcode130 ...
16 years, 3 months ago (2009-06-08 20:15:33 UTC) #3
etnu00
http://codereview.appspot.com/67159/diff/1/23 File ../trunk/features/src/main/javascript/features/osapi/gadgetsrpctransport.js (right): http://codereview.appspot.com/67159/diff/1/23#newcode43 Line 43: callback({ code : 500, message : 'Container refused ...
16 years, 3 months ago (2009-06-08 20:23:46 UTC) #4
louiscryan
After discussion I've removed the call chaining as it doesnt add a lot of value. ...
16 years, 3 months ago (2009-06-08 21:52:07 UTC) #5
louiscryan
16 years, 3 months ago (2009-06-08 21:54:22 UTC) #6
Updated patch
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b