@Override public boolean isLockable( Type type, Scope scope ) { return Type.WRITE.equals( type ) && Scope.EXCLUSIVE.equals( scope ); }
/** * @param type * @param scope * @return true if type is {@link Type#WRITE} and scope is {@link Scope#EXCLUSIVE} * @see DavResource#isLockable(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope) */ public boolean isLockable(Type type, Scope scope) { return Type.WRITE.equals(type) && Scope.EXCLUSIVE.equals(scope); }
/** * @see DavResource#getLock(Type, Scope) */ @Override public ActiveLock getLock(Type type, Scope scope) { ActiveLock lock = null; if (TransactionConstants.TRANSACTION.equals(type)) { lock = txMgr.getLock(type, scope, this); } return lock; }
@Override public boolean isLockable(Type type, Scope scope) { return Type.WRITE.equals(type) && Scope.EXCLUSIVE.equals(scope); }
/** * Creates a new WriteLockEntry * * @param type Can currently only be * {@link Type#WRITE write} * @param scope Can currently only be {@link Scope#EXCLUSIVE exclusive} * or {@link Scope#SHARED shared}. * * @throws IllegalArgumentException If an argument contains invalid string */ WriteLockEntry(Type type, Scope scope) { if (!Type.WRITE.equals(type)) { throw new IllegalArgumentException("Invalid Type:" + type); } if (!Scope.EXCLUSIVE.equals(scope) && !Scope.SHARED.equals(scope)) { throw new IllegalArgumentException("Invalid scope:" +scope); } this.scope = scope; }
/** * Creates a new WriteLockEntry * * @param type Can currently only be * {@link Type#WRITE write} * @param scope Can currently only be {@link Scope#EXCLUSIVE exclusive} * or {@link Scope#SHARED shared}. * * @throws IllegalArgumentException If an argument contains invalid string */ WriteLockEntry(Type type, Scope scope) { if (!Type.WRITE.equals(type)) { throw new IllegalArgumentException("Invalid Type:" + type); } if (!Scope.EXCLUSIVE.equals(scope) && !Scope.SHARED.equals(scope)) { throw new IllegalArgumentException("Invalid scope:" +scope); } this.scope = scope; }
/** * Returns true if this a lock with the given type and scope is supported. * * @param type * @param scope * @return true if applying a lock with the given type and scope is basically * supported. */ public boolean isSupportedLock(Type type, Scope scope) { Iterator it = entries.iterator(); while (it.hasNext()) { LockEntry le = (LockEntry) it.next(); if (le.getType().equals(type) && le.getScope().equals(scope)) { return true; } } return false; }
@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; }
/** * Returns the lock applying to the given resource or <code>null</code> if * no lock can be found. * * @param type * @param scope * @param resource * @return lock that applies to the given resource or <code>null</code>. */ public synchronized ActiveLock getLock(Type type, Scope scope, DavResource resource) { if (!(Type.WRITE.equals(type) && Scope.EXCLUSIVE.equals(scope))) { return null; } return getLock(resource.getResourcePath()); }
/** * Returns the lock applying to the given resource or <code>null</code> if * no lock can be found. * * @param type type * @param scope scope * @param resource resource * @return lock that applies to the given resource or <code>null</code>. */ public synchronized ActiveLock getLock(Type type, Scope scope, DavResource resource) { if (!(Type.WRITE.equals(type) && Scope.EXCLUSIVE.equals(scope))) { return null; } return getLock(resource.getResourcePath()); }
/** * Returns the lock applying to the given resource or <code>null</code> if * no lock can be found. * * @param type * @param scope * @param resource * @return lock that applies to the given resource or <code>null</code>. */ public synchronized ActiveLock getLock(Type type, Scope scope, DavResource resource) { if (!(Type.WRITE.equals(type) && Scope.EXCLUSIVE.equals(scope))) { return null; } return getLock(resource.getResourcePath()); }
/** * Returns the lock applying to the given resource or <code>null</code> if * no lock can be found. * * @param type * @param scope * @param resource * @return lock that applies to the given resource or <code>null</code>. */ public synchronized ActiveLock getLock(Type type, Scope scope, DavResource resource) { if (!(Type.WRITE.equals(type) && Scope.EXCLUSIVE.equals(scope))) { return null; } return getLock(resource.getResourcePath()); }
/** * Returns true if this a lock with the given type and scope is supported. * * @param type * @param scope * @return true if applying a lock with the given type and scope is basically * supported. */ public boolean isSupportedLock(Type type, Scope scope) { for (LockEntry le : entries) { if (le.getType().equals(type) && le.getScope().equals(scope)) { return true; } } return false; }
/** * Returns true if this a lock with the given type and scope is supported. * * @param type * @param scope * @return true if applying a lock with the given type and scope is basically * supported. */ public boolean isSupportedLock(Type type, Scope scope) { for (LockEntry le : entries) { if (le.getType().equals(type) && le.getScope().equals(scope)) { return true; } } return false; }
/** * {@link javax.jcr.Property JCR properties} are locked if their * parent node is locked; thus this method will always return the * {@link ActiveLock lock} object from the collection this resource is * internal member of. * * @param type * @param scope * @return lock present on this resource or <code>null</code> if this resource * has no lock. * @see DavResource#getLock(Type, Scope) */ @Override public ActiveLock getLock(Type type, Scope scope) { if (Type.WRITE.equals(type)) { return getCollection().getLock(type, scope); } else { return super.getLock(type, scope); } }
/** * Return the lock applied to the given resource or <code>null</code> * * @param type * @param scope * @param resource * @return lock applied to the given resource or <code>null</code> * @see LockManager#getLock(Type, Scope, DavResource) * todo: is it correct to return one that specific lock, the current session is token-holder of? */ public ActiveLock getLock(Type type, Scope scope, TransactionResource resource) { ActiveLock lock = null; if (TransactionConstants.TRANSACTION.equals(type)) { String[] sessionTokens = resource.getSession().getLockTokens(); int i = 0; while (lock == null && i < sessionTokens.length) { String lockToken = sessionTokens[i]; lock = getLock(lockToken, scope, resource); i++; } } return lock; }
/** * Create a new lock * * @param lockInfo * @throws IllegalArgumentException if either scope or type is invalid. */ public DefaultActiveLock(LockInfo lockInfo) { if (lockInfo != null) { if (!(Type.WRITE.equals(lockInfo.getType()) && Scope.EXCLUSIVE.equals(lockInfo.getScope()))) { throw new IllegalArgumentException("Only 'exclusive write' lock is allowed scope/type pair."); } owner = lockInfo.getOwner(); isDeep = lockInfo.isDeep(); setTimeout(lockInfo.getTimeout()); } }
/** * Create a new lock * * @param lockInfo lock info * @throws IllegalArgumentException if either scope or type is invalid. */ public SerializableActiveLock(LockInfo lockInfo) { if (lockInfo != null) { if (!(Type.WRITE.equals(lockInfo.getType()) && Scope.EXCLUSIVE.equals(lockInfo.getScope()))) { throw new IllegalArgumentException("Only 'exclusive write' lock is allowed scope/type pair."); } owner = lockInfo.getOwner(); isDeep = lockInfo.isDeep(); setTimeout(lockInfo.getTimeout()); } }
/** * Create a new lock * * @param lockInfo * @throws IllegalArgumentException if either scope or type is invalid. */ public DefaultActiveLock(LockInfo lockInfo) { if (lockInfo != null) { if (!(Type.WRITE.equals(lockInfo.getType()) && Scope.EXCLUSIVE.equals(lockInfo.getScope()))) { throw new IllegalArgumentException("Only 'exclusive write' lock is allowed scope/type pair."); } owner = lockInfo.getOwner(); isDeep = lockInfo.isDeep(); setTimeout(lockInfo.getTimeout()); } }
/** * Create a new lock * * @param lockInfo * @throws IllegalArgumentException if either scope or type is invalid. */ public DefaultActiveLock(LockInfo lockInfo) { if (lockInfo != null) { if (!(Type.WRITE.equals(lockInfo.getType()) && Scope.EXCLUSIVE.equals(lockInfo.getScope()))) { throw new IllegalArgumentException("Only 'exclusive write' lock is allowed scope/type pair."); } owner = lockInfo.getOwner(); isDeep = lockInfo.isDeep(); setTimeout(lockInfo.getTimeout()); } }