-
Notifications
You must be signed in to change notification settings - Fork 18
/
SipiMessages.scala
124 lines (108 loc) · 4.54 KB
/
SipiMessages.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
* Copyright © 2015-2021 the contributors (see Contributors.md).
*
* This file is part of Knora.
*
* Knora is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Knora is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with Knora. If not, see <http://www.gnu.org/licenses/>.
*/
package org.knora.webapi.messages.store.sipimessages
import org.knora.webapi.messages.admin.responder.usersmessages.UserADM
import org.knora.webapi.messages.store.StoreRequest
import org.knora.webapi.messages.traits.RequestWithSender
/**
* An abstract trait for messages that can be sent to the [[org.knora.webapi.store.iiif.IIIFManager]]
*/
sealed trait IIIFRequest extends StoreRequest
/**
* An abstract trait for messages that can be sent to [[org.knora.webapi.store.iiif.SipiConnector]].
*/
sealed trait SipiRequest extends IIIFRequest {
def requestingUser: UserADM
}
/**
* Requests file metadata from Sipi. A successful response is a [[GetFileMetadataResponse]].
*
* @param fileUrl the URL at which Sipi can serve the file.
* @param requestingUser the user making the request.
*/
case class GetFileMetadataRequest(fileUrl: String, requestingUser: UserADM) extends SipiRequest
/**
* Represents file metadata returned by Sipi.
*
* @param originalFilename the file's original filename, if known.
* @param originalMimeType the file's original MIME type.
* @param internalMimeType the file's internal MIME type. Always defined (https://dasch.myjetbrains.com/youtrack/issue/DSP-711).
* @param width the file's width in pixels, if applicable.
* @param height the file's height in pixels, if applicable.
* @param pageCount the number of pages in the file, if applicable.
* @param duration the duration of the file in seconds, if applicable.
*/
case class GetFileMetadataResponse(originalFilename: Option[String],
originalMimeType: Option[String],
internalMimeType: String,
width: Option[Int],
height: Option[Int],
pageCount: Option[Int],
duration: Option[BigDecimal],
fps: Option[BigDecimal])
/**
* Asks Sipi to move a file from temporary to permanent storage.
*
* @param internalFilename the name of the file.
* @param prefix the prefix under which the file should be stored.
* @param requestingUser the user making the request.
*/
case class MoveTemporaryFileToPermanentStorageRequest(internalFilename: String, prefix: String, requestingUser: UserADM)
extends SipiRequest
/**
* Asks Sipi to delete a temporary file.
*
* @param internalFilename the name of the file.
* @param requestingUser the user making the request.
*/
case class DeleteTemporaryFileRequest(internalFilename: String, requestingUser: UserADM) extends SipiRequest
/**
* Asks Sipi for a text file. Currently only for UTF8 encoded text files.
*
* @param fileUrl the URL pointing to the file.
* @param requestingUser the user making the request.
*/
case class SipiGetTextFileRequest(fileUrl: String, requestingUser: UserADM, senderName: String)
extends SipiRequest
with RequestWithSender
/**
* Represents a response for [[SipiGetTextFileRequest]].
*
* @param content the file content.
*/
case class SipiGetTextFileResponse(content: String)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// IIIF Request ADM
sealed trait IIIFRequestADM extends IIIFRequest
/**
* Queries IIIF Service status.
*/
case object IIIFServiceGetStatus extends IIIFRequestADM
/**
* Represents a response for [[IIIFServiceGetStatus]].
*/
sealed trait IIIFServiceStatusResponse
/**
* Represents a positive response for [[IIIFServiceGetStatus]].
*/
case object IIIFServiceStatusOK extends IIIFServiceStatusResponse
/**
* Represents a negative response for [[IIIFServiceGetStatus]].
*/
case object IIIFServiceStatusNOK extends IIIFServiceStatusResponse