/** * Called when the <code>Visitor</code> is passed to a * <code>Property</code>. * <p> * It calls <code>TraversingItemVisitor.entering(Property, int)</code> * followed by <code>TraversingItemVisitor.leaving(Property, int)</code>. * Implement these abstract methods to specify behavior on 'arrival at' and * 'after leaving' the <code>Property</code>. * <p> * If this method throws, the visiting process is aborted. * * @param property the <code>Property</code> that is accepting this * visitor. * @throws RepositoryException if an error occurs. */ public void visit(Property property) throws RepositoryException { entering(property, currentLevel); leaving(property, currentLevel); }
@Override protected void entering(Property prop, int i) throws RepositoryException { super.entering(prop, i); } };
public void visit(Node node) throws RepositoryException { session = node.getSession(); super.visit(node); }
public void visit(Node node) throws RepositoryException { // do not traverse into virtual paths if(!JcrHelper.isVirtualNode(node)) { super.visit(node); } }
@Override protected void entering(Property prop, int i) throws RepositoryException { visitingProperty(prop, i); super.entering(prop, i); } };
private void assertEntry(final int index, final boolean isAllow) throws RepositoryException { AccessControlEntry first = AccessControlUtils.getAccessControlList(superuser, path).getAccessControlEntries()[index]; assertEquals(testUser.getPrincipal(), first.getPrincipal()); Node n = superuser.getNode("/jcr:system/rep:permissionStore/default/" + testUser.getPrincipal().getName()); TraversingItemVisitor v = new TraversingItemVisitor.Default(true, -1) { @Override protected void entering(Node node, int level) throws RepositoryException { if (node.isNodeType("rep:Permissions") && node.hasProperty("rep:accessControlledPath") && path.equals(node.getProperty("rep:accessControlledPath").getString())) { assertEquals(index, node.getProperty("rep:index").getLong()); assertEquals(isAllow, node.getProperty("rep:isAllow").getBoolean()); } } }; v.visit(n); } }
@Override public void visit(Node node) throws RepositoryException { if (node instanceof HippoNode) { try { Node canonical = ((HippoNode) node).getCanonicalNode(); if (canonical == null || !canonical.isSame(node)) { return; } } catch (ItemNotFoundException e) { // canonical node no longer exists return; } } super.visit(node); }
@Override protected void entering(Node node, int i) throws RepositoryException { visitingNode(node, i); super.entering(node, i); } @Override
@Override protected void entering(Node node, int i) throws RepositoryException { if (node.isNodeType(AccessControlConstants.NT_REP_ACE)) { numACEs[0]++; } super.entering(node, i); } @Override
protected void entering(final Node node, int level) throws RepositoryException { super.entering(node, level); if(isCacheEntryNode(node) && node.hasNode(JCRHttpCacheStoreConstants.PATH_CONTENTS)){ final Node contents = node.getNode(JCRHttpCacheStoreConstants.PATH_CONTENTS); if(contents.hasNode(JcrConstants.JCR_CONTENT)){ final Node jcrContent = contents.getNode(JcrConstants.JCR_CONTENT); if(jcrContent.hasProperty(JcrConstants.JCR_DATA)){ final Property property = jcrContent.getProperty(JcrConstants.JCR_DATA); final Binary binary = property.getBinary(); bytes += binary.getSize(); } } } }
@Override protected void entering(Node node, int level) throws RepositoryException { assertTrue(superuser.nodeExists(node.getPath())); super.entering(node, level); } };