I have written a custom VCardProvider which is installed during the initialization of my plugin. In version 3.5.2 I set the system property provider.vcard.className to my VCardProvider and programtically re-initialized the VCardManager. I was then able to set the provider.vcard.className back to the original value configured by the administrator to ensure the proper VCardProvider was used if my plugin was deleted/removed from the system while the server was shutdown (or even while the server was still running).
In 3.6.0a it appears that setting the provider.vcard.className system property automatically triggers the VCardManager to restart using the newly assigned value. This prevents me from restoring the original provider.vcard.className system property to ensure a valid VCardProvider is configured should my plugin be removed.
Is there way to set the provider.vcard.className without triggering an automatic restart of the VCardManager?
Is there a way in general to ensure that the setting of system properties does not trigger unexpected server actions?
Thanks
This prevents me from restoring the original provider.vcard.className system property to ensure a valid VCardProvider is configured should my plugin be removed.
I’m not sure, but if the VCardManager is restarted automatically if you set this property, I would assume that the original Provider is restored if you delete the property. At least I would implement it this way…
You should search for a listener for this property and check the source.
Thanks coolcat for providing me with your hints on where to look. I believe I have a solution to my problem, although I must admit it is a bit of a hack.
After reading through the source code here is what I discovered:
The VCardManagersets a PropertyEventListener to handle any changes made to the “provider.vcard.className” property IN THE DB.
The VCardManager restarts the VCardProvider whenver this property is SET.
To solve my problem what I did was
-
retrieve the “provider.vcard.className” property IN THE DB to determine the configured VCardProvider.
-
set the “provider.vcard.className” property IN THE DB to my custom VCardProvider which in turn automatically started due the reasons stated above.
-
delete the “provider.vcard.className” property IN THE DB to ensure my custom VCardProvider was not the configured one should the server crash.
-
set the “provider.vcard.className” property IN THE OPENFIRE.XML file to be the originally configured VCardProvider. This ensures when the server starts that VCardManager will migrate the value into the DB and restore the configuration back to its opriginal state. By setting the property in the XML file I was able to restore the orgianl settings withoutt triggering an automatic restart of the VCardManager and yet still ensure the VCardManager will use the original value when the server bounces.
All of this was neccessary becasue of two problems
1 - The destroyPlugin() is never called when opefire.exe is shutdown.
2 - VCardManager automatically restarts whenever the sytem property in the DB is set.
I would like to cast a vote that both of these “features” of openfire be changes in a future release.