/** * Create a new LockDiscovery property * * @param locks */ public LockDiscovery(ActiveLock[] locks) { super(DavPropertyName.LOCKDISCOVERY, false); for (ActiveLock lock : locks) { addActiveLock(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()); } }
/** * Returns the Xml representation of this <code>LockEntry</code>. * * @return Xml representation * @see org.apache.jackrabbit.webdav.xml.XmlSerializable#toXml(Document) * @param document */ public Element toXml(Document document) { Element entry = DomUtil.createElement(document, XML_LOCKENTRY, NAMESPACE); entry.appendChild(getScope().toXml(document)); entry.appendChild(getType().toXml(document)); return entry; }
protected SupportedLock getSupportedLock() { SupportedLock supportedLock = new SupportedLock(); supportedLock.addEntry(Type.WRITE, Scope.EXCLUSIVE); return supportedLock; }
/** * Create a new {@link XWikiDavResourceFactory}. */ public XWikiDavResourceFactory(ServletContext servletContext) throws ServletException { this.lockManager = new SimpleLockManager(); this.servletContext = servletContext; }
public long getSecondsRemaining() { long timeout = activeLock.getTimeout(); return (timeout == DavConstants.INFINITE_TIMEOUT) ? Long.MAX_VALUE : timeout / 1000; }
/** * @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); }
/** * Returns the Xml representation of this <code>LockEntry</code>. * * @return Xml representation * @see org.apache.jackrabbit.webdav.xml.XmlSerializable#toXml(Document) * @param document */ public Element toXml(Document document) { Element entry = DomUtil.createElement(document, XML_LOCKENTRY, NAMESPACE); entry.appendChild(getScope().toXml(document)); entry.appendChild(getType().toXml(document)); return entry; }
/** * Create a new LockDiscovery property * * @param lock */ public LockDiscovery(ActiveLock lock) { super(DavPropertyName.LOCKDISCOVERY, false); addActiveLock(lock); }
public long getSecondsRemaining() { long timeout = activeLock.getTimeout(); return (timeout == DavConstants.INFINITE_TIMEOUT) ? Long.MAX_VALUE : timeout / 1000; }
/** * Create a new LockDiscovery property * * @param lock */ public LockDiscovery(ActiveLock lock) { super(DavPropertyName.LOCKDISCOVERY, false); addActiveLock(lock); }
/** * Create a new LockDiscovery property * * @param locks */ public LockDiscovery(ActiveLock[] locks) { super(DavPropertyName.LOCKDISCOVERY, false); for (ActiveLock lock : locks) { addActiveLock(lock); } }
/** * Create a new LockDiscovery property * * @param locks */ public LockDiscovery(ActiveLock[] locks) { super(DavPropertyName.LOCKDISCOVERY, false); for (int i = 0; i < locks.length; i++) { addActiveLock(locks[i]); } }
/** * Create a new LockDiscovery property * * @param lock */ public LockDiscovery(ActiveLock lock) { super(DavPropertyName.LOCKDISCOVERY, false); addActiveLock(lock); }