Class ArchiveVersionStabilizer
java.lang.Object
org.odpi.openmetadata.samples.archiveutilities.ArchiveVersionStabilizer
Carries the version numbers of unchanged elements over from the previous edition of an archive.
An archive writer stamps every element with the same new version number (see EgeriaBaseArchiveWriter.getVersionNumber()), which tells a repository that the element is newer than the copy it already holds. That is right for an element whose content has changed, but stamping the unchanged ones as well meant that every rebuild changed every element: the archive could not be reproduced, a review of a content change was buried in thousands of version changes, and a repository reloading the archive rewrote every element in it.
This class compares each element and type in the new archive with the one of the same unique identifier in the previous edition. If they are identical apart from version numbers - their own and those of the classifications, entity proxies and attribute types they carry - the previous edition's copy is used, so it keeps its previous versions. New and changed elements keep the new version. An entity is compared together with its classifications, so it keeps its previous version only if none of them has changed.
An archive writer stamps every element with the same new version number (see EgeriaBaseArchiveWriter.getVersionNumber()), which tells a repository that the element is newer than the copy it already holds. That is right for an element whose content has changed, but stamping the unchanged ones as well meant that every rebuild changed every element: the archive could not be reproduced, a review of a content change was buried in thousands of version changes, and a repository reloading the archive rewrote every element in it.
This class compares each element and type in the new archive with the one of the same unique identifier in the previous edition. If they are identical apart from version numbers - their own and those of the classifications, entity proxies and attribute types they carry - the previous edition's copy is used, so it keeps its previous versions. New and changed elements keep the new version. An entity is compared together with its classifications, so it keeps its previous version only if none of them has changed.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonggetHighestVersion(OpenMetadataArchive archive) Return the highest version number of any element in an archive, or zero if it has none.intstabilizeVersions(OpenMetadataArchive newArchive, OpenMetadataArchive previousArchive) Give each element and type of the new archive that is unchanged from the previous edition its previous version numbers.
-
Constructor Details
-
ArchiveVersionStabilizer
public ArchiveVersionStabilizer()
-
-
Method Details
-
stabilizeVersions
Give each element and type of the new archive that is unchanged from the previous edition its previous version numbers. An unchanged element is replaced by its copy from the previous edition, so its version - and the versions of the classifications and entity proxies it carries - are exactly as they were.- Parameters:
newArchive- archive about to be written - updated in placepreviousArchive- previous edition of the archive, or null if there is none- Returns:
- number of elements and types whose previous version was kept
-
getHighestVersion
Return the highest version number of any element in an archive, or zero if it has none. Once versions are carried over from one edition to the next, the elements of an archive no longer all share one version.- Parameters:
archive- archive to examine- Returns:
- highest version number, or zero
-