eXist-db/exist — pull request #398 by adamretter (2014-11-23 18:51:12+00:00)
Title: Code cleanup and improved separation of concerns

This is a general cleanup effort to try and fix the separation of concerns between several classes and between interface and implementation, highlights include:

* Refactoring the persistent and in-memory DOMs to reduce duplication within and across packages. In addition the inheritance hierarchy has been cleaned up and been made consistent. The in-memory DOM is now in `org.exist.dom.memtree`, the in-memory representation of the persistent DOM is in `org.exist.dom.persistent` and the common interfaces and classes are in the `org.exist.dom` base package.

* The interface for Stored Nodes from the persistent DOM has been extracted and this is used outside of `org.exist.dom.persistent` instead of NodeImpl/NodeProxy etc, which allows us to scope to implement different in-memory models of the stored DOM in future.

* eXist's QName class which was quite a mess has been cleaned up and made immutable. It is also more closely with Java's QName, the goal being to eventually replace eXist's QName class with Java's for better API compatibility. To do this will require moving node typing out of the QName class by cleaning up the broker/indexer interface to not mix concerns through QName.

* Some problems with NodeKind and NodeName tests have been identified and fixed.

* Where eXist declared XML namespace constants which are already in the JDKs XMLConstants interface, we have dropped the eXist ones to use the standard ones instead.

* Abstracted out a great deal of duplicated code between ArrayNodeSet implementations... and many many more general code improvements and deletion of dead/redundant code.