Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
11 changed files
with
90 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
webapi/src/main/scala/org/knora/webapi/store/iiif/IIIFRequestMessageHandler.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright © 2021 - 2023 Swiss National Data and Service Center for the Humanities and/or DaSCH Service Platform contributors. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.knora.webapi.store.iiif | ||
|
||
import zio._ | ||
|
||
import org.knora.webapi.core.MessageHandler | ||
import org.knora.webapi.core.MessageRelay | ||
import org.knora.webapi.messages.ResponderRequest | ||
import org.knora.webapi.messages.store.sipimessages.DeleteTemporaryFileRequest | ||
import org.knora.webapi.messages.store.sipimessages.GetFileMetadataRequest | ||
import org.knora.webapi.messages.store.sipimessages.IIIFRequest | ||
import org.knora.webapi.messages.store.sipimessages.IIIFServiceGetStatus | ||
import org.knora.webapi.messages.store.sipimessages.MoveTemporaryFileToPermanentStorageRequest | ||
import org.knora.webapi.messages.store.sipimessages.SipiGetTextFileRequest | ||
import org.knora.webapi.store.iiif.api.IIIFService | ||
|
||
trait IIIFRequestMessageHandler extends MessageHandler | ||
|
||
final case class IIIFRequestMessageHandlerLive(iiifService: IIIFService) extends IIIFRequestMessageHandler { | ||
|
||
override def isResponsibleFor(message: ResponderRequest): Boolean = | ||
message.isInstanceOf[IIIFRequest] | ||
|
||
override def handle(message: ResponderRequest): Task[Any] = message match { | ||
case req: GetFileMetadataRequest => iiifService.getFileMetadata(req) | ||
case req: MoveTemporaryFileToPermanentStorageRequest => iiifService.moveTemporaryFileToPermanentStorage(req) | ||
case req: DeleteTemporaryFileRequest => iiifService.deleteTemporaryFile(req) | ||
case req: SipiGetTextFileRequest => iiifService.getTextFileRequest(req) | ||
case IIIFServiceGetStatus => iiifService.getStatus() | ||
case other => ZIO.logError(s"IIIFServiceManager received an unexpected message: $other") | ||
} | ||
} | ||
|
||
object IIIFRequestMessageHandlerLive { | ||
val layer: URLayer[IIIFService with MessageRelay, IIIFRequestMessageHandler] = ZLayer.fromZIO { | ||
for { | ||
mr <- ZIO.service[MessageRelay] | ||
is <- ZIO.service[IIIFService] | ||
handler <- mr.subscribe(IIIFRequestMessageHandlerLive(is)) | ||
} yield handler | ||
} | ||
} |
53 changes: 0 additions & 53 deletions
53
webapi/src/main/scala/org/knora/webapi/store/iiif/IIIFServiceManager.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.