Search in sources :

Example 1 with DeleteContextImpl

use of org.apache.jackrabbit.server.io.DeleteContextImpl in project jackrabbit by apache.

the class DavResourceImpl method removeMember.

/**
     * @see DavResource#removeMember(DavResource)
     */
public void removeMember(DavResource member) throws DavException {
    if (!exists() || !member.exists()) {
        throw new DavException(DavServletResponse.SC_NOT_FOUND);
    }
    if (isLocked(this) || isLocked(member)) {
        throw new DavException(DavServletResponse.SC_LOCKED);
    }
    // don't allow removal of nodes, that would be filtered out
    if (isFilteredResource(member)) {
        log.debug("Avoid removal of filtered resource: " + member.getDisplayName());
        throw new DavException(DavServletResponse.SC_FORBIDDEN);
    }
    DeleteManager dm = config.getDeleteManager();
    dm.delete(new DeleteContextImpl(getJcrSession()), member);
    // make sure, non-jcr locks are removed, once the removal is completed
    try {
        if (!isJcrLockable()) {
            ActiveLock lock = getLock(Type.WRITE, Scope.EXCLUSIVE);
            if (lock != null) {
                lockManager.releaseLock(lock.getToken(), member);
            }
        }
    } catch (DavException e) {
    // since check for 'locked' exception has been performed before
    // ignore any error here
    }
}
Also used : DeleteManager(org.apache.jackrabbit.server.io.DeleteManager) DeleteContextImpl(org.apache.jackrabbit.server.io.DeleteContextImpl) ActiveLock(org.apache.jackrabbit.webdav.lock.ActiveLock) JcrActiveLock(org.apache.jackrabbit.webdav.jcr.lock.JcrActiveLock) JcrDavException(org.apache.jackrabbit.webdav.jcr.JcrDavException) DavException(org.apache.jackrabbit.webdav.DavException)

Aggregations

DeleteContextImpl (org.apache.jackrabbit.server.io.DeleteContextImpl)1 DeleteManager (org.apache.jackrabbit.server.io.DeleteManager)1 DavException (org.apache.jackrabbit.webdav.DavException)1 JcrDavException (org.apache.jackrabbit.webdav.jcr.JcrDavException)1 JcrActiveLock (org.apache.jackrabbit.webdav.jcr.lock.JcrActiveLock)1 ActiveLock (org.apache.jackrabbit.webdav.lock.ActiveLock)1