/** * {@inheritDoc} * * @throws NullPointerException Thrown if this resource couldn't find a {@link org.apache.jackrabbit.webdav.lock.LockManager} to use to handle the lock operation. */ public ActiveLock getLock(Type type, Scope scope) { if (null == lockManager) throw new NullPointerException(new StringBuffer("Unable to query for lock on ").append(getResourcePath()).append(" because LockManager is null.").toString()); else return lockManager.getLock(type, scope, this); }
@Override public ActiveLock getLock(Type type, Scope scope) { return getContext().getLockManager().getLock(type, scope, this); }
@Override public ActiveLock getLock( Type type, Scope scope ) { ActiveLock lock = null; if ( exists() && Type.WRITE.equals( type ) && Scope.EXCLUSIVE.equals( scope ) ) { lock = lockManager.getLock( type, scope, this ); } return lock; }
/** * @see DavResource#getLock(Type, Scope) */ public ActiveLock getLock(Type type, Scope scope) { ActiveLock lock = null; if (exists() && Type.WRITE.equals(type) && Scope.EXCLUSIVE.equals(scope)) { // try to retrieve the repository lock information first try { if (node.isLocked()) { Lock jcrLock = node.getLock(); if (jcrLock != null && jcrLock.isLive()) { lock = new JcrActiveLock(jcrLock); String lockroot = locator .getFactory() .createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(), jcrLock.getNode().getPath(), false).getHref(false); lock.setLockroot(lockroot); } } } catch (RepositoryException e) { // LockException (no lock applies) >> should never occur // RepositoryException, AccessDeniedException or another error >> ignore } // could not retrieve a jcr-lock. test if a simple webdav lock is present. if (lock == null) { lock = lockManager.getLock(type, scope, this); } } return lock; }