Hi,
In order to integrate Shindig with the XWiki datastore, 4 interfaces have to
be implemented: PersonService, AppDataService, ActivityService and
MessagesService (javadocs here [0]). To this end, I have created the
xwiki-social-opensocial module [1].
While implementing PersonService (PersonServiceXW - [2]), I have encountered
the following problem:
As I needed to access the datastore, I also made PersonServiceXW a XWiki
Component in order to gain access to the DocumentAccessBridge Component.
BUT, here is the problem, the DocumentAccessBridge never gets initialized
and at runtime is null.
The reason this might happen, as Sergiu suggested, is that Shindig uses
Guice to bind the services implementations in its code, thus the
PersonServiceXW component never gets to be registered with XWiki's Component
Manager.
My question is how do I get data in and out XWiki's datastore from the
PersonService implementation, if I cannot use the DocumentAccessBridge this
way? Can it be registered to the Component Manager somehow, or is there a
completely different way this could be achieved?
I will continue with some integration details (about the patch on
xwiki-web-standard and the OpenSocial XWiki Application). At the end I
included some instructions on how to build and test them.
***xwiki-web-standard patch (apply on xwiki-platform-web), consisting of:
- in standard/src/main/webapps/templates:
* added 3 .vm files which handles getting/adding/deleting friends:
addfriend.vm, getuserfriends.vm, deletefriend.vm
- in standard/src/main/webapps/resources/xwiki/opensocial:
* added javascript and css files necessary for the Shindig container
- in standard/src/main/webapps/WEB-INF:
* modified web.xml to include all shindig servlet mappings and necessary
Guice modules
- in standard/src/main/webapps/WEB-INF/classes:
* added container/default/container.js and shindig.properties - default
Shindig container configurations. I put them in the classpath as they
required modifications from the original files
- in standard:
* modified pom.xml, to include as a dependency xwiki-social-opensocial
module
***Open Social XWiki Application, consisting of:
- OpenSocial.GadgetContainerClass - the simplest OpenSocial Gadget
container; has a single url property (the url of the gadget); in view mode
it displays/renders it
- OpenSocial.GadgetContainerClassSheet
- OpenSocial.GadgetContainerClassTemplate
- OpenSocial.HelloWorld - hello world Gadget (only displays a String) - NO
OpenSocial features - works
- OpenSocial.LabpixiesTodo - Gadget with NO OpenSocial features 1 - works
- OpenSocial.Horoscope - Gadget with NO OpenSocial features 2 - works
- OpenSocial.ListFriends - SHOULD list the friends of the currently logged
in user. The friends are retrieved using the XWiki implementation of the
Shindig's PersonService, which is located in the xwiki-social-opensocial
module (PersonServiceXW). The service TRIES to use DocumentAccessBridge
component in order to retrieve the necessary data from the XWiki datastore.
- OpenSocial.TestingGadgetsSource - used to attach gadgets XML files to the
page. Their URLs can be used for GadgetContainerClass objects (e.g.
ListFriends gadget)
- Panels.My Friends - panel, displays the friends of the currently logged in
user
- Panels.Navigation
- XWiki.FriendClass - A friend; objects of this type can be attached to user
profiles; has as a single property friendName, which contains the name of
the friend
- XWiki.FriendClassSheet
- XWiki.FriendClassTemplate
- XWiki.XWikiUserSheet - to add the list of friends to profile
- XWiki.MyResources
- XWiki.XWikiPreferences
Instructions for testing (one possible way at least):
1. Patch xwiki-platform-web (changes are only in xwiki-web-standard), with
the patch from JIRA - [3]
2. Build xwiki-web-standard
3. Build xwiki-enterprise in offline mode (-o), so it will use
xwiki-web-standard from the local repository build at step 2
4. Run XWiki Enterprise. I always use
xwiki-enterprise-jetty-hsqldb-2.0-SNAPSHOT from the generated distributions
5. Import opensocial XAR - [4]
What to look for while testing (working stuff):
- Gadgets:
- see all/add new gadgets
http://localhost:8080/xwiki/bin/view/OpenSocial/GadgetContainerClass
-
http://localhost:8080/xwiki/bin/view/OpenSocial/HelloWorld
-
http://localhost:8080/xwiki/bin/view/OpenSocial/LabpixiesTodo
-
http://localhost:8080/xwiki/bin/view/OpenSocial/Horoscope
-
http://localhost:8080/xwiki/bin/view/OpenSocial/ListFriends (social
features) --> as specified before, not working
- While you're here, you could also:
- Log in as Alice (password 'alice')
- Go to profile page and edit friends list; You should have 2 friends:
Jane and Bob (they have as passwords 'jane', and 'bob')
- See My Friends Panel, with the friends of the current logged in user
displayed
[0] -
http://incubator.apache.org/shindig/shindig-1.1.x/apidocs/org/apache/shindi…
[1] -
https://svn.xwiki.org/svnroot/xwiki/sandbox/gsoc/opensocial/xwiki-social-op…
[2] -
https://svn.xwiki.org/svnroot/xwiki/sandbox/gsoc/opensocial/xwiki-social-op…
[3] -
http://jira.xwiki.org/jira/browse/XSANDBOX-36?focusedCommentId=43674&pa…
[4] -
http://jira.xwiki.org/jira/browse/XSANDBOX-64?focusedCommentId=43675&pa…
Other helpful links:
- Guice module configuration for my service implementations
https://svn.xwiki.org/svnroot/xwiki/sandbox/gsoc/opensocial/xwiki-social-op…
- Exemple of PersonService being injected by Guice in Shindig's code
http://svn.apache.org/repos/asf/incubator/shindig/trunk/java/social-api/src…
Thanks,
Anamaria