Skip to content

Commit

Permalink
docu
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin Hofer committed Sep 25, 2023
1 parent 4824dde commit 01cc327
Show file tree
Hide file tree
Showing 11 changed files with 120 additions and 124 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,56 @@ import org.dbpedia.databus_mods.server.core.views.Views
import scala.annotation.meta.field
import scala.beans.BeanProperty

/**
* Java representation of dataid core metadata for a file registered on the DBpedia databus
* @param dataIdSingleFile
* @param publisher
* @param dataIdGroup
* @param dataIdArtifact
* @param dataIdVersion
* @param downloadUrl
* @param name
* @param checksum
* @param issued
*/
@Entity
@Table(
name = "databus_file",
// uniqueConstraints = Array(
// // TODO
// new UniqueConstraint(columnNames = Array("dataIdSingleFile", "checkSum")))
)
class DatabusFile
class DataIdPart
(
// TODO rename to databusFileID or fileID
@BeanProperty
@(JsonView@field)(value = Array(classOf[Views.Default]))
@(Column@field)(length = 4000)
var dataIdSingleFile: String,

@BeanProperty
var publisher: String,

@BeanProperty
var dataIdGroup: String,

@BeanProperty
var dataIdArtifact: String,

@BeanProperty
var dataIdVersion: String,

@BeanProperty
@(Column@field)(length = 4000)
var downloadUrl: String,

@BeanProperty
var name: String,

@BeanProperty
@(JsonView@field)(value = Array(classOf[Views.Default]))
var checksum: String,

@BeanProperty
@Temporal(TemporalType.TIMESTAMP)
var issued: java.sql.Timestamp
Expand All @@ -50,10 +70,10 @@ class DatabusFile
@(JsonView@field)(value = Array(classOf[Views.Default]))
var id: Long = _

@(JsonView@field)(value = Array(classOf[Views.DatabusFileView]))
@(OneToMany@field)(mappedBy = "databusFile", cascade = Array(CascadeType.ALL), fetch = FetchType.EAGER, orphanRemoval = true)
@BeanProperty
var tasks: java.util.List[Task] = new util.ArrayList[Task]()
// @(JsonView@field)(value = Array(classOf[Views.DatabusFileView]))
// @(OneToMany@field)(mappedBy = "databusFile", cascade = Array(CascadeType.ALL), fetch = FetchType.EAGER, orphanRemoval = true)
// @BeanProperty
// var tasks: java.util.List[Task] = new util.ArrayList[Task]()

def this() {
this(null, null, null, null, null, null, null, null, null)
Expand Down Expand Up @@ -81,15 +101,15 @@ class DatabusFile
|+ dataIdVersion : $dataIdVersion
|+ downloadUrl : $downloadUrl
|+ checksum : $checksum
|+ taskIds : ${tasks.map(_.getId).mkString(", ")}
|""".stripMargin
// + taskIds : ${tasks.map(_.getId).mkString(", ")}
}

def getDatabusPath: String = {
List(publisher,dataIdGroup,dataIdArtifact,dataIdVersion,name).mkString("/")
}

def copyOf(df: DatabusFile): Unit = {
def copyOf(df: DataIdPart): Unit = {
setId(df.getId)
setIssued(df.getIssued)
setPublisher(df.getPublisher)
Expand All @@ -98,6 +118,6 @@ class DatabusFile
setDataIdVersion(df.getDataIdVersion)
setDownloadUrl(df.getDownloadUrl)
setChecksum(df.getChecksum)
setTasks(df.getTasks)
// setTasks(df.getTasks)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import org.springframework.transaction.annotation.Transactional

@Repository
@Transactional
trait DatabusFileRepository extends CrudRepository[DatabusFile,Long] {

def findByDataIdSingleFileAndChecksum(dataIdSingleFile: String, checksum: String): Optional[DatabusFile]

trait DataIdPartRepo extends CrudRepository[DataIdPart,Long] {

def findByDataIdSingleFileAndChecksum(dataIdSingleFile: String, checksum: String): Optional[DataIdPart]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.springframework.data.repository.CrudRepository
import org.springframework.stereotype.Repository

@Repository
trait WorkerRepository extends CrudRepository[Worker,Long] {
trait WorkerRepo extends CrudRepository[Worker,Long] {

def findByUrl(url: String): Optional[Worker]
}

This file was deleted.

This file was deleted.

This file was deleted.

19 changes: 0 additions & 19 deletions doc/arch.md

This file was deleted.

89 changes: 89 additions & 0 deletions doc/worker-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,92 @@

## Pollingbased API Profile

## Backlog
- configuration of boot starter
- documentation: server setup, boot starter, re-implementation of APIs
- push metadata over master
- refactor ActivityController to be a blank trait
- create VocabFactory to help extend the existing Mod Vocab

### Components

- core: core components for master and workers
- model
- rdf generation
- validation
- worker client
-

## Springboot Starter

### Http Api Documentation

---

#### Execute Mod Activity at Worker

<details>
<summary><code>POST</code> <code><b>/activity</b></code> <code>(execute activity at worker)</code></summary>

##### Parameters

> | name | type | data type | description |
> |--------| -------|-----------|-----------|
> | dataId | required | string | IRI of dataid entity |
> | accessIRI | optional | string | access IRI of data |
##### Responses

> | http code | content-type | response |
> |--------------------|-------------------------------------------|-----------------------------------|
> | `200` | `text/turtle` | `Descriptive Mod Activity Metadata` |
> | `202` | `text/plain` | `Descriptive Mod Activity Metadata` |
> | `400` | `application/json` | `{"code":"400","message":"Bad Request"}` |
> | `500` | `application/json` | `{"code":"500","message":"${Exception}"}` |
##### Example cURL

> ```javascript
> curl -X POST --data-urlencode "dataId=TODO" http://localhost:8080/
> ```
</details>
---
#### Polling Activity Status
<details>
<summary><code>GET </code> <code><b>/${jobid}/activity</b></code> <code>(check activity at worker)</code></summary>
##### Responses
> | http code | content-type | response |
> |---------------------------|-----------------------------------------------------------------|-----------------------------------|
> | `202` | `text/turtle` | `Configuration created successfully` |
> | `202` | `text/plain` | `Configuration created successfully` |
> | `400` | `application/json` | `{"code":"400","message":"Bad Request"}` |
> | `500` |`application/json` | `{"code":"500","message":"${Exception}"}` |
##### Example cURL
> ```javascript
> curl -X POST -H "Content-Type: application/json" --data @post.json http://localhost:8889/
> ```
</details>
---
## HTTP API Re-Implementation
[//]: # (The master will follow redirects &#40;includes 202&#41; and obeys retry after headers)
Requirements:
- Post request that ends with /activity
Pitfalls/Features:
- Activity Deduplication
- Resource Management: Delete local files after they have been accessed once
-

0 comments on commit 01cc327

Please sign in to comment.