rename of the app, some properties added

This commit is contained in:
Michele Artini 2021-06-11 10:06:03 +02:00
parent f338213452
commit d638790c78
42 changed files with 42 additions and 22 deletions

View File

@ -11,7 +11,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>dnet-directindex</artifactId> <artifactId>dnet-directindex-api</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<dependencies> <dependencies>

View File

@ -1,6 +1,5 @@
package eu.dnetlib.openaire.directindex; package eu.dnetlib.openaire.directindex;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
@ -19,15 +18,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableScheduling @EnableScheduling
public class DirectIndexApplication extends AbstractDnetApp { public class DirectIndexApplication extends AbstractDnetApp {
@Value("${openaire.api.directindex.mongo.url}")
private String mongoUrl;
@Value("${openaire.api.directindex.mongo.db}")
private String mongoDb;
@Value("${openaire.api.directindex.mongo.collection}")
private String mongoColl;
public static void main(final String[] args) { public static void main(final String[] args) {
SpringApplication.run(DirectIndexApplication.class, args); SpringApplication.run(DirectIndexApplication.class, args);
} }
@ -39,7 +29,7 @@ public class DirectIndexApplication extends AbstractDnetApp {
.paths(p -> p.startsWith("/api/")) .paths(p -> p.startsWith("/api/"))
.build() .build()
.apiInfo(new ApiInfoBuilder() .apiInfo(new ApiInfoBuilder()
.title("OpenAIRE DirectIndex APIs") .title("OpenAIRE DirectIndex API")
.description("APIs documentation") .description("APIs documentation")
.version("1.1") .version("1.1")
.contact(ApiInfo.DEFAULT_CONTACT) .contact(ApiInfo.DEFAULT_CONTACT)

View File

@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -24,6 +25,7 @@ import eu.dnetlib.openaire.directindex.repo.RecordInfo;
import eu.dnetlib.openaire.directindex.repo.RecordInfoRepository; import eu.dnetlib.openaire.directindex.repo.RecordInfoRepository;
@RestController @RestController
@RequestMapping("/api")
public class DirectIndexController extends AbstractDnetController { public class DirectIndexController extends AbstractDnetController {
private static final Log log = LogFactory.getLog(DirectIndexController.class); private static final Log log = LogFactory.getLog(DirectIndexController.class);
@ -37,7 +39,7 @@ public class DirectIndexController extends AbstractDnetController {
@Autowired @Autowired
private ISLookupClient isLookupClient; private ISLookupClient isLookupClient;
@PostMapping("/api/results/feedObject") @PostMapping("/results/feedObject")
public String feedResult(@RequestBody final ResultEntry pub) throws DirectIndexApiException { public String feedResult(@RequestBody final ResultEntry pub) throws DirectIndexApiException {
log.debug(pub); log.debug(pub);
@ -64,15 +66,14 @@ public class DirectIndexController extends AbstractDnetController {
} }
@DeleteMapping("/api/result/{openaireId}") @DeleteMapping("/result/{openaireId}")
public void deleteResultWithOpenaireId(@PathVariable final String openaireId) throws DirectIndexApiException { public void deleteResultWithOpenaireId(@PathVariable final String openaireId) throws DirectIndexApiException {
deleteResult(openaireId); deleteResult(openaireId);
} }
@DeleteMapping("/api/results") @DeleteMapping("/results")
public void deleteResultWithOriginalId(@RequestParam final String originalId, @RequestParam final String collectedFromId) throws Exception { public void deleteResultWithOriginalId(@RequestParam final String originalId, @RequestParam final String collectedFromId) throws Exception {
final String openaireId = xmlRecordConverter.calculateOpenaireId(originalId, collectedFromId); deleteResult(xmlRecordConverter.calculateOpenaireId(originalId, collectedFromId));
deleteResult(openaireId);
} }
private void deleteResult(final String openaireId) throws DirectIndexApiException { private void deleteResult(final String openaireId) throws DirectIndexApiException {
@ -87,7 +88,7 @@ public class DirectIndexController extends AbstractDnetController {
recordInfoRepository.save(info); recordInfoRepository.save(info);
} }
@GetMapping("/api/admin/evictCache") @GetMapping("/admin/evictCache")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
public void evictCache() { public void evictCache() {
isLookupClient.evictCache(); isLookupClient.evictCache();

View File

@ -0,0 +1,32 @@
server.port=8080
spring.profiles.active=dev
maven.pom.path = /META-INF/maven/eu.dnetlib.dhp/dnet-directindex-application/effective-pom.xml
spring.main.banner-mode = off
logging.level.root = INFO
#logging.level.org.springframework = DEBUG
management.endpoints.web.exposure.include = prometheus,health
management.endpoints.web.base-path = /
management.endpoints.web.path-mapping.prometheus = metrics
management.endpoints.web.path-mapping.health = health
spring.datasource.url=jdbc:postgresql://localhost:5432/oa_directindex
spring.datasource.username=oa_directindex
spring.datasource.password=
# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto = validate
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.hbm2dll.extra_physical_table_types = MATERIALIZED VIEW
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.jpa.open-in-view=true
spring.jpa.properties.hibernate.show_sql=false
spring.jpa.properties.hibernate.use_sql_comments=false
spring.jpa.properties.hibernate.format_sql=false
openaire.api.community=http://${container.hostname}/openaire/community/
oaf.schema.location=https://www.openaire.eu/schema/1.0/oaf-1.0.xsd

View File

@ -1,3 +0,0 @@
openaire.api.directindex.layoutToRecord.xslt=/xslt/openaireLayoutToRecordStylesheet.xsl
openaire.api.community=http://${container.hostname}/openaire/community/

View File

@ -18,7 +18,7 @@
<module>dhp-broker-public-application</module> <module>dhp-broker-public-application</module>
<module>dhp-mdstore-manager</module> <module>dhp-mdstore-manager</module>
<module>dnet-orgs-database-application</module> <module>dnet-orgs-database-application</module>
<module>dnet-directindex</module> <module>dnet-directindex-api</module>
</modules> </modules>
<dependencies> <dependencies>