Friday, October 12, 2007

discovering which SWAF config.xml file to change

Have you ever wondered exactly where in the XML config hierarchy a particular plugin is defined? With XML file inheritance in SWAF, it can sometimes get very complicated.

I have created some enhancements to the XML parsing and plugin creation methods that allow you to track the one or many XML FILENAMES where a plugin is defined.

  1. load this file
  2. start the application whose configurations you want to trace.
  3. get a handle on some plugin and then ask it for its debug!source_files. It will return a rope of XML file names that contain that plugin's definition in the order that they were encountered. I.E., the last XML file in the rope is the one that the plugin used for its definition.
For example:
MagikSF> smallworld_product.applications.an_element().plugin(:map_plugin).debug!source_files
MagikSF> print(!)
1 ".....\sw_user_custom\pni_gui\resources\base\data\config.xml"
2 ".....\sw_user_custom\custom_application\resources\base\data\config.xml"

so, this tells you that the "custom_application" config.xml file overrides the same plugin settings in PNI_GUI config.xml. If you want to make a change to the :map_plugin you will need to make it in CUSTOM_APPLICATION for the changes to take hold.

DISCLAIMER: DO NOT PUT THIS IN YOUR PRODUCTION CODE. This script is intended only for debugging your XML configuration files and should not be in any image that is writing data to a production database.

No comments: