blob: 72e4b0e3bac496abdb987a6f0d6363bbb508142b [file] [log] [blame]
Akron8154dbe2020-11-13 17:52:53 +01001package de.ids_mannheim.korap.plkexport;
2import com.fasterxml.jackson.databind.JsonNode;
3import javax.ws.rs.core.Response;
4import javax.ws.rs.core.Response.ResponseBuilder;
5import java.io.IOException;
6import java.io.Writer;
7
8interface Exporter {
9
10 // Implemented by MatchAggregator
Akron62d90a32020-11-18 20:45:38 +010011 public boolean init (String s) throws IOException;
Akron8154dbe2020-11-13 17:52:53 +010012 public void setMeta(JsonNode n);
13 public void setQuery(JsonNode n);
14 public void setCollection(JsonNode n);
Akroneedac912020-11-16 12:54:42 +010015 public JsonNode getMeta();
16 public JsonNode getQuery();
17 public JsonNode getCollection();
Akron62d90a32020-11-18 20:45:38 +010018 public boolean appendMatches (String s) throws IOException;
Akron74122712020-11-17 09:41:21 +010019 public String getFileName ();
20 public void setFileName (String s);
21 public String getQueryString ();
22 public void setQueryString (String s);
Akrond2072ee2020-11-17 16:12:41 +010023 public String getCorpusQueryString ();
24 public void setCorpusQueryString (String s);
Akron820dc642020-11-19 13:11:50 +010025 public String getSource ();
26 public void setSource (String h, String p);
27
Akronc1c18242020-11-18 18:24:12 +010028 public int getTotalResults ();
29 public boolean hasTimeExceeded ();
Akron62d90a32020-11-18 20:45:38 +010030 public void setMaxResults (int m);
Akron8154dbe2020-11-13 17:52:53 +010031
32 // Implemented by Exporter
33 public ResponseBuilder serve();
34
35 // Needs to be overwritten
36 public void writeHeader (Writer w) throws IOException;
37 public void addMatch (JsonNode n, Writer w) throws IOException;
38 public void writeFooter (Writer w) throws IOException;
Akrone57937b2020-11-17 08:49:31 +010039 public String getMimeType ();
40 public String getSuffix ();
Akron8154dbe2020-11-13 17:52:53 +010041};