On Tue, Dec 1, 2009 at 13:55, Asiri Rathnayake
<[email protected]> wrote:
> Hi Devs,
>
> in XWiki::initXWiki(XWikiConfig config, XWikiContext context,
> XWikiEngineContext engine_context, boolean noupdate) method signature, the
> flag "noupdate" indicates whether the database should be updated or not. But
> as far as I can understand, it's meaning is reversed:
>
> - if "noupdate" is true -> You can update the database and install data into
> it (like define major xwiki classes etc.).
>
> - if "noupdate" is false -> You should not add anything into the database.
> (I guess this means you can only create the database schemas.)
>
> One observation I made though is that "noupdate" is actually used only in
> the following code segment:
>
> <code>
> // Make sure these classes exists
> if (noupdate) {
> initializeMandatoryClasses(context);
> getStatsService(context);
> }
> </code>
>
> * Question:- Do we really need this flag?
>
> The other problem is that pckager plugin is using a version of XWiki
> constructor that sets this flag to "false" by default:
>
> see
> http://svn.xwiki.org/svnroot/xwiki/platform/xwiki-tools/trunk/xwiki-packager-plugin/src/main/java/com/xpn/xwiki/tool/backup/AbstractPackager.javaand
>
> http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.javafor
> proof.
>
> This means when we are packaging the database (hsqldb), none of the
> mandatory classes are packaged. They will only be initialized when XE is
> loaded for the first time.
>
> * Question:- Is this the desired behavior?
This mean we have objects but not the corresponding classes in the
database so the database is not valid. Even if XE is able to fix the
issue it seems wrong to be to generate an invalid database.
>
> Apperantly I have introduced a bug (sort of) because XWiki.WikiMacroClass &
> XWiki.WikiMacroParameterClass are initialized inside if(noupdate){} clause
> but I have invoked registerWikiMacros(); call outside of it (in
> XWiki::initXWiki()). This makes hsqldb database build report an exception
> because wiki macro registration code throws an exception if it cannot find
> the necessary xwiki class definitions.
>
> I can fix this error by simply moving registerWikiMacros(); call inside the
> if(noupdate){} check but I'm not sure whether it is the correct way.
>
> WDYT?
IMO we should enable standard class generation in packager.
Now for the registerWikiMacros(); issue i see to issues actually:
* it does not sounds right to have wiki macro classed initialized in
initializeMandatoryClasses in fact (I even tough it was done in
registerWikiMacros()), for me it's not a mandatory class, it should be
initialized by the wiki macro initializer
* since "noupdate" seems related to "don't put data in the database,
just structure" yes registerWikiMacros() should go inside the if block
>
> - Asiri
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>
--
Thomas Mortagne
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs