CCM NG: Next part of WebDAV support
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5374 8810af33-2d31-482b-a856-94f89814c4dfccm-docs
parent
0c87717bc4
commit
11e89cf555
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Guarantees that any unmarshalled enum constants effectively are the constant
|
||||||
|
* Java instances itself, so that {@code ==} can be used for comparison.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* Subclass must provide the constants to be used instead of an equal value by
|
||||||
|
* {@link #getConstants()}.
|
||||||
|
*
|
||||||
|
* @author unknown
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public abstract class ConstantsAdapter<T> extends XmlAdapter<T, T> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T unmarshal(final T value) throws Exception {
|
||||||
|
|
||||||
|
return value;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T marshal(final T value) throws Exception {
|
||||||
|
|
||||||
|
return replaceValueByConstants(value, this.getConstants());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> T replaceValueByConstants(
|
||||||
|
final T value, final Collection<T> constants) {
|
||||||
|
|
||||||
|
return constants
|
||||||
|
.stream()
|
||||||
|
.filter(constant -> constant.equals(value))
|
||||||
|
.findAny()
|
||||||
|
.orElse(value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Constant instances to be returned by {@link #marshal(Object)} as
|
||||||
|
* a replacement for any equal instances. Must not be {@code null}.
|
||||||
|
*/
|
||||||
|
protected abstract Collection<T> getConstants();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,196 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebDAV {@code activelock} XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_activelock">Chapter
|
||||||
|
* 14.1 "activelock XML Element" of RFC 4918 "HTTP Extensions for Web
|
||||||
|
* Distributed Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
@XmlType(propOrder = {"lockScope",
|
||||||
|
"lockType",
|
||||||
|
"depth",
|
||||||
|
"owner",
|
||||||
|
"timeOut",
|
||||||
|
"lockToken",
|
||||||
|
"lockRoot"})
|
||||||
|
@XmlRootElement(name = "activelock")
|
||||||
|
public class ActiveLock {
|
||||||
|
|
||||||
|
@XmlElement(name = "lockscope")
|
||||||
|
private final LockScope lockScope;
|
||||||
|
|
||||||
|
@XmlElement(name = "locktype")
|
||||||
|
private final LockType lockType;
|
||||||
|
|
||||||
|
private final Depth depth;
|
||||||
|
|
||||||
|
private final Owner owner;
|
||||||
|
|
||||||
|
@XmlElement(name = "timeout")
|
||||||
|
private final TimeOut timeOut;
|
||||||
|
|
||||||
|
@XmlElement(name = "locktoken")
|
||||||
|
private final LockToken lockToken;
|
||||||
|
|
||||||
|
@XmlElement(name = "lockroot")
|
||||||
|
private final LockRoot lockRoot;
|
||||||
|
|
||||||
|
private ActiveLock() {
|
||||||
|
this.lockScope = null;
|
||||||
|
this.lockType = null;
|
||||||
|
this.depth = null;
|
||||||
|
this.owner = null;
|
||||||
|
this.timeOut = null;
|
||||||
|
this.lockToken = null;
|
||||||
|
this.lockRoot = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActiveLock(final LockScope lockScope,
|
||||||
|
final LockType lockType,
|
||||||
|
final Depth depth,
|
||||||
|
final Owner owner,
|
||||||
|
final TimeOut timeOut,
|
||||||
|
final LockToken lockToken,
|
||||||
|
final LockRoot lockRoot) {
|
||||||
|
|
||||||
|
this.lockScope = Objects.requireNonNull(lockScope, "lockScope");
|
||||||
|
this.lockType = Objects.requireNonNull(lockType, "lockType");
|
||||||
|
this.depth = Objects.requireNonNull(depth, "depth");
|
||||||
|
this.owner = owner;
|
||||||
|
this.timeOut = timeOut;
|
||||||
|
this.lockToken = lockToken;
|
||||||
|
this.lockRoot = Objects.requireNonNull(lockRoot, "lockRoot");
|
||||||
|
}
|
||||||
|
|
||||||
|
public final LockScope getLockScope() {
|
||||||
|
return this.lockScope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final LockType getLockType() {
|
||||||
|
return this.lockType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Depth getDepth() {
|
||||||
|
return this.depth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Owner getOwner() {
|
||||||
|
return this.owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final TimeOut getTimeOut() {
|
||||||
|
return this.timeOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final LockToken getLockToken() {
|
||||||
|
return this.lockToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final LockRoot getLockRoot() {
|
||||||
|
return this.lockRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 71 * hash + Objects.hashCode(lockScope);
|
||||||
|
hash = 71 * hash + Objects.hashCode(lockType);
|
||||||
|
hash = 71 * hash + Objects.hashCode(depth);
|
||||||
|
hash = 71 * hash + Objects.hashCode(owner);
|
||||||
|
hash = 71 * hash + Objects.hashCode(timeOut);
|
||||||
|
hash = 71 * hash + Objects.hashCode(lockToken);
|
||||||
|
hash = 71 * hash + Objects.hashCode(lockRoot);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof ActiveLock)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final ActiveLock other = (ActiveLock) obj;
|
||||||
|
if (!Objects.equals(lockScope, other.getLockScope())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(lockType, other.getLockType())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (depth != other.getDepth()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(owner, other.getOwner())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(timeOut, other.getTimeOut())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(lockToken, other.getLockToken())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Objects.equals(lockRoot, other.getLockRoot());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ lockScope = %s, "
|
||||||
|
+ "lockType = %s, "
|
||||||
|
+ "depth = %s, "
|
||||||
|
+ "owner = %s,"
|
||||||
|
+ "timeOut = %s, "
|
||||||
|
+ "lockToken = %s, "
|
||||||
|
+ "lockRoot = %s }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(lockScope),
|
||||||
|
Objects.toString(lockType),
|
||||||
|
Objects.toString(depth),
|
||||||
|
Objects.toString(owner),
|
||||||
|
Objects.toString(timeOut),
|
||||||
|
Objects.toString(lockToken),
|
||||||
|
Objects.toString(lockRoot));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebDAV allprop XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* This is a singleton. All instances are absolutely identical, hence can be
|
||||||
|
* compared using {@code ==} and share one unique hash code. Use
|
||||||
|
* {@link #ALLPROP} always.
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_allprop">Chapter
|
||||||
|
* 14.2 "allprop XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "allprop")
|
||||||
|
@XmlType(factoryMethod = "createSingleton")
|
||||||
|
public final class AllProp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton instance, providing improved performance and the ability to
|
||||||
|
* compare by <em>same</em> instance.
|
||||||
|
*
|
||||||
|
* @since 1.2
|
||||||
|
*/
|
||||||
|
public static final AllProp ALLPROP = new AllProp();
|
||||||
|
|
||||||
|
private AllProp() {
|
||||||
|
// For unmarshalling only.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton factory to be used solely by JAXB.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private static AllProp createSingleton() {
|
||||||
|
return ALLPROP;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final String toString() {
|
||||||
|
return getClass().getSimpleName();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebDAV collection XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* * This is a singleton. All instances are absolutely identical, hence can be
|
||||||
|
* compared using {@code ==} and share one unique hash code. Use
|
||||||
|
* {@link #COLLECTION} always.
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_activelock">Chapter
|
||||||
|
* 14.3 "collection XML Element" of RFC 4918 "HTTP Extensions for Web
|
||||||
|
* Distributed Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public final class Collection {
|
||||||
|
|
||||||
|
private Collection() {
|
||||||
|
// For unmarshalling only.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton instance, providing improved performance and the ability to
|
||||||
|
* compare by <em>same</em> instance.
|
||||||
|
*
|
||||||
|
* @since 1.2
|
||||||
|
*/
|
||||||
|
public static final Collection COLLECTION = new Collection();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton factory to be used solely by JAXB.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private static Collection createSingleton() {
|
||||||
|
return COLLECTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return getClass().getSimpleName();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlEnumValue;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* WebDAV depth XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_depth">Chapter
|
||||||
|
* 14.4 "depth XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement
|
||||||
|
public enum Depth {
|
||||||
|
|
||||||
|
@XmlEnumValue("0")
|
||||||
|
ZERO,
|
||||||
|
@XmlEnumValue("1")
|
||||||
|
ONE,
|
||||||
|
@XmlEnumValue("infinity")
|
||||||
|
INFINITY
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAnyElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import static java.util.Collections.*;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* WebDAV error XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_error">Chapter
|
||||||
|
* 14.5 "error XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*/
|
||||||
|
@XmlRootElement
|
||||||
|
public final class Error {
|
||||||
|
|
||||||
|
@XmlAnyElement(lax = true)
|
||||||
|
public final List<Object> errors;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private Error() {
|
||||||
|
errors = new LinkedList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Error(final Object error, final Object... errors) {
|
||||||
|
|
||||||
|
Objects.requireNonNull(error);
|
||||||
|
|
||||||
|
this.errors = new LinkedList<>();
|
||||||
|
this.errors.add(error);
|
||||||
|
this.errors.addAll(Arrays.asList(errors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public final List<Object> getErrors() {
|
||||||
|
return unmodifiableList(this.errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 83 * hash + Objects.hashCode(errors);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof Error)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final Error other = (Error) obj;
|
||||||
|
return Objects.equals(errors, other.errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ errors = %s }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(errors));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebDAV exclusive XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* This is a singleton. All instances are absolutely identical, hence can be
|
||||||
|
* compared using {@code ==} and share one unique hash code. Use
|
||||||
|
* {@link #EXCLUSIVE} always.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_exclusive">Chapter
|
||||||
|
* 14.6 "exclusive XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*/
|
||||||
|
@XmlRootElement
|
||||||
|
@XmlType(factoryMethod = "createSingleton")
|
||||||
|
public class Exclusive {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton instance, providing improved performance and the ability to
|
||||||
|
* compare by <em>same</em> instance.
|
||||||
|
*
|
||||||
|
* @since 1.2
|
||||||
|
*/
|
||||||
|
public static final Exclusive EXCLUSIVE = new Exclusive();
|
||||||
|
|
||||||
|
private static Exclusive createSingleton() {
|
||||||
|
return EXCLUSIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Exclusive() {
|
||||||
|
// For unmarshalling only.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return getClass().getSimpleName();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,110 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* WebDAV href XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_href">Chapter
|
||||||
|
* 14.7 "href XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "href")
|
||||||
|
public final class HRef {
|
||||||
|
|
||||||
|
@XmlValue
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
private HRef() {
|
||||||
|
this.value = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HRef(final URI uri) {
|
||||||
|
|
||||||
|
Objects.requireNonNull(uri);
|
||||||
|
value = uri.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public HRef(final String uri) {
|
||||||
|
|
||||||
|
Objects.requireNonNull(uri);
|
||||||
|
value = uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Value as a <code>URI</code> instance, if the value is a valid
|
||||||
|
* URI; <code>null</code> otherwise.
|
||||||
|
*
|
||||||
|
* @throws java.net.URISyntaxException
|
||||||
|
*/
|
||||||
|
public final URI getURI() throws URISyntaxException {
|
||||||
|
return new URI(this.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final String getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 59 * hash + Objects.hashCode(value);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final HRef other = (HRef) obj;
|
||||||
|
return Objects.equals(value, other.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ %s }",
|
||||||
|
super.toString(),
|
||||||
|
value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAnyElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebDAV include XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_include">Chapter
|
||||||
|
* 14.8 "include XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*/
|
||||||
|
@XmlRootElement
|
||||||
|
public final class Include {
|
||||||
|
|
||||||
|
@XmlAnyElement(lax = true)
|
||||||
|
private final List<Object> includes;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private Include() {
|
||||||
|
this.includes = new LinkedList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Include(final Object... includes) {
|
||||||
|
|
||||||
|
Objects.requireNonNull(includes);
|
||||||
|
|
||||||
|
this.includes = Arrays.asList(includes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final List<Object> getIncludes() {
|
||||||
|
return Collections.unmodifiableList(this.includes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 17 * hash + Objects.hashCode(includes);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof Include)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final Include other = (Include) obj;
|
||||||
|
return Objects.equals(includes, other.getIncludes());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
|
||||||
|
return String.format("%s{ includes = %s }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(includes));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebDAV location XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_location">Chapter
|
||||||
|
* 14.9 "location XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement
|
||||||
|
public final class Location {
|
||||||
|
|
||||||
|
@XmlElement(name = "href")
|
||||||
|
private final HRef hRef;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private Location() {
|
||||||
|
this.hRef = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location(final HRef hRef) {
|
||||||
|
|
||||||
|
Objects.requireNonNull(hRef);
|
||||||
|
|
||||||
|
this.hRef = hRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final HRef getHRef() {
|
||||||
|
return this.hRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 3;
|
||||||
|
hash = 37 * hash + Objects.hashCode(hRef);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof Location)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final Location other = (Location) obj;
|
||||||
|
return Objects.equals(hRef, other.getHRef());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ href = %s }",
|
||||||
|
Objects.toString(hRef));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebDAV lockentry XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_lockentry">Chapter
|
||||||
|
* 14.10 "lockentry XML Element" of RFC 4918 "HTTP Extensions for Web
|
||||||
|
* Distributed Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlType(propOrder = {"lockScope", "lockType"})
|
||||||
|
@XmlRootElement(name = "lockentry")
|
||||||
|
public final class LockEntry {
|
||||||
|
|
||||||
|
@XmlElement(name = "lockscope")
|
||||||
|
private final LockScope lockScope;
|
||||||
|
|
||||||
|
@XmlElement(name = "locktype")
|
||||||
|
private final LockType lockType;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private LockEntry() {
|
||||||
|
this.lockScope = null;
|
||||||
|
this.lockType = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LockEntry(final LockScope lockScope, final LockType lockType) {
|
||||||
|
|
||||||
|
Objects.requireNonNull(lockScope);
|
||||||
|
Objects.requireNonNull(lockType);
|
||||||
|
|
||||||
|
this.lockScope = lockScope;
|
||||||
|
this.lockType = lockType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final LockScope getLockScope() {
|
||||||
|
return this.lockScope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final LockType getLockType() {
|
||||||
|
return this.lockType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 3;
|
||||||
|
hash = 59 * hash + Objects.hashCode(lockScope);
|
||||||
|
hash = 59 * hash + Objects.hashCode(lockType);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof LockEntry)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final LockEntry other = (LockEntry) obj;
|
||||||
|
if (!Objects.equals(lockScope, other.getLockScope())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Objects.equals(lockType, other.getLockType());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ lockScope = %s,"
|
||||||
|
+ "lockType = %s }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(lockScope),
|
||||||
|
Objects.toString(lockType));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,127 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebDAV lockinfo XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_lockinfo">Chapter
|
||||||
|
* 14.11 "lockinfo XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlType(propOrder = {"lockScope", "lockType", "owner"})
|
||||||
|
@XmlRootElement(name = "lockinfo")
|
||||||
|
public final class LockInfo {
|
||||||
|
|
||||||
|
@XmlElement(name = "lockscope")
|
||||||
|
private final LockScope lockScope;
|
||||||
|
|
||||||
|
@XmlElement(name = "locktype")
|
||||||
|
private final LockType lockType;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
private final Owner owner;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private LockInfo() {
|
||||||
|
this.lockScope = null;
|
||||||
|
this.lockType = null;
|
||||||
|
this.owner = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LockInfo(final LockScope lockScope,
|
||||||
|
final LockType lockType,
|
||||||
|
final Owner owner) {
|
||||||
|
|
||||||
|
this.lockScope = Objects.requireNonNull(lockScope);
|
||||||
|
this.lockType = Objects.requireNonNull(lockType);
|
||||||
|
this.owner = Objects.requireNonNull(owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final LockScope getLockScope() {
|
||||||
|
return this.lockScope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final LockType getLockType() {
|
||||||
|
return this.lockType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Owner getOwner() {
|
||||||
|
return this.owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 5;
|
||||||
|
hash = 67 * hash + Objects.hashCode(lockScope);
|
||||||
|
hash = 67 * hash + Objects.hashCode(lockType);
|
||||||
|
hash = 67 * hash + Objects.hashCode(owner);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof LockInfo)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final LockInfo other = (LockInfo) obj;
|
||||||
|
if (!Objects.equals(lockScope, other.getLockScope())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(lockType, other.getLockType())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Objects.equals(owner, other.getOwner());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ "
|
||||||
|
+ "lockScope = %s, "
|
||||||
|
+ "lockType = %s,"
|
||||||
|
+ "owner = %s"
|
||||||
|
+ " }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(lockScope),
|
||||||
|
Objects.toString(lockType),
|
||||||
|
Objects.toString(owner));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* WebDAV lockroot XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_lockroot">Chapter
|
||||||
|
* 14.12 "lockroot XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "lockroot")
|
||||||
|
public class LockRoot {
|
||||||
|
|
||||||
|
@XmlElement(name = "href")
|
||||||
|
private final HRef hRef;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private LockRoot() {
|
||||||
|
this.hRef = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LockRoot(final HRef hRef) {
|
||||||
|
|
||||||
|
Objects.requireNonNull(hRef);
|
||||||
|
|
||||||
|
this.hRef = hRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final HRef getHRef() {
|
||||||
|
return this.hRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 83 * hash + Objects.hashCode(this.hRef);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof LockRoot)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final LockRoot other = (LockRoot) obj;
|
||||||
|
return Objects.equals(hRef, other.getHRef());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ hRef = %s }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(hRef));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,131 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import org.libreccm.webdav.ConstantsAdapter;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||||
|
|
||||||
|
import static java.util.Arrays.*;
|
||||||
|
import static javax.xml.bind.annotation.XmlAccessType.FIELD;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebDAV lockscope XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_lockscope">Chapter
|
||||||
|
* 14.13 "lockscope XML Element" of RFC 4918 "HTTP Extensions for Web
|
||||||
|
* Distributed Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(FIELD)
|
||||||
|
@XmlType(propOrder = {"exclusive", "shared"})
|
||||||
|
@XmlJavaTypeAdapter(LockScope.Adapter.class)
|
||||||
|
@XmlRootElement(name = "lockscope")
|
||||||
|
public final class LockScope {
|
||||||
|
|
||||||
|
public static final LockScope SHARED = new LockScope(Shared.SHARED, null);
|
||||||
|
|
||||||
|
public static final LockScope EXCLUSIVE = new LockScope(null,
|
||||||
|
Exclusive.EXCLUSIVE);
|
||||||
|
|
||||||
|
private final Shared shared;
|
||||||
|
|
||||||
|
private final Exclusive exclusive;
|
||||||
|
|
||||||
|
private LockScope() {
|
||||||
|
this.shared = null;
|
||||||
|
this.exclusive = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private LockScope(final Shared shared, final Exclusive exclusive) {
|
||||||
|
this.shared = shared;
|
||||||
|
this.exclusive = exclusive;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Shared getShared() {
|
||||||
|
return shared;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Exclusive getExclusive() {
|
||||||
|
return exclusive;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 5;
|
||||||
|
hash = 97 * hash + Objects.hashCode(shared);
|
||||||
|
hash = 97 * hash + Objects.hashCode(exclusive);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof LockScope)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final LockScope other = (LockScope) obj;
|
||||||
|
if (!Objects.equals(shared, other.getShared())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Objects.equals(exclusive, other.getExclusive());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Guarantees that any unmarshalled enum constants effectively are the
|
||||||
|
* constant Java instances itself, so that {@code ==} can be used form
|
||||||
|
* comparison.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected static final class Adapter extends ConstantsAdapter<LockScope> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final Collection<LockScope> getConstants() {
|
||||||
|
return asList(SHARED, EXCLUSIVE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ shared = %s, exclusive = %s }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(shared),
|
||||||
|
Objects.toString(exclusive));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebDAV locktoken XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_locktoken">Chapter
|
||||||
|
* 14.4 "locktoken XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "locktoken")
|
||||||
|
public final class LockToken {
|
||||||
|
|
||||||
|
@XmlElement(name = "href")
|
||||||
|
private final HRef hRef;
|
||||||
|
|
||||||
|
private LockToken() {
|
||||||
|
this.hRef = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LockToken(final HRef hRef) {
|
||||||
|
|
||||||
|
Objects.requireNonNull(hRef);
|
||||||
|
|
||||||
|
this.hRef = hRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final HRef getHRef() {
|
||||||
|
return this.hRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 97 * hash + Objects.hashCode(hRef);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof LockToken)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final LockToken other = (LockToken) obj;
|
||||||
|
return Objects.equals(hRef, other.getHRef());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ %s }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(hRef));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* WebDAV locktype XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* This is a singleton. All instances are absolutely identical, hence can be
|
||||||
|
* compared using {@code ==} and share one unique hash code. Use {@link #WRITE}
|
||||||
|
* always.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_locktype">Chapter
|
||||||
|
* 14.15 "locktype XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
@XmlRootElement(name = "locktype")
|
||||||
|
@XmlType(factoryMethod = "createSingleton")
|
||||||
|
public final class LockType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton instance, providing improved performance and the ability to
|
||||||
|
* compare by <em>same</em> instance.
|
||||||
|
*/
|
||||||
|
public static final LockType WRITE = new LockType(Write.WRITE);
|
||||||
|
|
||||||
|
private static LockType createSingleton() {
|
||||||
|
return WRITE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private final Write write;
|
||||||
|
|
||||||
|
private LockType() {
|
||||||
|
this.write = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enum
|
||||||
|
private LockType(final Write write) {
|
||||||
|
this.write = write;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Write getWrite() {
|
||||||
|
return write;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 5;
|
||||||
|
hash = 37 * hash + Objects.hashCode(write);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof LockType)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final LockType other = (LockType) obj;
|
||||||
|
return Objects.equals(write, other.getWrite());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(write));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,127 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebDAV multistatus XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_multistatus">Chapter
|
||||||
|
* 14.16 "multistatus XML Element" of RFC 4918 "HTTP Extensions for Web
|
||||||
|
* Distributed Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlType(propOrder = {"responses", "responseDescription"})
|
||||||
|
@XmlRootElement(name = "multistatus")
|
||||||
|
public final class MultiStatus {
|
||||||
|
|
||||||
|
@XmlElement(name = "response")
|
||||||
|
private final List<Response> responses;
|
||||||
|
|
||||||
|
@XmlElement(name = "responsedescription")
|
||||||
|
private final ResponseDescription responseDescription;
|
||||||
|
|
||||||
|
public MultiStatus() {
|
||||||
|
this.responses = new LinkedList<>();
|
||||||
|
this.responseDescription = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiStatus(final ResponseDescription responseDescription,
|
||||||
|
final Response... responses) {
|
||||||
|
|
||||||
|
if (responses == null || responses.length == 0) {
|
||||||
|
this.responses = Collections.emptyList();
|
||||||
|
} else {
|
||||||
|
this.responses = Arrays.asList(responses);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.responseDescription = responseDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiStatus(final Response... responses) {
|
||||||
|
this(null, responses);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiStatus(final ResponseDescription responseDescription) {
|
||||||
|
this(responseDescription, (Response[]) null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final List<Response> getResponses() {
|
||||||
|
return Collections.unmodifiableList(responses);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final ResponseDescription getResponseDescription() {
|
||||||
|
return this.responseDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 47 * hash + Objects.hashCode(responses);
|
||||||
|
hash = 47 * hash + Objects.hashCode(responseDescription);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof MultiStatus)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final MultiStatus other = (MultiStatus) obj;
|
||||||
|
if (!Objects.equals(responses, other.getResponses())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Objects.equals(responseDescription,
|
||||||
|
other.getResponseDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ responses = %s, "
|
||||||
|
+ "responseDescription = %s }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(responses),
|
||||||
|
Objects.toString(responseDescription));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAnyElement;
|
||||||
|
import javax.xml.bind.annotation.XmlMixed;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebDAV owner XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_owner">Chapter
|
||||||
|
* 14.17 "owner XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*/
|
||||||
|
@XmlRootElement
|
||||||
|
public final class Owner {
|
||||||
|
|
||||||
|
@XmlMixed
|
||||||
|
@XmlAnyElement(lax = true)
|
||||||
|
private final List<Object> any;
|
||||||
|
|
||||||
|
private Owner() {
|
||||||
|
any = new LinkedList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Owner(final Object... any) {
|
||||||
|
|
||||||
|
Objects.requireNonNull(any);
|
||||||
|
this.any = Arrays.asList(any);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final List<Object> getAny() {
|
||||||
|
return Collections.unmodifiableList(any);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 23 * hash + Objects.hashCode(any);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof Owner)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final Owner other = (Owner) obj;
|
||||||
|
return Objects.equals(any, other.getAny());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ %s }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(any));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAnyElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* WebDAV prop XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_prop">Chapter
|
||||||
|
* 14.18 "prop XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement
|
||||||
|
public final class Prop {
|
||||||
|
|
||||||
|
@XmlAnyElement(lax = true)
|
||||||
|
private final List<Object> properties;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private Prop() {
|
||||||
|
// For unmarshalling only.
|
||||||
|
properties = new LinkedList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Prop(final Object... any) {
|
||||||
|
properties = Arrays.asList(any);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final List<Object> getProperties() {
|
||||||
|
return Collections.unmodifiableList(properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 43 * hash + Objects.hashCode(properties);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof Prop)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final Prop other = (Prop) obj;
|
||||||
|
return Objects.equals(properties, other.getProperties());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ properties = %s }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(properties));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,155 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
|
import static javax.xml.bind.annotation.XmlAccessType.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebDAV propfind XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_propfind">Chapter
|
||||||
|
* 14.20 "propfind XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(FIELD)
|
||||||
|
@XmlType(propOrder = {"propName", "allProp", "include", "prop"})
|
||||||
|
@XmlRootElement(name = "propfind")
|
||||||
|
public final class PropFind {
|
||||||
|
|
||||||
|
@XmlElement(name = "propname")
|
||||||
|
private final PropName propName;
|
||||||
|
|
||||||
|
@XmlElement(name = "allprop")
|
||||||
|
private final AllProp allProp;
|
||||||
|
|
||||||
|
private final Include include;
|
||||||
|
|
||||||
|
private final Prop prop;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private PropFind() {
|
||||||
|
this(null, null, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PropFind(final PropName propName, final AllProp allProp,
|
||||||
|
final Include include, final Prop prop) {
|
||||||
|
this.propName = propName;
|
||||||
|
this.allProp = allProp;
|
||||||
|
this.include = include;
|
||||||
|
this.prop = prop;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropFind(final PropName propName) {
|
||||||
|
this(Objects.requireNonNull(propName), null, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropFind(final AllProp allProp, final Include include) {
|
||||||
|
this(null, Objects.requireNonNull(allProp), include, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropFind(final AllProp allProp) {
|
||||||
|
this(null, Objects.requireNonNull(allProp), null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropFind(final Prop prop) {
|
||||||
|
this(null, null, null, Objects.requireNonNull(prop));
|
||||||
|
}
|
||||||
|
|
||||||
|
public final PropName getPropName() {
|
||||||
|
return this.propName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final AllProp getAllProp() {
|
||||||
|
return this.allProp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Include getInclude() {
|
||||||
|
return this.include;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Prop getProp() {
|
||||||
|
return this.prop;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 31 * hash + Objects.hashCode(propName);
|
||||||
|
hash = 31 * hash + Objects.hashCode(allProp);
|
||||||
|
hash = 31 * hash + Objects.hashCode(include);
|
||||||
|
hash = 31 * hash + Objects.hashCode(prop);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof PropFind)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final PropFind other = (PropFind) obj;
|
||||||
|
if (!Objects.equals(propName, other.getPropName())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(allProp, other.getAllProp())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(include, other.getInclude())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Objects.equals(prop, other.getProp());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ propName = %s,"
|
||||||
|
+ "allProp = %s, "
|
||||||
|
+ "include = %s, "
|
||||||
|
+ "prop = %s }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(propName),
|
||||||
|
Objects.toString(allProp),
|
||||||
|
Objects.toString(include),
|
||||||
|
Objects.toString(prop));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebDAV propname XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This is a singleton. All instances are absolutely identical, hence can be
|
||||||
|
* compared using {@code ==} and share one unique hash code. Use
|
||||||
|
* {@link #PROPNAME} always.
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net) * @author
|
||||||
|
* <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_propname">Chapter
|
||||||
|
* 14.21 "propname XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "propname")
|
||||||
|
@XmlType(factoryMethod = "createSingleton")
|
||||||
|
public final class PropName {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton instance, providing improved performance and the ability to
|
||||||
|
* compare by <em>same</em> instance.
|
||||||
|
*
|
||||||
|
* @since 1.2
|
||||||
|
*/
|
||||||
|
public static final PropName PROPNAME = new PropName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton factory to be used solely by JAXB.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private static PropName createSingleton() {
|
||||||
|
return PROPNAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
private PropName() {
|
||||||
|
// For unmarshalling only.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return getClass().getSimpleName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,158 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* WebDAV propstat XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_propstat">Chapter
|
||||||
|
* 14.22 "propstat XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlType(propOrder = {"prop", "status", "error", "responseDescription"})
|
||||||
|
@XmlRootElement(name = "propstat")
|
||||||
|
public final class PropStat {
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
private final Prop prop;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
private final Status status;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
private final Error error;
|
||||||
|
|
||||||
|
@XmlElement(name = "responsedescription")
|
||||||
|
private final ResponseDescription responseDescription;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private PropStat() {
|
||||||
|
this.prop = null;
|
||||||
|
this.status = null;
|
||||||
|
this.error = null;
|
||||||
|
this.responseDescription = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropStat(final Prop prop,
|
||||||
|
final Status status,
|
||||||
|
final Error error,
|
||||||
|
final ResponseDescription responseDescription) {
|
||||||
|
|
||||||
|
this.prop = Objects.requireNonNull(prop);
|
||||||
|
this.status = Objects.requireNonNull(status);
|
||||||
|
this.error = error;
|
||||||
|
this.responseDescription = responseDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropStat(final Prop prop, final Status status) {
|
||||||
|
this(prop, status, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropStat(final Prop prop, final Status status, final Error error) {
|
||||||
|
this(prop, status, error, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropStat(final Prop prop,
|
||||||
|
final Status status,
|
||||||
|
final ResponseDescription responseDescription) {
|
||||||
|
|
||||||
|
this(prop, status, null, responseDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Prop getProp() {
|
||||||
|
return this.prop;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Status getStatus() {
|
||||||
|
return this.status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Error getError() {
|
||||||
|
return this.error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final ResponseDescription getResponseDescription() {
|
||||||
|
return this.responseDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 3;
|
||||||
|
hash = 29 * hash + Objects.hashCode(prop);
|
||||||
|
hash = 29 * hash + Objects.hashCode(status);
|
||||||
|
hash = 29 * hash + Objects.hashCode(error);
|
||||||
|
hash = 29 * hash + Objects.hashCode(responseDescription);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof PropStat)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final PropStat other = (PropStat) obj;
|
||||||
|
if (!Objects.equals(prop, other.getProp())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(status, other.getStatus())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(error, other.getError())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Objects.equals(responseDescription,
|
||||||
|
other.getResponseDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ prop = %s,"
|
||||||
|
+ "status = %s, "
|
||||||
|
+ "error = %s, "
|
||||||
|
+ "responseDescription %s }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(prop),
|
||||||
|
Objects.toString(status),
|
||||||
|
Objects.toString(error),
|
||||||
|
Objects.toString(responseDescription));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlElements;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* WebDAV propertyupdate XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_propertyupdate">Chapter
|
||||||
|
* 14.19 "propertyupdate XML Element" of RFC 4918 "HTTP Extensions for Web
|
||||||
|
* Distributed Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "propertyupdate")
|
||||||
|
public final class PropertyUpdate {
|
||||||
|
|
||||||
|
@XmlElements({
|
||||||
|
@XmlElement(name = "remove", type = Remove.class)
|
||||||
|
, @XmlElement(name = "set", type = Set.class)})
|
||||||
|
private final List<RemoveOrSet> removesOrSets;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private PropertyUpdate() {
|
||||||
|
removesOrSets = new LinkedList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropertyUpdate(final RemoveOrSet removeOrSet,
|
||||||
|
final RemoveOrSet... removesOrSets) {
|
||||||
|
|
||||||
|
Objects.requireNonNull(removeOrSet);
|
||||||
|
this.removesOrSets = createList(removeOrSet, removesOrSets);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> List<T> createList(T first, T[] other) {
|
||||||
|
|
||||||
|
final List<T> list = new LinkedList<>();
|
||||||
|
list.add(first);
|
||||||
|
Collections.addAll(list, other);
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RemoveOrSet> list() {
|
||||||
|
return Collections.unmodifiableList(removesOrSets);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RemoveOrSet> getRemoveOrSets() {
|
||||||
|
return list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 79 * hash + Objects.hashCode(removesOrSets);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof PropertyUpdate)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final PropertyUpdate other = (PropertyUpdate) obj;
|
||||||
|
return Objects.equals(removesOrSets, other.getRemoveOrSets());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ removeOrSets = %s }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(removesOrSets));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* WebDAV remove XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_remove">Chapter
|
||||||
|
* 14.23 "remove XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement
|
||||||
|
public final class Remove extends RemoveOrSet {
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private Remove() {
|
||||||
|
// For unmarshalling only.
|
||||||
|
}
|
||||||
|
|
||||||
|
public Remove(final Prop prop) {
|
||||||
|
super(prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canEqual(final Object obj) {
|
||||||
|
return obj instanceof Remove;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Internal superclass of set and remove WebDAV elements.
|
||||||
|
*
|
||||||
|
* This class shall not be used directly, but instead <code>Set</code> and
|
||||||
|
* <code>Remove</code> classes should be used.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* @see Set
|
||||||
|
* @see Remove
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class RemoveOrSet {
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
private final Prop prop;
|
||||||
|
|
||||||
|
public final Prop getProp() {
|
||||||
|
return this.prop;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected RemoveOrSet() {
|
||||||
|
this.prop = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RemoveOrSet(final Prop prop) {
|
||||||
|
this.prop = Objects.requireNonNull(prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 67 * hash + Objects.hashCode(prop);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof RemoveOrSet)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final RemoveOrSet other = (RemoveOrSet) obj;
|
||||||
|
if (!other.canEqual(this)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Objects.equals(prop, other.getProp());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canEqual(final Object obj) {
|
||||||
|
return obj instanceof RemoveOrSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString(final String data) {
|
||||||
|
return String.format("%s{ prop = %s%s }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(prop),
|
||||||
|
data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final String toString() {
|
||||||
|
return toString("");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,216 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
|
import static java.util.Collections.*;
|
||||||
|
import static javax.xml.bind.annotation.XmlAccessType.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* WebDAV response XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_response">Chapter
|
||||||
|
* 14.24 "response XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(FIELD)
|
||||||
|
@XmlType(propOrder = {"hRefs", "status", "propStats", "error",
|
||||||
|
"responseDescription", "location"})
|
||||||
|
@XmlRootElement
|
||||||
|
public final class Response {
|
||||||
|
|
||||||
|
@XmlElement(name = "href")
|
||||||
|
private final List<HRef> hRefs;
|
||||||
|
|
||||||
|
private final Status status;
|
||||||
|
|
||||||
|
@XmlElement(name = "propstat")
|
||||||
|
private final List<PropStat> propStats;
|
||||||
|
|
||||||
|
private final Error error;
|
||||||
|
|
||||||
|
@XmlElement(name = "responsedescription")
|
||||||
|
private ResponseDescription responseDescription;
|
||||||
|
|
||||||
|
private Location location;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private Response() {
|
||||||
|
this(new LinkedList<HRef>(),
|
||||||
|
null,
|
||||||
|
new LinkedList<PropStat>(),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Response(final List<HRef> hRefs,
|
||||||
|
final Status status,
|
||||||
|
final List<PropStat> propStats,
|
||||||
|
final Error error,
|
||||||
|
final ResponseDescription responseDescription,
|
||||||
|
final Location location) {
|
||||||
|
this.hRefs = hRefs;
|
||||||
|
this.status = status;
|
||||||
|
this.propStats = propStats;
|
||||||
|
this.error = error;
|
||||||
|
this.responseDescription = responseDescription;
|
||||||
|
this.location = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Response(final HRef hRef,
|
||||||
|
final Error error,
|
||||||
|
final ResponseDescription responseDescription,
|
||||||
|
final Location location,
|
||||||
|
final PropStat propStat,
|
||||||
|
final PropStat... propStats) {
|
||||||
|
|
||||||
|
this(Collections.singletonList(hRef),
|
||||||
|
null,
|
||||||
|
createList(propStat, propStats),
|
||||||
|
error,
|
||||||
|
responseDescription, location);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Response(final Status status,
|
||||||
|
final Error error,
|
||||||
|
final ResponseDescription responseDescription,
|
||||||
|
final Location location,
|
||||||
|
final HRef hRef,
|
||||||
|
final HRef... hRefs) {
|
||||||
|
|
||||||
|
this(createList(hRef, hRefs),
|
||||||
|
Objects.requireNonNull(status),
|
||||||
|
Collections.<PropStat>emptyList(),
|
||||||
|
error,
|
||||||
|
responseDescription,
|
||||||
|
location);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> List<T> createList(T first, T[] other) {
|
||||||
|
|
||||||
|
final List<T> list = new LinkedList<>();
|
||||||
|
list.add(first);
|
||||||
|
Collections.addAll(list, other);
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final List<HRef> getHRefs() {
|
||||||
|
return unmodifiableList(this.hRefs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Status getStatus() {
|
||||||
|
return this.status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Error getError() {
|
||||||
|
return this.error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final ResponseDescription getResponseDescription() {
|
||||||
|
return this.responseDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Location getLocation() {
|
||||||
|
return this.location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final List<PropStat> getPropStats() {
|
||||||
|
return unmodifiableList(this.propStats);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 31 * hash + Objects.hashCode(hRefs);
|
||||||
|
hash = 31 * hash + Objects.hashCode(status);
|
||||||
|
hash = 31 * hash + Objects.hashCode(propStats);
|
||||||
|
hash = 31 * hash + Objects.hashCode(error);
|
||||||
|
hash = 31 * hash + Objects.hashCode(responseDescription);
|
||||||
|
hash = 31 * hash + Objects.hashCode(location);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof Response)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final Response other = (Response) obj;
|
||||||
|
if (!Objects.equals(hRefs, other.getHRefs())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(status, other.getStatus())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(propStats, other.getPropStats())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(error, other.getError())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(responseDescription,
|
||||||
|
other.getResponseDescription())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Objects.equals(location, other.getLocation());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ hRefs = %s, "
|
||||||
|
+ "status = %s, "
|
||||||
|
+ "propStats = %s,"
|
||||||
|
+ "error = %s,"
|
||||||
|
+ "responseDescription = %s }",
|
||||||
|
super.toString(),
|
||||||
|
Objects.toString(hRefs),
|
||||||
|
Objects.toString(status),
|
||||||
|
Objects.toString(propStats),
|
||||||
|
Objects.toString(error),
|
||||||
|
Objects.toString(responseDescription));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlValue;
|
||||||
|
|
||||||
|
import static javax.xml.bind.annotation.XmlAccessType.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* WebDAV responsedescription XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_responsedescription">Chapter
|
||||||
|
* 14.25 "responsedescription XML Element" of RFC 4918 "HTTP Extensions for Web
|
||||||
|
* Distributed Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(NONE)
|
||||||
|
@XmlRootElement(name = "responsedescription")
|
||||||
|
public final class ResponseDescription {
|
||||||
|
|
||||||
|
@XmlValue
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private ResponseDescription() {
|
||||||
|
// For unmarshalling only.
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseDescription(final String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 3;
|
||||||
|
hash = 67 * hash + Objects.hashCode(content);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof ResponseDescription)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final ResponseDescription other = (ResponseDescription) obj;
|
||||||
|
return Objects.equals(content, other.getContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ content = \"%s\" }",
|
||||||
|
super.toString(),
|
||||||
|
content);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RFC 1123 date format
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* This class formats and parses dates using the RFC 1123 compliant pattern
|
||||||
|
* [WDY], [DY] [MTH] [YEAR] [hh]:[mm]:[ss] GMT.
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public final class Rfc1123DateFormat extends SimpleDateFormat {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 7064959972169916377L;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Rfc1123DateFormat() {
|
||||||
|
super("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
|
||||||
|
this.calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,127 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* /**
|
||||||
|
* RFC 3339 date-time format
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This class formats and parses dates using the ISO 8601 compliant pattern
|
||||||
|
* [YYYY]-[MM]-[DD]T[hh]:[mm]:[ss].([fff])[OFS]. Parsing and formatting are
|
||||||
|
* handled in different ways to provide at-most stability and compatibility.
|
||||||
|
* While formatting always will produce a String in full UTC notation
|
||||||
|
* (containing time offset literal 'Z' and fraction of seconds), parsing is
|
||||||
|
* flexible and can handle not only optional fraction of seconds, but also
|
||||||
|
* numeric time offsets in addition to the time offset literal 'Z'.
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public final class Rfc3339DateTimeFormat extends SimpleDateFormat {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 5892844197992067945L;
|
||||||
|
|
||||||
|
private static final String DEFAULT_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
|
||||||
|
|
||||||
|
public Rfc3339DateTimeFormat() {
|
||||||
|
super(DEFAULT_PATTERN, Locale.US);
|
||||||
|
this.calendar = Calendar
|
||||||
|
.getInstance(TimeZone.getTimeZone("UTC"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final Date parse(final String text) throws ParseException {
|
||||||
|
final String patchedText = this.ignoreTimeOffsetColon(text);
|
||||||
|
|
||||||
|
final String pattern = this.buildPatternVariant(patchedText);
|
||||||
|
|
||||||
|
if (!pattern.equals(DEFAULT_PATTERN)) {
|
||||||
|
this.applyPattern(pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.parse(patchedText);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildPatternVariant(final String text) {
|
||||||
|
|
||||||
|
final StringBuilder pattern = new StringBuilder("yyyy-MM-dd'T'HH:mm:ss");
|
||||||
|
this.addFractionToPattern(pattern, text);
|
||||||
|
this.addTimeOffsetToPattern(pattern, text);
|
||||||
|
return pattern.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addFractionToPattern(final StringBuilder pattern,
|
||||||
|
final String text) {
|
||||||
|
|
||||||
|
if (text.lastIndexOf('.') != -1) {
|
||||||
|
pattern.append(".SSS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addTimeOffsetToPattern(final StringBuilder pattern,
|
||||||
|
final String text) {
|
||||||
|
|
||||||
|
final boolean appendAsLiteral = text.charAt(text.length() - 1) == 'Z';
|
||||||
|
|
||||||
|
if (appendAsLiteral) {
|
||||||
|
pattern.append('\'');
|
||||||
|
}
|
||||||
|
|
||||||
|
pattern.append('Z');
|
||||||
|
|
||||||
|
if (appendAsLiteral) {
|
||||||
|
pattern.append('\'');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String ignoreTimeOffsetColon(final String text)
|
||||||
|
throws ParseException {
|
||||||
|
|
||||||
|
if (text == null || text.isEmpty()) {
|
||||||
|
throw new ParseException("Cannot parse empty text", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text.charAt(text.length() - 1) == 'Z') {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text.charAt(text.length() - 3) != ':') {
|
||||||
|
throw new ParseException(
|
||||||
|
"According to RFC 3339 time offset must contain colon separator.",
|
||||||
|
text.length() - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new StringBuilder(text).deleteCharAt(text.length() - 3)
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* WebDAV set XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_set">Chapter
|
||||||
|
* 14.26 "set XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement
|
||||||
|
public final class Set extends RemoveOrSet {
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private Set() {
|
||||||
|
// For unmarshalling only.
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set(final Prop prop) {
|
||||||
|
super(prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canEqual(final Object obj) {
|
||||||
|
return obj instanceof Set;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* WebDAV shared XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* This is a singleton. All instances are absolutely identical, hence can be
|
||||||
|
* compared using {@code ==} and share one unique hash code. Use {@link #SHARED}
|
||||||
|
* always.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_shared">Chapter
|
||||||
|
* 14.27 "shared XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*/
|
||||||
|
@XmlRootElement
|
||||||
|
@XmlType(factoryMethod = "createSingleton")
|
||||||
|
public final class Shared {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton instance, providing improved performance and the ability to
|
||||||
|
* compare by <em>same</em> instance.
|
||||||
|
*
|
||||||
|
* @since 1.2
|
||||||
|
*/
|
||||||
|
public static final Shared SHARED = new Shared();
|
||||||
|
|
||||||
|
private static Shared createSingleton() {
|
||||||
|
return SHARED;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Shared() {
|
||||||
|
// For unmarshalling only.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final String toString() {
|
||||||
|
return getClass().getSimpleName();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlValue;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
import static javax.xml.bind.annotation.XmlAccessType.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* WebDAV status XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_status">Chapter
|
||||||
|
* 14.28 "status XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(NONE)
|
||||||
|
@XmlRootElement
|
||||||
|
public final class Status {
|
||||||
|
|
||||||
|
@XmlValue
|
||||||
|
private String statusLine;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private Status() {
|
||||||
|
// For unmarshalling only.
|
||||||
|
}
|
||||||
|
|
||||||
|
private Status(final int statusCode, final String reasonPhrase) {
|
||||||
|
this.statusLine = String.format("HTTP/1.1 %d %s",
|
||||||
|
statusCode,
|
||||||
|
reasonPhrase);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Status(final Response.StatusType responseStatus) {
|
||||||
|
this(responseStatus.getStatusCode(), responseStatus.getReasonPhrase());
|
||||||
|
}
|
||||||
|
|
||||||
|
public final String getStatus() {
|
||||||
|
return statusLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 89 * hash + Objects.hashCode(statusLine);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof Status)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final Status other = (Status) obj;
|
||||||
|
return Objects.equals(statusLine, other.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ statusLine = \"%s\" }",
|
||||||
|
super.toString(),
|
||||||
|
statusLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,195 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import org.libreccm.webdav.ConstantsAdapter;
|
||||||
|
import org.libreccm.webdav.Headers;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlValue;
|
||||||
|
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||||
|
|
||||||
|
import static java.lang.Long.*;
|
||||||
|
import static java.util.Collections.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* WebDAV timeout XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_timeout">Chapter
|
||||||
|
* 14.29 "timeout XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
|
@XmlRootElement(name = "timeout")
|
||||||
|
@XmlJavaTypeAdapter(TimeOut.Adapter.class)
|
||||||
|
public final class TimeOut {
|
||||||
|
|
||||||
|
private static final long INFINITE_VALUE = Long.MAX_VALUE;
|
||||||
|
|
||||||
|
private static final String INFINITE_TOKEN = Headers.TIMEOUT_INFINITE;
|
||||||
|
|
||||||
|
private static final String SECOND_TOKEN = Headers.TIMEOUT_SECOND + "%d";
|
||||||
|
|
||||||
|
public static final TimeOut INFINITE = new TimeOut();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of seconds, or {@link #INFINITE_VALUE} for infinite timeout.
|
||||||
|
*/
|
||||||
|
private long timeType;
|
||||||
|
|
||||||
|
private TimeOut() {
|
||||||
|
this(INFINITE_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimeOut(final long seconds) {
|
||||||
|
this.timeType = seconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlValue
|
||||||
|
private String getTimeType() {
|
||||||
|
|
||||||
|
if (timeType == INFINITE_VALUE) {
|
||||||
|
return INFINITE_TOKEN;
|
||||||
|
} else {
|
||||||
|
return String.format(SECOND_TOKEN, timeType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTimeType(final String timeType) {
|
||||||
|
|
||||||
|
if (isInfinite(timeType)) {
|
||||||
|
this.timeType = INFINITE_VALUE;
|
||||||
|
} else {
|
||||||
|
this.timeType = parseSecond(timeType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isInfinite(final String timeType) {
|
||||||
|
return INFINITE_TOKEN.equals(timeType);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static long parseSecond(final String timeType) {
|
||||||
|
return parseLong(timeType.substring(timeType.lastIndexOf('-') + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean isInfinite() {
|
||||||
|
return this.timeType == INFINITE_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The duration of the timeout in seconds, or {@link Long#MAX_VALUE}
|
||||||
|
* for infinity. Note that future versions will return null for
|
||||||
|
* infinity.
|
||||||
|
*/
|
||||||
|
public final long getSeconds() {
|
||||||
|
return this.timeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory method creating {@link TimeOut} instances from {@code String}
|
||||||
|
* value representations (e. g. as used in HTTP {@link Headers#TIMEOUT}
|
||||||
|
* header). Guarantees that {@link #INFINITE} singleton is returned for
|
||||||
|
* {@code "Infinite"} string, hence allowing to compare for infinity using
|
||||||
|
* {@code ==} comparison.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* TimeOut to = TimeOut.valueOf("Infinite");
|
||||||
|
* if (to == Timeout.INFINITE) { ... }
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @param timeType Either {@code Second-n} (where {@code n} is the length of
|
||||||
|
* the timeout) or {@code Infinite}.
|
||||||
|
*
|
||||||
|
* @return An instance of {@link TimeOut} with the length taken from the
|
||||||
|
* {@code timeOutHeader} string. Instance is guaranteed to be
|
||||||
|
* {@link #INFINITE} in case {@code timeOutHeader} is
|
||||||
|
* {@code "Infinity"}.
|
||||||
|
*
|
||||||
|
* @since 1.2.1
|
||||||
|
*/
|
||||||
|
public static final TimeOut valueOf(final String timeType) {
|
||||||
|
|
||||||
|
if (isInfinite(timeType)) {
|
||||||
|
return INFINITE;
|
||||||
|
} else {
|
||||||
|
return new TimeOut(parseSecond(timeType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 5;
|
||||||
|
hash = 53 * hash + (int) (timeType ^ (timeType >>> 32));
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof TimeOut)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final TimeOut other = (TimeOut) obj;
|
||||||
|
return timeType == Long.parseLong(other.getTimeType());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ %s }",
|
||||||
|
super.toString(),
|
||||||
|
Long.toString(timeType));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Guarantees that any unmarshalled enum constants effectively are the
|
||||||
|
* constant Java instances itself, so that {@code ==} can be used form
|
||||||
|
* comparison.
|
||||||
|
*
|
||||||
|
* @since 1.2
|
||||||
|
*/
|
||||||
|
protected static final class Adapter extends ConstantsAdapter<TimeOut> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final Collection<TimeOut> getConstants() {
|
||||||
|
return singleton(INFINITE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* WebDAV write XML Element.
|
||||||
|
*
|
||||||
|
* The class is based on a class/interface from java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* This is a singleton. All instances are absolutely identical, hence can be
|
||||||
|
* compared using {@code ==} and share one unique hash code. Use {@link #WRITE}
|
||||||
|
* always.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Markus KARG (mkarg@java.net)
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_write">Chapter
|
||||||
|
* 14.30 "write XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
|
||||||
|
* Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement
|
||||||
|
@XmlType(factoryMethod = "createSingleton")
|
||||||
|
public final class Write {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton instance, providing improved performance and the ability to
|
||||||
|
* compare by <em>same</em> instance.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final Write WRITE = new Write();
|
||||||
|
|
||||||
|
private static Write createSingleton() {
|
||||||
|
return WRITE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Write() {
|
||||||
|
// For unmarshalling only.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return getClass().getSimpleName();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* This package contains WebDAV XML Elements.
|
||||||
|
*
|
||||||
|
* The classes in this package are based on the classes from the
|
||||||
|
* java.net WebDAV Project:
|
||||||
|
*
|
||||||
|
* <a href="https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java">https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java</a>
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:mkarg@java.net">Markus Karg</a>
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*
|
||||||
|
* @see <a href="http://www.webdav.org/specs/rfc4918.html#xml.element.definitions">Chapter 14 "XML Element Definitions" of RFC 4918 "HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)"</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlSchema(namespace = "DAV:",
|
||||||
|
xmlns = @XmlNs(prefix = "D", namespaceURI = "DAV:"),
|
||||||
|
elementFormDefault = QUALIFIED)
|
||||||
|
package org.libreccm.webdav.xml.elements;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlNs;
|
||||||
|
import javax.xml.bind.annotation.XmlSchema;
|
||||||
|
|
||||||
|
import static javax.xml.bind.annotation.XmlNsForm.*;
|
||||||
|
|
||||||
Loading…
Reference in New Issue