Each data source can have associated state

This pull request extends the data source machinery allowing some state to be associated with each data source. This will avoid problems like: re-connecting to database servers for each operation.

Changes are:

- Add an associated data type and initialise & finalise methods to the data source type class;

- Update the action monad to incorporate a reader for a value of the associated state data type;

- Update tests code to initialise, use, and finalise the state;

- Implement startup and shutdown functionality to initialise and finalise the state for all data sources;

- Refactor core functions to thread this initialised state through the system;

- Re-refactor the tests in light of this architectural change;

- Reimplement testing data sources hiding the data inside this state value.