use of org.apache.jackrabbit.oak.upgrade.RepositoryUpgrade.LoggingCompositeHook in project jackrabbit-oak by apache.
the class RepositorySidegrade method migrateWithoutCheckpoints.
private void migrateWithoutCheckpoints() throws CommitFailedException, RepositoryException {
final List<CommitHook> hooks = new ArrayList<>();
if (customCommitHooks != null) {
hooks.addAll(customCommitHooks);
}
NodeState sourceRoot = wrapSource(source.getRoot(), true, false);
NodeBuilder targetRoot = target.getRoot().builder();
copyWorkspace(sourceRoot, targetRoot);
removeCheckpointReferences(targetRoot);
if (includeIndex) {
IndexCopier.copy(sourceRoot, targetRoot, includePaths);
}
if (!versionCopyConfiguration.isCopyAll()) {
NodeBuilder versionStorage = VersionHistoryUtil.getVersionStorage(targetRoot);
if (!versionStorage.exists()) {
// it's possible that this is a new repository and the version storage
// hasn't been created/copied yet
versionStorage = VersionHistoryUtil.createVersionStorage(targetRoot);
}
if (!versionCopyConfiguration.skipOrphanedVersionsCopy()) {
copyVersionStorage(targetRoot, getVersionStorage(sourceRoot), versionStorage, versionCopyConfiguration);
}
hooks.add(new EditorHook(new VersionableEditor.Provider(sourceRoot, getWorkspaceName(), versionCopyConfiguration)));
}
// type validation, reference and indexing hooks
hooks.add(new EditorHook(new CompositeEditorProvider(createTypeEditorProvider(), createIndexEditorProvider())));
target.merge(targetRoot, new LoggingCompositeHook(hooks, null, false), CommitInfo.EMPTY);
}
Aggregations