/** * 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()); } }
/** * * @param lockInfo * @param lockToken * @param resource * @return * @throws DavException * @see DavResource#refreshLock(org.apache.jackrabbit.webdav.lock.LockInfo, String) */ public ActiveLock refreshLock(LockInfo lockInfo, String lockToken, DavResource resource) throws DavException { ActiveLock lock = getLock(lockInfo.getType(), lockInfo.getScope(), resource); if (lock == null) { throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED); } else if (!lock.getToken().equals(lockToken)) { throw new DavException(DavServletResponse.SC_LOCKED); } lock.setTimeout(lockInfo.getTimeout()); return lock; }
/** * @param lockInfo lock info * @param lockToken lock token * @param resource resource * @return lock * @throws DavException ex * @see DavResource#refreshLock(org.apache.jackrabbit.webdav.lock.LockInfo, String) */ public ActiveLock refreshLock(LockInfo lockInfo, String lockToken, DavResource resource) throws DavException { ActiveLock lock = getLock(lockInfo.getType(), lockInfo.getScope(), resource); if (lock == null) { throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED); } else if (!lock.getToken().equals(lockToken)) { throw new DavException(DavServletResponse.SC_LOCKED); } lock.setTimeout(lockInfo.getTimeout()); return lock; }
/** * * @param lockInfo * @param lockToken * @param resource * @return * @throws DavException * @see DavResource#refreshLock(org.apache.jackrabbit.webdav.lock.LockInfo, String) */ public ActiveLock refreshLock(LockInfo lockInfo, String lockToken, DavResource resource) throws DavException { ActiveLock lock = getLock(lockInfo.getType(), lockInfo.getScope(), resource); if (lock == null) { throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED); } else if (!lock.getToken().equals(lockToken)) { throw new DavException(DavServletResponse.SC_LOCKED); } lock.setTimeout(lockInfo.getTimeout()); return lock; }
/** * * @param lockInfo * @param lockToken * @param resource * @return * @throws DavException * @see DavResource#refreshLock(org.apache.jackrabbit.webdav.lock.LockInfo, String) */ public ActiveLock refreshLock(LockInfo lockInfo, String lockToken, DavResource resource) throws DavException { ActiveLock lock = getLock(lockInfo.getType(), lockInfo.getScope(), resource); if (lock == null) { throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED); } else if (!lock.getToken().equals(lockToken)) { throw new DavException(DavServletResponse.SC_LOCKED); } lock.setTimeout(lockInfo.getTimeout()); return lock; }
/** * 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; } }
try { javax.jcr.lock.LockManager lockMgr = node.getSession().getWorkspace().getLockManager(); long timeout = lockInfo.getTimeout(); if (timeout == LockInfo.INFINITE_TIMEOUT) { timeout = Long.MAX_VALUE;
/** * 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; }
/** * Reset the timeout of the lock identified by the given lock token. * * @param lockInfo * @param lockToken * @param resource * @return * @throws DavException if the lock did not exist or is expired. */ private synchronized ActiveLock refreshLock(LockInfo lockInfo, String lockToken, TransactionResource resource) throws DavException { TransactionMap responsibleMap = getMap(resource); Transaction tx = responsibleMap.get(lockToken); if (tx == null) { throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "No valid transaction lock found for resource '" + resource.getResourcePath() + "'"); } else if (tx.getLock().isExpired()) { removeExpired(tx, responsibleMap, resource); throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "Transaction lock for resource '" + resource.getResourcePath() + "' was already expired."); } else { tx.getLock().setTimeout(lockInfo.getTimeout()); } return tx.getLock(); }
long timeout = reqLockInfo.getTimeout(); if (timeout == LockInfo.INFINITE_TIMEOUT) { timeout = Long.MAX_VALUE;