Here's a patch against the current trunk (14002) for the Catalog+DAO splitting (refer to to R'n'D page http://geoserver.org/pages/viewpage.action?pageId=22708796).
This is a step-zero refactoring, aimed at a first split from the Catalog logic and the real data handling.
Most of the code is still bound to the InMemoryCatalogDAO requirements.
The hibernate module is not aligned with these changes yet, so it won't work
until refactored itself. I think some other minor changes will be needed to the
CatalogImpl class in order to make also the hib module work.
The main refactoring has been made on CatalogImpl: it has been split in 2 classes + 1 interface:
Some other classes have been involved in the refactoring:
Handled some data that are no longer in CatalogImpl, but in InMemoryCatalogDAO.
Reads and writes data file also handled by XStreamPersister.
While CatalogWriter writes data in the "new" format, LegacyCatalogReader may read both legacy and new format.
Added a workaround to be discussed about the resolve() call.
- The current DAO exposes methods for every lookup/search loop in the original CatalogImpl. I
think this is the least DAO interface we need for this step zero refactoring.
- All of the listener logic has been left in the CatalogImpl, and the ModProxy stuff as
well. The DAO's update() methods are aware about the proxying because the
InMemoryCatalogDAO needs it to commit() the changes. This kind of coupling
does not worry me, because having old and new values may be useful also for
other checks at DAO level.
- I split the saved() call in the 2-phase preSave() and postSave() to have a
- The default(Name|Work)space logic was a bit too tied with the way it was
handled (null key into a Map). Now data and logic is more explicit in their usage.
- resolve() has been moved into the MemoryDAO. Maybe it should not be its
concern, but rather of the object that is creating the resource (the
XStreamPersister?). This has to be discussed and cleaned up.
This patch compiles and passes all the tests with the web+restconfig profiles
Waiting for a review.