if (depth == 0) {
parseProperties(req, resources, generatedXML, path, type,
properties);
} else {
// The stack always contains the object of the current level
Stack stack = new Stack();
stack.push(path);
// Stack of the objects one level below
Stack stackBelow = new Stack();
while ((!stack.isEmpty()) && (depth >= 0)) {
String currentPath = (String) stack.pop();
parseProperties(req, resources, generatedXML, currentPath,
type, properties);
try {
object = resources.lookup(currentPath);
} catch (NamingException e) {
continue;
}
if ((object instanceof DirContext) && (depth > 0)) {
try {
NamingEnumeration enumeration = resources.list(currentPath);
while (enumeration.hasMoreElements()) {
NameClassPair ncPair =
(NameClassPair) enumeration.nextElement();
String newPath = currentPath;
if (!(newPath.endsWith("/")))
newPath += "/";
newPath += ncPair.getName();
stackBelow.push(newPath);
}
} catch (NamingException e) {
resp.sendError
(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
path);
return;
}
// Displaying the lock-null resources present in that
// collection
String lockPath = currentPath;
if (lockPath.endsWith("/"))
lockPath =
lockPath.substring(0, lockPath.length() - 1);
Vector currentLockNullResources =
(Vector) lockNullResources.get(lockPath);
if (currentLockNullResources != null) {
Enumeration lockNullResourcesList =
currentLockNullResources.elements();
while (lockNullResourcesList.hasMoreElements()) {
String lockNullPath = (String)
lockNullResourcesList.nextElement();
parseLockNullProperties
(req, generatedXML, lockNullPath, type,
properties);
}
}
}
if (stack.isEmpty()) {
depth--;
stack = stackBelow;
stackBelow = new Stack();
}
generatedXML.sendData();
}