Skip to content

Commit

Permalink
fixed compilation errors; renamed imports to changed class names...
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin Hofer committed Jan 12, 2024
1 parent 01cc327 commit 0774d8e
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.dbpedia.databus_mods.server.core.controller.admin

import com.fasterxml.jackson.annotation.JsonView
import org.dbpedia.databus_mods.server.core.persistence.WorkerRepository
import org.dbpedia.databus_mods.server.core.persistence.WorkerRepo
import org.dbpedia.databus_mods.server.core.views.Views
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
Expand All @@ -13,7 +13,7 @@ class WorkerController {

private val log = LoggerFactory.getLogger(classOf[WorkerController])

@Autowired private var workerRepository: WorkerRepository = _
@Autowired private var workerRepository: WorkerRepo = _

@JsonView(value = Array(classOf[Views.PublicWorkerView]))
@RequestMapping(value = Array(), method = Array(RequestMethod.GET, RequestMethod.DELETE, RequestMethod.POST))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.dbpedia.databus_mods.server.core.execution

import org.dbpedia.databus_mods.server.core.service.{MetadataService, TaskService}


object Singleton {

var taskService: TaskService = _

var metadataService: MetadataService = _

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import org.dbpedia.databus.mods.core.worker.api.ModActivityClientHttp
import org.dbpedia.databus_mods.server.core.persistence.{Task, TaskStatus, Worker}
import org.dbpedia.databus_mods.server.core.service.TaskService
import org.slf4j.LoggerFactory
//import org.dbpedia.databus_mods.server.core.execution.Singleton

import java.net.URI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Task
@(JoinColumn@field)(name = "databusFile_id")
@BeanProperty
@(JsonView@field)(value = Array(classOf[Views.PublicTaskView]))
var databusFile: DatabusFile,
var databusFile: DataIdPart,
@(ManyToOne@field)(fetch = FetchType.EAGER)
@BeanProperty
@(JsonView@field)(value = Array(classOf[Views.PublicTaskView], classOf[Views.DatabusFileView]))
Expand All @@ -31,10 +31,10 @@ class Task
@(JsonView@field)(value = Array(classOf[Views.Default]))
var id: Long = _

@PreRemove
def removeTaskFromDatabusFile(): Unit = {
databusFile.getTasks.remove(this)
}
// @PreRemove
// def removeTaskFromDatabusFile(): Unit = {
// databusFile.getTasks.remove(this)
// }

// @BeanProperty
// var uri: String = _
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package org.dbpedia.databus_mods.server.core.service
import java.util.Optional
import java.util

import org.dbpedia.databus_mods.server.core.persistence.{DatabusFile, DatabusFileRepository}
import org.dbpedia.databus_mods.server.core.persistence.{DataIdPart, DataIdPartRepo}
import org.springframework.stereotype.Service

@Service
class DatabusFileService(databusFileRepository: DatabusFileRepository) {
class DatabusFileService(databusFileRepository: DataIdPartRepo) {

def add(df: DatabusFile): Unit = {
def add(df: DataIdPart): Unit = {
val databusFile = databusFileRepository.findByDataIdSingleFileAndChecksum(df.dataIdSingleFile, df.checksum)
if(databusFile.isPresent) {
df.copyOf(databusFile.get)
Expand All @@ -18,11 +18,11 @@ class DatabusFileService(databusFileRepository: DatabusFileRepository) {
}
}

def get(databusId: String, checksum: String): Optional[DatabusFile] = {
def get(databusId: String, checksum: String): Optional[DataIdPart] = {
databusFileRepository.findByDataIdSingleFileAndChecksum(databusId,checksum)
}

def getAll: util.Iterator[DatabusFile] = {
def getAll: util.Iterator[DataIdPart] = {
databusFileRepository.findAll().iterator()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.dbpedia.databus_mods.server.core.service
import java.util
import java.util.Optional

import org.dbpedia.databus_mods.server.core.persistence.{Mod, ModRepository, Worker, WorkerRepository}
import org.dbpedia.databus_mods.server.core.persistence.{Mod, ModRepository, Worker, WorkerRepo}
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
Expand All @@ -18,7 +18,7 @@ class ModService {

@Autowired private var modRepository: ModRepository = _

@Autowired private var workerRepository: WorkerRepository = _
@Autowired private var workerRepository: WorkerRepo = _

def add(m: Mod): Unit = {
val mod = modRepository.findByName(m.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import java.util
import java.util.Optional

import org.dbpedia.databus_mods.server.core.execution.{WorkerThreadExceptionHandler, WorkerThreadPool}
import org.dbpedia.databus_mods.server.core.persistence.{Worker, WorkerRepository}
import org.dbpedia.databus_mods.server.core.persistence.{Worker, WorkerRepo}
import org.springframework.stereotype.Service


@Service
class WorkerService(
workerThreadPool: WorkerThreadPool,
workerRepository: WorkerRepository, taskService: TaskService) {
workerRepository: WorkerRepo, taskService: TaskService) {

def add(w: Worker): Unit = {
val worker = workerRepository.findByUrl(w.getUrl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ package org.dbpedia.databus_mods.server.core.utils
import java.sql.Timestamp

import org.apache.jena.query.{QueryExecutionFactory, QueryFactory, Syntax}
import org.dbpedia.databus_mods.server.core.persistence.DatabusFile
import org.dbpedia.databus_mods.server.core.persistence.DataIdPart

import scala.collection.mutable.ArrayBuffer

object DatabusQueryUtil {

def getUpdates(query: String, endpoint: String): Array[DatabusFile] = {
def getUpdates(query: String, endpoint: String): Array[DataIdPart] = {
val limit = 10000
var responseSize, offset = 0
val databusFilesBuffer = new ArrayBuffer[DatabusFile]()
val databusFilesBuffer = new ArrayBuffer[DataIdPart]()

do {
responseSize = 0
Expand All @@ -26,7 +26,7 @@ object DatabusQueryUtil {
responseSize += 1
val qs = resultSet.next()
databusFilesBuffer.append(
new DatabusFile(
new DataIdPart(
qs.getResource("file").getURI,
qs.getResource("downloadURL").getURI,
qs.getLiteral("sha256sum").getLexicalForm,
Expand All @@ -40,7 +40,7 @@ object DatabusQueryUtil {
databusFilesBuffer.toArray
}

def queryDatabusFileByURI(uri: String, endpoint: String): Option[DatabusFile] = {
def queryDatabusFileByURI(uri: String, endpoint: String): Option[DataIdPart] = {
val query =
s"""PREFIX dataid: <http://dataid.dbpedia.org/ns/core#>
|PREFIX dct: <http://purl.org/dc/terms/>
Expand All @@ -58,7 +58,7 @@ object DatabusQueryUtil {
val resultSet = queryExec.execSelect()
val possibleDatabusFile = if (resultSet.hasNext) {
val qs = resultSet.next()
Some(new DatabusFile(
Some(new DataIdPart(
uri,
qs.getResource("downloadURL").getURI,
qs.getLiteral("sha256sum").getLexicalForm,
Expand Down

0 comments on commit 0774d8e

Please sign in to comment.