@Override public int countSiblingsNamed( Name childName ) { return node.getChildReferences(cache).getChildCount(childName); } };
@Override public Object getValueInRow( RowAccessor row ) { CachedNode node = row.getNode(indexInRow); if (node == null) return null; return new Long(node.getChildReferences(cache).size()); }
@Override public Object getValueInRow( RowAccessor row ) { CachedNode node = row.getNode(indexInRow); if (node == null) return null; return new Long(node.getChildReferences(cache).size()); }
@Override public long getChildCount( CachedNode node ) { assert node != null; return node.getChildReferences(session.cache()).size(); }
public NodeKey indexesKey() { if (indexesKey == null) { // This is idempotent, so no need to lock CachedNode systemNode = systemNode(); ChildReference nodeTypesRef = systemNode.getChildReferences(system).getChild(ModeShapeLexicon.INDEXES); indexesKey = nodeTypesRef.getKey(); } return indexesKey; }
/** * Checks if this ws cache is empty. An empty cache is considered when the only node key under root is the system key. * * @return {@code true} if the system key is the only key under root, {@code false} other wise. */ public boolean isEmpty() { CachedNode root = getNode(getRootKey()); // expect there to be 1 child under root - the system key return root.getChildReferences(this).size() == 1; }
public NodeKey nodeTypesKey() { if (nodeTypesKey == null) { // This is idempotent, so no need to lock CachedNode systemNode = systemNode(); ChildReference nodeTypesRef = systemNode.getChildReferences(system).getChild(JcrLexicon.NODE_TYPES); nodeTypesKey = nodeTypesRef.getKey(); } return nodeTypesKey; }
public NodeKey versionStorageKey() { if (versionStorageKey == null) { // This is idempotent, so no need to lock CachedNode systemNode = systemNode(); ChildReference locksRef = systemNode.getChildReferences(system).getChild(JcrLexicon.VERSION_STORAGE); versionStorageKey = locksRef.getKey(); } return versionStorageKey; }
/** * Get the total number of children. * * @return the total number of children * @throws RepositoryException */ protected final long childCount() throws RepositoryException { return node().getChildReferences(sessionCache()).size(); }
public NodeKey systemKey() { if (systemKey == null) { // This is idempotent, so no need to lock CachedNode rootNode = system.getNode(system.getRootKey()); ChildReference systemRef = rootNode.getChildReferences(system).getChild(JcrLexicon.SYSTEM); systemKey = systemRef.getKey(); } return systemKey; }
public NodeKey systemKey() { if (systemKey == null) { // This is idempotent, so no need to lock CachedNode rootNode = system.getNode(system.getRootKey()); ChildReference systemRef = rootNode.getChildReferences(system).getChild(JcrLexicon.SYSTEM); systemKey = systemRef.getKey(); } return systemKey; }
protected CachedNode getNodeAtPath( Path path, NodeCache cache ) { CachedNode node = cache.getNode(cache.getRootKey()); for (Segment segment : path) { ChildReference childRef = node.getChildReferences(cache).getChild(segment); if (childRef == null) return null; node = cache.getNode(childRef); } return node; }
private void loadStoredProjections( boolean validate ) { assert !started(); SessionCache systemSession = repository.createSystemSession(repository.context(), false); CachedNode systemNode = getSystemNode(systemSession); ChildReference federationNodeRef = systemNode.getChildReferences(systemSession).getChild(ModeShapeLexicon.FEDERATION); if (federationNodeRef != null) { Collection<Projection> newProjections = loadStoredProjections(systemSession, federationNodeRef, validate); Snapshot current = this.snapshot.get(); Snapshot updated = current.withProjections(newProjections); this.snapshot.compareAndSet(current, updated); } }
@Override protected Segment segment() throws RepositoryException { AbstractJcrNode parent = parent(); CachedNode node = parent.node(); SessionCache cache = session.cache(); ChildReference childRef = node.getChildReferences(cache).getChild(sharedSet.key()); return childRef.getSegment(); } }
protected NodeIterator getNodesInternal() throws RepositoryException { ChildReferences childReferences = node().getChildReferences(sessionCache()); if (childReferences.isEmpty()) return JcrEmptyNodeIterator.INSTANCE; return new JcrChildNodeIterator(new ChildNodeResolver(session, key(), false), childReferences); }
protected AbstractJcrNode getNodeIfExists( Name childName ) throws RepositoryException { // It's just a name, so look for a child ... ChildReference ref = node().getChildReferences(sessionCache()).getChild(childName); return ref != null ? session().node(ref.getKey(), null, key()) : null; }
@Override Path path() throws ItemNotFoundException, InvalidItemStateException { AbstractJcrNode parent = parent(); CachedNode node = parent.node(); SessionCache cache = session.cache(); ChildReference childRef = node.getChildReferences(cache).getChild(sharedSet.key()); Path parentPath = parent.path(); return session().pathFactory().create(parentPath, childRef.getSegment()); }
AbstractJcrNode getNode( Name childName ) throws PathNotFoundException, RepositoryException { // It's just a name, so look for a child ... ChildReference ref = node().getChildReferences(sessionCache()).getChild(childName); if (ref == null) { String msg = JcrI18n.childNotFoundUnderNode.text(readable(childName), location(), session.workspaceName()); throw new PathNotFoundException(msg); } return session().node(ref.getKey(), null, key()); }
@Override public NodeIterator getNodes() throws RepositoryException { checkSession(); ChildReferences childReferences = node().getChildReferences(sessionCache()); if (childReferences.isEmpty()) return JcrEmptyNodeIterator.INSTANCE; // if we don't require permission checking, we should use the child references directly since it may have precomputed the size return session.checkPermissionsWhenIteratingChildren() ? new JcrChildNodeIterator(new ChildNodeResolver(session, key()), childReferences.iterator()) : new JcrChildNodeIterator(new ChildNodeResolver(session, key()), childReferences); }
private void assertUniqueChildren( JcrSession session, String nodeAbsPath, Set<String> names ) throws RepositoryException { ChildReferences childReferences = session.getNode(nodeAbsPath).node().getChildReferences(session.cache()); for (String name : names) { assertEquals(1, childReferences.getChildCount(session.nameFactory().create(name))); } }