Merge branch 'Jalview-JS/develop' into merge_js_develop
[jalview.git] / src / jalview / ws / sifts / SiftsSettings.java
index 5e2c526..1c25a34 100644 (file)
@@ -22,57 +22,76 @@ package jalview.ws.sifts;
 
 import java.util.Objects;
 
-public class SiftsSettings
+import jalview.bin.ApplicationSingletonProvider;
+import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
+
+public class SiftsSettings implements ApplicationSingletonI
 {
-  private static boolean mapWithSifts = false;
+  /**
+   * Constructor
+   * 
+   * @return
+   */
+  private static SiftsSettings getInstance()
+  {
+    return (SiftsSettings) ApplicationSingletonProvider
+            .getInstance(SiftsSettings.class);
+  }
+
+  private SiftsSettings()
+  {
+    // singleton; use getInstance()
+  }
+
+  private boolean mapWithSifts = false;
 
-  private static String siftDownloadDirectory;
+  private String siftDownloadDirectory;
 
-  private static int cacheThresholdInDays;
+  private int cacheThresholdInDays;
 
-  private static int failSafePIDThreshold;
+  private int failSafePIDThreshold;
 
   public static boolean isMapWithSifts()
   {
-    return mapWithSifts;
+    return getInstance().mapWithSifts;
   }
 
   public static void setMapWithSifts(boolean mapWithSifts)
   {
-    SiftsSettings.mapWithSifts = mapWithSifts;
+    getInstance().mapWithSifts = mapWithSifts;
   }
 
   public static String getSiftDownloadDirectory()
   {
-    return siftDownloadDirectory;
+    return getInstance().siftDownloadDirectory;
   }
 
   public static void setSiftDownloadDirectory(String siftDownloadDirectory)
   {
-    SiftsSettings.siftDownloadDirectory = siftDownloadDirectory;
+    getInstance().siftDownloadDirectory = siftDownloadDirectory;
   }
 
   public static int getCacheThresholdInDays()
   {
-    return cacheThresholdInDays;
+    return getInstance().cacheThresholdInDays;
   }
 
   public static void setCacheThresholdInDays(String cacheThresholdInDays)
   {
     Objects.requireNonNull(cacheThresholdInDays);
-    SiftsSettings.cacheThresholdInDays = Integer
+    getInstance().cacheThresholdInDays = Integer
             .valueOf(cacheThresholdInDays);
   }
 
   public static int getFailSafePIDThreshold()
   {
-    return failSafePIDThreshold;
+    return getInstance().failSafePIDThreshold;
   }
 
   public static void setFailSafePIDThreshold(String failSafePIDThreshold)
   {
     Objects.requireNonNull(failSafePIDThreshold);
-    SiftsSettings.failSafePIDThreshold = Integer
+    getInstance().failSafePIDThreshold = Integer
             .valueOf(failSafePIDThreshold);
   }
 }