The PropertyHandler object is the organizer of properties, looking for settings on how to configure OpenMap components. It is designed to look through a series of locations to find properties files, loading them in order. If there is a name conflict for a property, the last version of the property set is the one that gets used. This object isn't really interested in hooking up with other objects. It's assumed that many objects will want to contact this object, and find the properties that apply to them. There is one exception this: When components start implementing the PropertyProvider interface, and the PropertyHandler becomes capable of creating an properties file, then the PropertyHandler will be able to use the BeanContext to query PropertyProviders to get their properties to put in the properties file.
The PropertyHandler looks in several places for an openmap.properties file:
- as a resource in the code base.
- in the configDir set as a system property at runtime.
- in the user's home directory.
For each properties file, a check is performed to look within for an include property containing a marker name list. That list is parsed, and each item is checked (markerName.URL) for an URL to another properties file.
Also significant, the PropertyHandler can be given a BeanContext to load components. For this, the openmap.components property contains a marker name list for openmap objects. Each member of the list is then used to look for another property (markername.class) which specifies which class names are to be instantiated and added to the BeanContext. Intelligent components are smart enough to wire themselves together. Order does matter for the openmap.components property, especially for components that get added to lists and menus. Place the components in the list in the order that you want components added to the MapHandler.
If the debug.showprogress environment variable is set, the PropertyHandler will display a progress bar when it is creating components. If the debug.properties file is set, the steps that the PropertyHandler takes in looking for property files will be displayed.
If the PropertyHandler is created with an empty constructor or with a null Properties object, it will do the search for an openmap.properties file. If you don't want it to do that search, create it with an empty Properties object.