Hi Sarthak, > On 15 Oct 2017, at 21:43, Sarthak Gupta <[email protected]> wrote: > > > > On Sun, Oct 15, 2017 at 7:53 PM, Vincent Massol <[email protected]> wrote: > Hi Sarthak, > > > On 14 Oct 2017, at 09:52, Sarthak Gupta <[email protected]> wrote: > > > > Hello, > > As the tests of my project application-glossary > > <https://github.com/xwiki-contrib/application-glossary> are not working > > I’ll try to have a look when I’m back from GSOC summit. > > > , in > > spite of my attempts(I will handle then later), I am moving on to > > implementing the next feature of the application i.e creating > > transformation. > > As far as I understand, the transformation requires a cache component from > > which entries shall be taken for rendering purpose. This cache should get > > updated when a glossary xobject is added, deleted or modified. For this > > functionality to take place, it should make use of an Event Listener. > > > > Hope I am right till now? > > Yes that’s exactly it! > > > Hello Vincent, > > What I would suggest is that you implement the Transformation without cache > for the first version, you make the app work fully end to end, you release a > 1.0 version that the community can try out, and then you start working on > version 1.1 which adds the cache to improve performance. > > WDYT? > > I think for implementing the transformations, some source will be required > from which the entries already present in the Glossary space will be taken. > Here it is the cache object. So, an alternative here can be to use the > "query module" everytime for knowing which entries are present in the > Glossary Space. And that would slow down the Xwiki to a large extent I guess > because for each word a query will be executed. Would using the "Query" be > fine or there can be any other better approach?
Some ideas: Version 1.0: * When the transformation executes (i.e. when a page is rendered), you do a query to get the glossary entries. Version 1.1: * You make your transformation implement Initializable and in initialize() you go a query to get all existing Glossary entries that you save in a cache component that you write * The cache component internally uses a Cache<> object for storing the Glossary entries * You also implement a component implementing EventListener that gets the cache component injected so that you can update the cache when glossary xobjects are created/modified/deleted. If you feel comfortable you can implement directly version 1.1 but my recommendation would be get a working v1.0 version ASAP and then iterate to improve it. Hope it helps, Thanks -Vincent PS: Please keep the discussion on the list so that anyone can help you and see the answers and chime in or just learn from it! :) > Thanks > > Sarthak Gupta > > > > > > I have a question in my mind. > > > > The "cache" and the "event Listener" are to be implemented as two separate > > components. right? > > Correct. > > > What I think is, that the EventListener component should be filled with > > appropriate methods just like this > > <https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-component/xwiki-platform-component-wiki/src/main/java/org/xwiki/component/wiki/internal/bridge/DefaultWikiObjectComponentManagerEventListener.java> > > and > > then in these methods, the cache should be updated. > > > > Is this implementation right? > > Correct. > > > And after this, the rendering part will come…. > > Awesome. > > Thanks. Let me know if you need more of my/our help. > -Vincent > > > > > Thanks > > > > Sarthak Gupta

