Examples of PathResolver


Examples of org.apache.jackrabbit.spi.commons.conversion.PathResolver

        }

        try {
            NamespaceResolver nr = new SessionNamespaceResolver(getSecuritySession());

            PathResolver pr = new DefaultNamePathResolver(nr);
            String jcrPath = pr.getJCRPath(absPath);

            if (deniedPathes.get() != null && deniedPathes.get().contains(jcrPath)) {
                cache.put(cacheKey, false);
                return false;
            }

            if (isSystemPrincipal()) {
                cache.put(cacheKey, true);
                return true;
            }

            Item i = null;
            Boolean itemExists = null;

            // Always deny write access on system folders
            if (permissions.contains(getPrivilegeName(Privilege.JCR_WRITE, workspaceName)) ||
                    permissions.contains(getPrivilegeName(Privilege.JCR_MODIFY_PROPERTIES, workspaceName)) ||
                    permissions.contains(getPrivilegeName(Privilege.JCR_REMOVE_NODE, workspaceName))) {
                itemExists = getSecuritySession().itemExists(jcrPath);
                if (itemExists.booleanValue()) {
                    i = getSecuritySession().getItem(jcrPath);
                    if (i.isNode()) {
                        if (((Node) i).isNodeType(Constants.JAHIAMIX_SYSTEMNODE)) {
                            cache.put(cacheKey, false);
                            return false;
                        }
                    }
                }
            }

            if (permissions.size() != 1 || !permissions.contains(getPrivilegeName(Privilege.JCR_ADD_CHILD_NODES, workspaceName))) {
                if (itemExists == null) {
                    itemExists = getSecuritySession().itemExists(jcrPath);
                }
                boolean newItem = !itemExists.booleanValue(); // Jackrabbit checks the ADD_NODE permission on non-existing nodes
                if (newItem) {
                    // If node is new (local to the session), always grant permission
                    cache.put(cacheKey, true);
                    return true;
                }
            }

            // Administrators are always granted
            if (jahiaPrincipal != null) {
                if (isAdmin(jahiaPrincipal.getName(), 0)) {
                    cache.put(cacheKey, true);
                    return true;
                }
            }

            int depth = 1;
            if (itemExists == null) {
                itemExists = getSecuritySession().itemExists(jcrPath);
            }
            while (!itemExists.booleanValue()) {
                jcrPath = pr.getJCRPath(absPath.getAncestor(depth++));
                itemExists = getSecuritySession().itemExists(jcrPath);
            }

            if (i == null) {
                i = getSecuritySession().getItem(jcrPath);
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.conversion.PathResolver

                // nop
            }
        };

        NameResolver nResolver = new ParsingNameResolver(NameFactoryImpl.getInstance(), new DummyNamespaceResolver());
        PathResolver pResolver = new ParsingPathResolver(PathFactoryImpl.getInstance(), nResolver, idResolver);
        resolver = new DefaultNamePathResolver(nResolver, pResolver);
        qvFactory = QValueFactoryImpl.getInstance();
        vFactory = new ValueFactoryQImpl(qvFactory, resolver);
    }
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.conversion.PathResolver

        if (excludedIDs.contains(id)) {
            return count;
        }
        executeAndLog(new AddNode(getTransactionId(), id.getUUID()));
        if (++count % 100 == 0) {
            PathResolver resolver = new DefaultNamePathResolver(
                    handler.getContext().getNamespaceRegistry());
            log.info("indexing... {} ({})", resolver.getJCRPath(path), new Long(count));
        }
        if (count % 10 == 0) {
            checkIndexingQueue(true);
        }
        checkVolatileCommit();
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.conversion.PathResolver

        if (excludedIDs.contains(id)) {
            return count;
        }
        executeAndLog(new AddNode(getTransactionId(), id.getUUID()));
        if (++count % 100 == 0) {
            PathResolver resolver = new DefaultNamePathResolver(
                    handler.getContext().getNamespaceRegistry());
            log.info("indexing... {} ({})", resolver.getJCRPath(path), new Long(count));
        }
        if (count % 10 == 0) {
            checkIndexingQueue(true);
        }
        checkVolatileCommit();
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.conversion.PathResolver

        if (excludedIDs.contains(id)) {
            return count;
        }
        executeAndLog(new AddNode(getTransactionId(), id.getUUID()));
        if (++count % 100 == 0) {
            PathResolver resolver = new DefaultNamePathResolver(
                    handler.getContext().getNamespaceRegistry());
            log.info("indexing... {} ({})", resolver.getJCRPath(path), new Long(count));
        }
        if (count % 10 == 0) {
            checkIndexingQueue(true);
        }
        checkVolatileCommit();
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.conversion.PathResolver

                // nop
            }
        };

        NameResolver nResolver = new ParsingNameResolver(NameFactoryImpl.getInstance(), new DummyNamespaceResolver());
        PathResolver pResolver = new ParsingPathResolver(PathFactoryImpl.getInstance(), nResolver, idResolver);
        resolver = new DefaultNamePathResolver(nResolver, pResolver);
        qvFactory = QValueFactoryImpl.getInstance();
        vFactory = new ValueFactoryQImpl(qvFactory, resolver);
    }
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.conversion.PathResolver

        }
        return fs;
    }
   
    public void testReadHoldFromFile() throws RepositoryException {
        PathResolver resolver = (SessionImpl) superuser;
        RetentionRegistryImpl re = new RetentionRegistryImpl((SessionImpl) superuser, createFileSystem());
        try {
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath), false));
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childN3.getPath()), false));
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath + "/somechild"), false));
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath + "/hold/is/deep"), false));

            assertFalse(re.hasEffectiveHold(resolver.getQPath(testNodePath), false));
            assertFalse(re.hasEffectiveHold(resolver.getQPath(childN2.getPath()), false));

        } finally {
            re.close();
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.conversion.PathResolver

            s.logout();
        }
    }

    public void testWriteFile() throws RepositoryException {
        PathResolver resolver = (SessionImpl) superuser;
        FileSystem fs = createFileSystem();
        RetentionRegistryImpl re = new RetentionRegistryImpl((SessionImpl) superuser, fs);

        try {
            // write the changes to the fs
            re.close();

            // create a new dummy registry again.
            re = new RetentionRegistryImpl((SessionImpl) superuser, fs);

            // test holds
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath), false));
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childN3.getPath()), false));
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath + "/somechild"), false));
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath + "/hold/is/deep"), false));

            // test policies
            assertTrue(re.hasEffectiveRetention(resolver.getQPath(childNPath), false));
            assertTrue(re.hasEffectiveRetention(resolver.getQPath(childNPath + "/somechild"), true));
        } finally {
            re.close();
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.conversion.PathResolver

            re.close();
        }
    }

    public void testWriteFileWithChanges() throws RepositoryException, NotExecutableException {
        PathResolver resolver = (SessionImpl) superuser;
        FileSystem fs = createFileSystem();
        RetentionRegistryImpl re = new RetentionRegistryImpl((SessionImpl) superuser, fs);
        String childN3Path = childN3.getPath();
        try {
            retentionMgr.removeRetentionPolicy(childNPath);
            retentionMgr.removeHold(childNPath, retentionMgr.getHolds(childNPath)[0]);
            superuser.save();
           
            retentionMgr.setRetentionPolicy(childN3Path, getApplicableRetentionPolicy("retentionOnChild2"));
            retentionMgr.addHold(childNPath, "holdOnChild", false);
            superuser.save();

            // write the changes to the fs
            re.close();

            // create a new dummy registry again.
            re = new RetentionRegistryImpl((SessionImpl) superuser, fs);

            // test holds
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath), false));
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath), true));
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childN3Path), true));

            assertFalse(re.hasEffectiveHold(resolver.getQPath(childN3Path), false));
            assertFalse(re.hasEffectiveHold(resolver.getQPath(childN3Path + "/child"), false));
            assertFalse(re.hasEffectiveHold(resolver.getQPath(childN3Path + "/child"), true));

            // test policies
            assertTrue(re.hasEffectiveRetention(resolver.getQPath(childN3Path), false));
            assertTrue(re.hasEffectiveRetention(resolver.getQPath(childN3Path + "/child"), true));

            assertFalse(re.hasEffectiveRetention(resolver.getQPath(childN3Path + "/child/more"), true));
            assertFalse(re.hasEffectiveRetention(resolver.getQPath(childNPath), true));
            assertFalse(re.hasEffectiveRetention(resolver.getQPath(childNPath), false));
        } finally {
            re.close();
            // remove the extra policy that is not cleared upon teardown
            if (retentionMgr.getRetentionPolicy(childN3Path) != null) {
                retentionMgr.removeRetentionPolicy(childN3.getPath());
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.conversion.PathResolver

        if (excludedIDs.contains(id)) {
            return count;
        }
        executeAndLog(new AddNode(getTransactionId(), id));
        if (++count % 100 == 0) {
            PathResolver resolver = new DefaultNamePathResolver(
                    handler.getContext().getNamespaceRegistry());
            log.info("indexing... {} ({})", resolver.getJCRPath(path), count);
        }
        if (count % 10 == 0) {
            checkIndexingQueue(true);
        }
        checkVolatileCommit();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.