Search in sources :

Example 1 with LoggingCompositeHook

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);
}
Also used : CompositeEditorProvider(org.apache.jackrabbit.oak.spi.commit.CompositeEditorProvider) ReportingNodeState(org.apache.jackrabbit.oak.upgrade.nodestate.report.ReportingNodeState) EmptyNodeState(org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState) NameFilteringNodeState(org.apache.jackrabbit.oak.upgrade.nodestate.NameFilteringNodeState) MetadataExposingNodeState(org.apache.jackrabbit.oak.upgrade.nodestate.MetadataExposingNodeState) NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) FilteringNodeState(org.apache.jackrabbit.oak.upgrade.nodestate.FilteringNodeState) CommitHook(org.apache.jackrabbit.oak.spi.commit.CommitHook) EditorHook(org.apache.jackrabbit.oak.spi.commit.EditorHook) ArrayList(java.util.ArrayList) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) LoggingCompositeHook(org.apache.jackrabbit.oak.upgrade.RepositoryUpgrade.LoggingCompositeHook) RepositoryUpgrade.createTypeEditorProvider(org.apache.jackrabbit.oak.upgrade.RepositoryUpgrade.createTypeEditorProvider) RepositoryUpgrade.createIndexEditorProvider(org.apache.jackrabbit.oak.upgrade.RepositoryUpgrade.createIndexEditorProvider) CompositeEditorProvider(org.apache.jackrabbit.oak.spi.commit.CompositeEditorProvider)

Aggregations

ArrayList (java.util.ArrayList)1 EmptyNodeState (org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState)1 CommitHook (org.apache.jackrabbit.oak.spi.commit.CommitHook)1 CompositeEditorProvider (org.apache.jackrabbit.oak.spi.commit.CompositeEditorProvider)1 EditorHook (org.apache.jackrabbit.oak.spi.commit.EditorHook)1 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)1 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)1 LoggingCompositeHook (org.apache.jackrabbit.oak.upgrade.RepositoryUpgrade.LoggingCompositeHook)1 RepositoryUpgrade.createIndexEditorProvider (org.apache.jackrabbit.oak.upgrade.RepositoryUpgrade.createIndexEditorProvider)1 RepositoryUpgrade.createTypeEditorProvider (org.apache.jackrabbit.oak.upgrade.RepositoryUpgrade.createTypeEditorProvider)1 FilteringNodeState (org.apache.jackrabbit.oak.upgrade.nodestate.FilteringNodeState)1 MetadataExposingNodeState (org.apache.jackrabbit.oak.upgrade.nodestate.MetadataExposingNodeState)1 NameFilteringNodeState (org.apache.jackrabbit.oak.upgrade.nodestate.NameFilteringNodeState)1 ReportingNodeState (org.apache.jackrabbit.oak.upgrade.nodestate.report.ReportingNodeState)1