diff --git a/pom.xml b/pom.xml index a527168..5967310 100644 --- a/pom.xml +++ b/pom.xml @@ -36,6 +36,7 @@ nl.knaw.dans.dvingest.DdDataverseIngestApplication + 0.1.0-SNAPSHOT @@ -56,6 +57,48 @@ org.jacoco jacoco-maven-plugin + + org.apache.maven.plugins + maven-dependency-plugin + + + initialize + + unpack + + + + + nl.knaw.dans + dd-dataverse-ingest-api + ${dd-dataverse-ingest-api.version} + ${project.build.directory}/openapi + + + + + + + + org.openapitools + openapi-generator-maven-plugin + + + + generate + + + jaxrs-spec + ${project.build.directory}/openapi/dd-dataverse-ingest-api.yml + nl.knaw.dans.dvingest.resources + nl.knaw.dans.dvingest.api + nl.knaw.dans.dvingest.resources + ${project.basedir}/src/main/resources/openapi-generator-templates + + + + + diff --git a/src/main/assembly/dist/cfg/config.yml b/src/main/assembly/dist/cfg/config.yml index feece3c..a44fc09 100644 --- a/src/main/assembly/dist/cfg/config.yml +++ b/src/main/assembly/dist/cfg/config.yml @@ -6,12 +6,10 @@ server: adminContextPath: / applicationConnectors: - type: http - # Replace with port number unique for this service - port: 20000 # TODO: Replace with unique port number + port: 20360 adminConnectors: - type: http - # Replace with port number unique for this service - port: 20001 # TODO: Replace with unique port number + port: 20361 # # See https://www.dropwizard.io/en/latest/manual/configuration.html#logging diff --git a/src/main/java/nl/knaw/dans/dvingest/DdDataverseIngestApplication.java b/src/main/java/nl/knaw/dans/dvingest/DdDataverseIngestApplication.java index 6b3e271..35c8352 100644 --- a/src/main/java/nl/knaw/dans/dvingest/DdDataverseIngestApplication.java +++ b/src/main/java/nl/knaw/dans/dvingest/DdDataverseIngestApplication.java @@ -19,6 +19,8 @@ import io.dropwizard.core.Application; import io.dropwizard.core.setup.Bootstrap; import io.dropwizard.core.setup.Environment; +import nl.knaw.dans.dvingest.config.DdDataverseIngestConfiguration; +import nl.knaw.dans.dvingest.resources.DefaultApiResource; public class DdDataverseIngestApplication extends Application { @@ -38,7 +40,7 @@ public void initialize(final Bootstrap bootstrap @Override public void run(final DdDataverseIngestConfiguration configuration, final Environment environment) { - + environment.jersey().register(new DefaultApiResource()); } } diff --git a/src/main/java/nl/knaw/dans/dvingest/DdDataverseIngestConfiguration.java b/src/main/java/nl/knaw/dans/dvingest/config/DdDataverseIngestConfiguration.java similarity index 85% rename from src/main/java/nl/knaw/dans/dvingest/DdDataverseIngestConfiguration.java rename to src/main/java/nl/knaw/dans/dvingest/config/DdDataverseIngestConfiguration.java index 7735b4c..fcde703 100644 --- a/src/main/java/nl/knaw/dans/dvingest/DdDataverseIngestConfiguration.java +++ b/src/main/java/nl/knaw/dans/dvingest/config/DdDataverseIngestConfiguration.java @@ -14,13 +14,10 @@ * limitations under the License. */ -package nl.knaw.dans.dvingest; +package nl.knaw.dans.dvingest.config; -import com.fasterxml.jackson.annotation.JsonProperty; import io.dropwizard.core.Configuration; -import javax.validation.constraints.NotEmpty; - public class DdDataverseIngestConfiguration extends Configuration { } diff --git a/src/main/java/nl/knaw/dans/dvingest/resources/DefaultApiResource.java b/src/main/java/nl/knaw/dans/dvingest/resources/DefaultApiResource.java new file mode 100644 index 0000000..b046731 --- /dev/null +++ b/src/main/java/nl/knaw/dans/dvingest/resources/DefaultApiResource.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2024 DANS - Data Archiving and Networked Services (info@dans.knaw.nl) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package nl.knaw.dans.dvingest.resources; + +import javax.ws.rs.core.Response; + +public class DefaultApiResource implements DefaultApi { + + @Override + public Response rootGet() { + return Response.ok().entity( + "Dataverse Ingest Service v%s".formatted( + this.getClass().getPackage().getImplementationVersion())).build(); + } +} diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt new file mode 100644 index 0000000..b008046 --- /dev/null +++ b/src/main/resources/banner.txt @@ -0,0 +1,11 @@ + █████ █████ █████ █████ ███ █████ + ░░███ ░░███ ░░███ ░░███ ░░░ ░░███ + ███████ ███████ ███████ ██████ ███████ ██████ █████ █████ ██████ ████████ █████ ██████ ████ ████████ ███████ ██████ ████████████ + ███░░███ ███░░███ █████████████░░███ ░░░░░███░░░███░ ░░░░░███░░███ ░░███ ███░░███░░███░░██████░░ ███░░█████████████░░███░░███░░███ ███░░███ ███░░██████░░░░░███░ +░███ ░███ ░███ ░███░░░░░░░░░░░███ ░███ ███████ ░███ ███████ ░███ ░███░███████ ░███ ░░░░░█████ ░███████░░░░░░░░░░ ░███ ░███ ░███ ░███ ░███░███████░░█████ ░███ +░███ ░███ ░███ ░███ ░███ ░███ ███░░███ ░███ ██████░░███ ░░███ ███ ░███░░░ ░███ ░░░░███░███░░░ ░███ ░███ ░███ ░███ ░███░███░░░ ░░░░███░███ ███ +░░████████░░████████ ░░████████░░████████ ░░█████░░████████ ░░█████ ░░██████ █████ ██████ ░░██████ █████████ █████░░███████░░██████ ██████ ░░█████ + ░░░░░░░░ ░░░░░░░░ ░░░░░░░░ ░░░░░░░░ ░░░░░ ░░░░░░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░░░░ ░░░░░░ ░░░░░░░░░ ░░░░░ ░░░░░███ ░░░░░░ ░░░░░░ ░░░░░ + ███ ░███ + ░░██████ + ░░░░░░ \ No newline at end of file diff --git a/src/main/resources/openapi-generator-templates/pathParams.mustache b/src/main/resources/openapi-generator-templates/pathParams.mustache new file mode 100644 index 0000000..c35fb5b --- /dev/null +++ b/src/main/resources/openapi-generator-templates/pathParams.mustache @@ -0,0 +1,11 @@ +{{#isPathParam}}{{! + + }} @PathParam("{{baseName}}"){{! + + }}{{#useBeanValidation}} {{>beanValidation}}{{/useBeanValidation}}{{! + + }}{{#schema.vendorExtensions.x-field-extra-annotation}} {{schema.vendorExtensions.x-field-extra-annotation}}{{/schema.vendorExtensions.x-field-extra-annotation}}{{! + + }} {{{dataType}}} {{paramName}}{{! + +}}{{/isPathParam}} \ No newline at end of file