You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Václav Tolar <Va...@cleverlance.com> on 2008/09/03 14:56:04 UTC

Shinding does not preserve order of requests

Hi all,

According my testing it looks that Shindig does not fulfill following requirement from OpenSocial specification:

Containers must preserve the semantics of executing requests in serial order, though. A request that contains a write and then a read must return the newly written data, while a request that contains a read and then a write must return the data that was present before the write took place.

In the both restfulcontainer.js and jsonrpccontainer.js is order of the requests within a batch lost when array of requests is transformed to object jsonBatchData.

Is this known bug?

Thanks
Vaclav Tolar

Re: Shinding does not preserve order of requests

Posted by Chris Chabot <ch...@gmail.com>.
we're working on switching over the php version of shindig to the json-rpc
protocol too, so i think this bug will go away soonish automagically :)

On Wed, Sep 3, 2008 at 5:18 PM, Václav Tolar
<Va...@cleverlance.com>wrote:

> Apologize. jsonrpccontainer.js seems to be ok.
> Vaclav
>
> -----Původní zpráva-----
> Od: Václav Tolar
> Odesláno: 3. září 2008 16:03
> Komu: 'shindig-dev@incubator.apache.org'
> Předmět: RE: Shinding does not preserve order of requests
>
> Well. I have tested the restfulcontainer.js, not jsonrpccontainer.js. I
> have checked jsonrpccontainer.js just visually, so I might be wrong about
> it. However I am quite sur with restfulcontainer.js.
>
> Vaclav
>
> -----Původní zpráva-----
> Od: Chris Chabot [mailto:chabotc@gmail.com]
> Odesláno: 3. září 2008 15:12
> Komu: shindig-dev@incubator.apache.org
> Předmět: Re: Shinding does not preserve order of requests
>
> From another email conversation i gathered that the nifty thing of the
> json-rpc container was that it -did- honor the request order (this was
> about
> some tests failing in the compliance test gadget- & how json-rpc would fix
> that).
>
> So it doesn't mean that in the end? that would be a shame!
>
> On Wed, Sep 3, 2008 at 3:56 PM, Václav Tolar
> <Va...@cleverlance.com>wrote:
>
> > Hi all,
> >
> > According my testing it looks that Shindig does not fulfill following
> > requirement from OpenSocial specification:
> >
> > Containers must preserve the semantics of executing requests in serial
> > order, though. A request that contains a write and then a read must
> return
> > the newly written data, while a request that contains a read and then a
> > write must return the data that was present before the write took place.
> >
> > In the both restfulcontainer.js and jsonrpccontainer.js is order of the
> > requests within a batch lost when array of requests is transformed to
> object
> > jsonBatchData.
> >
> > Is this known bug?
> >
> > Thanks
> > Vaclav Tolar
> >
>
>
>
> --
>
>  -- Chris Chabot
>



-- 

-- Chris Chabot

RE: Shinding does not preserve order of requests

Posted by Václav Tolar <Va...@cleverlance.com>.
Apologize. jsonrpccontainer.js seems to be ok.
Vaclav

-----Původní zpráva-----
Od: Václav Tolar
Odesláno: 3. září 2008 16:03
Komu: 'shindig-dev@incubator.apache.org'
Předmět: RE: Shinding does not preserve order of requests

Well. I have tested the restfulcontainer.js, not jsonrpccontainer.js. I have checked jsonrpccontainer.js just visually, so I might be wrong about it. However I am quite sur with restfulcontainer.js.

Vaclav

-----Původní zpráva-----
Od: Chris Chabot [mailto:chabotc@gmail.com]
Odesláno: 3. září 2008 15:12
Komu: shindig-dev@incubator.apache.org
Předmět: Re: Shinding does not preserve order of requests

From another email conversation i gathered that the nifty thing of the
json-rpc container was that it -did- honor the request order (this was about
some tests failing in the compliance test gadget- & how json-rpc would fix
that).

So it doesn't mean that in the end? that would be a shame!

On Wed, Sep 3, 2008 at 3:56 PM, Václav Tolar
<Va...@cleverlance.com>wrote:

> Hi all,
>
> According my testing it looks that Shindig does not fulfill following
> requirement from OpenSocial specification:
>
> Containers must preserve the semantics of executing requests in serial
> order, though. A request that contains a write and then a read must return
> the newly written data, while a request that contains a read and then a
> write must return the data that was present before the write took place.
>
> In the both restfulcontainer.js and jsonrpccontainer.js is order of the
> requests within a batch lost when array of requests is transformed to object
> jsonBatchData.
>
> Is this known bug?
>
> Thanks
> Vaclav Tolar
>



--

  -- Chris Chabot

Re: Gadgets Id. How to get it?

Posted by sharmishtha gupta <sh...@gmail.com>.
Ok so got your answer

On Sun, Sep 14, 2008 at 1:37 AM, sharmishtha gupta <
sharmishtha.gupta@gmail.com> wrote:

>  Hi
> I am here little confuse about whether you want to pass gadget id to make
> just a shindig call or want to play with the function in gadget.js
>
>
> gadgets.IfrGadgetService.prototype.setUserPref = function(editToken, name,
>     value) {
>   *var id = this.getGadgetIdFromModuleId(this.f);
>   var gadget = gadgets.container.getGadget(id);
> *  var prefs = gadget.getUserPrefs();
>   for (var i = 1, j = arguments.length; i < j; i += 2) {
>     prefs[arguments[i]] = arguments[i + 1];
>   }
>   gadget.setUserPrefs(prefs);
> };
>  You can set specific id for a gadget by calling the corcerned function
> from gadget.js in your application file or better to introduce one js file
> which contain the specific change and then include that js file in your
> application file.
>
> If you just want to make a shindig call then you can probably write a js
> file which is setting gadget url/ gadget id based on your database call in
> the back end:-
>
> <script type="text/javascript">
> var gServerBaseURL = '';
> var gProfileGadget = null;
> var gCanvasGadget = null;
> var gChromeIds = [ "gadget-profile-chrome", "gadget-canvas-chrome" ];
> var gOwnerId = 1; //define your suitable ownerid
> var gViewerId =  1; //define suitable viewerid
>
> function generateSecureToken( gadget, mode ) {
>   // TODO: Use a less silly mechanism of mapping a gadget URL to an appid
>   var appId = 0;
>   var appIdGeneratorUrl = gadget.specUrl + "?mode=" + mode;
>   for (var i = 0; i < appIdGeneratorUrl.length; i++) {
>     appId += appIdGeneratorUrl.charCodeAt(i);
>   }
>
>   var fields = [gOwnerId, gViewerId, appId, "shindig", gadget.specUrl,
> "0"];
>   for (var i = 0; i < fields.length; i++) {
>     // escape each field individually, for metachars in URL
>     fields[i] = escape(fields[i]);
>   }
>   return fields.join(":");
> }
> </script>
>
> <script type="text/javascript">
>
> function handleNewProfileGadget( gadgetUrl ) {
>   gProfileGadget = gadgets.container.createGadget( {'specUrl': gadgetUrl}
> );
>   gProfileGadget.setServerBase('');
>   gProfileGadget.width=170;
>   gadgets.container.addGadget( gProfileGadget );
>   gadgets.container.layoutManager.setGadgetChromeIds( gChromeIds );
> }
> function handleNewCanvasGadget( gadgetUrl ) {
>   gCanvasGadget = gadgets.container.createGadget( {'specUrl': gadgetUrl} );
>   gCanvasGadget.setServerBase('');
>   gadgets.container.addGadget( gCanvasGadget );
>   gadgets.container.layoutManager.setGadgetChromeIds( gChromeIds );
> }
>
> function handleGadgetInMode( mode ) {
>   var currGadget = null;
>
>   if (document.forms[ "profileViewGadgetForm" ].elements[ "selectGadget"
> ].selectedIndex == -1) {
>    //nothing has been selected yet!
>    return ;
>   }
>    var gadgetUrl = gServerBaseURL + document.forms[ "profileViewGadgetForm"
> ].elements[ "selectGadget" ].value;
>
>    if( mode == "profile" ) {
>     if( gProfileGadget === null ) handleNewProfileGadget( gadgetUrl );
>     currGadget = gProfileGadget;
>   } else if( mode == "canvas" ) {
>     if( gCanvasGadget === null ) handleNewCanvasGadget( gadgetUrl );
>     currGadget = gCanvasGadget;
>
>     var profileDetailsDiv=document.getElementById("profileDetails");
>     profileDetailsDiv.style.display = "none";
>   }
>
>   currGadget.specUrl = gadgetUrl;
>   currGadget.secureToken = escape(generateSecureToken( currGadget, mode ));
>
>   gadgets.container.setView( mode );
>   gadgets.container.renderGadget( currGadget );
>  }
> function initProfileGadget( ) {
>   handleGadgetInMode("profile");
>
> }
>
> gadgets.util.registerOnLoadHandler(initProfileGadget);
> </script>
>
> I hope this will help
>
> Regards
> Sharmishtha
>   On Sun, Sep 14, 2008 at 1:10 AM, <al...@indt.org.br> wrote:
>
>> I'm using RPC, and I want to send the container that a specified gadget
>> made a call, how can I send the gadgets id to the container, so he can
>> answer the call to the gadget?
>>
>> Thanks.
>>
>>
>

Re: Gadgets Id. How to get it?

Posted by sharmishtha gupta <sh...@gmail.com>.
Hi
I am here little confuse about whether you want to pass gadget id to make
just a shindig call or want to play with the function in gadget.js


gadgets.IfrGadgetService.prototype.setUserPref = function(editToken, name,
    value) {
  *var id = this.getGadgetIdFromModuleId(this.f);
  var gadget = gadgets.container.getGadget(id);
*  var prefs = gadget.getUserPrefs();
  for (var i = 1, j = arguments.length; i < j; i += 2) {
    prefs[arguments[i]] = arguments[i + 1];
  }
  gadget.setUserPrefs(prefs);
};
 You can set specific id for a gadget by calling the corcerned function from
gadget.js in your application file or better to introduce one js file which
contain the specific change and then include that js file in your
application file.

If you just want to make a shindig call then you can probably write a js
file which is setting gadget url/ gadget id based on your database call in
the back end:-

<script type="text/javascript">
var gServerBaseURL = '';
var gProfileGadget = null;
var gCanvasGadget = null;
var gChromeIds = [ "gadget-profile-chrome", "gadget-canvas-chrome" ];
var gOwnerId = 1; //define your suitable ownerid
var gViewerId =  1; //define suitable viewerid

function generateSecureToken( gadget, mode ) {
  // TODO: Use a less silly mechanism of mapping a gadget URL to an appid
  var appId = 0;
  var appIdGeneratorUrl = gadget.specUrl + "?mode=" + mode;
  for (var i = 0; i < appIdGeneratorUrl.length; i++) {
    appId += appIdGeneratorUrl.charCodeAt(i);
  }

  var fields = [gOwnerId, gViewerId, appId, "shindig", gadget.specUrl, "0"];
  for (var i = 0; i < fields.length; i++) {
    // escape each field individually, for metachars in URL
    fields[i] = escape(fields[i]);
  }
  return fields.join(":");
}
</script>

<script type="text/javascript">

function handleNewProfileGadget( gadgetUrl ) {
  gProfileGadget = gadgets.container.createGadget( {'specUrl': gadgetUrl} );
  gProfileGadget.setServerBase('');
  gProfileGadget.width=170;
  gadgets.container.addGadget( gProfileGadget );
  gadgets.container.layoutManager.setGadgetChromeIds( gChromeIds );
}
function handleNewCanvasGadget( gadgetUrl ) {
  gCanvasGadget = gadgets.container.createGadget( {'specUrl': gadgetUrl} );
  gCanvasGadget.setServerBase('');
  gadgets.container.addGadget( gCanvasGadget );
  gadgets.container.layoutManager.setGadgetChromeIds( gChromeIds );
}

function handleGadgetInMode( mode ) {
  var currGadget = null;

  if (document.forms[ "profileViewGadgetForm" ].elements[ "selectGadget"
].selectedIndex == -1) {
   //nothing has been selected yet!
   return ;
  }
   var gadgetUrl = gServerBaseURL + document.forms[ "profileViewGadgetForm"
].elements[ "selectGadget" ].value;

   if( mode == "profile" ) {
    if( gProfileGadget === null ) handleNewProfileGadget( gadgetUrl );
    currGadget = gProfileGadget;
  } else if( mode == "canvas" ) {
    if( gCanvasGadget === null ) handleNewCanvasGadget( gadgetUrl );
    currGadget = gCanvasGadget;

    var profileDetailsDiv=document.getElementById("profileDetails");
    profileDetailsDiv.style.display = "none";
  }

  currGadget.specUrl = gadgetUrl;
  currGadget.secureToken = escape(generateSecureToken( currGadget, mode ));

  gadgets.container.setView( mode );
  gadgets.container.renderGadget( currGadget );
 }
function initProfileGadget( ) {
  handleGadgetInMode("profile");

}

gadgets.util.registerOnLoadHandler(initProfileGadget);
</script>

I hope this will help

Regards
Sharmishtha
On Sun, Sep 14, 2008 at 1:10 AM, <al...@indt.org.br> wrote:

> I'm using RPC, and I want to send the container that a specified gadget
> made a call, how can I send the gadgets id to the container, so he can
> answer the call to the gadget?
>
> Thanks.
>
>

RE: Gadgets Id. How to get it?

Posted by al...@indt.org.br.
I found out that I can use the this.f to get the iframeId, and that
helped a lot.

Thank you. 

-----Original Message-----
From: ext alan.castro@indt.org.br [mailto:alan.castro@indt.org.br] 
Sent: Saturday, September 13, 2008 3:41 PM
To: shindig-dev@incubator.apache.org
Subject: Gadgets Id. How to get it?

I'm using RPC, and I want to send the container that a specified gadget
made a call, how can I send the gadgets id to the container, so he can
answer the call to the gadget?

Thanks.


Gadgets Id. How to get it?

Posted by al...@indt.org.br.
I'm using RPC, and I want to send the container that a specified gadget
made a call, how can I send the gadgets id to the container, so he can
answer the call to the gadget?

Thanks.


RE: Shinding does not preserve order of requests

Posted by Václav Tolar <Va...@cleverlance.com>.
Well. I have tested the restfulcontainer.js, not jsonrpccontainer.js. I have checked jsonrpccontainer.js just visually, so I might be wrong about it. However I am quite sur with restfulcontainer.js.

Vaclav

-----Původní zpráva-----
Od: Chris Chabot [mailto:chabotc@gmail.com]
Odesláno: 3. září 2008 15:12
Komu: shindig-dev@incubator.apache.org
Předmět: Re: Shinding does not preserve order of requests

From another email conversation i gathered that the nifty thing of the
json-rpc container was that it -did- honor the request order (this was about
some tests failing in the compliance test gadget- & how json-rpc would fix
that).

So it doesn't mean that in the end? that would be a shame!

On Wed, Sep 3, 2008 at 3:56 PM, Václav Tolar
<Va...@cleverlance.com>wrote:

> Hi all,
>
> According my testing it looks that Shindig does not fulfill following
> requirement from OpenSocial specification:
>
> Containers must preserve the semantics of executing requests in serial
> order, though. A request that contains a write and then a read must return
> the newly written data, while a request that contains a read and then a
> write must return the data that was present before the write took place.
>
> In the both restfulcontainer.js and jsonrpccontainer.js is order of the
> requests within a batch lost when array of requests is transformed to object
> jsonBatchData.
>
> Is this known bug?
>
> Thanks
> Vaclav Tolar
>



--

  -- Chris Chabot

Re: Shinding does not preserve order of requests

Posted by Chris Chabot <ch...@gmail.com>.
From another email conversation i gathered that the nifty thing of the
json-rpc container was that it -did- honor the request order (this was about
some tests failing in the compliance test gadget- & how json-rpc would fix
that).

So it doesn't mean that in the end? that would be a shame!

On Wed, Sep 3, 2008 at 3:56 PM, Václav Tolar
<Va...@cleverlance.com>wrote:

> Hi all,
>
> According my testing it looks that Shindig does not fulfill following
> requirement from OpenSocial specification:
>
> Containers must preserve the semantics of executing requests in serial
> order, though. A request that contains a write and then a read must return
> the newly written data, while a request that contains a read and then a
> write must return the data that was present before the write took place.
>
> In the both restfulcontainer.js and jsonrpccontainer.js is order of the
> requests within a batch lost when array of requests is transformed to object
> jsonBatchData.
>
> Is this known bug?
>
> Thanks
> Vaclav Tolar
>



-- 

  -- Chris Chabot