Initial revision
[old-projects.git] / ekit / com / swabunga / spell / engine / Configuration.java
diff --git a/ekit/com/swabunga/spell/engine/Configuration.java b/ekit/com/swabunga/spell/engine/Configuration.java
new file mode 100644 (file)
index 0000000..710e8ec
--- /dev/null
@@ -0,0 +1,61 @@
+package com.swabunga.spell.engine;\r
+\r
+import java.util.ResourceBundle;\r
+\r
+/**\r
+ * @author aim4min\r
+ *\r
+ */\r
+public abstract class Configuration {\r
+\r
+    public static final String EDIT_DEL1 = "EDIT_DEL1";\r
+    public static final String EDIT_DEL2 = "EDIT_DEL2";\r
+    public static final String EDIT_SWAP = "EDIT_SWAP";\r
+    public static final String EDIT_SUB = "EDIT_SUB";\r
+    public static final String EDIT_SIMILAR = "EDIT_SIMILAR";\r
+    public static final String EDIT_MIN = "EDIT_MIN";\r
+    public static final String EDIT_MAX = "EDIT_MAX";\r
+       \r
+       public static final String SPELL_THRESHOLD = "SPELL_THRESHOLD";\r
+       public static final String SPELL_IGNOREUPPERCASE = "SPELL_IGNOREUPPERCASE";\r
+       public static final String SPELL_IGNOREMIXEDCASE = "SPELL_IGNOREMIXEDCASE";\r
+       public static final String SPELL_IGNOREINTERNETADDRESSES = "SPELL_IGNOREINTERNETADDRESS";\r
+       public static final String SPELL_IGNOREDIGITWORDS = "SPELL_IGNOREDIGITWORDS";\r
+       public static final String SPELL_IGNOREMULTIPLEWORDS = "SPELL_IGNOREMULTIPLEWORDS";\r
+       public static final String SPELL_IGNORESENTANCECAPITALIZATION = "SPELL_IGNORESENTANCECAPTILIZATION";\r
+       \r
+       public abstract int getInteger(String key);\r
+       public abstract boolean getBoolean(String key);\r
+       public abstract void setInteger(String key, int value);\r
+       public abstract void setBoolean(String key, boolean value);\r
+       \r
+       public static final Configuration getConfiguration() {\r
+               Configuration result;\r
+               // changed, breaks applet security otherwise (Howard Kistler)\r
+               String config = (String)null;\r
+               try\r
+               {\r
+                       config = System.getProperty("jazzy.config");\r
+               }\r
+               catch(Exception e)\r
+               {\r
+                       config = (String)null;\r
+                       e.printStackTrace(System.err);\r
+               }\r
+               // End Mod\r
+               if (config != null && config.length() > 0) {\r
+                       try {\r
+                               result = (Configuration)Class.forName(config).newInstance();\r
+                       } catch (InstantiationException e) {\r
+                               result = new PropertyConfiguration();\r
+                       } catch (IllegalAccessException e) {\r
+                               result = new PropertyConfiguration();\r
+                       } catch (ClassNotFoundException e) {\r
+                               result = new PropertyConfiguration();\r
+                       }\r
+               } else {\r
+                       result = new PropertyConfiguration();   \r
+               }\r
+               return result;\r
+       }\r
+}\r