[xwiki-users] On Space Created Event
Hi, How can I register a java event listener against a space created event? I would need this to add some stuff to another database everytime a new space was created. Thanks -- View this message in context: http://xwiki.475771.n2.nabble.com/On-Space-Created-Event-tp7473505p7473505.h... Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi Diego, On Apr 17, 2012, at 3:31 PM, _diego wrote:
Hi,
How can I register a java event listener against a space created event? I would need this to add some stuff to another database everytime a new space was created.
You cannot because spaces don't exist in the model! :) Spaces are just document namespaces. You can register an event when a document is created and then check the space the document is in. Thanks -Vincent
Thanks, However I'm still having a problem. I'm implementing an EventListener as described http://extensions.xwiki.org/xwiki/bin/view/Extension/Observation+Module+Loca... here with the component annotation and the corresponding line in components.txt. However when I try to start xwiki, there's a NoClassDefFound: java.lang.NoClassDefFoundError: Could not initialize class org.MyExample. I've checked and it is in the jar file I created. -- View this message in context: http://xwiki.475771.n2.nabble.com/On-Space-Created-Event-tp7473505p7476387.h... Sent from the XWiki- Users mailing list archive at Nabble.com.
Just to give you heads up you can mention below property in xwiki.cfg file xwiki.authentication.authclass=com.MyAuthClass. Now in MyAuthClass you can check XWikiContext.getAction().equals("create")// it means user is creating some doc. I am not sure if we have some variable in XWikiContext thru which you can distinguish if it is a space or not(may be some yo can check the parent of doc to be created). If Not, you can follow the convention that user always create the space document suffixed with "MySpace" and one more check in this custom class (XWikiContext.getURL().toString().contains("MySpace/")). Hope it helps. On Tue, Apr 17, 2012 at 7:01 PM, _diego <[email protected]> wrote:
Hi,
How can I register a java event listener against a space created event? I would need this to add some stuff to another database everytime a new space was created.
Thanks
-- View this message in context: http://xwiki.475771.n2.nabble.com/On-Space-Created-Event-tp7473505p7473505.h... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
participants (3)
-
_diego -
mohit gupta -
Vincent Massol