@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); }
/** * 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; }
public boolean isSessionScoped() { return ItemResourceConstants.EXCLUSIVE_SESSION.equals(activeLock.getScope()); }
@Override public boolean isLockable(Type type, Scope scope) { return Type.WRITE.equals(type) && Scope.EXCLUSIVE.equals(scope); }
public boolean isSessionScoped() { return ItemResourceConstants.EXCLUSIVE_SESSION.equals(activeLock.getScope()); }
/** * 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; }
/** * 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()); } }
/** * Build the transaction object associated by the lock. * * @param locator * @param lockInfo * @return */ private Transaction createTransaction(DavResourceLocator locator, LockInfo lockInfo) { if (TransactionConstants.GLOBAL.equals(lockInfo.getScope())) { return new GlobalTransaction(locator, new TxActiveLock(lockInfo)); } else { return new LocalTransaction(locator, new TxActiveLock(lockInfo)); } }