Index: /trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/Makefile
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/Makefile	(revision 2187)
+++ /trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/Makefile	(revision 2188)
@@ -1,3 +1,4 @@
-CLASSES = CSFrame.class \
+CLASSES = PreferencesDialog.class\
+  CSFrame.class \
   CSModel.class\
   Constants.class\
Index: /trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/PreferencesDialog.java
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/PreferencesDialog.java	(revision 2187)
+++ /trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/PreferencesDialog.java	(revision 2188)
@@ -37,4 +37,5 @@
 package org.nzdl.gsdl.SimpleGraphicalClient;
 
+import org.nzdl.gsdl.util.NzdlPreferences;
 import javax.swing.*;
 import java.awt.*;
@@ -69,12 +70,36 @@
 
     //contentBox.add();
+    String preferanceName = null;
     // the preferences themselves ...
 
-    JCheckBox showFirstDocCheckBox = new JCheckBox("Automatically display the document contents of the first result", true); //should read initial value from preferences data structure
+    preferanceName = "Automatically display the first document";
+    JCheckBox showFirstDocCheckBox = 
+      new JCheckBox(preferanceName, NzdlPreferences.getBoolean(preferanceName));
     showFirstDocCheckBox.setHorizontalAlignment(SwingConstants.LEFT);
 
-    JCheckBox showAsTextCheckBox = new JCheckBox("Always display raw text (don't interpret HTML)", false); //should read initial value from preferences data structure
+    preferanceName = "Always display raw text (don't interpret HTML)";
+    JCheckBox showAsTextCheckBox = 
+      new JCheckBox(preferanceName, NzdlPreferences.getBoolean(preferanceName));
     showAsTextCheckBox.setHorizontalAlignment(SwingConstants.LEFT);
 
+    preferanceName = "Connect to multiple servers";
+    JCheckBox connectToMultipleCheckBox = 
+      new JCheckBox(preferanceName, NzdlPreferences.getBoolean(preferanceName));
+    connectToMultipleCheckBox.setHorizontalAlignment(SwingConstants.LEFT);
+
+    preferanceName = "Log at the NzdlService level";
+    JCheckBox logNetworkLevelCheckBox = 
+      new JCheckBox(preferanceName, NzdlPreferences.getBoolean(preferanceName));
+    logNetworkLevelCheckBox.setHorizontalAlignment(SwingConstants.LEFT);
+
+    preferanceName = "Cache corba requests";
+    JCheckBox useCacheCheckBox = 
+      new JCheckBox(preferanceName, NzdlPreferences.getBoolean(preferanceName));
+    useCacheCheckBox.setHorizontalAlignment(SwingConstants.LEFT);
+
+    preferanceName = "Save documents";
+    JCheckBox saveDocsCheckBox = 
+      new JCheckBox(preferanceName, NzdlPreferences.getBoolean(preferanceName));
+    saveDocsCheckBox.setHorizontalAlignment(SwingConstants.LEFT);
 
 
@@ -84,4 +109,8 @@
     contentBox.add(showFirstDocCheckBox);
     contentBox.add(showAsTextCheckBox);
+    contentBox.add(connectToMultipleCheckBox);
+    contentBox.add(logNetworkLevelCheckBox);
+    contentBox.add(useCacheCheckBox);
+    contentBox.add(saveDocsCheckBox);
 
     okButton = new JButton("Ok");
@@ -115,5 +144,6 @@
 	    //System.err.println("ok button pressed!");
 
-	    dispose(); //close window
+	  NzdlPreferences.getInstance().save();
+	  dispose(); //close window
 	}
     else
Index: /trunk/java-client/org/nzdl/gsdl/SimpleServer.java
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/SimpleServer.java	(revision 2187)
+++ /trunk/java-client/org/nzdl/gsdl/SimpleServer.java	(revision 2188)
@@ -40,4 +40,5 @@
 import org.nzdl.gsdl.util.NzdlCorbaFactory;
 import org.nzdl.gsdl.util.NzdlServiceFactory;
+import org.nzdl.gsdl.util.NzdlPreferences;
 
 
@@ -69,8 +70,10 @@
     corbaComErrorHolder error = NzdlCorbaFactory.createComErrorHolder();
     try{
-      NzdlServiceFactory.caching = true;
-      NzdlServiceFactory.doMultiple = true;
-      NzdlServiceFactory.saveDocs = true;
       
+      NzdlPreferences.setBoolean("Connect to multiple servers", true);
+      NzdlPreferences.setBoolean("Cache corba requests", true);
+      NzdlPreferences.setBoolean("Save documents", true);
+      NzdlPreferences.setBoolean("Log at the NzdlService level", true);
+
       NzdlService client = NzdlServiceFactory.createNzdlService(args,
 								null,
Index: /trunk/java-client/org/nzdl/gsdl/service/NzdlMultiWayWrapper.java
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/service/NzdlMultiWayWrapper.java	(revision 2187)
+++ /trunk/java-client/org/nzdl/gsdl/service/NzdlMultiWayWrapper.java	(revision 2188)
@@ -34,4 +34,5 @@
 import java.io.FileWriter;
 import org.nzdl.gsdl.util.NzdlServiceFactory;
+import org.nzdl.gsdl.util.NzdlPreferences;
 
 
@@ -72,5 +73,6 @@
       String key = (String)  e.nextElement();
       NzdlService server = (NzdlService) servers.get(key);
-      if (NzdlServiceFactory.logMultiple)
+      
+      if (NzdlPreferences.getBoolean("Log at the NzdlService level"))
 	server = new NzdlLogWrapper(server, 
 				    "log.file.after.split." + key + "cache", 
Index: /trunk/java-client/org/nzdl/gsdl/util/Makefile
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/util/Makefile	(revision 2187)
+++ /trunk/java-client/org/nzdl/gsdl/util/Makefile	(revision 2188)
@@ -13,5 +13,6 @@
 	$(JAVAC) $(JAVACOPTIONS)  $<
 
-CLASSFILES=NzdlConstants.class  \
+CLASSFILES=NzdlPreferences.class\
+     NzdlConstants.class  \
      NzdlCorbaFactory.class  \
      NzdlHosts.class  \
Index: /trunk/java-client/org/nzdl/gsdl/util/NzdlPreferences.java
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/util/NzdlPreferences.java	(revision 2188)
+++ /trunk/java-client/org/nzdl/gsdl/util/NzdlPreferences.java	(revision 2188)
@@ -0,0 +1,111 @@
+/*
+ *    NzdlPreferences.java
+ *    Copyright (C) 2001 New Zealand Digital Library Project
+ *
+ *    This program is free software; you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation; either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    This program is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with this program; if not, write to the Free Software
+ *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+//the package we're in
+package org.nzdl.gsdl.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Hashtable;
+import java.util.Properties;
+
+
+/**
+ * Stores our preferences...
+ */
+public final class NzdlPreferences {
+  /** The hashtable we write to disk ... */
+  protected Properties _preferences = null;
+  static NzdlPreferences instance = null;
+  static String preferencesFileName = "preferences";
+
+  protected NzdlPreferences() {
+    System.out.println("In constructor");
+    try {
+      _preferences = new Properties();
+      File file = new File(preferencesFileName);
+      InputStream stream = new FileInputStream(file);
+      _preferences.load(stream);
+    } catch (Exception exception) {
+      System.out.println("Unable to load file " + preferencesFileName+ "\n" + exception);
+    }
+  }
+  public void save() {
+    try {
+      File file = new File(preferencesFileName);
+      OutputStream stream = new FileOutputStream(file);
+      _preferences.store(stream,"Preferences ...");
+    } catch (Exception exception) {
+      System.out.println("Unable to save file " + preferencesFileName + "\n" + exception);
+      System.out.println("preferences =" + _preferences);
+    }
+  }
+  
+  /**
+   * Get the static Preferences object
+   */
+  public static NzdlPreferences getInstance() {
+    if (instance == null)
+      instance = new NzdlPreferences();
+    return instance;
+  }
+  /**
+   * Get a boolean preference
+   */
+  public static boolean getBoolean(String key){
+    String value = (String) getInstance()._preferences.get(key);
+    if (value == null)
+      {
+	setBoolean(key,false);
+	return false;
+      }
+    return Boolean.valueOf(value).booleanValue();
+  }
+  /**
+   * Set a boolean preference
+   */
+  public static void setBoolean(String key,boolean value) {
+    getInstance()._preferences.put(key,"" + value);
+    getInstance().save();
+  }
+  /**
+   * Get a String preference
+   */
+  public static String getString(String key){
+    String value = (String) getInstance()._preferences.get(key);
+    if (value == null)
+      {
+	setString(key,"");
+	return "";
+      }
+    return value;
+  }
+  /**
+   * Set a String preference
+   */
+  public static void setString(String key, String value) {
+    getInstance()._preferences.put(key, value);
+    getInstance().save();
+  }
+}
+
Index: /trunk/java-client/org/nzdl/gsdl/util/NzdlServiceFactory.java
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/util/NzdlServiceFactory.java	(revision 2187)
+++ /trunk/java-client/org/nzdl/gsdl/util/NzdlServiceFactory.java	(revision 2188)
@@ -102,16 +102,4 @@
   };
 
-  /** Are we using a caching NzdlService ? */
-  static public boolean caching = true;
-  /** Are we logging before the cache ? */
-  static public boolean logBefore = true;
-  /** Are we logging after the cache ? */
-  static public boolean logAfter = true;
-  /** Are we saving documents ? */
-  static public boolean saveDocs = false;
-  /** Are we trying for multiple servers ? */
-  static public boolean doMultiple = false;
-  /** Are we logging after individual servers ? */
-  static public boolean logMultiple = false;
 
   /**
@@ -533,19 +521,19 @@
     NzdlService nzdl = null;
     
-    if (doMultiple)
+    if (NzdlPreferences.getBoolean("Connect to multiple servers"))
       nzdl = new NzdlMultiWayWrapper(_args,_props,_URL,_filename,_IOR);
     else
       nzdl = findIOR(_args,_props,_URL,_filename,_IOR);
     
-    if (saveDocs)
+    if (NzdlPreferences.getBoolean("Save documents"))
       nzdl = new NzdlDocSaveWrapper(nzdl);
     
-    if (logAfter)
+    if (NzdlPreferences.getBoolean("Log at the NzdlService level"))
       nzdl = new NzdlLogWrapper(nzdl, "log.file.after.cache", "AFTER: ");
     
-    if (caching)
+    if (NzdlPreferences.getBoolean("Cache corba requests"))
       nzdl = new NzdlCacheWrapper(nzdl);
 
-    if (logBefore)
+    if (NzdlPreferences.getBoolean("Log at the NzdlService level"))
       nzdl = new NzdlLogWrapper(nzdl, "log.file.before.cache", "BEFORE: ");
     
