You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by "Gerald B. Rosenberg" <gb...@newtechlaw.com> on 2004/11/24 08:23:29 UTC

Is there a better/faster way to walk the tree?

New to Slide/Webdav.

I need to walk through the data store to find and examine each file 
currently present.  This recursive tree-walker works, but is slow, 
specifically in creating a new WebdavResource on the recursive call.  Is 
there a faster/better way to do this?

Thanks,
Gerald



private void processTree(WebdavResource res) {
	WebdavResource wdr = res;
	WebdavResource[] resources = null;

	try {
		logger.debug("Current path: " + wdr.getPath());
		resources = wdr.listWebdavResources();
		for (int i = 0; i < resources.length; i++) {
			if (resources[i].isCollection()) {
				processTree(new WebdavResource(res.getHttpURL(),
					resources[i].getDisplayName() + "/"));
			} else {
				logger.debug("File: " + resources[i].getPath());
			}
		}
	} catch (HttpException e) {
		logger.debug("HttpExceptionMessage: " + e.getMessage());
		logger.debug("HttpExceptionReason: " + e.getReason());
		e.printStackTrace();
	} catch (IOException e) {
		e.printStackTrace();
	}
}



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org