Skip to content

Commit 4ff3339

Browse files
committed
added Actuator
some optimization
1 parent 4f07a32 commit 4ff3339

File tree

13 files changed

+21
-305
lines changed

13 files changed

+21
-305
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For mapping documents only Gemma is available currently!
99

1010
The mapping service allows multiple schemas to be uploaded and managed and documents to be mapped over one of them at a time accordingly.
1111
Therefore, the service is extensible to other mappers, although currently only Gemma, a service that can only map JSON files, is available.
12-
The REST API is documented at the following link: [http://localhost:8095/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config](http://localhost:8095/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config)
12+
The REST API is documented at the following link: [http://localhost:8095/swagger-ui/index.html](http://localhost:8095/swagger-ui/index.html)
1313

1414
## How to build
1515

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
plugins {
22
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
33
id 'org.springframework.boot' version '2.6.6'
4-
// id 'org.asciidoctor.convert' version '2.4.0'
54
id "org.asciidoctor.jvm.convert" version "3.3.0"
65
id "org.owasp.dependencycheck" version "7.0.4.1"
76
id 'net.researchgate.release' version '2.8.1'
@@ -11,7 +10,7 @@ plugins {
1110

1211
description = 'Generic mapping service supporting different mapping implementations.'
1312
group = 'edu.kit.datamanager'
14-
version = '1.0'
13+
version = '1.0.0'
1514

1615
println "Building ${name} version: ${version}"
1716

@@ -36,6 +35,7 @@ dependencies {
3635
implementation 'org.springframework.boot:spring-boot-starter-security:2.6.5'
3736
implementation 'org.springframework.boot:spring-boot-starter-validation:2.6.5'
3837
implementation 'org.springframework.boot:spring-boot-starter-web:2.6.5'
38+
implementation 'org.springframework.boot:spring-boot-starter-actuator:2.6.6'
3939
implementation 'org.springdoc:springdoc-openapi-ui:1.6.6'
4040
implementation 'org.springdoc:springdoc-openapi-data-rest:1.6.6'
4141
implementation 'org.springdoc:springdoc-openapi-webmvc-core:1.6.6'

src/main/java/edu/kit/datamanager/mappingservice/annotations/LocalFileURL.java

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/main/java/edu/kit/datamanager/mappingservice/configuration/ApplicationProperties.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ public class ApplicationProperties extends GenericPluginProperties {
3737
/**
3838
* The absolute path to the python interpreter.
3939
*/
40+
@edu.kit.datamanager.annotations.ExecutableFileURL
4041
@Value("${mapping-service.gemma.pythonLocation}")
4142
private URL pythonLocation;
4243

4344
/**
4445
* The path to the gemma mapping script 'mapping_single.py'
4546
*/
46-
@edu.kit.datamanager.mappingservice.annotations.LocalFileURL
47+
@edu.kit.datamanager.annotations.LocalFileURL
4748
@Value("${mapping-service.gemma.gemmaLocation}")
4849
private URL gemmaLocation;
4950

src/main/java/edu/kit/datamanager/mappingservice/configuration/SpringRestConfiguration.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/main/java/edu/kit/datamanager/mappingservice/configuration/WebSecurityConfig.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,12 @@
1515
*/
1616
package edu.kit.datamanager.mappingservice.configuration;
1717

18-
//import edu.kit.datamanager.security.filter.JwtAuthenticationFilter;
19-
//import edu.kit.datamanager.security.filter.JwtAuthenticationProvider;
20-
2118
import org.slf4j.Logger;
2219
import org.springframework.beans.factory.annotation.Autowired;
2320
import org.springframework.boot.web.servlet.FilterRegistrationBean;
2421
import org.springframework.context.annotation.Bean;
2522
import org.springframework.context.annotation.Configuration;
2623
import org.springframework.http.HttpMethod;
27-
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
2824
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
2925
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
3026
import org.springframework.security.config.annotation.web.builders.WebSecurity;
@@ -51,20 +47,12 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
5147
public WebSecurityConfig() {
5248
}
5349

54-
@Override
55-
public void configure(AuthenticationManagerBuilder auth) {
56-
// auth.authenticationEventPublisher(new NoopAuthenticationEventPublisher()).authenticationProvider(new JwtAuthenticationProvider("test123", logger));
57-
}
58-
5950
@Override
6051
protected void configure(HttpSecurity http) throws Exception {
6152
HttpSecurity httpSecurity = http.authorizeRequests()
6253
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll().and().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
6354
.and()
6455
.csrf().disable();
65-
// .addFilterAfter(new JwtAuthenticationFilter(authenticationManager()), BasicAuthenticationFilter.class);
66-
67-
// httpSecurity = httpSecurity.addFilterAfter(new NoAuthenticationFilter("test123", authenticationManager()), JwtAuthenticationFilter.class);
6856

6957
httpSecurity.
7058
authorizeRequests().

src/main/java/edu/kit/datamanager/mappingservice/validator/LocalFileValidator.java

Lines changed: 0 additions & 67 deletions
This file was deleted.

src/main/resources/application.properties

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# General Spring Boot Settings (do not change!)
22
spring.main.allow-bean-definition-overriding=true
33
spring.main.allow-circular-references=true
4-
spring.mvc.pathmatch.matching-strategy=ant_path_matcher
4+
#spring.mvc.pathmatch.matching-strategy=ant_path_matcher
55

66
# Server Settings for defining port and security
77
server.port: 8095
@@ -16,23 +16,18 @@ spring.servlet.multipart.max-request-size: 100MB
1616
#logging settings
1717
logging.level.root: ERROR
1818
#logging.level.edu.kit: DEBUG
19-
#logging.level.org.springframework:DEBUG
20-
#logging.level.org.springframework.amqp: WARN
21-
logging.level.edu.kit.datamanager: TRACE
19+
logging.level.edu.kit.datamanager: INFO
2220

2321
springdoc.swagger-ui.disable-swagger-default-url=true
2422

25-
###################################################################
26-
################## Repository Specific Settings ##################
27-
###################################################################
28-
repo.basepath: file:///tmp
29-
30-
# Enable/disable (default) authentication. If authentication is enabled, a separate
31-
# Authentication Service should be used in order to obtain JSON Web Tokens holding
32-
# login information. The token has then to be provided within the Authentication header
33-
# of each HTTP request with a value of 'Bearer <TOKEN>' without quotes, replacing <TOKEN>
34-
# be the token obtained from the authentication service.
35-
repo.auth.enabled: false
23+
# Actuator settings
24+
info.app.name=Mapping-Service
25+
info.app.description=Generic mapping service supporting different mapping implementations.
26+
info.app.group=edu.kit.datamanager
27+
info.app.version=1.0.0
28+
management.endpoint.health.probes.enabled=true
29+
#management.endpoints.web.exposure.include=info, health, beans, configprops, loggers, prometheus, logfile, metrics, env
30+
management.endpoints.web.exposure.include=*
3631

3732
# The jwtSecret is the mutual secret between all trusted services. This means, that if
3833
# authentication is enabled, the jwtSecret used by the Authentication Service to sign
@@ -52,5 +47,5 @@ mapping-service.gemma.pythonLocation:file:///usr/bin/python3
5247
mapping-service.gemma.gemmaLocation:file:src/test/resources/python/mapping_single.py
5348

5449
# Absolute path to the local gemma mappings folder
55-
#metastore.indexer.mappingsLocation:file:///Users/maximilian/Documents/GitHub/mapping-service/src/test/resources/mapping/gemma
56-
mapping-service.mappingsLocation:file:///tmp/metastore2/mapping
50+
#metastore.indexer.mappingsLocation:file:src/test/resources/mapping/gemma
51+
mapping-service.mappingsLocation:file:///tmp/mapping-service/

src/test/java/edu/kit/datamanager/mappingservice/documentation/MappingControllerDocumentationTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ public class MappingControllerDocumentationTest {
9595
private IAclEntryDao aclEntryDao;
9696

9797
private final static String EXAMPLE_SCHEMA_ID_XML = "my_first_xsd";
98-
private final static String TEMP_DIR_4_ALL = "/tmp/metastore2/";
99-
private final static String TEMP_DIR_4_MAPPING = TEMP_DIR_4_ALL + "mapping/";
98+
private final static String TEMP_DIR_4_MAPPING = "/tmp/mapping-service/";
10099
private final static String EXAMPLE_SCHEMA_ID_JSON = "my_first_json";
101100

102101
@BeforeEach

src/test/java/edu/kit/datamanager/mappingservice/impl/MappingServiceTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ public class MappingServiceTest {
8484
@Autowired
8585
MappingService mappingService4Test;
8686

87-
private final static String TEMP_DIR_4_ALL = "/tmp/metastore2/";
88-
private final static String TEMP_DIR_4_MAPPING = TEMP_DIR_4_ALL + "mapping/";
89-
87+
private final static String TEMP_DIR_4_MAPPING = "/tmp/mapping-service/";
9088

9189
@BeforeEach
9290
public void setUp() {

0 commit comments

Comments
 (0)