diff --git a/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/controller/admin/WorkerController.scala b/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/controller/admin/WorkerController.scala index f704f36..3c369af 100644 --- a/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/controller/admin/WorkerController.scala +++ b/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/controller/admin/WorkerController.scala @@ -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 @@ -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)) diff --git a/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/execution/Singleton.scala b/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/execution/Singleton.scala new file mode 100644 index 0000000..cd69766 --- /dev/null +++ b/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/execution/Singleton.scala @@ -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 = _ + +} \ No newline at end of file diff --git a/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/execution/WorkerThread.scala b/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/execution/WorkerThread.scala index ffab996..cff1dd1 100644 --- a/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/execution/WorkerThread.scala +++ b/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/execution/WorkerThread.scala @@ -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 diff --git a/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/persistence/Task.scala b/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/persistence/Task.scala index 6c9e98b..eb9d084 100644 --- a/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/persistence/Task.scala +++ b/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/persistence/Task.scala @@ -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])) @@ -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 = _ diff --git a/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/service/DatabusFileService.scala b/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/service/DatabusFileService.scala index ba20429..e8e0cf4 100644 --- a/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/service/DatabusFileService.scala +++ b/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/service/DatabusFileService.scala @@ -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) @@ -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() } } diff --git a/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/service/ModService.scala b/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/service/ModService.scala index f1f3d10..7c7c3e0 100644 --- a/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/service/ModService.scala +++ b/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/service/ModService.scala @@ -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 @@ -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) diff --git a/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/service/WorkerService.scala b/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/service/WorkerService.scala index 92ef140..a70dd82 100644 --- a/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/service/WorkerService.scala +++ b/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/service/WorkerService.scala @@ -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) diff --git a/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/utils/DatabusQueryUtil.scala b/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/utils/DatabusQueryUtil.scala index dda105d..af7dbea 100644 --- a/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/utils/DatabusQueryUtil.scala +++ b/databus-mods-server/databus-mods-server-core/src/main/scala/org/dbpedia/databus_mods/server/core/utils/DatabusQueryUtil.scala @@ -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 @@ -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, @@ -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: |PREFIX dct: @@ -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,