protected void print( Node node,
boolean includeSystem,
int maxNumberOfChildren,
int depth ) throws RepositoryException {
if (print && depth > 0) {
if (!includeSystem && node.getPath().equals("/jcr:system")) return;
if (node.getDepth() != 0) {
int snsIndex = node.getIndex();
String segment = node.getName() + (snsIndex > 1 ? ("[" + snsIndex + "]") : "");
System.out.println(StringUtil.createString(' ', 2 * node.getDepth()) + '/' + segment);
}
int nextDepth = depth - 1;
if (nextDepth <= 0) return;
NodeIterator children = node.getNodes();
int count = 0;
while (children.hasNext()) {
if (count >= maxNumberOfChildren) {
System.out.println(StringUtil.createString(' ', 2 * (node.getDepth() + 1)) + "...");
break;
}
print(children.nextNode(), includeSystem, maxNumberOfChildren, nextDepth);
++count;
}
}
}