blob: 11413ae42b7ae8ebde4edb2f29af69b2b3e7eec9 [file] [log] [blame]
hebastaa66693a2020-07-19 16:51:28 +02001/**
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 */
9package de.ids_mannheim.korap.plkexport;
10
Akronc931cd02020-09-15 10:54:17 +020011import java.io.*;
12import java.lang.String;
13import java.util.Properties;
14
hebastaa66693a2020-07-19 16:51:28 +020015public class ExWSConf {
16 /*
17 * maximum hits to be exported
18 * TODO: Define this constants after discussing it.
Akronc931cd02020-09-15 10:54:17 +020019 * Maybe we need a distinction between users at the IDS and external users
hebastaa66693a2020-07-19 16:51:28 +020020 * See also: https://www.ids-mannheim.de/cosmas2/script-app/hilfe/sitzung.html
21 */
22 public static final int MAX_EXP_LIMIT = 10000;
hebasta541e6762020-07-22 20:01:53 +020023
hebasta2e431202020-11-02 10:00:26 +010024 // Version of Export Plugin
hebasta541e6762020-07-22 20:01:53 +020025 public static final int VERSION_MAJOR = 0;
26 public static final int VERSION_MINOR = 1;
Akron91077492020-10-02 17:52:24 +020027 public static final int VERSION_PATCHLEVEL= 1;
Akronc931cd02020-09-15 10:54:17 +020028
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 };
hebastaa66693a2020-07-19 16:51:28 +020067}