From 7a2c9c7c9a76569abf98567ca094b26693c60651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Schild?= Date: Fri, 29 Sep 2023 12:30:35 +0200 Subject: [PATCH] Switch to jakarta xml stuff for simpler Java 11+ compatibility The api remains identical, except the places where javax.xml stuff was exposed They now use the jakarta.xml names Bump all dependencies to latest versions, also build environment Added Cyclode DX SBOM --- Changelog.md | 12 + README.md | 7 +- nb-configuration.xml | 2 +- pom.xml | 227 ++++++++++++------ .../config/AppConfigAppKeyValueAnswer.java | 8 +- .../api/config/AppConfigAppsAnswer.java | 10 +- .../nextcloud/api/filesharing/ItemType.java | 6 +- .../nextcloud/api/filesharing/Share.java | 10 +- .../nextcloud/api/filesharing/ShareType.java | 6 +- .../api/filesharing/SharesXMLAnswer.java | 6 +- .../api/filesharing/SingleShareXMLAnswer.java | 4 +- .../api/utils/InstantXmlAdapter.java | 2 +- .../nextcloud/api/utils/ListXMLAnswer.java | 6 +- .../api/utils/LocalDateXmlAdapter.java | 2 +- .../nextcloud/api/utils/XMLAnswer.java | 9 +- .../nextcloud/api/utils/XMLAnswerParser.java | 6 +- 16 files changed, 215 insertions(+), 108 deletions(-) diff --git a/Changelog.md b/Changelog.md index 80d6b17..97a2c1c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,4 +1,14 @@ # Changelog for nextcloud api +## Version 13 +- 2023-09-29 + - Release 13.0.0 + -- Switch to jakarta xml stuff for simpler Java 11+ compatibility + -- The api remains identical, except the places where javax.xml stuff was exposed + They now use the jakarta.xml names + -- Bump all dependencies to latest versions, also build environment + -- Added Cyclode DX SBOM + +## Version 12 - 2023-09-29 - Release 12.0.5, added bearer authentication for non-webdav calls (Thanks to Arnout Engelen) - 2022-11-29 @@ -18,6 +28,8 @@ - The getQuota() method now returns an Optional, to handle the case when no quota is set at all (Allowing unlimited storage) Thanks @kriszman for the patches + +## Version 11 - 2021-10-13 - Prepare 11.7.0-SNAPSHOT - Fix downloadFolder() when having special chars in folder name(s) diff --git a/README.md b/README.md index 29e34a4..087412b 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Java api library to access nextcloud features from java applications - Management of groups - Folder management (Without access control) - List shares and create new file shares (No way to delete/update shares atm.) -- Tested against nextCloud 23.0.2 server version, but should also work with older nextCloud and ownCloud systems +- Tested against nextCloud 27.0.1 server version, but should also work with older nextCloud and ownCloud systems ## Usage - Add this dependency to your pom.xml file @@ -19,10 +19,13 @@ Java api library to access nextcloud features from java applications com.github.a-schild nextcloud-java-api - 12.0.5 + 13.0.0 ``` +- The 13.x versions are now using the jakarta.xml binding stuff, to prevent problems with Java 11+ + No API changes have been made in v13, but at some places the XML stuff is exposed + Which made it necessary to bump the major version number - Create a NextcloudConnector instance and provide your server settings and authentification - Now you can use the methods exposed to access your nextcloud instance diff --git a/nb-configuration.xml b/nb-configuration.xml index 23f0477..2bc8c8a 100644 --- a/nb-configuration.xml +++ b/nb-configuration.xml @@ -15,6 +15,6 @@ Any value defined here will override the pom.xml file value but is only applicab --> gpl30 true - JDK_1.8 + JDK_1.8_ZULU diff --git a/pom.xml b/pom.xml index 75412e0..f3677ca 100644 --- a/pom.xml +++ b/pom.xml @@ -3,25 +3,47 @@ 4.0.0 org.aarboard.nextcloud nextcloud-api - 12.0.4 + 13.0.0 jar + + 4.4.16 + 4.1.5 + 4.5.14 + 2.0.9 + 5.12 + 2.13.0 + 3.13.0 + 1.16.0 + 2.15.2 + 4.0.1 + 2.1.1 + 3.0.0 + + + ${slf4j-api.version} + 4.0.3 + 4.13.2 + + UTF-8 + 3.11.0 + 3.1.0 + 3.0.1 + 3.3.1 + 3.1.0 + 1.0.0 + 3.1.1 + 1.6.13 + 3.3.0 + 3.6.0 + 2.0.1 + 3.1.0 + 3.1.2 + 2.7.9 + 1.8 1.8 - 4.13.2 - 4.4.15 - 4.1.5 - 4.5.13 - 1.7.36 - 1.7.36 - 5.10 - 2.11.0 - 3.12.0 - 1.15 - 2.3.3 - 3.0.2 - 2.14.1 gpl30 NextCloud Java API library @@ -72,14 +94,6 @@ ${slf4j-api.version} - - - org.slf4j - slf4j-simple - ${slf4j-simple.version} - test - - com.github.lookfirst sardine @@ -110,6 +124,11 @@ jakarta.xml.bind-api ${jakarta.xml.bind-api.version} + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-api.version} + org.glassfish.jaxb @@ -117,19 +136,33 @@ ${jaxb-runtime.version} + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + + + + org.slf4j + slf4j-simple + ${slf4j-simple.version} + test + junit junit ${junit.version} test - + - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - + com.sun.xml.bind + jaxb-impl + ${jaxb-impl.version} + test + @@ -163,7 +196,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + ${maven-gpg-plugin.version} sign-artifacts @@ -174,6 +207,33 @@ + + org.cyclonedx + cyclonedx-maven-plugin + ${cyclonedx-maven-plugin.version} + + + package + + makeAggregateBom + + + + + library + 1.4 + true + true + true + true + true + false + false + true + all + nextcloud-api-${project.version}-sbom + + @@ -183,52 +243,56 @@ org.apache.maven.plugins maven-compiler-plugin - 2.3.2 + ${maven-compiler-plugin.version} ${project.build.sourceEncoding} + ${maven.compiler.source} + ${maven.compiler.target} + ${maven.compiler.source} + ${maven.compiler.target} org.apache.maven.plugins maven-resources-plugin - 2.4.3 + ${maven-resources-plugin.version} ${project.build.sourceEncoding} - org.codehaus.mojo - buildnumber-maven-plugin - 1.4 - - - validate - - create - - - - - true - true - - - - org.codehaus.mojo - templating-maven-plugin - 1.0.0 - - - generate-verion-class - - filter-sources - - - + org.codehaus.mojo + buildnumber-maven-plugin + ${buildnumber-maven-plugin.version} + + + validate + + create + + + + + false + true + + + + org.codehaus.mojo + templating-maven-plugin + ${templating-maven-plugin.version} + + + generate-verion-class + + filter-sources + + + maven-deploy-plugin - 2.8.2 + ${maven-deploy-plugin.version} default-deploy @@ -242,7 +306,7 @@ org.apache.maven.plugins maven-release-plugin - 2.5.3 + ${maven-release-plugin.version} true false @@ -253,14 +317,14 @@ org.apache.maven.scm maven-scm-provider-gitexe - 1.9.5 + ${maven-scm-provider-gitexe.version} org.sonatype.plugins nexus-staging-maven-plugin - 1.6.7 + ${nexus-staging-maven-plugin.version} true ossrh @@ -271,7 +335,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + ${maven-source-plugin.version} attach-sources @@ -284,8 +348,8 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.9.1 - + ${maven-javadoc-plugin.version} + 8 @@ -300,7 +364,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 + ${maven-gpg-plugin.version} sign-artifacts @@ -314,7 +378,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.15 + ${maven-surefire-plugin.version} @@ -336,6 +400,33 @@ + + org.cyclonedx + cyclonedx-maven-plugin + ${cyclonedx-maven-plugin.version} + + + package + + makeAggregateBom + + + + + library + 1.4 + true + true + true + true + true + false + false + true + all + nextcloud-api-${project.version}-sbom + + diff --git a/src/main/java/org/aarboard/nextcloud/api/config/AppConfigAppKeyValueAnswer.java b/src/main/java/org/aarboard/nextcloud/api/config/AppConfigAppKeyValueAnswer.java index 5fbace2..27d7922 100644 --- a/src/main/java/org/aarboard/nextcloud/api/config/AppConfigAppKeyValueAnswer.java +++ b/src/main/java/org/aarboard/nextcloud/api/config/AppConfigAppKeyValueAnswer.java @@ -16,11 +16,11 @@ */ package org.aarboard.nextcloud.api.config; -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 jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; import org.aarboard.nextcloud.api.utils.XMLAnswer; @XmlRootElement(name = "ocs") diff --git a/src/main/java/org/aarboard/nextcloud/api/config/AppConfigAppsAnswer.java b/src/main/java/org/aarboard/nextcloud/api/config/AppConfigAppsAnswer.java index c877bfa..a4e0d2b 100644 --- a/src/main/java/org/aarboard/nextcloud/api/config/AppConfigAppsAnswer.java +++ b/src/main/java/org/aarboard/nextcloud/api/config/AppConfigAppsAnswer.java @@ -16,12 +16,12 @@ */ package org.aarboard.nextcloud.api.config; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElementWrapper; +import jakarta.xml.bind.annotation.XmlRootElement; import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlRootElement; import org.aarboard.nextcloud.api.utils.XMLAnswer; @XmlRootElement(name = "ocs") diff --git a/src/main/java/org/aarboard/nextcloud/api/filesharing/ItemType.java b/src/main/java/org/aarboard/nextcloud/api/filesharing/ItemType.java index c7fe1bd..6398742 100644 --- a/src/main/java/org/aarboard/nextcloud/api/filesharing/ItemType.java +++ b/src/main/java/org/aarboard/nextcloud/api/filesharing/ItemType.java @@ -16,10 +16,10 @@ */ package org.aarboard.nextcloud.api.filesharing; +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; import java.security.InvalidParameterException; -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; /** * diff --git a/src/main/java/org/aarboard/nextcloud/api/filesharing/Share.java b/src/main/java/org/aarboard/nextcloud/api/filesharing/Share.java index b10b5ac..1a23784 100644 --- a/src/main/java/org/aarboard/nextcloud/api/filesharing/Share.java +++ b/src/main/java/org/aarboard/nextcloud/api/filesharing/Share.java @@ -16,13 +16,13 @@ */ package org.aarboard.nextcloud.api.filesharing; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.adapters.XmlAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import java.time.Instant; import java.time.LocalDate; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.adapters.XmlAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.aarboard.nextcloud.api.utils.InstantXmlAdapter; import org.aarboard.nextcloud.api.utils.LocalDateXmlAdapter; diff --git a/src/main/java/org/aarboard/nextcloud/api/filesharing/ShareType.java b/src/main/java/org/aarboard/nextcloud/api/filesharing/ShareType.java index 1d88ef8..174b034 100644 --- a/src/main/java/org/aarboard/nextcloud/api/filesharing/ShareType.java +++ b/src/main/java/org/aarboard/nextcloud/api/filesharing/ShareType.java @@ -16,10 +16,10 @@ */ package org.aarboard.nextcloud.api.filesharing; +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; import java.security.InvalidParameterException; -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; /** * https://docs.nextcloud.com/server/11/developer_manual/core/ocs-share-api.html diff --git a/src/main/java/org/aarboard/nextcloud/api/filesharing/SharesXMLAnswer.java b/src/main/java/org/aarboard/nextcloud/api/filesharing/SharesXMLAnswer.java index 75b46de..3f1fd12 100644 --- a/src/main/java/org/aarboard/nextcloud/api/filesharing/SharesXMLAnswer.java +++ b/src/main/java/org/aarboard/nextcloud/api/filesharing/SharesXMLAnswer.java @@ -16,10 +16,10 @@ */ package org.aarboard.nextcloud.api.filesharing; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElementWrapper; +import jakarta.xml.bind.annotation.XmlRootElement; import java.util.List; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlRootElement; import org.aarboard.nextcloud.api.utils.XMLAnswer; /** diff --git a/src/main/java/org/aarboard/nextcloud/api/filesharing/SingleShareXMLAnswer.java b/src/main/java/org/aarboard/nextcloud/api/filesharing/SingleShareXMLAnswer.java index 6a07829..9720948 100644 --- a/src/main/java/org/aarboard/nextcloud/api/filesharing/SingleShareXMLAnswer.java +++ b/src/main/java/org/aarboard/nextcloud/api/filesharing/SingleShareXMLAnswer.java @@ -16,8 +16,8 @@ */ package org.aarboard.nextcloud.api.filesharing; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; import org.aarboard.nextcloud.api.utils.XMLAnswer; /** diff --git a/src/main/java/org/aarboard/nextcloud/api/utils/InstantXmlAdapter.java b/src/main/java/org/aarboard/nextcloud/api/utils/InstantXmlAdapter.java index bcf3875..abb55c0 100644 --- a/src/main/java/org/aarboard/nextcloud/api/utils/InstantXmlAdapter.java +++ b/src/main/java/org/aarboard/nextcloud/api/utils/InstantXmlAdapter.java @@ -1,8 +1,8 @@ package org.aarboard.nextcloud.api.utils; +import jakarta.xml.bind.annotation.adapters.XmlAdapter; import java.time.Instant; -import javax.xml.bind.annotation.adapters.XmlAdapter; public class InstantXmlAdapter extends XmlAdapter { diff --git a/src/main/java/org/aarboard/nextcloud/api/utils/ListXMLAnswer.java b/src/main/java/org/aarboard/nextcloud/api/utils/ListXMLAnswer.java index 1887d47..ff7e915 100644 --- a/src/main/java/org/aarboard/nextcloud/api/utils/ListXMLAnswer.java +++ b/src/main/java/org/aarboard/nextcloud/api/utils/ListXMLAnswer.java @@ -1,10 +1,10 @@ package org.aarboard.nextcloud.api.utils; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElementWrapper; +import jakarta.xml.bind.annotation.XmlRootElement; import java.util.List; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "ocs") diff --git a/src/main/java/org/aarboard/nextcloud/api/utils/LocalDateXmlAdapter.java b/src/main/java/org/aarboard/nextcloud/api/utils/LocalDateXmlAdapter.java index c370588..4eefdfa 100644 --- a/src/main/java/org/aarboard/nextcloud/api/utils/LocalDateXmlAdapter.java +++ b/src/main/java/org/aarboard/nextcloud/api/utils/LocalDateXmlAdapter.java @@ -1,8 +1,8 @@ package org.aarboard.nextcloud.api.utils; +import jakarta.xml.bind.annotation.adapters.XmlAdapter; import java.time.LocalDate; -import javax.xml.bind.annotation.adapters.XmlAdapter; public class LocalDateXmlAdapter extends XmlAdapter { diff --git a/src/main/java/org/aarboard/nextcloud/api/utils/XMLAnswer.java b/src/main/java/org/aarboard/nextcloud/api/utils/XMLAnswer.java index 7b1608e..29e3b49 100644 --- a/src/main/java/org/aarboard/nextcloud/api/utils/XMLAnswer.java +++ b/src/main/java/org/aarboard/nextcloud/api/utils/XMLAnswer.java @@ -16,10 +16,11 @@ */ package org.aarboard.nextcloud.api.utils; -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 jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; + /** * diff --git a/src/main/java/org/aarboard/nextcloud/api/utils/XMLAnswerParser.java b/src/main/java/org/aarboard/nextcloud/api/utils/XMLAnswerParser.java index b5fb681..c48c651 100644 --- a/src/main/java/org/aarboard/nextcloud/api/utils/XMLAnswerParser.java +++ b/src/main/java/org/aarboard/nextcloud/api/utils/XMLAnswerParser.java @@ -1,12 +1,12 @@ package org.aarboard.nextcloud.api.utils; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Unmarshaller; import java.io.IOException; import java.io.Reader; import java.util.HashMap; import java.util.Map; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; import org.aarboard.nextcloud.api.exception.NextcloudApiException; import org.aarboard.nextcloud.api.utils.ConnectorCommon.ResponseParser;