Examples of ChildReferences


Examples of org.modeshape.jcr.cache.ChildReferences

        // The rest of this logic is only for non-root nodes ...
        assert currentParent != null;

        // Get our parent's child references to find which one points to us ...
        ChildReferences currentReferences = currentParent.getChildReferences(cache);
        ChildReference parentRefToMe = null;
        if (currentReferences.supportsGetChildReferenceByKey()) {
            // Just using the node key is faster if it is supported by the implementation ...
            parentRefToMe = currentReferences.getChild(key);
        } else {
            // Directly look up the ChildReference by going to the cache (and possibly connector) ...
            NodeKey parentKey = getParentKey(cache);
            parentRefToMe = cache.getChildReference(parentKey, key);
        }
View Full Code Here

Examples of org.modeshape.jcr.cache.ChildReferences

            assert aclNodeReference != null;
            CachedNode aclNode = cache.getNode(aclNodeReference);
            assert aclNode != null;

            Map<String, Set<String>> permissions = new HashMap<>();
            ChildReferences permissionsReference = aclNode.getChildReferences(cache);
            for (ChildReference permissionReference : permissionsReference) {
                CachedNode permission = cache.getNode(permissionReference);
                String name = permission.getProperty(ModeShapeLexicon.PERMISSION_PRINCIPAL_NAME, cache).getFirstValue().toString();
                Property privileges = permission.getProperty(ModeShapeLexicon.PERMISSION_PRIVILEGES_NAME, cache);
                Set<String> privilegeNames = new HashSet<>();
View Full Code Here

Examples of org.modeshape.jcr.cache.ChildReferences

                session.lockManager().lock(node, true, false, Long.MAX_VALUE, null);

                // manipulate that lock using the system cache to simulate corrupt data
                SessionCache systemSession = repository.createSystemSession(repository.runningState().context(), false);
                SystemContent systemContent = new SystemContent(systemSession);
                ChildReferences childReferences = systemContent.locksNode().getChildReferences(systemSession);
                assertFalse("No locks found", childReferences.isEmpty());
                for (ChildReference childReference : childReferences) {
                    MutableCachedNode lock = systemSession.mutable(childReference.getKey());
                    lock.setProperty(systemSession, propertyFactory.create(ModeShapeLexicon.IS_DEEP, true));
                    lock.setProperty(systemSession, propertyFactory.create(ModeShapeLexicon.LOCKED_KEY, node.key().toString()));
                    lock.setProperty(systemSession, propertyFactory.create(ModeShapeLexicon.SESSION_SCOPE, false));
                }
                systemSession.save();
                return null;
            }
        }, "config/repo-config-persistent-no-indexes.json");

        // second run should run the upgrade
        startRunStop(new RepositoryOperation() {
            @SuppressWarnings( "deprecation" )
            @Override
            public Void call() throws Exception {
                // manipulate that lock using the system cache to simulate corrupt data
                SessionCache systemSession = repository.createSystemSession(repository.runningState().context(), true);
                SystemContent systemContent = new SystemContent(systemSession);
                ChildReferences childReferences = systemContent.locksNode().getChildReferences(systemSession);
                assertFalse("No locks found", childReferences.isEmpty());
                for (ChildReference childReference : childReferences) {
                    CachedNode lock = systemSession.getNode(childReference.getKey());
                    assertNull("Property not removed", lock.getProperty(ModeShapeLexicon.IS_DEEP, systemSession));
                    assertNull("Property not removed", lock.getProperty(ModeShapeLexicon.LOCKED_KEY, systemSession));
                    assertNull("Property not removed", lock.getProperty(ModeShapeLexicon.SESSION_SCOPE, systemSession));
View Full Code Here

Examples of org.modeshape.jcr.cache.ChildReferences

                Document blockDoc = cache.blockFor(nextKey);
                if (blockDoc == null) {
                    throw new DocumentNotFoundException(nextKey);
                }
                // we only need the direct children of the block to avoid nesting
                ChildReferences refs = cache.translator().getChildReferencesFromBlock(blockDoc);
                ChildReferencesInfo nextNextKey = cache.translator().getChildReferencesInfo(blockDoc);
                next = new Segment(refs, nextNextKey != null ? nextNextKey.nextKey : null);
            }
            return next;
        }
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.