Before describing this package, a short description of the problem that it solves. We assume that at some stage, we will run into the use-case, where we might have add-on data (armies, scenarios etc.) that is not in the main trunk. Then the problem is: If a scenario requests, say, an army from such an add-on package, how do you find it?

The solution that some games use is this: add-on data is always put in a special directory with the same underlying directory tree as the main data, and the code always searches the adjoint of all directories for files. As an example, let us say, all army files are in the army/ subdirectory. The freelords data might be in some data directory /usr/share/games/freelords/data. An add-on "moreArmies" wants to add a few more armies. To make them visible, we put all the data in this add-on under the directory ~/.freelords/moreArmies. When we are now looking for some army-related data, we will look in two directories:

If the army file is found in either of the two directories, we were succesful in our search. Another add-on could then add data files in, say, ~/.freelords/moreData/army and so on.

The code for performing and searching the adjoint of multiple directories is contained in this package. It basically wraps around some netbeans API that can do a lot more than we need. On constructing a new DataRepository, you give a number of starting nodes below it expects a certain directory tree. These starting nodes can be directories, in which case there must be certain subdirectories, or zip and jar files, in which case the content must form the specified directory tree.

When you want to access a resource (e.g., some army description), you define the physical file name by a triple consisting of the package name, the resource name, and the file type. The package name specifies the subdirectory where the data is expected. The resource name should equal the file name, and the file type defines the file extension. So to request the xml definition for an orc army, you might have the ARMY package, the 'orc' resource, and an XML file type, which would look for the file army/orc.xml.