| 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 { |
| Akron | 62d90a3 | 2020-11-18 20:45:38 +0100 | [diff] [blame] | 16 | |
| hebasta | 2e43120 | 2020-11-02 10:00:26 +0100 | [diff] [blame] | 17 | // Version of Export Plugin |
| hebasta | 541e676 | 2020-07-22 20:01:53 +0200 | [diff] [blame] | 18 | public static final int VERSION_MAJOR = 0; |
| 19 | public static final int VERSION_MINOR = 1; |
| Akron | 9107749 | 2020-10-02 17:52:24 +0200 | [diff] [blame] | 20 | public static final int VERSION_PATCHLEVEL= 1; |
| Akron | c931cd0 | 2020-09-15 10:54:17 +0200 | [diff] [blame] | 21 | |
| 22 | private static Properties prop; |
| 23 | |
| 24 | // Load properties from file |
| 25 | public static Properties properties (String propFile) { |
| 26 | |
| 27 | if (prop != null) |
| 28 | return prop; |
| 29 | |
| 30 | if (propFile == null) |
| 31 | propFile = "exportPlugin.conf"; |
| 32 | |
| 33 | InputStream iFile; |
| 34 | try { |
| 35 | iFile = new FileInputStream(propFile); |
| 36 | prop = new Properties(); |
| 37 | prop.load(iFile); |
| 38 | } |
| 39 | catch (IOException t) { |
| 40 | try { |
| 41 | iFile = ExWSConf.class.getClassLoader() |
| 42 | .getResourceAsStream(propFile); |
| 43 | |
| 44 | if (iFile == null) { |
| 45 | System.err.println("Unable to load properties."); |
| 46 | return null; |
| 47 | }; |
| 48 | |
| 49 | prop = new Properties(); |
| 50 | prop.load(iFile); |
| 51 | iFile.close(); |
| 52 | } |
| 53 | catch (IOException e) { |
| 54 | System.err.println(e.getLocalizedMessage()); |
| 55 | return null; |
| 56 | }; |
| 57 | }; |
| 58 | return prop; |
| 59 | }; |
| hebasta | a66693a | 2020-07-19 16:51:28 +0200 | [diff] [blame] | 60 | } |