aboutsummaryrefslogtreecommitdiff
path: root/src/uk/ac/ox/cs/pagoda/util/Properties.java
blob: 9ebebb63d6c643ac90a372a79ea5e75a39b7f8e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package uk.ac.ox.cs.pagoda.util;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class Properties {
	
	String dataPath = null;
	public String getDataPath() { return dataPath; }
	public void setDataPath(String path) { dataPath = path; }
	
	String ontologyPath;
	public String getOntologyPath() { return ontologyPath; }
	public void setOntologyPath(String path) { ontologyPath = path; }
	
	String queryPath = null; 
	public String getQueryPath() { return queryPath; }
	public void setQueryPath(String path) { queryPath = path; }
	
	String answerPath = null; 
	public String getAnswerPath() { return answerPath; }
	public void setAnswerPath(String path) { answerPath = path; }
	
	boolean toClassify = true;
	public boolean getToClassify() { return toClassify; }
	public void setToClassify(boolean flag) { toClassify = flag; }
	
	boolean toCallHermiT = true; 
	public boolean getToCallHermiT() { return toCallHermiT; }
	public void setToCallHermiT(boolean flag) { toCallHermiT = flag; }
	
	public static boolean shellModeDefault = false;
	
	boolean shellMode = shellModeDefault;
	public boolean getShellMode() { return shellMode; }
	public void setShellMode(boolean flag) { shellMode = flag; }
	
	public Properties(String path) {
		java.util.Properties m_properties = new java.util.Properties();
		InputStream inputStream = null; 
		try {
			inputStream = new FileInputStream(path);
			m_properties.load(inputStream);
			
			setOntologyPath(m_properties.getProperty("ONTOLOGY"));
			setDataPath(m_properties.getProperty("DATA"));
			setQueryPath(m_properties.getProperty("QUERY"));
			setAnswerPath(m_properties.getProperty("ANSWER"));
			setToClassify(Boolean.parseBoolean(m_properties.getProperty("TO_CLASSIFY")));
			setToCallHermiT(Boolean.parseBoolean(m_properties.getProperty("CALL_HERMIT")));
			
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (inputStream != null)
				try {
					inputStream.close();
				} catch (IOException e) {
					e.printStackTrace();
				} 
		}
	}
	public Properties() { }

}