Hi Anamaria, On Aug 9, 2009, at 2:39 AM, Anamaria Stoica wrote:
> 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. There's no magic. If the component is registered in components.txt and if you're looking it up to access it the DAB will get set properly. So it's just that you're no looking it up and there's no way it can be injected with dependencies. > 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? Why couldn't you use it? > Can it be registered to the Component Manager somehow, or is there a > completely different way this could be achieved? You're not provided enough information so that we can help you. From what I read the solution is extra simple: just look up the component using XWiki's component manager and you're done. Now the only question is what shinding requires. Does it accept an instance of PersonService or does it take a class. In other words does it perform the instantiation itself (the new) or can you pass to it an already instantiated object? *IF* (and if) it controls the instantiation then you need to do it differently: - knowing guice you can configure if to inject an instance instead of a class so that might be a direction to look into - otherwise simply make you person service impl a standard POJO and have a setDAB method that you call after it's been instantiated by shindig somehow. [snip] Thanks -Vincent _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

