public void inheritLocks(DAVResource resource, boolean useParent) throws DAVException { DAVResource whichResource = resource; if (useParent) { DAVResource parentResource = DAVResourceHelper.createParentResource(resource); if (parentResource == null) { throw new DAVException( "Could not fetch parent resource. Unable to inherit locks from the parent and apply them to this resource.", HttpServletResponse.SC_INTERNAL_SERVER_ERROR, 0); } whichResource = parentResource; } DAVLock lock = getLock(whichResource); if (lock == null) { return; } DAVInheritWalker inheritHandler = new DAVInheritWalker(resource, lock, !useParent); DAVResourceWalker walker = new DAVResourceWalker(); walker.walk( this, whichResource, null, 0, null, DAVResourceWalker.DAV_WALKTYPE_NORMAL | DAVResourceWalker.DAV_WALKTYPE_LOCKNULL, inheritHandler, DAVDepth.DEPTH_INFINITY); }
public void addLock(DAVLock lock, DAVResource resource) throws DAVException { DAVDepth depth = lock.getDepth(); if (!resource.isCollection()) { depth = DAVDepth.DEPTH_ZERO; } appendLock(resource, lock); if (depth != DAVDepth.DEPTH_ZERO) { DAVResourceWalker walker = new DAVResourceWalker(); DAVLockWalker lockHandler = new DAVLockWalker(resource, lock); DAVResponse response = walker.walk( this, resource, null, 0, null, DAVResourceWalker.DAV_WALKTYPE_NORMAL | DAVResourceWalker.DAV_WALKTYPE_AUTH, lockHandler, DAVDepth.DEPTH_INFINITY); if (response != null) { throw new DAVException( "Error(s) occurred on resources during the addition of a depth lock.", ServletDAVHandler.SC_MULTISTATUS, 0, response); } } }