You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Laura Nathanson <la...@gmail.com> on 2010/05/13 16:32:38 UTC

gadget prefs vs person app data

I've integrated parts of Shindig with my social networking site, but, I
haven't been able to grasp this from the documentation I've seen.. What's
the difference between prefs and app data?

I've implemented app data for my site, and know that I'm supposed to go on
and provide prefs. But I'm not sure what that will do that app data doesn't
already...

Re: gadget prefs vs person app data

Posted by Mat Mannion <M....@warwick.ac.uk>.
Unless I have misunderstood the spec and how things work, I believe it's
also the case that you can access appdata for different users who have the
same gadget using opensocial libraries. AppData is also persisted across
multiple instances of the same gadget, while userprefs are per-gadget.

HTH,

Mat

On 13 May 2010 22:12, Jacky Wang (王超) <ch...@google.com> wrote:

> Hi Laura,
>
> One of the major differences between user pref and appdata is, user pref
> participated in the gadget rendering stage, yet appdata doesn't.
>
> For example, the user may set his favorite fruit to banana, while the
> default value is apple. Then:
> - if the user set userpref: fav_fruit = "banana", then in the rendering
> stage, this value will be set and user will see a banana pic when gadget is
> rendered.
> - if the user set appdata.fav_fruit = "banana", user will see an apple pic
> first, then in your code there will be some routine to read the appdata
> fields, and replace the apple pic with banana one.
>
> The implementation is different too.
>
> For user preference variables, it is set/get through the routines:
> - features/src/main/javascript/features/core.prefs/*
> - features/src/main/javascript/features/setprefs/*
>
> The userpref storage is separated with social data storages like
> profile/friends/activities.  In the sample implementation, it's stored in
> user's browser cookie.
>
> The appdata is manipulated through the routines:
> [Java]
> -
> java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/AppDataService.java
> -
> java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/AppDataHandler.java
> [PHP]
> - php/src/social/spi/AppDataService.php
> - php/src/social/service/AppDataHandler.php
>
> Typically, the app data is stored in the DB.
>
> One extra point is that the appdata is a good place to cache the
> intermediate result which might be time-consuming to calculate.  A good
> related reading material is:
>
> http://code.google.com/events/io/2009/sessions/DesigningOpenSocialAppsSpeedScale.html
> The slides:
>
> http://dl.google.com/io/2009/pres/DesigningOpenSocialAppsForSpeedandScale.pdf
> ,
> page 49-51.
>
> Hope it helps.
>
> Cheers,
> Jacky
>
> On Thu, May 13, 2010 at 7:32 AM, Laura Nathanson
> <la...@gmail.com>wrote:
>
> > I've integrated parts of Shindig with my social networking site, but, I
> > haven't been able to grasp this from the documentation I've seen.. What's
> > the difference between prefs and app data?
> >
> > I've implemented app data for my site, and know that I'm supposed to go
> on
> > and provide prefs. But I'm not sure what that will do that app data
> doesn't
> > already...
> >
>
>
>
> --
> Best Regards,
>
> Jacky Wang
> (Office) +86-10-6250-3316
> (Mobile) +86-1381-0018-677
> Kejian Building, Tsinghua Science Park Building 6
> No.1 Zhongguancun East Road, Haidian District
> Beijing P.R.China 100084
>



-- 
Mat Mannion
Web Developer
e-lab, IT Services
University of Warwick
Coventry
CV4 7AL

Tel: 024 765 74433
Email: M.Mannion@warwick.ac.uk

Re: gadget prefs vs person app data

Posted by "Jacky Wang (王超)" <ch...@google.com>.
Hi Laura,

One of the major differences between user pref and appdata is, user pref
participated in the gadget rendering stage, yet appdata doesn't.

For example, the user may set his favorite fruit to banana, while the
default value is apple. Then:
- if the user set userpref: fav_fruit = "banana", then in the rendering
stage, this value will be set and user will see a banana pic when gadget is
rendered.
- if the user set appdata.fav_fruit = "banana", user will see an apple pic
first, then in your code there will be some routine to read the appdata
fields, and replace the apple pic with banana one.

The implementation is different too.

For user preference variables, it is set/get through the routines:
- features/src/main/javascript/features/core.prefs/*
- features/src/main/javascript/features/setprefs/*

The userpref storage is separated with social data storages like
profile/friends/activities.  In the sample implementation, it's stored in
user's browser cookie.

The appdata is manipulated through the routines:
[Java]
- java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/AppDataService.java
- java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/AppDataHandler.java
[PHP]
- php/src/social/spi/AppDataService.php
- php/src/social/service/AppDataHandler.php

Typically, the app data is stored in the DB.

One extra point is that the appdata is a good place to cache the
intermediate result which might be time-consuming to calculate.  A good
related reading material is:
http://code.google.com/events/io/2009/sessions/DesigningOpenSocialAppsSpeedScale.html
The slides:
http://dl.google.com/io/2009/pres/DesigningOpenSocialAppsForSpeedandScale.pdf,
page 49-51.

Hope it helps.

Cheers,
Jacky

On Thu, May 13, 2010 at 7:32 AM, Laura Nathanson
<la...@gmail.com>wrote:

> I've integrated parts of Shindig with my social networking site, but, I
> haven't been able to grasp this from the documentation I've seen.. What's
> the difference between prefs and app data?
>
> I've implemented app data for my site, and know that I'm supposed to go on
> and provide prefs. But I'm not sure what that will do that app data doesn't
> already...
>



-- 
Best Regards,

Jacky Wang
(Office) +86-10-6250-3316
(Mobile) +86-1381-0018-677
Kejian Building, Tsinghua Science Park Building 6
No.1 Zhongguancun East Road, Haidian District
Beijing P.R.China 100084