IBM Research

Writing Your Own Persistence Backend

You can write your own persistence backend by extending com/ibm/wbi/persistent/SectionBackend. All WBI configuration data, not just plugins, will then use this backend. This might be useful for performance purposes, network transparency, or for clustering servers running the WBI proxy software.

The class and initialization string for your backend is listed in the $WBIHOME/wbi.boot file. When WBI boots it will attempt to instantiate the subclass of mentioned (hence it must appear in your CLASSPATH), and it will initialize it with the init string from that file. The init string might contain a ";"-delimited list of properties of a network resource such as hostname, port, etc. -- WBI does not attempt to parse it so its format is up to you.

Since it is a hierarchical database, you'll find the term child used. A particular instance of a Section represents a particular node in a tree. Its children are those nodes beneath it in a tree. E.g., if you cd on your filesystem to some directory, the directories beneath it are its children.

The persistence subsystem lazy-loads sections on demand to minimize startup time. A future revision might unload sections which are no longer being used. To support lazy-loading, the populateChildren() you will implement works by adding the "stub" object into the dictionary argument as the value for each contained child. That child's only need be read when the constructChild() method is invoked.

When devising a backend you have a choice of whether you want all of the data loaded for a given section on constructChild(), or to read the data as it is requested. The former is simpler and faster for small amounts of data; the latter is better for very large amounts of data. For example, you might want to save to a Berkeley DB file, in which case it does not make sense to preload the entire database. To support this choice, you can return a new Hashtable() or your own implementation of Dictionary in response to the constructDictionary() method.