Checkpoint commit for OPENDJ-1206 : Create a new ReplicationBackend/ChangelogBackend 
 to support cn=changelog
CR-4439

Implementation of an additional validation of provided cookie when searching changelog
in cookie mode. 

Check for each state of the provided cookie that the csn is not older than the oldest CSN
available in each domain. If this is not the case, then an error 
ERR_RESYNC_REQUIRED_TOO_OLD_DOMAIN_IN_PROVIDED_COOKIE is returned. 

This check was done previously in the ECLServerHandler class but was not ported when
writing ChangelogBackend.  It also means I'm re-adding some methods deleted by the 
previous big clean done by Jean-Noel. 

Changes:
* ReplicationServer.java : 
  - add the check to validateServerState() method
  - refactor validateServerState() method for better readability
* ReplicationServerDomain.java : 
  - re-add getOldestState() method
* ReplicationDomainDB. java : 
  - re-add getDomainOldestCSNs(DN) method
* FileChangelogDB.java, JEChangelogDB.java : 
  - re-add implementation of getDomainOldestCSNs(DN) method


git-svn-id: https://svn.forgerock.org/opendj/trunk@10989 41b1ffd8-f28e-4786-ab96-9950f0a78031
OPENDJ-1540 (CR-4436) Persistent searches on cn=changelog with changesOnly=true should not return the base changelog entry

I did the following changes:

- Persistent searches on cn=changelog with changesOnly=true no longer return the base changelog entry
- Fixed a functional bug with setting hasSubordinates on the base changelog entry:
-- hasSubordinates must be computed regardless of the search parameters, result can also be cached in memory once and for all
- As a consequence, it means we can immediately return the base changelog entry for initial searches without even looking for any subordinate changelog entries.
- Fixed a race condition when registering persistent searches: first set the cookie in the attachments then register the persistent searches
- implementing numSubordinates() was not required and it might be buggy, so returned -1 instead.


ChangelogBackend.java:
In notifyEntryAdded() (a.k.a. persistent search phase), never return the base changelog entry.
Removed EntrySender and moved all its methods back into ChangelogBackend + stored the MultiDomainServerState cookie as an attachment of the SearchOperation.
Renamed search*() to internalSearch*().
In hasSubordinates(), reimplemented it in a more efficient way + added baseChangelogHasSubordinates() and baseEntryHasSubordinates field to memoize its result.
In numSubordinates(), is not required, so just returned -1 + removed NumSubordinatesSearchOperation.
In registerPersistentSearch(), register the persistent searches after setting the cookie attachment on the search operation
Completed javadocs.

In registerPersistentSearch(), forced changesOnly=true persistent searches to never return the changelog base entry.
Renamed Entry.hasReturnedBaseEntry field to mustReturnBaseEntry to fit the fact the changelog base entry might never be returned + inverted all the boolean expressions related to this field.


git-svn-id: https://svn.forgerock.org/opendj/trunk@10990 41b1ffd8-f28e-4786-ab96-9950f0a78031
Fixed checkstyle error.

git-svn-id: https://svn.forgerock.org/opendj/trunk@10991 41b1ffd8-f28e-4786-ab96-9950f0a78031
Fixed a NPE in ChangelogBackendTestCase.

git-svn-id: https://svn.forgerock.org/opendj/trunk@10992 41b1ffd8-f28e-4786-ab96-9950f0a78031