|  | ## Configuring Databases

Introduction

Databases are primarily collections of Records and Indexes along with the associated metadata and objects required for processing the data.

Configuration is typically done in a single file, with all of the dependent components included within it and stored in a directory devoted to just that database. The file is normally called, simply, 'config.xml'.

Example

An example database configuration:

    01 <config type="database" id="db_ead">
    02   <objectType>database.SimpleDatabase</objectType>
    03
    04   <paths>
    05     <path type="defaultPath">dbs/ead</path>
    06     <path type="metadataPath">metadata.bdb</path>
    07     <path type="indexStoreList">eadIndexStore</path>
    08     <object type="recordStore" ref="eadRecordStore"/>
    09   </paths>
    10   <subConfigs>
    11     ...
    12   </subConfigs>
    13   <objects>
    14     ...
    15   </objects>
    16 </config>

Explanation

In line 1 we open a new object, of type 'database' with an identifier of 'db_ead'. You should replace 'db_ead' with the identifier you want for your database.

The second line defines the type of database. There is currently only one type, so this line should be copied in verbatim.

Between lines 4 and 9 we define 3 paths and one reference to an object. To explain each in turn:

- defaultPath is the path to the directory where the database is being stored. It will be prepended to any further paths in the database or in any subsidiary object.
- metadataPath is the path to a datastore in which the database will keep its metadata. This includes things like the number of records, the average size or the records and so forth. As it's a file path, it would end up being dbs/ead/metdata.bdb -- in other words, in the same directory as the rest of the database files.
- indexStoreList is a space separated list of references to all indexStores the database will use. This is needed if we intend to index any records later, as it tells the database which indexStores to register the record in.
- The object reference is to an object called 'eadRecordStore' which is an instance of a 'recordStore'. This is important for future workflows, so that the database knows which recordStore it should put records into by default.

Lines 10-12 will contain a series of subConfig elements, each of which is the configuration for a subsidiary object such as the recordStore and the indexes.

Lines 13-15 will contain a series of path elements, each of which has a reference to an object that has been previously configured. This lines instruct the server to actually instantiate the object. This means that the objects can be configured globally but only built when required.