Package org.apache.jackrabbit.oak.spi.commit

Examples of org.apache.jackrabbit.oak.spi.commit.CommitHook


        NodeBuilder builder = store.getRoot().builder();
        for (WorkspaceInitializer wspInit : initializer) {
            wspInit.initialize(builder, workspaceName, queryEngineSettings, indexProvider, commitHook);
        }
        try {
            CommitHook hook = new EditorHook(new IndexUpdateProvider(indexEditor));
            CommitInfo info = new CommitInfo("OakInitializer", null);
            store.merge(builder, hook, info);
        } catch (CommitFailedException e) {
            throw new RuntimeException(e);
        }
View Full Code Here


    }

    private static CommitHook newCommitHook(final String name,
            final PropertyState state, final AsyncIndexStats indexStats)
            throws CommitFailedException {
        return new CommitHook() {
            @Override
            @Nonnull
            public NodeState processCommit(NodeState before, NodeState after,
                    CommitInfo info) throws CommitFailedException {
                // check for concurrent updates by this async task
View Full Code Here

        NodeState newRoot = rootBuilder.getNodeState();

        NodeStoreBranch branch = store.branch();
        branch.setRoot(newRoot);
        branch.merge(new CommitHook() {
            @Override
            public NodeState processCommit(NodeState before, NodeState after) {
                NodeBuilder rootBuilder = after.builder();
                NodeBuilder testBuilder = rootBuilder.child("test");
                testBuilder.child("fromHook");
View Full Code Here

            copyPrivileges(builder);
            copyVersionStore(builder, idxToPrefix);
            copyWorkspaces(builder, idxToPrefix);

            // TODO: default hooks?
            CommitHook hook = new CompositeHook(
                    new EditorHook(new GroupEditorProvider()),
                    new EditorHook(new CompositeEditorProvider(
                            new TypeEditorProvider(),
                            new IndexUpdateProvider(new CompositeIndexEditorProvider(
                                    new ReferenceEditorProvider(),
View Full Code Here

                CompositeHook.compose(initHooks));

        // add index hooks later to prevent the OakInitializer to do excessive indexing
        with(new IndexUpdateProvider(indexEditors));
        withEditorHook();
        CommitHook commitHook = CompositeHook.compose(commitHooks);
        return new ContentRepositoryImpl(
                store,
                commitHook,
                defaultWorkspaceName,
                indexProvider,
View Full Code Here

    }

    @Override
    public NodeState merge() throws CommitFailedException {
        NodeState oldRoot = base;
        CommitHook commitHook = store.getHook();
        NodeState toCommit = commitHook.processCommit(store, oldRoot, currentRoot);
        setRoot(toCommit);

        try {
            if (branchRevision == null) {
                // Nothing was written to this branch: return initial node state.
View Full Code Here

        assertEquals(newRoot, after);
    }

    @Test
    public void beforeCommitHook() throws CommitFailedException {
        store.setHook(new CommitHook() {
            @Override
            public NodeState processCommit(
                    NodeStore store, NodeState before, NodeState after) {
                NodeBuilder rootBuilder = store.getBuilder(after);
                NodeBuilder testBuilder = store.getBuilder(after.getChildNode("test"));
View Full Code Here

                groupsPath = userConfig.getParameters().getProperty(UserManagerImpl.PARAM_GROUPS_PATH, UserConstants.DEFAULT_GROUP_PATH);
            } else {
                groupsPath = UserConstants.DEFAULT_GROUP_PATH;
            }
            // TODO: default hooks?
            CommitHook hook = new CompositeHook(
                    new EditorHook(new GroupEditorProvider(groupsPath)),
                    new EditorHook(new CompositeEditorProvider(
                            new TypeEditorProvider(false),
                            new IndexUpdateProvider(new CompositeIndexEditorProvider(
                                    new ReferenceEditorProvider(),
View Full Code Here

                                  @Nonnull RepositoryInitializer initializer,
                                  @Nonnull IndexEditorProvider indexEditor) {
        try {
            NodeBuilder builder = store.getRoot().builder();
            initializer.initialize(builder);
            CommitHook hook = new EditorHook(new IndexUpdateProvider(indexEditor));
            CommitInfo info = new CommitInfo("OakInitializer", null);
            store.merge(builder, hook, info);
        } catch (CommitFailedException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

        NodeBuilder builder = store.getRoot().builder();
        for (WorkspaceInitializer wspInit : initializer) {
            wspInit.initialize(builder, workspaceName, indexProvider, commitHook);
        }
        try {
            CommitHook hook = new EditorHook(new IndexUpdateProvider(indexEditor));
            CommitInfo info = new CommitInfo("OakInitializer", null);
            store.merge(builder, hook, info);
        } catch (CommitFailedException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.spi.commit.CommitHook

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.