OaiRunner.scala 2.06 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * generic OAI Server - agnostic in relation to the data repository
 * initially created for memobase project
 *
 * Copyright (C) 2021  UB Basel
 *
 * This program 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.
 *
 * This program 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 this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 */


23
24
package org.swissbib.memobase.oai.runner

25
import modules.OaiRepository
26
import org.swissbib.memobase.oai.common.validation.{BadArgumentsParameter, NoContentForQueryParameter}
27
import org.swissbib.memobase.oai.response.{BadArgumentsResponse, NoContentForQueryResponse, OaiResponse}
28
29
import play.api.Configuration

30

31
abstract class OaiRunner {
Günter Hipler's avatar
Günter Hipler committed
32
  def run()(implicit config: Configuration, repository: OaiRepository): OaiResponse
33
34
}

35

36

Günter Hipler's avatar
Günter Hipler committed
37
case class NoContentForQueryRunner(parameter: NoContentForQueryParameter) extends OaiRunner {
38

Günter Hipler's avatar
Günter Hipler committed
39
  //todo: Es fehlt noch eine Response für no content
40
41
  override def run()(implicit config: Configuration, repository: OaiRepository): OaiResponse =
    NoContentForQueryResponse(config,repository,parameter)
42
43
44

}

45
//todo: make more detailed types
Günter Hipler's avatar
Günter Hipler committed
46
47
48
49
50
//todo: brauchen wir das?
//case class GetExceptionRunner(config: Configuration, repository: OaiRepository, request:
//                                                          BadArgumentsReq) extends OaiRequestRunner {
//  override def run(): OaiResponse = ???
//}
51
52


53
case class BadArgumentsErrorRunner(parameter: BadArgumentsParameter) extends OaiRunner {
54

Günter Hipler's avatar
Günter Hipler committed
55
  override def run()(implicit config: Configuration, repository: OaiRepository): OaiResponse =
56
    BadArgumentsResponse(config, repository,parameter)
57
58
59
}