Package org.apache.jackrabbit.oak.api

Examples of org.apache.jackrabbit.oak.api.ContentSession


    public SystemRoot(final NodeStore store, final CommitHook hook, final String workspaceName,
            final SecurityProvider securityProvider, final QueryIndexProvider indexProvider) {

        super(store, hook, workspaceName, SystemSubject.INSTANCE, securityProvider, indexProvider);

        contentSession = new ContentSession() {
            private final AuthInfoImpl authInfo = new AuthInfoImpl(
                    null, null, SystemSubject.INSTANCE.getPrincipals());

            @Override
            public void close() {
View Full Code Here


    @Override
    public void commit(@Nullable String message, @Nullable String path)
            throws CommitFailedException {
        checkLive();
        ContentSession session = getContentSession();
        CommitInfo info = new CommitInfo(
                session.toString(), session.getAuthInfo().getUserID(), message);
        store.merge(builder, getCommitHook(path), info);
        secureBuilder.baseChanged();
        modCount = 0;
        if (permissionProvider.hasValue()) {
            permissionProvider.get().refresh();
View Full Code Here

                .with(new NamespaceEditorProvider()).createContentSession();
    }

    @Test
    public void testMappings() throws Exception {
        final ContentSession session = createContentSession();
        NamespaceRegistry r = new ReadWriteNamespaceRegistry() {
            @Override
            protected Tree getReadTree() {
                return session.getLatestRoot().getTree("/");
            }
            @Override
            protected Root getWriteRoot() {
                return session.getLatestRoot();
            }
        };

        assertEquals("", r.getURI(""));
        assertEquals("http://www.jcp.org/jcr/1.0", r.getURI("jcr"));
View Full Code Here

            } else if (attributes.containsKey(REFRESH_INTERVAL)) {
                throw new RepositoryException("Duplicate attribute '" + REFRESH_INTERVAL + "'.");
            }

            RefreshStrategy refreshStrategy = createRefreshStrategy(refreshInterval);
            ContentSession contentSession = contentRepository.login(credentials, workspaceName);
            SessionDelegate sessionDelegate = createSessionDelegate(refreshStrategy, contentSession);
            SessionContext context = createSessionContext(
                    securityProvider, createAttributes(refreshInterval), sessionDelegate);
            return context.getSession();
        } catch (LoginException e) {
View Full Code Here


    @Nonnull
    public ObservationManager getObservationManager() throws UnsupportedRepositoryOperationException {
        if (observationManager == null) {
            ContentSession contentSession = getSessionDelegate().getContentSession();
            if (!(contentSession instanceof Observable)) {
                throw new UnsupportedRepositoryOperationException("Observation not supported for session " + contentSession);
            }

            observationManager = new ObservationManagerImpl(
View Full Code Here

        super(fixture);
    }

    @Test
    public void testMappings() throws Exception {
        final ContentSession session = createContentSession();
        NamespaceRegistry r = new ReadWriteNamespaceRegistry() {
            @Override
            protected Tree getReadTree() {
                return session.getLatestRoot().getTree("/");
            }
            @Override
            protected Root getWriteRoot() {
                return session.getLatestRoot();
            }
        };

        assertEquals("", r.getURI(""));
        assertEquals("http://www.jcp.org/jcr/1.0", r.getURI("jcr"));
View Full Code Here

        super(fixture);
    }

    @Before
    public void setUp() throws CommitFailedException {
        ContentSession session = createContentSession();

        // Add test content
        Root root = session.getLatestRoot();
        Tree tree = root.getTree("/");
        Tree x = tree.addChild("x");
        Tree y = x.addChild("y");
        Tree z = y.addChild("z");
        root.commit();

        // Acquire a fresh new root to avoid problems from lingering state
        this.root = new ImmutableRoot(session.getLatestRoot(), TreeTypeProvider.EMPTY);
    }
View Full Code Here

            final SecurityProvider securityProvider, final QueryIndexProvider indexProvider) {

        super(store, hook, PostCommitHook.EMPTY, workspaceName,
                SystemSubject.INSTANCE, securityProvider, indexProvider);

        contentSession = new ContentSession() {
            private final AuthInfoImpl authInfo = new AuthInfoImpl(
                    null, null, SystemSubject.INSTANCE.getPrincipals());

            @Override
            public void close() {
View Full Code Here

        };
    }

    @Test
    public void testNullLogin() throws Exception {
        ContentSession cs = null;
        try {
            cs = login(null);
            fail("Null login should fail");
        } catch (LoginException e) {
            // success
        } finally {
            if (cs != null) {
                cs.close();
            }
        }
    }
View Full Code Here

        }
    }

    @Test
    public void testGuestLogin() throws Exception {
        ContentSession cs = null;
        try {
            cs = login(new GuestCredentials());
        } finally {
            if (cs != null) {
                cs.close();
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.api.ContentSession

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.