use of org.apache.jackrabbit.oak.spi.commit.CompositeEditorProvider 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 = wrapNodeState(source.getRoot(), true, false);
NodeBuilder targetRoot = target.getRoot().builder();
copyWorkspace(sourceRoot, targetRoot);
removeCheckpointReferences(targetRoot);
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);
removeVersions();
}
use of org.apache.jackrabbit.oak.spi.commit.CompositeEditorProvider in project jackrabbit-oak by apache.
the class LuceneIndexAggregationTest2 method createRepository.
@Override
protected ContentRepository createRepository() {
LuceneIndexProvider provider = new LuceneIndexProvider();
return new Oak().with(new InitialContent() {
@Override
public void initialize(@Nonnull NodeBuilder builder) {
super.initialize(builder);
// registering additional node types for wider testing
InputStream stream = null;
try {
stream = LuceneIndexAggregationTest2.class.getResourceAsStream("test_nodetypes.cnd");
NodeState base = builder.getNodeState();
NodeStore store = new MemoryNodeStore(base);
Root root = RootFactory.createSystemRoot(store, new EditorHook(new CompositeEditorProvider(new NamespaceEditorProvider(), new TypeEditorProvider())), null, null, null, null);
NodeTypeRegistry.register(root, stream, "testing node types");
NodeState target = store.getRoot();
target.compareAgainstBaseState(base, new ApplyDiff(builder));
} catch (Exception e) {
LOG.error("Error while registering required node types. Failing here", e);
fail("Error while registering required node types");
} finally {
printNodeTypes(builder);
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
LOG.debug("Ignoring exception on stream closing.", e);
}
}
}
}
}).with(new OpenSecurityProvider()).with(((QueryIndexProvider) provider.with(getNodeAggregator()))).with((Observer) provider).with(new LuceneIndexEditorProvider()).createContentRepository();
}
Aggregations