diff --git a/.github/workflows/build-test-with-registry.yml b/.github/workflows/build-test-with-registry.yml index 8272a57..f27c41b 100644 --- a/.github/workflows/build-test-with-registry.yml +++ b/.github/workflows/build-test-with-registry.yml @@ -16,16 +16,16 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3 + - uses: actions/checkout@v7 + - name: Set up JDK 21 + uses: actions/setup-java@v6 with: - java-version: '11' - distribution: 'adopt' + java-version: '21' + distribution: 'temurin' cache: gradle - name: Install local registry run: | - /bin/bash -c "$(curl -fsSL https://data.scrc.uk/static/localregistry.sh)" + /bin/bash -c "$(curl -fsSL https://data.fairdatapipeline.org/static/localregistry.sh)" ~/.fair/registry/scripts/start_fair_registry - name: Grant execute permission for gradlew run: chmod +x gradlew @@ -34,6 +34,7 @@ jobs: export REGTOKEN=`cat ~/.fair/registry/token` export LOCALREG=FRESHASADAISY ./gradlew build - - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v7 with: + token: ${{ secrets.CODECOV_TOKEN }} files: ./api/build/reports/jacoco/test/jacocoTestReport.xml,./dataregistry/build/reports/jacoco/test/jacocoTestReport.xml diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 5fcbba4..7b644c5 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -16,12 +16,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3 + - uses: actions/checkout@v7 + - name: Set up JDK 21 + uses: actions/setup-java@v6 with: - java-version: '11' - distribution: 'adopt' + java-version: '21' + distribution: 'temurin' cache: gradle - name: Grant execute permission for gradlew run: chmod +x gradlew diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/gradle-publish.yml index 64bd386..e5d8cfa 100644 --- a/.github/workflows/gradle-publish.yml +++ b/.github/workflows/gradle-publish.yml @@ -16,12 +16,12 @@ jobs: packages: write steps: - - uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3 + - uses: actions/checkout@v7 + - name: Set up JDK 21 + uses: actions/setup-java@v6 with: - java-version: '11' - distribution: 'adopt' + java-version: '21' + distribution: 'temurin' server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml index a89a3a3..a718044 100644 --- a/.github/workflows/javadoc.yml +++ b/.github/workflows/javadoc.yml @@ -9,13 +9,13 @@ jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 with: fetch-depth: 0 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v6 with: - distribution: 'adopt' - java-version: '11' + distribution: 'temurin' + java-version: '21' cache: 'gradle' - name: Grant execute permission for gradlew run: chmod +x gradlew diff --git a/.gitignore b/.gitignore index 042ecdd..ef02f73 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,7 @@ gradle build .idea +api/bin +dataregistry/bin +dataregistry/build +graphify-out diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c5f3f6b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.configuration.updateBuildConfiguration": "interactive" +} \ No newline at end of file diff --git a/README.md b/README.md index 66b032b..099f635 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,12 @@ Documentation can be found on https://www.fairdatapipeline.org/docs/API/Java/ JavaDocs are automatically published on https://www.fairdatapipeline.org/javaDataPipeline/ -To use a release version (latest: 1.0.0-rc3) include the following dependency (available from mavenCentral): +To use a release version (latest: 1.0.0-rc4) include the following dependency (available from mavenCentral): ```gradle group: 'org.fairdatapipeline', name: 'api', -version: '1.0.0-rc3' +version: '1.0.0-rc4' ``` ## javaSimpleModel diff --git a/api/build.gradle b/api/build.gradle index 70f9295..011e9b9 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -1,21 +1,22 @@ plugins { id 'java' - id "com.diffplug.gradle.spotless" version "4.4.0" + id "com.diffplug.spotless" version "8.10.2" id "maven-publish" id "signing" id "jacoco" } -group 'org.fairdatapipeline' -version '1.0.0-rc3' +group = 'org.fairdatapipeline' +version = '1.0.0-rc4' repositories { mavenCentral() } java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } withJavadocJar() withSourcesJar() } @@ -32,12 +33,12 @@ dependencies { implementation 'com.google.guava:guava:31.1-jre' implementation 'com.moandjiezana.toml:toml4j:0.7.2' implementation 'commons-io:commons-io:2.11.0' - implementation 'jakarta.ws.rs:jakarta.ws.rs-api:3.0.0' + implementation 'jakarta.ws.rs:jakarta.ws.rs-api:3.1.0' implementation 'org.apache.commons:commons-math3:3.6.1' implementation 'org.apache.maven:maven-artifact:3.8.4' - implementation 'org.glassfish.jersey.core:jersey-client:3.0.4' - implementation 'org.glassfish.jersey.inject:jersey-hk2:3.0.4' - implementation 'org.glassfish.jersey:jersey-bom:3.0.4' + implementation 'org.glassfish.jersey.core:jersey-client:3.1.12' + implementation 'org.glassfish.jersey.inject:jersey-hk2:3.1.12' + implementation 'org.glassfish.jersey:jersey-bom:3.1.12' implementation 'org.immutables:value-annotations:2.9.0' implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.2' implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.15.2' @@ -49,9 +50,10 @@ dependencies { implementation 'org.slf4j:slf4j-simple:1.7.36' testAnnotationProcessor 'org.immutables:value:2.9.0' testImplementation(platform('org.junit:junit-bom:5.8.1')) + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' testImplementation('org.junit.jupiter:junit-jupiter:5.8.2') testImplementation 'org.skyscreamer:jsonassert:1.5.0' - testImplementation 'org.mockito:mockito-core:4.3.1' + testImplementation 'org.mockito:mockito-core:5.11.0' testImplementation 'org.assertj:assertj-core:3.22.0' testImplementation 'org.javatuples:javatuples:1.2' } @@ -67,14 +69,14 @@ test { jacocoTestReport { dependsOn test reports { - xml.enabled true - html.enabled false + xml.required = true + html.required = false } } spotless { java { - googleJavaFormat() + googleJavaFormat("1.36.1") } } @@ -126,8 +128,8 @@ publishing { maven { url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/' credentials { - username findProperty('ossrhUsername') - password findProperty('ossrhPassword') + username = findProperty('ossrhUsername') + password = findProperty('ossrhPassword') } } } diff --git a/api/src/main/java/org/fairdatapipeline/api/Coderun.java b/api/src/main/java/org/fairdatapipeline/api/Coderun.java index 0128de3..599d40e 100644 --- a/api/src/main/java/org/fairdatapipeline/api/Coderun.java +++ b/api/src/main/java/org/fairdatapipeline/api/Coderun.java @@ -239,8 +239,8 @@ private void prepare_code_run() { String remote_repo = this.config.run_metadata().remote_repo().orElse(""); URL remote_repo_url; try { - remote_repo_url = new URL(remote_repo); - } catch (MalformedURLException e) { + remote_repo_url = URI.create(remote_repo).toURL(); + } catch (MalformedURLException | IllegalArgumentException e) { throw (new ConfigException( "Remote repo must be a valid URL; (" + remote_repo + " isn't)", e)); } diff --git a/api/src/main/java/org/fairdatapipeline/api/Data_product.java b/api/src/main/java/org/fairdatapipeline/api/Data_product.java index 271e7da..052bb50 100644 --- a/api/src/main/java/org/fairdatapipeline/api/Data_product.java +++ b/api/src/main/java/org/fairdatapipeline/api/Data_product.java @@ -34,8 +34,10 @@ public abstract class Data_product implements AutoCloseable { Path filePath; CleanableFileChannel filechannel; Object_component whole_obj_oc; + /** the name given by the user (asked for in the FileApi.get_dp_for_xxx() call) */ final String givenDataProduct_name; + /** * usually the same as the given name, unless the config use section has given an alternative data * product name to open. diff --git a/api/src/main/java/org/fairdatapipeline/estimate/Estimate.java b/api/src/main/java/org/fairdatapipeline/estimate/Estimate.java index 41c4f90..a747ed3 100644 --- a/api/src/main/java/org/fairdatapipeline/estimate/Estimate.java +++ b/api/src/main/java/org/fairdatapipeline/estimate/Estimate.java @@ -14,7 +14,9 @@ @JsonDeserialize @JsonSerialize public interface Estimate extends Component { - /** @return Number - the value that is stored in this component */ + /** + * @return Number - the value that is stored in this component + */ @JsonProperty("value") Number internalValue(); diff --git a/dataregistry/build.gradle b/dataregistry/build.gradle index d15123a..311fdc3 100644 --- a/dataregistry/build.gradle +++ b/dataregistry/build.gradle @@ -1,17 +1,18 @@ plugins { id 'java' - id "com.diffplug.gradle.spotless" version "4.4.0" + id "com.diffplug.spotless" version "8.10.2" id "maven-publish" id "signing" id "jacoco" } -group 'org.fairdatapipeline' -version '1.0.0-rc3' +group = 'org.fairdatapipeline' +version = '1.0.0-rc4' java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } withJavadocJar() withSourcesJar() } @@ -26,13 +27,15 @@ repositories { dependencies { testImplementation(platform('org.junit:junit-bom:5.8.1')) + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2' testImplementation 'org.hamcrest:hamcrest:2.2' - testImplementation 'org.mockito:mockito-core:4.3.1' - implementation 'org.glassfish.jersey.core:jersey-client:3.0.4' - implementation 'org.glassfish.jersey.inject:jersey-hk2:3.0.4' - implementation 'org.glassfish.jersey:jersey-bom:3.0.4' - implementation 'jakarta.ws.rs:jakarta.ws.rs-api:3.0.0' + testImplementation 'org.mockito:mockito-core:5.11.0' + implementation 'org.glassfish.jersey.core:jersey-client:3.1.12' + implementation 'org.glassfish.jersey.connectors:jersey-jnh-connector:3.1.12' + implementation 'org.glassfish.jersey.inject:jersey-hk2:3.1.12' + implementation 'org.glassfish.jersey:jersey-bom:3.1.12' + implementation 'jakarta.ws.rs:jakarta.ws.rs-api:3.1.0' implementation 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.15.2' implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2' implementation 'com.fasterxml.jackson.core:jackson-annotations:2.15.2' @@ -46,7 +49,7 @@ dependencies { spotless { java { - googleJavaFormat() + googleJavaFormat("1.36.1") } } @@ -60,8 +63,8 @@ test { jacocoTestReport { dependsOn test reports { - xml.enabled true - html.enabled false + xml.required = true + html.required = false } } @@ -113,8 +116,8 @@ publishing { maven { url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/' credentials { - username findProperty('ossrhUsername') - password findProperty('ossrhPassword') + username = findProperty('ossrhUsername') + password = findProperty('ossrhPassword') } } } diff --git a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryAuthor.java b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryAuthor.java index bc78e9e..ab9d5e8 100644 --- a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryAuthor.java +++ b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryAuthor.java @@ -51,7 +51,9 @@ public void setName(String name) { this.name = name; } - /** @param identifier (optional): Full URL of identifier (e.g. ORCiD or ROR ID) of the Author. */ + /** + * @param identifier (optional): Full URL of identifier (e.g. ORCiD or ROR ID) of the Author. + */ public void setIdentifier(String identifier) { this.identifier = identifier; } diff --git a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryCode_repo_release.java b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryCode_repo_release.java index 94c7041..918aa27 100644 --- a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryCode_repo_release.java +++ b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryCode_repo_release.java @@ -68,12 +68,16 @@ public void setVersion(String version) { this.version = version; } - /** @param website (optional): URL of the website for this code release, if applicable. */ + /** + * @param website (optional): URL of the website for this code release, if applicable. + */ public void setWebsite(URL website) { this.website = website; } - /** @param object APIURL of the associated Object. */ + /** + * @param object APIURL of the associated Object. + */ public void setObject(APIURL object) { this.object = object; } diff --git a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryCode_run.java b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryCode_run.java index f90bd59..8a32fc5 100644 --- a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryCode_run.java +++ b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryCode_run.java @@ -132,12 +132,16 @@ public APIURL getRo_crate() { return this.ro_crate; } - /** @param run_date Datetime of the CodeRun. */ + /** + * @param run_date Datetime of the CodeRun. + */ public void setRun_date(LocalDateTime run_date) { this.run_date = run_date; } - /** @param description (optional): Free text description of the CodeRun. */ + /** + * @param description (optional): Free text description of the CodeRun. + */ public void setDescription(String description) { this.description = description; } @@ -166,12 +170,16 @@ public void setSubmission_script(APIURL submission_script) { this.submission_script = submission_script; } - /** @param inputs List of RegistryObject_component that the CodeRun used as inputs. */ + /** + * @param inputs List of RegistryObject_component that the CodeRun used as inputs. + */ public void setInputs(List inputs) { this.inputs = (inputs == null) ? null : new ArrayList<>(inputs); } - /** @param outputs List of RegistryObject_component that the CodeRun produced as outputs. */ + /** + * @param outputs List of RegistryObject_component that the CodeRun produced as outputs. + */ public void setOutputs(List outputs) { this.outputs = (outputs == null) ? null : new ArrayList<>(outputs); } diff --git a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryData_product.java b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryData_product.java index 4665761..0954db0 100644 --- a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryData_product.java +++ b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryData_product.java @@ -122,12 +122,16 @@ public void setVersion(String version) { this.version = version; } - /** @param object APIURL of the associated Object. */ + /** + * @param object APIURL of the associated Object. + */ public void setObject(APIURL object) { this.object = object; } - /** @param namespace API URL of the Namespace of the DataProduct. */ + /** + * @param namespace API URL of the Namespace of the DataProduct. + */ public void setNamespace(APIURL namespace) { this.namespace = namespace; } diff --git a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryExternal_object.java b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryExternal_object.java index 99a2f0b..6b40e14 100644 --- a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryExternal_object.java +++ b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryExternal_object.java @@ -167,22 +167,30 @@ public void setPrimary_not_supplement(boolean primary_not_supplement) { this.primary_not_supplement = primary_not_supplement; } - /** @param release_date Date-time the ExternalObject was released. */ + /** + * @param release_date Date-time the ExternalObject was released. + */ public void setRelease_date(LocalDateTime release_date) { this.release_date = release_date; } - /** @param title Title of the ExternalObject. */ + /** + * @param title Title of the ExternalObject. + */ public void setTitle(String title) { this.title = title; } - /** @param description (optional): Free text description of the ExternalObject. */ + /** + * @param description (optional): Free text description of the ExternalObject. + */ public void setDescription(String description) { this.description = description; } - /** @param data_product API URL of the associated DataProduct. */ + /** + * @param data_product API URL of the associated DataProduct. + */ public void setData_product(APIURL data_product) { this.data_product = data_product; } diff --git a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryFile_type.java b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryFile_type.java index d6690bd..8e521bc 100644 --- a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryFile_type.java +++ b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryFile_type.java @@ -63,7 +63,9 @@ public void setName(String name) { this.name = name; } - /** @param extension Filename extension. (like csv) */ + /** + * @param extension Filename extension. (like csv) + */ public void setExtension(String extension) { this.extension = extension; } diff --git a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryIssue.java b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryIssue.java index b6e0c9c..2f75aa9 100644 --- a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryIssue.java +++ b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryIssue.java @@ -114,7 +114,9 @@ public void addComponent_issue(APIURL object_component_url) { } } - /** @param uuid UUID of the Issue. If not specified a UUID is generated automatically. */ + /** + * @param uuid UUID of the Issue. If not specified a UUID is generated automatically. + */ public void setUuid(String uuid) { this.uuid = uuid; } diff --git a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryKey_value.java b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryKey_value.java index 2f1c191..5d6b510 100644 --- a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryKey_value.java +++ b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryKey_value.java @@ -40,17 +40,23 @@ public APIURL getObject() { return this.object; } - /** @param key Meta-data name */ + /** + * @param key Meta-data name + */ public void setKey(String key) { this.key = key; } - /** @param value Meta-data value */ + /** + * @param value Meta-data value + */ public void setValue(String value) { this.value = value; } - /** @param object APIURL of the associated Object. */ + /** + * @param object APIURL of the associated Object. + */ public void setObject(APIURL object) { this.object = object; } diff --git a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryKeyword.java b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryKeyword.java index 413e61c..5e580a8 100644 --- a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryKeyword.java +++ b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryKeyword.java @@ -44,17 +44,23 @@ public URL getIdentifier() { return this.identifier; } - /** @param object {@link APIURL} of the associated Object. */ + /** + * @param object {@link APIURL} of the associated Object. + */ public void setObject(APIURL object) { this.object = object; } - /** @param keyphrase Free text field for the key phrase to associate with the Object. */ + /** + * @param keyphrase Free text field for the key phrase to associate with the Object. + */ public void setKeyphrase(String keyphrase) { this.keyphrase = keyphrase; } - /** @param identifier (optional): URL of ontology annotation to associate with this Keyword. */ + /** + * @param identifier (optional): URL of ontology annotation to associate with this Keyword. + */ public void setIdentifier(URL identifier) { this.identifier = identifier; } diff --git a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryNamespace.java b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryNamespace.java index f4be74f..4857340 100644 --- a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryNamespace.java +++ b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryNamespace.java @@ -52,17 +52,23 @@ public URL getWebsite() { return this.website; } - /** @param name The Namespace name */ + /** + * @param name The Namespace name + */ public void setName(String name) { this.name = name; } - /** @param full_name (optional): The full name of the Namespace. */ + /** + * @param full_name (optional): The full name of the Namespace. + */ public void setFull_name(String full_name) { this.full_name = full_name; } - /** @param website (optional): Website URL associated with the Namespace. */ + /** + * @param website (optional): Website URL associated with the Namespace. + */ public void setWebsite(URL website) { this.website = website; } diff --git a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryObject.java b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryObject.java index e9b94de..2a7ad02 100644 --- a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryObject.java +++ b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryObject.java @@ -136,7 +136,9 @@ public List getKeywords() { return (this.keywords == null) ? new ArrayList<>() {} : new ArrayList<>(keywords); } - /** @param description (optional): Free text description of the Object. */ + /** + * @param description (optional): Free text description of the Object. + */ public void setDescription(String description) { this.description = description; } @@ -149,7 +151,9 @@ public void setStorage_location(APIURL storage_location) { this.storage_location = storage_location; } - /** @param authors (optional): List of Author APIURLs associated with this Object. */ + /** + * @param authors (optional): List of Author APIURLs associated with this Object. + */ public void setAuthors(List authors) { this.authors = new ArrayList<>(authors); } @@ -161,7 +165,9 @@ public void setUuid(String uuid) { this.uuid = uuid; } - /** @param file_type (optional): FileType of this Object. */ + /** + * @param file_type (optional): FileType of this Object. + */ public void setFile_type(APIURL file_type) { this.file_type = file_type; } diff --git a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryObject_component.java b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryObject_component.java index f689ee7..14f5681 100644 --- a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryObject_component.java +++ b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryObject_component.java @@ -104,7 +104,9 @@ public List getOutputs_of() { return (outputs_of == null) ? new ArrayList<>() {} : new ArrayList<>(this.outputs_of); } - /** @param object The APIURL of the Object to associate this ObjectComponent with. */ + /** + * @param object The APIURL of the Object to associate this ObjectComponent with. + */ public void setObject(APIURL object) { this.object = object; } @@ -117,12 +119,16 @@ public void setName(String name) { this.name = name; } - /** @param description (optional): Free text description of the ObjectComponent. */ + /** + * @param description (optional): Free text description of the ObjectComponent. + */ public void setDescription(String description) { this.description = description; } - /** @param whole_object If this ObjectComponent refers to the whole object or not. */ + /** + * @param whole_object If this ObjectComponent refers to the whole object or not. + */ public void setWhole_object(boolean whole_object) { this.whole_object = whole_object; } diff --git a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryStorage_location.java b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryStorage_location.java index 3cf4965..63064bf 100644 --- a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryStorage_location.java +++ b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryStorage_location.java @@ -66,7 +66,9 @@ public void setPath(String path) { this.path = path; } - /** @param hash The calculated SHA1 hash of the file, or git hash of the repo. */ + /** + * @param hash The calculated SHA1 hash of the file, or git hash of the repo. + */ public void setHash(String hash) { this.hash = hash; } @@ -79,7 +81,9 @@ public void setIs_public(boolean is_public) { this.is_public = is_public; } - /** @param storage_root Reference to the StorageRoot to append the path to. */ + /** + * @param storage_root Reference to the StorageRoot to append the path to. + */ public void setStorage_root(APIURL storage_root) { this.storage_root = storage_root; } diff --git a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryStorage_root.java b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryStorage_root.java index 2439259..8f72793 100644 --- a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryStorage_root.java +++ b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryStorage_root.java @@ -82,7 +82,9 @@ public List getLocations() { return (this.locations == null) ? new ArrayList<>() {} : new ArrayList<>(this.locations); } - /** @param root URI (including protocol) to the root of a StorageLocation. */ + /** + * @param root URI (including protocol) to the root of a StorageLocation. + */ public void setRoot(URI root) { this.root = root; } diff --git a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryUser_author.java b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryUser_author.java index b2fa15b..9b8d336 100644 --- a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryUser_author.java +++ b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/content/RegistryUser_author.java @@ -30,12 +30,16 @@ public APIURL getAuthor() { return author; } - /** @param user The API URL of the User to associate with this UserAuthor. */ + /** + * @param user The API URL of the User to associate with this UserAuthor. + */ public void setUser(APIURL user) { this.user = user; } - /** @param author The API URL of the Author to associate with this UserAuthor. */ + /** + * @param author The API URL of the Author to associate with this UserAuthor. + */ public void setAuthor(APIURL author) { this.author = author; } diff --git a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/restclient/RestClient.java b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/restclient/RestClient.java index ac3d407..eca998b 100644 --- a/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/restclient/RestClient.java +++ b/dataregistry/src/main/java/org/fairdatapipeline/dataregistry/restclient/RestClient.java @@ -21,7 +21,8 @@ import org.fairdatapipeline.dataregistry.content.Registry_RootObject; import org.fairdatapipeline.dataregistry.content.Registry_Updateable; import org.fairdatapipeline.dataregistry.oauth2token.OAuth2ClientTokenFeature; -import org.glassfish.jersey.client.HttpUrlConnectorProvider; +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.jnh.connector.JavaNetHttpConnectorProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,12 +37,14 @@ public class RestClient { private void init(String registry_url, String token) { client = ClientBuilder.newBuilder() + // java.net.http.HttpClient supports PATCH natively; the default HttpURLConnection + // connector needs a reflection hack that Java 16+ blocks. + .withConfig(new ClientConfig().connectorProvider(new JavaNetHttpConnectorProvider())) .register(Registry_RootObjectReader.class) .register(Registry_RootObjectWriter.class) .register(Registry_ObjectListReader.class) .register(JavaUtilCollectionsDeserializers.class) .register(new OAuth2ClientTokenFeature(token)) - .property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true) .build(); wt = client.target(registry_url); } @@ -65,7 +68,10 @@ public RestClient(String registry_url, String token) { * @return The first item found, or null if none are found. */ public Registry_RootObject getFirst(Class c, Map m) - throws ConnectException, RegistryVersionException, RegistryJSONException, ForbiddenException, + throws ConnectException, + RegistryVersionException, + RegistryJSONException, + ForbiddenException, RestClientException { // c = the class contained within the objectlist // return the first item found. @@ -94,7 +100,10 @@ public Registry_RootObject getFirst(Class c, Map< } void deal_with_jakarta_http_exceptions(Exception e) - throws ConnectException, RegistryVersionException, RegistryJSONException, ForbiddenException, + throws ConnectException, + RegistryVersionException, + RegistryJSONException, + ForbiddenException, RestClientException { if (e.getClass() == ProcessingException.class || e.getClass() == ResponseProcessingException.class) { @@ -127,7 +136,10 @@ void deal_with_jakarta_http_exceptions(Exception e) */ public Registry_ObjectList getList( Class c, Map m) - throws ConnectException, RegistryVersionException, RegistryJSONException, ForbiddenException, + throws ConnectException, + RegistryVersionException, + RegistryJSONException, + ForbiddenException, RestClientException { // c is the class contained within the ObjectList WebTarget wt2 = wt.path(Registry_RootObject.get_django_path(c.getSimpleName())); @@ -152,7 +164,10 @@ public Registry_ObjectList getList( * @return the FDP Object (or null if not found) */ public Registry_RootObject get(Class c, int i) - throws ConnectException, RegistryVersionException, RegistryJSONException, ForbiddenException, + throws ConnectException, + RegistryVersionException, + RegistryJSONException, + ForbiddenException, RestClientException { WebTarget wt2 = wt.path(Registry_RootObject.get_django_path(c.getSimpleName())).path(Integer.toString(i)); @@ -175,7 +190,10 @@ public Registry_RootObject get(Class c, int i) * @return The Object, or null if not found. */ public Registry_RootObject get(Class c, APIURL apiurl) - throws ConnectException, RegistryVersionException, RegistryJSONException, ForbiddenException, + throws ConnectException, + RegistryVersionException, + RegistryJSONException, + ForbiddenException, RestClientException { WebTarget wt2 = client.target(apiurl.toString()); try { @@ -197,7 +215,10 @@ public Registry_RootObject get(Class c, APIURL ap * @return the FDP Object we get back from the registry, with its URL set, or null upon error. */ public Registry_Updateable post(Registry_Updateable o) - throws ConnectException, RegistryVersionException, RegistryJSONException, ForbiddenException, + throws ConnectException, + RegistryVersionException, + RegistryJSONException, + ForbiddenException, RestClientException { WebTarget wt2 = wt.path(o.get_django_path()); if (o.getUrl() != null) { @@ -242,7 +263,10 @@ public Registry_Updateable post(Registry_Updateable o) * @return the Object returned from the registry, or null upon error. */ public Registry_Updateable patch(Registry_Updateable o) - throws ConnectException, RegistryVersionException, RegistryJSONException, ForbiddenException, + throws ConnectException, + RegistryVersionException, + RegistryJSONException, + ForbiddenException, RestClientException { if (!o.allow_method("PATCH")) { throw (new IllegalArgumentException( @@ -290,7 +314,10 @@ public Registry_Updateable patch(Registry_Updateable o) * @return the Object returned from the registry, or null upon error. */ public Registry_Updateable put(Registry_Updateable o) - throws ConnectException, RegistryVersionException, RegistryJSONException, ForbiddenException, + throws ConnectException, + RegistryVersionException, + RegistryJSONException, + ForbiddenException, RestClientException { if (!o.allow_method("PUT")) { throw (new IllegalArgumentException( @@ -336,7 +363,10 @@ public Registry_Updateable put(Registry_Updateable o) * @param i the ID of the FDP Object we're trying to delete */ public void delete(Class c, int i) - throws ConnectException, RegistryVersionException, RegistryJSONException, ForbiddenException, + throws ConnectException, + RegistryVersionException, + RegistryJSONException, + ForbiddenException, RestClientException { Registry_Updateable o = (Registry_Updateable) get(c, i); delete(o); @@ -348,7 +378,10 @@ public void delete(Class c, int i) * @param o the Object we are trying to delete */ public void delete(Registry_Updateable o) - throws ConnectException, RegistryVersionException, RegistryJSONException, ForbiddenException, + throws ConnectException, + RegistryVersionException, + RegistryJSONException, + ForbiddenException, RestClientException { if (!o.allow_method("DELETE")) { throw (new IllegalArgumentException( diff --git a/dataregistry/src/test/java/org/fairdatapipeline/dataregistry/restclient/restClientTest.java b/dataregistry/src/test/java/org/fairdatapipeline/dataregistry/restclient/restClientTest.java index c323666..3157200 100644 --- a/dataregistry/src/test/java/org/fairdatapipeline/dataregistry/restclient/restClientTest.java +++ b/dataregistry/src/test/java/org/fairdatapipeline/dataregistry/restclient/restClientTest.java @@ -5,7 +5,7 @@ import jakarta.ws.rs.core.MediaType; import java.net.MalformedURLException; -import java.net.URL; +import java.net.URI; import java.nio.file.Path; import java.time.LocalDateTime; import java.util.ArrayList; @@ -182,7 +182,7 @@ private Stream objectsToBeCreated() throws MalformedURLExce al.add(dp); RegistryExternal_object eo = new RegistryExternal_object(); eo.setDescription("My test external object"); - eo.setIdentifier(new URL("http://www.bbc.co.uk/")); + eo.setIdentifier(URI.create("http://www.bbc.co.uk/").toURL()); eo.setRelease_date(LocalDateTime.of(2021, 4, 4, 4, 4, 4, 4)); eo.setTitle("Initial External Object"); eo.setData_product(lc.makeAPIURL(RegistryData_product.class, 1)); @@ -210,7 +210,7 @@ private Stream objectsToBeCreated() throws MalformedURLExce crr.setName("Initial code repo release"); crr.setObject(lc.makeAPIURL(RegistryObject.class, 1)); crr.setVersion("1.0.0"); - crr.setWebsite(new URL("http://github.com/blabla")); + crr.setWebsite(URI.create("http://github.com/blabla").toURL()); al.add(crr); RegistryKey_value kv = new RegistryKey_value(); kv.setObject(lc.makeAPIURL(RegistryObject.class, 1)); diff --git a/dataregistry/src/test/java/org/fairdatapipeline/dataregistry/restclient/test_Registry_RootObjectWriter.java b/dataregistry/src/test/java/org/fairdatapipeline/dataregistry/restclient/test_Registry_RootObjectWriter.java index e18a179..f39bd26 100644 --- a/dataregistry/src/test/java/org/fairdatapipeline/dataregistry/restclient/test_Registry_RootObjectWriter.java +++ b/dataregistry/src/test/java/org/fairdatapipeline/dataregistry/restclient/test_Registry_RootObjectWriter.java @@ -2,7 +2,7 @@ import java.io.ByteArrayOutputStream; import java.net.MalformedURLException; -import java.net.URL; +import java.net.URI; import org.fairdatapipeline.dataregistry.content.*; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -27,7 +27,7 @@ void test_Namespace() throws MalformedURLException { RegistryNamespace ns = new RegistryNamespace(); ns.setName("name"); ns.setFull_name("Name Potter"); - ns.setWebsite(new URL("http://www.nos.nl/")); + ns.setWebsite(URI.create("http://www.nos.nl/").toURL()); Assertions.assertEquals( "{\"name\":\"name\",\"full_name\":\"Name Potter\",\"website\":\"http://www.nos.nl/\"}", write_json(ns, ns.getClass())); diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 62d4c05..2c35211 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5ceefc8..c42672d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ -#Fri Jul 10 10:20:32 BST 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 index fbd7c51..727d6af --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,69 +15,104 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +122,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,88 +133,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m" "--enable-native-access=ALL-UNNAMED"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 5093609..22fdb19 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,8 +13,10 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +27,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -33,20 +36,20 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" "--enable-native-access=ALL-UNNAMED" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -54,31 +57,16 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line @@ -86,17 +74,19 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/jitpack.yml b/jitpack.yml index adb3fe1..727c9ab 100644 --- a/jitpack.yml +++ b/jitpack.yml @@ -1,2 +1,2 @@ jdk: - - openjdk11 + - openjdk21 diff --git a/settings.gradle b/settings.gradle index c4dc075..ebc6f71 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,7 @@ +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0' +} + rootProject.name = 'java_api' include 'api' include 'dataregistry'