/** * 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()); } }
/** * 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()); } }
if (lockInfo.isDeep() || isInternalMember(resource, key)) { throw new DavException(DavServletResponse.SC_CONFLICT, "Resource '" + resource.getResourcePath() + "' cannot be locked due to a lock present on the member resource '" + key + "'.");
if (lockInfo.isDeep() || isInternalMember(resource, key)) { throw new DavException(DavServletResponse.SC_CONFLICT, "Resource '" + resource.getResourcePath() + "' cannot be locked due to a lock present on the member resource '" + key + "'.");
if (lockInfo.isDeep() || isInternalMember(resource, key)) { throw new DavException(DavServletResponse.SC_CONFLICT, "Resource '" + resource.getResourcePath() + "' cannot be locked due to a lock present on the member resource '" + key + "'.");
if (lockInfo.isDeep() || isInternalMember(resource, key)) { throw new DavException(DavServletResponse.SC_CONFLICT, "Resource '" + resource.getResourcePath() + "' cannot be locked due to a lock present on the member resource '" + key + "'.");
/** * Create a new transaction lock.<br> * If the lockInfo element is <code>null</code> the timeout defaults to * half and hour. The default scope is 'local'. * * @param lockInfo * @throws IllegalArgumentException if either scope or type is invalid or if * a depth other than infinity is requested. */ public TxActiveLock(LockInfo lockInfo) { if (lockInfo != null) { if (!TRANSACTION.equals(lockInfo.getType())) { throw new IllegalArgumentException("Only 'transaction' type is allowed for a transaction-activelock object."); } if (!(LOCAL.equals(lockInfo.getScope()) || GLOBAL.equals(lockInfo.getScope()))) { throw new IllegalArgumentException("Only 'global' or 'local' are valid scopes within a transaction-activelock element."); } if (!lockInfo.isDeep()) { throw new IllegalArgumentException("Only transaction locks can only be deep."); } setOwner(lockInfo.getOwner()); setTimeout(lockInfo.getTimeout()); scope = lockInfo.getScope(); } else { setTimeout(DEFAULT_TIMEOUT); // local scope by default scope = LOCAL; } }
/** * Create a new transaction lock.<br> * If the lockInfo element is <code>null</code> the timeout defaults to * half and hour. The default scope is 'local'. * * @param lockInfo * @throws IllegalArgumentException if either scope or type is invalid or if * a depth other than infinity is requested. */ public TxActiveLock(LockInfo lockInfo) { if (lockInfo != null) { if (!TRANSACTION.equals(lockInfo.getType())) { throw new IllegalArgumentException("Only 'transaction' type is allowed for a transaction-activelock object."); } if (!(LOCAL.equals(lockInfo.getScope()) || GLOBAL.equals(lockInfo.getScope()))) { throw new IllegalArgumentException("Only 'global' or 'local' are valid scopes within a transaction-activelock element."); } if (!lockInfo.isDeep()) { throw new IllegalArgumentException("Only transaction locks can only be deep."); } setOwner(lockInfo.getOwner()); setTimeout(lockInfo.getTimeout()); scope = lockInfo.getScope(); } else { setTimeout(DEFAULT_TIMEOUT); // local scope by default scope = LOCAL; } }
Lock jcrLock = lockMgr.lock(node.getPath(), lockInfo.isDeep(), false, timeout, lockInfo.getOwner()); if (jcrLock != null) { lock = new JcrActiveLock(jcrLock);
/** * Create a new transaction lock.<br> * If the lockInfo element is <code>null</code> the timeout defaults to * half and hour. The default scope is 'local'. * * @param lockInfo * @throws IllegalArgumentException if either scope or type is invalid or if * a depth other than infinity is requested. */ public TxActiveLock(LockInfo lockInfo) { if (lockInfo != null) { if (!TRANSACTION.equals(lockInfo.getType())) { throw new IllegalArgumentException("Only 'transaction' type is allowed for a transaction-activelock object."); } if (!(LOCAL.equals(lockInfo.getScope()) || GLOBAL.equals(lockInfo.getScope()))) { throw new IllegalArgumentException("Only 'global' or 'local' are valid scopes within a transaction-activelock element."); } if (!lockInfo.isDeep()) { throw new IllegalArgumentException("Only transaction locks can only be deep."); } setOwner(lockInfo.getOwner()); setTimeout(lockInfo.getTimeout()); scope = lockInfo.getScope(); } else { setTimeout(DEFAULT_TIMEOUT); // local scope by default scope = LOCAL; } }
public HttpLock(URI uri, LockInfo lockInfo) throws IOException { super(uri); TimeoutHeader th = new TimeoutHeader(lockInfo.getTimeout()); super.setHeader(th.getHeaderName(), th.getHeaderValue()); DepthHeader dh = new DepthHeader(lockInfo.isDeep()); super.setHeader(dh.getHeaderName(), dh.getHeaderValue()); super.setEntity(XmlEntity.create(lockInfo)); isRefresh = false; }
public HttpLock(URI uri, LockInfo lockInfo) throws IOException { super(uri); TimeoutHeader th = new TimeoutHeader(lockInfo.getTimeout()); super.setHeader(th.getHeaderName(), th.getHeaderValue()); DepthHeader dh = new DepthHeader(lockInfo.isDeep()); super.setHeader(dh.getHeaderName(), dh.getHeaderValue()); super.setEntity(XmlEntity.create(lockInfo)); isRefresh = false; }
/** * Create a new lock. * * @param lockInfo * @param resource * @return the lock * @throws DavException if the request lock has the wrong lock type or if * the lock could not be obtained for any reason. */ private synchronized ActiveLock createLock(LockInfo lockInfo, TransactionResource resource) throws DavException { if (!lockInfo.isDeep() || !TransactionConstants.TRANSACTION.equals(lockInfo.getType())) { throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED); } ActiveLock existing = getLock(lockInfo.getType(), lockInfo.getScope(), resource); if (existing != null) { throw new DavException(DavServletResponse.SC_LOCKED); } // TODO: check for locks on member resources is required as well for lock is always deep! Transaction tx = createTransaction(resource.getLocator(), lockInfo); tx.start(resource); // keep references to this lock addReferences(tx, getMap(resource), resource); return tx.getLock(); }
Lock jcrLock = lockMgr.lock((item).getPath(), reqLockInfo.isDeep(), sessionScoped, timeout, reqLockInfo.getOwner()); ActiveLock lock = new JcrActiveLock(jcrLock);