/** * Looks for a valid lock at the given path or a deep lock present with * a parent path. * * @param path * @return */ private ActiveLock getLock(String path) { ActiveLock lock = locks.get(path); if (lock != null) { // check if not expired if (lock.isExpired()) { lock = null; } } if (lock == null) { // check, if child of deep locked parent if (!path.equals("/")) { ActiveLock parentLock = getLock(getParentPath(path)); if (parentLock != null && parentLock.isDeep()) { lock = parentLock; } } } return lock; }
/** * Looks for a valid lock at the given path or a deep lock present with * a parent path. * * @param path * @return */ private ActiveLock getLock(String path) { ActiveLock lock = locks.get(path); if (lock != null) { // check if not expired if (lock.isExpired()) { lock = null; } } if (lock == null) { // check, if child of deep locked parent if (!path.equals("/")) { ActiveLock parentLock = getLock(getParentPath(path)); if (parentLock != null && parentLock.isDeep()) { lock = parentLock; } } } return lock; }
/** * Return true, if the resource with the given memberPath is a internal * non-collection member of the given resource, thus affected by a * non-deep lock present on the resource. * * @param resource * @param memberPath * @return */ private static boolean isInternalMember(DavResource resource, String memberPath) { if (resource.getResourcePath().equals(getParentPath(memberPath))) { // find the member with the given path DavResourceIterator it = resource.getMembers(); while (it.hasNext()) { DavResource member = it.nextResource(); if (member.getResourcePath().equals(memberPath)) { // return true if that member is not a collection return !member.isCollection(); } } } return false; }
/** * Return true, if the resource with the given memberPath is a internal * non-collection member of the given resource, thus affected by a * non-deep lock present on the resource. * * @param resource * @param memberPath * @return */ private static boolean isInternalMember(DavResource resource, String memberPath) { if (resource.getResourcePath().equals(getParentPath(memberPath))) { // find the member with the given path DavResourceIterator it = resource.getMembers(); while (it.hasNext()) { DavResource member = it.nextResource(); if (member.getResourcePath().equals(memberPath)) { // return true if that member is not a collection return !member.isCollection(); } } } return false; }
if (l.isDeep() || (key.equals(getParentPath(resourcePath)) && !resource.isCollection())) { throw new DavException(DavServletResponse.SC_LOCKED, "Resource '" + resource.getResourcePath() + "' already inherits a lock by its collection.");
if (l.isDeep() || (key.equals(getParentPath(resourcePath)) && !resource.isCollection())) { throw new DavException(DavServletResponse.SC_LOCKED, "Resource '" + resource.getResourcePath() + "' already inherits a lock by its collection.");