This page needs more code to show you how to use ZaphodsMap in a real-world application. Meanwhile here are the most essential facts:
This single static method in ZaphodsMap.pas is really all you need to load configuration values from an existing set of configuration files.
For more variations, you would instantiate TZaphodsMap for a branch, Activate a key, load a keyed file, and then start working with that keyed file. (Remember, your keyed file is the golden configuration file containing your software's settings.)
This component is what you should use when you want to install a new set of configuration files onto a computer. Day to day operation of your software probably will not require the setup component.
Using a ZaphodsMap component, it should be possible to easily obtain keys and settings for your software program.
A ZaphodsMap component should operate on a single software branch at a time. For that given branch, it should easily provide the path to the ZMKeybox.xml file, plus access to the keys within that keybox.
A ZaphodsMap component should return the DefaultContext provided in the central ZMGlobal.xml file, and it should always take that context (or any overrides) into consideration when finding settings.
Writing Values Back
This is the difficult part to implement. In order to write values back, it is necessary to remember which file, which section, and which setting was originally used, regardless of how many overrides were in effect.
You are writing an ISAPI DLL
You may want a way to store the configuration for an ISAPI DLL in a data folder which is separate from the DLL's folder, and separate from the EXE which loads the DLL (which would be inetinfo or an IIS worker process).
You are developing a Borland Delphi component
Makes it possible to have a Delphi (or Kylix) component load some configuration for use while the component is active in the Interactive Design Environment ("IDE"), and you want the configuration file located in its own folder, away from the Delphi EXE.
You are a Programmer
... and you want to have an easy way to maintain your own settings plus those of a few important customers in a single configuration file, so that when you deploy the configuration file, it works (without modification) at the customer's location. (See the feature called "DefaultContext".)
You Administer a Cluster of Servers that Load-Balance One-Another
...and you want to load settings that are the same for each server, yet each server has a unique Windows computer name, and the servers are not necessarily all on a LAN.
|This web site content is licensed under a Creative Commons Attribution 2.5 License. The ZaphodsMap web site is published by HREF Tools Corp. If you use ZaphodsMap, please mention ZaphodsMap.com at least once in your software source and at least once in your software documentation. All other trademarks are the property of their respective owners.|