Skip to content

Commit

Permalink
Basic service running, which currently can only report its version.
Browse files Browse the repository at this point in the history
  • Loading branch information
janvanmansum committed Nov 8, 2024
1 parent f4b2d22 commit 8daea6b
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 9 deletions.
43 changes: 43 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

<properties>
<main-class>nl.knaw.dans.dvingest.DdDataverseIngestApplication</main-class>
<dd-dataverse-ingest-api.version>0.1.0-SNAPSHOT</dd-dataverse-ingest-api.version>
</properties>

<scm>
Expand All @@ -56,6 +57,48 @@
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>nl.knaw.dans</groupId>
<artifactId>dd-dataverse-ingest-api</artifactId>
<version>${dd-dataverse-ingest-api.version}</version>
<outputDirectory>${project.build.directory}/openapi</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration combine.children="override">
<generatorName>jaxrs-spec</generatorName>
<inputSpec>${project.build.directory}/openapi/dd-dataverse-ingest-api.yml</inputSpec>
<apiPackage>nl.knaw.dans.dvingest.resources</apiPackage>
<modelPackage>nl.knaw.dans.dvingest.api</modelPackage>
<invokerPackage>nl.knaw.dans.dvingest.resources</invokerPackage>
<templateDirectory>${project.basedir}/src/main/resources/openapi-generator-templates</templateDirectory>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>

Expand Down
6 changes: 2 additions & 4 deletions src/main/assembly/dist/cfg/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<DdDataverseIngestConfiguration> {

Expand All @@ -38,7 +40,7 @@ public void initialize(final Bootstrap<DdDataverseIngestConfiguration> bootstrap

@Override
public void run(final DdDataverseIngestConfiguration configuration, final Environment environment) {

environment.jersey().register(new DefaultApiResource());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (C) 2024 DANS - Data Archiving and Networked Services ([email protected])
*
* 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();
}
}
11 changes: 11 additions & 0 deletions src/main/resources/banner.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
█████ █████ █████ █████ ███ █████
░░███ ░░███ ░░███ ░░███ ░░░ ░░███
███████ ███████ ███████ ██████ ███████ ██████ █████ █████ ██████ ████████ █████ ██████ ████ ████████ ███████ ██████ ████████████
███░░███ ███░░███ █████████████░░███ ░░░░░███░░░███░ ░░░░░███░░███ ░░███ ███░░███░░███░░██████░░ ███░░█████████████░░███░░███░░███ ███░░███ ███░░██████░░░░░███░
░███ ░███ ░███ ░███░░░░░░░░░░░███ ░███ ███████ ░███ ███████ ░███ ░███░███████ ░███ ░░░░░█████ ░███████░░░░░░░░░░ ░███ ░███ ░███ ░███ ░███░███████░░█████ ░███
░███ ░███ ░███ ░███ ░███ ░███ ███░░███ ░███ ██████░░███ ░░███ ███ ░███░░░ ░███ ░░░░███░███░░░ ░███ ░███ ░███ ░███ ░███░███░░░ ░░░░███░███ ███
░░████████░░████████ ░░████████░░████████ ░░█████░░████████ ░░█████ ░░██████ █████ ██████ ░░██████ █████████ █████░░███████░░██████ ██████ ░░█████
░░░░░░░░ ░░░░░░░░ ░░░░░░░░ ░░░░░░░░ ░░░░░ ░░░░░░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░░░░ ░░░░░░ ░░░░░░░░░ ░░░░░ ░░░░░███ ░░░░░░ ░░░░░░ ░░░░░
███ ░███
░░██████
░░░░░░
11 changes: 11 additions & 0 deletions src/main/resources/openapi-generator-templates/pathParams.mustache
Original file line number Diff line number Diff line change
@@ -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}}

0 comments on commit 8daea6b

Please sign in to comment.