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));
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Exclusive.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Exclusive.java
new file mode 100644
index 000000000..1e636e924
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Exclusive.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ *
+ * 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.
+ *
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.6 "exclusive XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ */
+@XmlRootElement
+@XmlType(factoryMethod = "createSingleton")
+public class Exclusive {
+
+ /**
+ * Singleton instance, providing improved performance and the ability to
+ * compare by same 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();
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/HRef.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/HRef.java
new file mode 100644
index 000000000..c3bc5204a
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/HRef.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see Chapter
+ * 14.7 "href XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ *
+ */
+@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 URI instance, if the value is a valid
+ * URI; null 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);
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Include.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Include.java
new file mode 100644
index 000000000..22fa062ca
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Include.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.8 "include XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ */
+@XmlRootElement
+public final class Include {
+
+ @XmlAnyElement(lax = true)
+ private final List 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 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));
+ }
+
+
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Location.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Location.java
new file mode 100644
index 000000000..e46a0c747
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Location.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.9 "location XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ *
+ */
+@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));
+ }
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockEntry.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockEntry.java
new file mode 100644
index 000000000..1065927ea
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockEntry.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.10 "lockentry XML Element" of RFC 4918 "HTTP Extensions for Web
+ * Distributed Authoring and Versioning (WebDAV)"
+ *
+ */
+@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));
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockInfo.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockInfo.java
new file mode 100644
index 000000000..50bd5d72e
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockInfo.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.11 "lockinfo XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ *
+ */
+@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));
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockRoot.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockRoot.java
new file mode 100644
index 000000000..f458e0706
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockRoot.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.12 "lockroot XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ *
+ */
+@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));
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockScope.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockScope.java
new file mode 100644
index 000000000..41b7aa873
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockScope.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.13 "lockscope XML Element" of RFC 4918 "HTTP Extensions for Web
+ * Distributed Authoring and Versioning (WebDAV)"
+ *
+ */
+@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 {
+
+ @Override
+ protected final Collection 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));
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockToken.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockToken.java
new file mode 100644
index 000000000..a7df3c5c3
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockToken.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.4 "locktoken XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ *
+ *
+ */
+@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));
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockType.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockType.java
new file mode 100644
index 000000000..a3125e6a2
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/LockType.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ *
+ * 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.
+ *
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.15 "locktype XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlRootElement(name = "locktype")
+@XmlType(factoryMethod = "createSingleton")
+public final class LockType {
+
+ /**
+ * Singleton instance, providing improved performance and the ability to
+ * compare by same 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));
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/MultiStatus.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/MultiStatus.java
new file mode 100644
index 000000000..eb0307edb
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/MultiStatus.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.16 "multistatus XML Element" of RFC 4918 "HTTP Extensions for Web
+ * Distributed Authoring and Versioning (WebDAV)"
+ *
+ */
+@XmlType(propOrder = {"responses", "responseDescription"})
+@XmlRootElement(name = "multistatus")
+public final class MultiStatus {
+
+ @XmlElement(name = "response")
+ private final List 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 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));
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Owner.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Owner.java
new file mode 100644
index 000000000..776b3932f
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Owner.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see Chapter
+ * 14.17 "owner XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ */
+@XmlRootElement
+public final class Owner {
+
+ @XmlMixed
+ @XmlAnyElement(lax = true)
+ private final List any;
+
+ private Owner() {
+ any = new LinkedList<>();
+ }
+
+ public Owner(final Object... any) {
+
+ Objects.requireNonNull(any);
+ this.any = Arrays.asList(any);
+ }
+
+ public final List 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));
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Prop.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Prop.java
new file mode 100644
index 000000000..c248fd4db
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Prop.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see Chapter
+ * 14.18 "prop XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ *
+ */
+@XmlRootElement
+public final class Prop {
+
+ @XmlAnyElement(lax = true)
+ private final List properties;
+
+ @SuppressWarnings("unused")
+ private Prop() {
+ // For unmarshalling only.
+ properties = new LinkedList<>();
+ }
+
+ public Prop(final Object... any) {
+ properties = Arrays.asList(any);
+ }
+
+ public final List 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));
+ }
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/PropFind.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/PropFind.java
new file mode 100644
index 000000000..642576904
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/PropFind.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.20 "propfind XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ *
+ */
+@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));
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/PropName.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/PropName.java
new file mode 100644
index 000000000..a2836233b
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/PropName.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ *
+ * 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
+ * Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.21 "propname XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ *
+ */
+@XmlRootElement(name = "propname")
+@XmlType(factoryMethod = "createSingleton")
+public final class PropName {
+
+ /**
+ * Singleton instance, providing improved performance and the ability to
+ * compare by same 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();
+ }
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/PropStat.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/PropStat.java
new file mode 100644
index 000000000..2a8d7394f
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/PropStat.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.22 "propstat XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ *
+ */
+@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));
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/PropertyUpdate.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/PropertyUpdate.java
new file mode 100644
index 000000000..254c9ad60
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/PropertyUpdate.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.19 "propertyupdate XML Element" of RFC 4918 "HTTP Extensions for Web
+ * Distributed Authoring and Versioning (WebDAV)"
+ *
+ *
+ */
+@XmlRootElement(name = "propertyupdate")
+public final class PropertyUpdate {
+
+ @XmlElements({
+ @XmlElement(name = "remove", type = Remove.class)
+ , @XmlElement(name = "set", type = Set.class)})
+ private final List 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 List createList(T first, T[] other) {
+
+ final List list = new LinkedList<>();
+ list.add(first);
+ Collections.addAll(list, other);
+
+ return list;
+ }
+
+ public List list() {
+ return Collections.unmodifiableList(removesOrSets);
+ }
+
+ public List 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));
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Remove.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Remove.java
new file mode 100644
index 000000000..72a5252fc
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Remove.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.23 "remove XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ *
+ *
+ */
+@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;
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/RemoveOrSet.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/RemoveOrSet.java
new file mode 100644
index 000000000..56d04c905
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/RemoveOrSet.java
@@ -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 Set and
+ * Remove classes should be used.
+ *
+ * The class is based on a class/interface from java.net WebDAV Project:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ * @see Set
+ * @see Remove
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ */
+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("");
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Response.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Response.java
new file mode 100644
index 000000000..f10589b65
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Response.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.24 "response XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ *
+ */
+@XmlAccessorType(FIELD)
+@XmlType(propOrder = {"hRefs", "status", "propStats", "error",
+ "responseDescription", "location"})
+@XmlRootElement
+public final class Response {
+
+ @XmlElement(name = "href")
+ private final List hRefs;
+
+ private final Status status;
+
+ @XmlElement(name = "propstat")
+ private final List propStats;
+
+ private final Error error;
+
+ @XmlElement(name = "responsedescription")
+ private ResponseDescription responseDescription;
+
+ private Location location;
+
+ @SuppressWarnings("unused")
+ private Response() {
+ this(new LinkedList(),
+ null,
+ new LinkedList(),
+ null,
+ null,
+ null);
+ }
+
+ private Response(final List hRefs,
+ final Status status,
+ final List 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.emptyList(),
+ error,
+ responseDescription,
+ location);
+ }
+
+ private static List createList(T first, T[] other) {
+
+ final List list = new LinkedList<>();
+ list.add(first);
+ Collections.addAll(list, other);
+
+ return list;
+ }
+
+ public final List 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 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));
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/ResponseDescription.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/ResponseDescription.java
new file mode 100644
index 000000000..e21e1e5f9
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/ResponseDescription.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.25 "responsedescription XML Element" of RFC 4918 "HTTP Extensions for Web
+ * Distributed Authoring and Versioning (WebDAV)"
+ *
+ */
+@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);
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Rfc1123DateFormat.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Rfc1123DateFormat.java
new file mode 100644
index 000000000..bae1eab1d
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Rfc1123DateFormat.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ * 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 Jens Pelzetter
+ */
+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"));
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Rfc3339DateTimeFormat.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Rfc3339DateTimeFormat.java
new file mode 100644
index 000000000..b69d0cdc4
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Rfc3339DateTimeFormat.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ *
+ * 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 Jens Pelzetter
+ *
+ */
+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();
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Set.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Set.java
new file mode 100644
index 000000000..b9d2c7b51
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Set.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see Chapter
+ * 14.26 "set XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ *
+ */
+@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;
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Shared.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Shared.java
new file mode 100644
index 000000000..4445b0f09
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Shared.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ * 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 Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.27 "shared XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ */
+@XmlRootElement
+@XmlType(factoryMethod = "createSingleton")
+public final class Shared {
+
+ /**
+ * Singleton instance, providing improved performance and the ability to
+ * compare by same 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();
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Status.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Status.java
new file mode 100644
index 000000000..b702a0e65
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Status.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.28 "status XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ */
+@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);
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/TimeOut.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/TimeOut.java
new file mode 100644
index 000000000..a04138d35
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/TimeOut.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see
+ * Chapter
+ * 14.29 "timeout XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ */
+@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:
+ *
+ *
+ * TimeOut to = TimeOut.valueOf("Infinite");
+ * if (to == Timeout.INFINITE) { ... }
+ *
+ *
+ * @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 {
+
+ @Override
+ protected final Collection getConstants() {
+ return singleton(INFINITE);
+ }
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Write.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Write.java
new file mode 100644
index 000000000..f955eb24e
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/Write.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ *
+ * 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.
+ *
+ *
+ * @author Markus KARG (mkarg@java.net)
+ * @author Jens Pelzetter
+ *
+ * @see Chapter
+ * 14.30 "write XML Element" of RFC 4918 "HTTP Extensions for Web Distributed
+ * Authoring and Versioning (WebDAV)"
+ *
+ *
+ */
+@XmlRootElement
+@XmlType(factoryMethod = "createSingleton")
+public final class Write {
+
+ /**
+ * Singleton instance, providing improved performance and the ability to
+ * compare by same 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();
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/package-info.java b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/package-info.java
new file mode 100644
index 000000000..cd6ac3185
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/webdav/xml/elements/package-info.java
@@ -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:
+ *
+ * https://gitlab.com/headcrashing/webdav-jaxrs/blob/master/src/main/java/net/java/dev/webdav/jaxrs/Headers.java
+ *
+ * @author Markus Karg
+ * @author Jens Pelzetter
+ *
+ * @see Chapter 14 "XML Element Definitions" of RFC 4918 "HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)"
+ *
+ */
+@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.*;
+