Initial revision
[old-projects.git] / ekit / com / swabunga / spell / engine / Configuration.java
1 package com.swabunga.spell.engine;
2
3 import java.util.ResourceBundle;
4
5 /**
6 * @author aim4min
7 *
8 */
9 public abstract class Configuration {
10
11 public static final String EDIT_DEL1 = "EDIT_DEL1";
12 public static final String EDIT_DEL2 = "EDIT_DEL2";
13 public static final String EDIT_SWAP = "EDIT_SWAP";
14 public static final String EDIT_SUB = "EDIT_SUB";
15 public static final String EDIT_SIMILAR = "EDIT_SIMILAR";
16 public static final String EDIT_MIN = "EDIT_MIN";
17 public static final String EDIT_MAX = "EDIT_MAX";
18
19 public static final String SPELL_THRESHOLD = "SPELL_THRESHOLD";
20 public static final String SPELL_IGNOREUPPERCASE = "SPELL_IGNOREUPPERCASE";
21 public static final String SPELL_IGNOREMIXEDCASE = "SPELL_IGNOREMIXEDCASE";
22 public static final String SPELL_IGNOREINTERNETADDRESSES = "SPELL_IGNOREINTERNETADDRESS";
23 public static final String SPELL_IGNOREDIGITWORDS = "SPELL_IGNOREDIGITWORDS";
24 public static final String SPELL_IGNOREMULTIPLEWORDS = "SPELL_IGNOREMULTIPLEWORDS";
25 public static final String SPELL_IGNORESENTANCECAPITALIZATION = "SPELL_IGNORESENTANCECAPTILIZATION";
26
27 public abstract int getInteger(String key);
28 public abstract boolean getBoolean(String key);
29 public abstract void setInteger(String key, int value);
30 public abstract void setBoolean(String key, boolean value);
31
32 public static final Configuration getConfiguration() {
33 Configuration result;
34 // changed, breaks applet security otherwise (Howard Kistler)
35 String config = (String)null;
36 try
37 {
38 config = System.getProperty("jazzy.config");
39 }
40 catch(Exception e)
41 {
42 config = (String)null;
43 e.printStackTrace(System.err);
44 }
45 // End Mod
46 if (config != null && config.length() > 0) {
47 try {
48 result = (Configuration)Class.forName(config).newInstance();
49 } catch (InstantiationException e) {
50 result = new PropertyConfiguration();
51 } catch (IllegalAccessException e) {
52 result = new PropertyConfiguration();
53 } catch (ClassNotFoundException e) {
54 result = new PropertyConfiguration();
55 }
56 } else {
57 result = new PropertyConfiguration();
58 }
59 return result;
60 }
61 }