| hebasta | a66693a | 2020-07-19 16:51:28 +0200 | [diff] [blame] | 1 | /** |
| 2 | * |
| 3 | * @author helge |
| 4 | * |
| 5 | * Class to define the constants of the export web service, |
| 6 | * like the maximum hits to be exported |
| 7 | * |
| 8 | */ |
| 9 | package de.ids_mannheim.korap.plkexport; |
| 10 | |
| Akron | c931cd0 | 2020-09-15 10:54:17 +0200 | [diff] [blame] | 11 | import java.io.*; |
| 12 | import java.lang.String; |
| 13 | import java.util.Properties; |
| 14 | |
| hebasta | a66693a | 2020-07-19 16:51:28 +0200 | [diff] [blame] | 15 | public class ExWSConf { |
| 16 | /* |
| 17 | * maximum hits to be exported |
| 18 | * TODO: Define this constants after discussing it. |
| Akron | c931cd0 | 2020-09-15 10:54:17 +0200 | [diff] [blame] | 19 | * Maybe we need a distinction between users at the IDS and external users |
| hebasta | a66693a | 2020-07-19 16:51:28 +0200 | [diff] [blame] | 20 | * See also: https://www.ids-mannheim.de/cosmas2/script-app/hilfe/sitzung.html |
| 21 | */ |
| 22 | public static final int MAX_EXP_LIMIT = 10000; |
| hebasta | 541e676 | 2020-07-22 20:01:53 +0200 | [diff] [blame] | 23 | |
| hebasta | 2e43120 | 2020-11-02 10:00:26 +0100 | [diff] [blame] | 24 | // Version of Export Plugin |
| hebasta | 541e676 | 2020-07-22 20:01:53 +0200 | [diff] [blame] | 25 | public static final int VERSION_MAJOR = 0; |
| 26 | public static final int VERSION_MINOR = 1; |
| Akron | 9107749 | 2020-10-02 17:52:24 +0200 | [diff] [blame] | 27 | public static final int VERSION_PATCHLEVEL= 1; |
| Akron | c931cd0 | 2020-09-15 10:54:17 +0200 | [diff] [blame] | 28 | |
| 29 | private static Properties prop; |
| 30 | |
| 31 | // Load properties from file |
| 32 | public static Properties properties (String propFile) { |
| 33 | |
| 34 | if (prop != null) |
| 35 | return prop; |
| 36 | |
| 37 | if (propFile == null) |
| 38 | propFile = "exportPlugin.conf"; |
| 39 | |
| 40 | InputStream iFile; |
| 41 | try { |
| 42 | iFile = new FileInputStream(propFile); |
| 43 | prop = new Properties(); |
| 44 | prop.load(iFile); |
| 45 | } |
| 46 | catch (IOException t) { |
| 47 | try { |
| 48 | iFile = ExWSConf.class.getClassLoader() |
| 49 | .getResourceAsStream(propFile); |
| 50 | |
| 51 | if (iFile == null) { |
| 52 | System.err.println("Unable to load properties."); |
| 53 | return null; |
| 54 | }; |
| 55 | |
| 56 | prop = new Properties(); |
| 57 | prop.load(iFile); |
| 58 | iFile.close(); |
| 59 | } |
| 60 | catch (IOException e) { |
| 61 | System.err.println(e.getLocalizedMessage()); |
| 62 | return null; |
| 63 | }; |
| 64 | }; |
| 65 | return prop; |
| 66 | }; |
| hebasta | a66693a | 2020-07-19 16:51:28 +0200 | [diff] [blame] | 67 | } |