Package javax.jcr

Examples of javax.jcr.GuestCredentials


        this.batchReadConfig = batchReadConfig;
        this.supportsObservation = "true".equals(repository.getDescriptor(Repository.OPTION_OBSERVATION_SUPPORTED));
        this.itemInfoCacheSize = itemInfoCacheSize;

        try {
            Session s = repository.login(new GuestCredentials());
            ValueFactory vf = s.getValueFactory();
            if (vf instanceof ValueFactoryQImpl) {
                qValueFactory = ((ValueFactoryQImpl) vf).getQValueFactory();
            }
        } catch (RepositoryException e) {
View Full Code Here


     */
    public Session login(Credentials credentials, String workspace) throws LoginException, NoSuchWorkspaceException,
            RepositoryException {

        if (credentials == null) {
            credentials = new GuestCredentials();
        }

        // check the workspace
        if (workspace == null) {
            workspace = this.getDefaultWorkspace();
View Full Code Here

    }

    @Test
    public void loginWithAttribute() throws RepositoryException {
        Session session = ((JackrabbitRepository) getRepository()).login(
                new GuestCredentials(), null,
                Collections.<String, Object>singletonMap(RepositoryImpl.REFRESH_INTERVAL, 42));

        String[] attributeNames = session.getAttributeNames();
        assertEquals(1, attributeNames.length);
        assertEquals(RepositoryImpl.REFRESH_INTERVAL, attributeNames[0]);
View Full Code Here

    }

    @Test(expected = NoSuchWorkspaceException.class)
    public void loginInvalidWorkspace() throws RepositoryException {
        Repository repository = getRepository();
        repository.login(new GuestCredentials(), "invalid");
    }
View Full Code Here

        restrictions.put("rep:glob", vf.createValue("*/social/relationships/following/*"));
        tmpl.addEntry(EveryonePrincipal.getInstance(), new Privilege[]{acMgr.privilegeFromName(Privilege.JCR_READ)}, true, restrictions);
        acMgr.setPolicy(tmpl.getPath(), tmpl);
        adminSession.save();

        Session anonymousSession = getRepository().login(new GuestCredentials());
        QueryManager qm = anonymousSession.getWorkspace().getQueryManager();
        Query q = qm.createQuery("/jcr:root/home//social/relationships/following//*[id='aaron.mcdonald@mailinator.com']", Query.XPATH);
        QueryResult r = q.execute();
        RowIterator it = r.getRows();
        Assert.assertTrue(it.hasNext());
View Full Code Here

    }

    @Test
    public void loginWithAttribute() throws RepositoryException {
        Session session = ((JackrabbitRepository) getRepository()).login(
                new GuestCredentials(), null,
                Collections.<String, Object>singletonMap(RepositoryImpl.REFRESH_INTERVAL, 42));

        String[] attributeNames = session.getAttributeNames();
        assertEquals(1, attributeNames.length);
        assertEquals(RepositoryImpl.REFRESH_INTERVAL, attributeNames[0]);
View Full Code Here

    }

    @Test(expected = NoSuchWorkspaceException.class)
    public void loginInvalidWorkspace() throws RepositoryException {
        Repository repository = getRepository();
        repository.login(new GuestCredentials(), "invalid");
    }
View Full Code Here

        sessions = null;
    }

    @Test
    public void testNodeIsCheckedOut() throws RepositoryException {
        Session s = repository.login(new GuestCredentials());
        sessions.add(s);

        assertFalse(s.nodeExists("/"));
        assertTrue(s.nodeExists("/testNode"));
View Full Code Here

        return repository;
    }

    @Override
    public Credentials getReadOnlyCredentials() {
        return new GuestCredentials();
    }
View Full Code Here

    protected Session createAnonymousSession() throws RepositoryException {
        Session admin = getAdminSession();
        AccessControlUtils.addAccessControlEntry(admin, "/", EveryonePrincipal.getInstance(), new String[] {Privilege.JCR_READ}, true);
        admin.save();
        return getRepository().login(new GuestCredentials());
    }
View Full Code Here

TOP

Related Classes of javax.jcr.GuestCredentials

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.