On Jul 1, 2009, at 10:45 PM, <glenn_engel(a)agilent.com> <glenn_engel(a)agilent.com
wrote:
-----Original Message-----
From: devs-bounces(a)xwiki.org [mailto:devs-bounces@xwiki.org] On
Behalf
Of Vincent Massol
Sent: Wednesday, July 01, 2009 1:34 PM
To: XWiki Developers
Subject: Re: [xwiki-devs] Plugin initialization
Hi Glenn,
On Jul 1, 2009, at 9:54 PM, <glenn_engel(a)agilent.com> wrote:
I seem to recall some discussion about automatic
plugin startup
being planned. One of the really nice things about confluence is
that you can add plugins with just a jar file and don't have to
edit .xml configuration files. This also makes upgrades of either
the plugin or wiki easier as everything is in the jar.
Was anything like this added for 2.0 or possibly planned in the near
future?
Yes definitely. This is how it works already. Plugins are the old way
of extending xwiki. The new way is to use components. For example if
you implement a Macro component and put it in WEB-INF/lib it'll be
automatically available.
How about a servlet? Is there a similar way to do this without
editing web.xml? I suppose if there was something I could put into
the jar that would automatically get an init method of some kind
then I could in theory add my servlet url with java code.
The servlet spec *mandates* a web.xml (except in Servlet 3.0 which
just came out) so there's no way to have a servlet without a web.xml
entry.
However why do you need a servlet? It's not required in most cases I
can think of since you can have a component instead? Maybe you could
tell us your use case so that we could help you better?
I noticed my Macro component didn't get
instantiated/initialized
until it was referenced.
Yes, that's the default. What's your need? We could add the feature to
load some specific components on startup in the future if there's a
need. Right now you can receive the startup event and do some specific
init at that time.
Are there other types of Components I should be aware of?
Not sure I understand. Everything is a component and can be replaced
or extended (except for old code not yet migrated to components).
Do you have a specific use case?
Thanks
-Vincent