Skip to content

Commit

Permalink
changed auto configuration for spring 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin Hofer committed Jun 15, 2023
1 parent 99a086d commit e33171d
Show file tree
Hide file tree
Showing 20 changed files with 425 additions and 535 deletions.
1 change: 0 additions & 1 deletion databus-mods-lib/databus-mods-dummy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<artifactId>databus-mods-core</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
package org.dbpedia.databus.mods.worker.dummy

import ch.qos.logback.classic.{Level, Logger}
import org.dbpedia.databus.mods.core.model.{ModActivity, ModActivityMetadata, ModActivityMetadataBuilder, ModActivityRequest}
import org.dbpedia.databus.mods.worker.springboot.{EnableModWorkerApi, ModWorkerApiProfile}
import org.slf4j.LoggerFactory
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.context.annotation.Bean

import scala.util.Random;

@SpringBootApplication
@EnableModWorkerApi(version = "1.0", profile = ModWorkerApiProfile.HttpPoll)
class DummyWorker {

@Bean
@EnableModWorkerApi(version = "1.0.0", profile = ModWorkerApiProfile.HttpPoll)
def getModActivity: ModActivity = new ModActivity {
def dummyActivity = new ModActivity {
override def perform(request: ModActivityRequest, builder: ModActivityMetadataBuilder): ModActivityMetadata = {
Thread.sleep(1000)
builder.withStatSummary((Random.nextInt(100)/100.0).toString).build()
builder.withStatSummary((Random.nextInt(100) / 100.0).toString).build()
}
}
}


object DummyWorker extends App {
val log = LoggerFactory.getLogger("org.spring").asInstanceOf[Logger]
log.setLevel(Level.DEBUG)
SpringApplication.run(classOf[DummyWorker], args: _*)
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.dbpedia.databus.mods.worker.springboot.config.ModWorkerApiAutoConfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import scala.collection.JavaConverters._
class ModWorkerApiAutoConfig() {

private val log = LoggerFactory.getLogger(classOf[ModWorkerApiAutoConfig])
log.info("Starting Mod Worker Interface")

@Bean
@ConditionalOnMissingBean(Array(classOf[ModActivity]))
Expand Down Expand Up @@ -54,8 +55,12 @@ class ModWorkerApiAutoConfig() {

if (annotation.isDefined) {
annotation.get.profile() match {
case ModWorkerApiProfile.Http => new ActivityControllerImpl
case ModWorkerApiProfile.HttpPoll => new ActivityControllerPollImpl(activityExecutionService)
case ModWorkerApiProfile.Http =>
log.info("Started Mod Worker with Http API")
new ActivityControllerImpl
case ModWorkerApiProfile.HttpPoll =>
log.info("Started Mod Worker with HttpPoll API")
new ActivityControllerPollImpl(activityExecutionService)
}
} else {
new ActivityControllerImpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,25 @@ import java.util.concurrent.Callable
@Command(name = "httpapi", mixinStandardHelpOptions = true)
class ApiHttpValidator extends Callable[Int] {

@Option(names = Array("-w", "--worker"), required = true)
@Option(
names = Array("-w", "--worker-endpoint"),
required = true,
description = Array("The URL of the mod worker API endpoint '.../activity'")
)
var endpoint: String = _

@Option(names = Array("-i", "--dataId"), required = true)
@Option(
names = Array("-i", "--dataId"),
required = true,
description = Array("A (Databus) DataID IRI")
)
var dataId: String = _

@Option(names = Array("--accessUri"), required = false)
@Option(
names = Array("--accessUri"),
required = false,
description = Array("An alternative access URI of the file referenced by the given DataID")
)
var accessUri: String = _

override def call(): Int = {
Expand Down
95 changes: 0 additions & 95 deletions databus-mods-server/application.yml

This file was deleted.

61 changes: 0 additions & 61 deletions databus-mods-server/databus-mods-server-core/application.yml

This file was deleted.

15 changes: 11 additions & 4 deletions databus-mods-server/databus-mods-server-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,20 @@
<artifactId>derby</artifactId>
</dependency>

<!-- https://mvnrepository.com/artifact/javax.persistence/javax.persistence-api -->
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.1.214</version>
<scope>runtime</scope>
</dependency>

<!-- &lt;!&ndash; https://mvnrepository.com/artifact/javax.persistence/javax.persistence-api &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>javax.persistence</groupId>-->
<!-- <artifactId>javax.persistence-api</artifactId>-->
<!-- <version>2.2</version>-->
<!-- </dependency>-->

<dependency>
<groupId>com.openlink.virtuoso</groupId>
<artifactId>virtjdbc4-1</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
server:
port: 9050
spring:
# datasource:
# url: jdbc:h2:mem:mydb
# username: sa
# password: password
# driver-class-name: org.h2.Driver
# jpa:
# spring.jpa.database-platform: org.hibernate.dialect.H2Dialect
# hibernate:
# ddl-auto: 'create-drop'
datasource:
driver-class-name: 'org.apache.derby.jdbc.EmbeddedDriver'
username: 'mysqluser'
password: 'mysqlpass'
url: 'jdbc:derby:derby;create=true'
hikari:
validationTimeout: 60000
jpa:
properties:
hibernate:
dialect: 'org.hibernate.dialect.DerbyDialect'
hibernate:
# ddl-auto: 'update'
ddl-auto: 'create-drop'
ddl-auto: 'update'
vaadin:
urlMapping: '/demo/*'

Expand Down Expand Up @@ -43,28 +56,28 @@ tmp:
# http:
# volume: '/home/marvin/src/github.com/dbpedia/databus-mods/databus-mods-server/volumes/www'
# baseUrl: 'http://localhost:8900/'
mods:
- name: 'DEMO'
accept: 'file'
select:
workers:
- 'http://localhost:32768/api'
query: '
PREFIX dataid: <http://dataid.dbpedia.org/ns/core#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX dcat: <http://www.w3.org/ns/dcat#>
PREFIX db: <https://databus.dbpedia.org/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?file ?sha256sum ?downloadURL ?issued WHERE {
{ SELECT DISTINCT ?file ?sha256sum ?downloadURL ?issued WHERE {
?dataset dcat:distribution ?distribution .
?distribution dct:issued ?issued .
?distribution dataid:file ?file .
?distribution dataid:sha256sum ?sha256sum .
?distribution dcat:downloadURL ?downloadURL .
?distribution dcat:byteSize ?size .
?dataset dataid:artifact <https://databus.dbpedia.org/dbpedia/databus/databus-data> .
} ORDER BY ?size OFFSET 5 LIMIT 10 }
}
'
#mods:
# - name: 'DEMO'
# accept: 'file'
# select:
# workers:
# - 'http://localhost:32768/api'
# query: '
#PREFIX dataid: <http://dataid.dbpedia.org/ns/core#>
#PREFIX dct: <http://purl.org/dc/terms/>
#PREFIX dcat: <http://www.w3.org/ns/dcat#>
#PREFIX db: <https://databus.dbpedia.org/>
#PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
#PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
#SELECT DISTINCT ?file ?sha256sum ?downloadURL ?issued WHERE {
#{ SELECT DISTINCT ?file ?sha256sum ?downloadURL ?issued WHERE {
# ?dataset dcat:distribution ?distribution .
# ?distribution dct:issued ?issued .
# ?distribution dataid:file ?file .
# ?distribution dataid:sha256sum ?sha256sum .
# ?distribution dcat:downloadURL ?downloadURL .
# ?distribution dcat:byteSize ?size .
# ?dataset dataid:artifact <https://databus.dbpedia.org/dbpedia/databus/databus-data> .
# } ORDER BY ?size OFFSET 5 LIMIT 10 }
#}
#'
Loading

0 comments on commit e33171d

Please sign in to comment.