| Akron | 8154dbe | 2020-11-13 17:52:53 +0100 | [diff] [blame] | 1 | package de.ids_mannheim.korap.plkexport; |
| 2 | import com.fasterxml.jackson.databind.JsonNode; |
| 3 | import javax.ws.rs.core.Response; |
| 4 | import javax.ws.rs.core.Response.ResponseBuilder; |
| 5 | import java.io.IOException; |
| 6 | import java.io.Writer; |
| 7 | |
| 8 | interface Exporter { |
| 9 | |
| 10 | // Implemented by MatchAggregator |
| Akron | 62d90a3 | 2020-11-18 20:45:38 +0100 | [diff] [blame] | 11 | public boolean init (String s) throws IOException; |
| Akron | 8154dbe | 2020-11-13 17:52:53 +0100 | [diff] [blame] | 12 | public void setMeta(JsonNode n); |
| 13 | public void setQuery(JsonNode n); |
| 14 | public void setCollection(JsonNode n); |
| Akron | eedac91 | 2020-11-16 12:54:42 +0100 | [diff] [blame] | 15 | public JsonNode getMeta(); |
| 16 | public JsonNode getQuery(); |
| 17 | public JsonNode getCollection(); |
| Akron | 62d90a3 | 2020-11-18 20:45:38 +0100 | [diff] [blame] | 18 | public boolean appendMatches (String s) throws IOException; |
| Akron | 7412271 | 2020-11-17 09:41:21 +0100 | [diff] [blame] | 19 | public String getFileName (); |
| 20 | public void setFileName (String s); |
| 21 | public String getQueryString (); |
| 22 | public void setQueryString (String s); |
| Akron | d2072ee | 2020-11-17 16:12:41 +0100 | [diff] [blame] | 23 | public String getCorpusQueryString (); |
| 24 | public void setCorpusQueryString (String s); |
| Akron | 820dc64 | 2020-11-19 13:11:50 +0100 | [diff] [blame] | 25 | public String getSource (); |
| 26 | public void setSource (String h, String p); |
| 27 | |
| Akron | c1c1824 | 2020-11-18 18:24:12 +0100 | [diff] [blame] | 28 | public int getTotalResults (); |
| 29 | public boolean hasTimeExceeded (); |
| Akron | 62d90a3 | 2020-11-18 20:45:38 +0100 | [diff] [blame] | 30 | public void setMaxResults (int m); |
| Akron | 8154dbe | 2020-11-13 17:52:53 +0100 | [diff] [blame] | 31 | |
| 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; |
| Akron | e57937b | 2020-11-17 08:49:31 +0100 | [diff] [blame] | 39 | public String getMimeType (); |
| 40 | public String getSuffix (); |
| Akron | 8154dbe | 2020-11-13 17:52:53 +0100 | [diff] [blame] | 41 | }; |