[xwiki-devs] [Proposal] Add a WikiReadyEvent?
Hi devs, We already have ApplicationStartedEvent and ApplicationReadyEvent (when DB is ready). We also need an event when the wiki is ready since in s a multiwiki environment when you create a new wiki for example, you might need to init some stuff (like initialize mandatory classes). It's also needed the first time a request comes in for a given wiki. Thus I propose to add a WikiReadyEvent next to ApplicationStartedEvent and to send it in XWiki.updateDatabase(): ... synchronized (wikiName) { if (!wikiList.contains(wikiName)) { wikiList.add(wikiName); // Make sure these classes exists if (initClasses) { initializeMandatoryClasses(context); getPluginManager().virtualInit(context); getRenderingEngine().virtualInit(context); } --> send WikiReadyEvent here } } WDYT? Note that I was tempted to have a WikiCreatedEvent event sent when creating a wiki but that wouldn't fill the use case of initializing the wiki on the first request to it. Thanks -Vincent
Vincent, on IRC you had suggested me to use such an event. I couldn't find it. Is there an overview of such events? thanks in advance Paul Le 13 avr. 2012 à 17:43, Vincent Massol a écrit :
Hi devs,
We already have ApplicationStartedEvent and ApplicationReadyEvent (when DB is ready). We also need an event when the wiki is ready since in s a multiwiki environment when you create a new wiki for example, you might need to init some stuff (like initialize mandatory classes). It's also needed the first time a request comes in for a given wiki.
Thus I propose to add a WikiReadyEvent next to ApplicationStartedEvent and to send it in XWiki.updateDatabase():
... synchronized (wikiName) { if (!wikiList.contains(wikiName)) { wikiList.add(wikiName);
// Make sure these classes exists if (initClasses) { initializeMandatoryClasses(context); getPluginManager().virtualInit(context); getRenderingEngine().virtualInit(context); }
--> send WikiReadyEvent here
} }
WDYT?
Note that I was tempted to have a WikiCreatedEvent event sent when creating a wiki but that wouldn't fill the use case of initializing the wiki on the first request to it.
Thanks -Vincent _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On Apr 13, 2012, at 5:47 PM, Paul Libbrecht wrote:
Vincent,
on IRC you had suggested me to use such an event. I couldn't find it.
Each module can create events. For AppStarted/ReadyEvent they're currently in commons-observation-api
Is there an overview of such events?
* Observation module: http://extensions.xwiki.org/xwiki/bin/view/Extension/Observation+Module * For events you need to check the javadoc for each module since each module can provides its own events. There's no centralized place where all events are listed ATM. Thanks -Vincent
thanks in advance
Paul
Le 13 avr. 2012 à 17:43, Vincent Massol a écrit :
Hi devs,
We already have ApplicationStartedEvent and ApplicationReadyEvent (when DB is ready). We also need an event when the wiki is ready since in s a multiwiki environment when you create a new wiki for example, you might need to init some stuff (like initialize mandatory classes). It's also needed the first time a request comes in for a given wiki.
Thus I propose to add a WikiReadyEvent next to ApplicationStartedEvent and to send it in XWiki.updateDatabase():
... synchronized (wikiName) { if (!wikiList.contains(wikiName)) { wikiList.add(wikiName);
// Make sure these classes exists if (initClasses) { initializeMandatoryClasses(context); getPluginManager().virtualInit(context); getRenderingEngine().virtualInit(context); }
--> send WikiReadyEvent here
} }
WDYT?
Note that I was tempted to have a WikiCreatedEvent event sent when creating a wiki but that wouldn't fill the use case of initializing the wiki on the first request to it.
Thanks -Vincent
On Fri, Apr 13, 2012 at 6:47 PM, Paul Libbrecht <[email protected]> wrote:
Vincent,
on IRC you had suggested me to use such an event. I couldn't find it. Is there an overview of such events?
That would indeed be a valueable piece of lore, specially for (but not limited to) newcomers. Thanks, Eduard
thanks in advance
Paul
Le 13 avr. 2012 à 17:43, Vincent Massol a écrit :
Hi devs,
We already have ApplicationStartedEvent and ApplicationReadyEvent (when DB is ready). We also need an event when the wiki is ready since in s a multiwiki environment when you create a new wiki for example, you might need to init some stuff (like initialize mandatory classes). It's also needed the first time a request comes in for a given wiki.
Thus I propose to add a WikiReadyEvent next to ApplicationStartedEvent and to send it in XWiki.updateDatabase():
... synchronized (wikiName) { if (!wikiList.contains(wikiName)) { wikiList.add(wikiName);
// Make sure these classes exists if (initClasses) { initializeMandatoryClasses(context); getPluginManager().virtualInit(context); getRenderingEngine().virtualInit(context); }
--> send WikiReadyEvent here
} }
WDYT?
Note that I was tempted to have a WikiCreatedEvent event sent when creating a wiki but that wouldn't fill the use case of initializing the wiki on the first request to it.
Thanks -Vincent _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
The whole initialization listening business is quite tricky so I am: +1 for WikiReadyEvent but again I could be more informed with an overview Can't this be created by collecting the relevant pointers to a javadoc? paul Le 14 avr. 2012 à 00:13, Eduard Moraru a écrit :
on IRC you had suggested me to use such an event. I couldn't find it. Is there an overview of such events?
That would indeed be a valueable piece of lore, specially for (but not limited to) newcomers.
On Apr 14, 2012, at 12:13 AM, Eduard Moraru wrote:
On Fri, Apr 13, 2012 at 6:47 PM, Paul Libbrecht <[email protected]> wrote:
Vincent,
on IRC you had suggested me to use such an event. I couldn't find it. Is there an overview of such events?
That would indeed be a valueable piece of lore, specially for (but not limited to) newcomers.
Eddy, there's an overview, it's at: http://extensions.xwiki.org/xwiki/bin/view/Extension/Observation+Module What's missing IMO is that each Module needs to document what Events it creates and thus what event can be consumed by others. It's up to each module to document that. For example the Model module should document all the model events (add/update/delete for all Entities). Right now we have 2 model modules: xwiki-platform-oldcore and xwiki-platform-model. Right now we have http://extensions.xwiki.org/xwiki/bin/view/Extension/Model+Module and we could either add doc for the oldcore there too or (better) create an oldcore module on e.x.o. Thanks -Vincent
Thanks, Eduard
thanks in advance
Paul
Le 13 avr. 2012 à 17:43, Vincent Massol a écrit :
Hi devs,
We already have ApplicationStartedEvent and ApplicationReadyEvent (when DB is ready). We also need an event when the wiki is ready since in s a multiwiki environment when you create a new wiki for example, you might need to init some stuff (like initialize mandatory classes). It's also needed the first time a request comes in for a given wiki.
Thus I propose to add a WikiReadyEvent next to ApplicationStartedEvent and to send it in XWiki.updateDatabase():
... synchronized (wikiName) { if (!wikiList.contains(wikiName)) { wikiList.add(wikiName);
// Make sure these classes exists if (initClasses) { initializeMandatoryClasses(context); getPluginManager().virtualInit(context); getRenderingEngine().virtualInit(context); }
--> send WikiReadyEvent here
} }
WDYT?
Note that I was tempted to have a WikiCreatedEvent event sent when creating a wiki but that wouldn't fill the use case of initializing the wiki on the first request to it.
Thanks -Vincent
On Tue, Apr 17, 2012 at 10:49 AM, Vincent Massol <[email protected]> wrote:
On Apr 14, 2012, at 12:13 AM, Eduard Moraru wrote:
On Fri, Apr 13, 2012 at 6:47 PM, Paul Libbrecht <[email protected]> wrote:
Vincent,
on IRC you had suggested me to use such an event. I couldn't find it. Is there an overview of such events?
That would indeed be a valueable piece of lore, specially for (but not limited to) newcomers.
Eddy, there's an overview, it's at: http://extensions.xwiki.org/xwiki/bin/view/Extension/Observation+Module
Not talking about that.
What's missing IMO is that each Module needs to document what Events it creates and thus what event can be consumed by others. It's up to each module to document that.
For example the Model module should document all the model events (add/update/delete for all Entities). Right now we have 2 model modules: xwiki-platform-oldcore and xwiki-platform-model. Right now we have http://extensions.xwiki.org/xwiki/bin/view/Extension/Model+Module and we could either add doc for the oldcore there too or (better) create an oldcore module on e.x.o.
This is what I was referring to (same as Paul), though it would be much more valuable if we could come up with a documentation scheme that could offer a single entry point for all the vents (somehow aggregated from all the other modules). I know that it`s each module's task to document events (and other API items), but an aggregated events documentation (or at least list with "event -> module" items where to go for more details) would be great. You can not assume everybody knows the code by heart. Thanks, Eduard
Thanks -Vincent
Thanks, Eduard
thanks in advance
Paul
Le 13 avr. 2012 à 17:43, Vincent Massol a écrit :
Hi devs,
We already have ApplicationStartedEvent and ApplicationReadyEvent (when DB is ready). We also need an event when the wiki is ready since in s a multiwiki environment when you create a new wiki for example, you might need to init some stuff (like initialize mandatory classes). It's also needed the first time a request comes in for a given wiki.
Thus I propose to add a WikiReadyEvent next to ApplicationStartedEvent and to send it in XWiki.updateDatabase():
... synchronized (wikiName) { if (!wikiList.contains(wikiName)) { wikiList.add(wikiName);
// Make sure these classes exists if (initClasses) { initializeMandatoryClasses(context); getPluginManager().virtualInit(context); getRenderingEngine().virtualInit(context); }
--> send WikiReadyEvent here
} }
WDYT?
Note that I was tempted to have a WikiCreatedEvent event sent when creating a wiki but that wouldn't fill the use case of initializing the wiki on the first request to it.
Thanks -Vincent
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Hi, On Fri, Apr 13, 2012 at 6:43 PM, Vincent Massol <[email protected]> wrote:
Hi devs,
We already have ApplicationStartedEvent and ApplicationReadyEvent (when DB is ready). We also need an event when the wiki is ready since in s a multiwiki environment when you create a new wiki for example, you might need to init some stuff (like initialize mandatory classes). It's also needed the first time a request comes in for a given wiki.
Thus I propose to add a WikiReadyEvent next to ApplicationStartedEvent and to send it in XWiki.updateDatabase():
... synchronized (wikiName) { if (!wikiList.contains(wikiName)) { wikiList.add(wikiName);
// Make sure these classes exists if (initClasses) { initializeMandatoryClasses(context); getPluginManager().virtualInit(context); getRenderingEngine().virtualInit(context); }
--> send WikiReadyEvent here
} }
WDYT?
+1. I could have used that on the annotations migrator instead of ApplicationReadyEvent. Thanks, Eduard
Note that I was tempted to have a WikiCreatedEvent event sent when creating a wiki but that wouldn't fill the use case of initializing the wiki on the first request to it.
Thanks -Vincent _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On Apr 14, 2012, at 12:12 AM, Eduard Moraru wrote:
Hi,
On Fri, Apr 13, 2012 at 6:43 PM, Vincent Massol <[email protected]> wrote:
Hi devs,
We already have ApplicationStartedEvent and ApplicationReadyEvent (when DB is ready). We also need an event when the wiki is ready since in s a multiwiki environment when you create a new wiki for example, you might need to init some stuff (like initialize mandatory classes). It's also needed the first time a request comes in for a given wiki.
Thus I propose to add a WikiReadyEvent next to ApplicationStartedEvent and to send it in XWiki.updateDatabase():
... synchronized (wikiName) { if (!wikiList.contains(wikiName)) { wikiList.add(wikiName);
// Make sure these classes exists if (initClasses) { initializeMandatoryClasses(context); getPluginManager().virtualInit(context); getRenderingEngine().virtualInit(context); }
--> send WikiReadyEvent here
} }
WDYT?
+1. I could have used that on the annotations migrator instead of ApplicationReadyEvent.
Does it mean you're not using a Migrator? Thanks -Vincent
Thanks, Eduard
Note that I was tempted to have a WikiCreatedEvent event sent when creating a wiki but that wouldn't fill the use case of initializing the wiki on the first request to it.
Thanks -Vincent
On Sat, Apr 14, 2012 at 10:40 AM, Vincent Massol <[email protected]> wrote:
On Apr 14, 2012, at 12:12 AM, Eduard Moraru wrote:
Hi,
On Fri, Apr 13, 2012 at 6:43 PM, Vincent Massol <[email protected]> wrote:
Hi devs,
We already have ApplicationStartedEvent and ApplicationReadyEvent (when DB is ready). We also need an event when the wiki is ready since in s a multiwiki environment when you create a new wiki for example, you might need to init some stuff (like initialize mandatory classes). It's also needed the first time a request comes in for a given wiki.
Thus I propose to add a WikiReadyEvent next to ApplicationStartedEvent and to send it in XWiki.updateDatabase():
... synchronized (wikiName) { if (!wikiList.contains(wikiName)) { wikiList.add(wikiName);
// Make sure these classes exists if (initClasses) { initializeMandatoryClasses(context); getPluginManager().virtualInit(context); getRenderingEngine().virtualInit(context); }
--> send WikiReadyEvent here
} }
WDYT?
+1. I could have used that on the annotations migrator instead of ApplicationReadyEvent.
Does it mean you're not using a Migrator?
A poor choice of words on my side. I was actually talking about this https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwik... targeted the currently configured annotations class. For the rest, yes, I`ve used a migrator (migration 40001: https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwik...). Thanks, Eduard
Thanks -Vincent
Thanks, Eduard
Note that I was tempted to have a WikiCreatedEvent event sent when creating a wiki but that wouldn't fill the use case of initializing the wiki on the first request to it.
Thanks -Vincent
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
+0 Thanks, Marius On Fri, Apr 13, 2012 at 6:43 PM, Vincent Massol <[email protected]> wrote:
Hi devs,
We already have ApplicationStartedEvent and ApplicationReadyEvent (when DB is ready). We also need an event when the wiki is ready since in s a multiwiki environment when you create a new wiki for example, you might need to init some stuff (like initialize mandatory classes). It's also needed the first time a request comes in for a given wiki.
Thus I propose to add a WikiReadyEvent next to ApplicationStartedEvent and to send it in XWiki.updateDatabase():
... synchronized (wikiName) { if (!wikiList.contains(wikiName)) { wikiList.add(wikiName);
// Make sure these classes exists if (initClasses) { initializeMandatoryClasses(context); getPluginManager().virtualInit(context); getRenderingEngine().virtualInit(context); }
--> send WikiReadyEvent here
} }
WDYT?
Note that I was tempted to have a WikiCreatedEvent event sent when creating a wiki but that wouldn't fill the use case of initializing the wiki on the first request to it.
Thanks -Vincent _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On Fri, Apr 13, 2012 at 5:43 PM, Vincent Massol <[email protected]> wrote:
Hi devs,
We already have ApplicationStartedEvent and ApplicationReadyEvent (when DB is ready). We also need an event when the wiki is ready since in s a multiwiki environment when you create a new wiki for example, you might need to init some stuff (like initialize mandatory classes). It's also needed the first time a request comes in for a given wiki.
Thus I propose to add a WikiReadyEvent next to ApplicationStartedEvent and to send it in XWiki.updateDatabase():
... synchronized (wikiName) { if (!wikiList.contains(wikiName)) { wikiList.add(wikiName);
// Make sure these classes exists if (initClasses) { initializeMandatoryClasses(context); getPluginManager().virtualInit(context); getRenderingEngine().virtualInit(context); }
--> send WikiReadyEvent here
} }
WDYT?
+1
Note that I was tempted to have a WikiCreatedEvent event sent when creating a wiki but that wouldn't fill the use case of initializing the wiki on the first request to it.
There is a WikiCreatedEvent event already.
Thanks -Vincent _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
participants (5)
-
Eduard Moraru -
Marius Dumitru Florea -
Paul Libbrecht -
Thomas Mortagne -
Vincent Massol