@Override public boolean isLockable( Type type, Scope scope ) { return Type.WRITE.equals( type ) && Scope.EXCLUSIVE.equals( scope ); }
/** * Create a <code>Scope</code> object from the given name and namespace. * * @param localName * @param namespace * @return Scope object. */ public static Scope create(String localName, Namespace namespace) { String key = DomUtil.getExpandedName(localName, namespace); if (scopes.containsKey(key)) { return scopes.get(key); } else { Scope scope = new Scope(localName, namespace); scopes.put(key, scope); return scope; } } }
/** * Create a <code>Scope</code> object from the given Xml element. * * @param lockScope * @return Scope object. */ public static Scope createFromXml(Element lockScope) { if (lockScope != null && DavConstants.XML_LOCKSCOPE.equals(lockScope.getLocalName())) { // we have the parent element and must retrieve the scope first lockScope = DomUtil.getFirstChildElement(lockScope); } if (lockScope == null) { throw new IllegalArgumentException("'null' is not a valid lock scope entry."); } Namespace namespace = Namespace.getNamespace(lockScope.getPrefix(), lockScope.getNamespaceURI()); return create(lockScope.getLocalName(), namespace); }
/** * 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; }
public Scope getScope() { return Scope.createFromXml(DomUtil.getChildElement(alElement, XML_LOCKSCOPE, NAMESPACE)); }
/** * 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; }
public Scope getScope() { return Scope.createFromXml(DomUtil.getChildElement(alElement, XML_LOCKSCOPE, NAMESPACE)); }
/** * @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; }
public Scope getScope() { return Scope.createFromXml(DomUtil.getChildElement(alElement, XML_LOCKSCOPE, NAMESPACE)); }
/** * Create a <code>Scope</code> object from the given Xml element. * * @param lockScope * @return Scope object. */ public static Scope createFromXml(Element lockScope) { if (lockScope != null && DavConstants.XML_LOCKSCOPE.equals(lockScope.getLocalName())) { // we have the parent element and must retrieve the scope first lockScope = DomUtil.getFirstChildElement(lockScope); } if (lockScope == null) { throw new IllegalArgumentException("'null' is not a valid lock scope entry."); } Namespace namespace = Namespace.getNamespace(lockScope.getPrefix(), lockScope.getNamespaceURI()); return create(lockScope.getLocalName(), namespace); }
/** * Create a <code>Scope</code> object from the given name and namespace. * * @param localName * @param namespace * @return Scope object. */ public static Scope create(String localName, Namespace namespace) { String key = DomUtil.getQualifiedName(localName, namespace); if (scopes.containsKey(key)) { return (Scope) scopes.get(key); } else { Scope scope = new Scope(localName, namespace); scopes.put(key, scope); return 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 the xml representation of this lock info.<br> * NOTE however, that the depth and the timeout are not included * in the xml. They will be passed to the server using the corresponding * request headers. * * @param document * @return xml representation of this lock info. * @see org.apache.jackrabbit.webdav.xml.XmlSerializable#toXml(Document) */ public Element toXml(Document document) { if (isRefreshLock) { return null; } else { Element lockInfo = DomUtil.createElement(document, XML_LOCKINFO, NAMESPACE); lockInfo.appendChild(scope.toXml(document)); lockInfo.appendChild(type.toXml(document)); if (owner != null) { DomUtil.addChildElement(lockInfo, XML_OWNER, NAMESPACE, owner); } return lockInfo; } }
type = Type.createFromXml(child); } else if (XML_LOCKSCOPE.equals(childName)) { scope = Scope.createFromXml(child); } else if (XML_OWNER.equals(childName)) {
/** * Create a <code>Scope</code> object from the given Xml element. * * @param lockScope * @return Scope object. */ public static Scope createFromXml(Element lockScope) { if (lockScope != null && DavConstants.XML_LOCKSCOPE.equals(lockScope.getLocalName())) { // we have the parent element and must retrieve the scope first lockScope = DomUtil.getFirstChildElement(lockScope); } if (lockScope == null) { throw new IllegalArgumentException("'null' is not a valid lock scope entry."); } Namespace namespace = Namespace.getNamespace(lockScope.getPrefix(), lockScope.getNamespaceURI()); return create(lockScope.getLocalName(), namespace); }
/** * Create a <code>Scope</code> object from the given name and namespace. * * @param localName * @param namespace * @return Scope object. */ public static Scope create(String localName, Namespace namespace) { String key = DomUtil.getExpandedName(localName, namespace); if (scopes.containsKey(key)) { return scopes.get(key); } else { Scope scope = new Scope(localName, namespace); scopes.put(key, scope); return 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 the xml representation of this lock info.<br> * NOTE however, that the depth and the timeout are not included * in the xml. They will be passed to the server using the corresponding * request headers. * * @param document * @return xml representation of this lock info. * @see org.apache.jackrabbit.webdav.xml.XmlSerializable#toXml(Document) */ public Element toXml(Document document) { if (isRefreshLock) { return null; } else { Element lockInfo = DomUtil.createElement(document, XML_LOCKINFO, NAMESPACE); lockInfo.appendChild(scope.toXml(document)); lockInfo.appendChild(type.toXml(document)); if (owner != null) { DomUtil.addChildElement(lockInfo, XML_OWNER, NAMESPACE, owner); } return lockInfo; } }
type = Type.createFromXml(child); } else if (XML_LOCKSCOPE.equals(childName)) { scope = Scope.createFromXml(child); } else if (XML_OWNER.equals(childName)) {