Index: /trunk/java-client/org/nzdl/gsdl/SearchAllCollections.java
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/SearchAllCollections.java	(revision 2214)
+++ /trunk/java-client/org/nzdl/gsdl/SearchAllCollections.java	(revision 2215)
@@ -54,4 +54,5 @@
 import org.nzdl.gsdl.service.NzdlService;
 import org.nzdl.gsdl.service.NzdlServiceClient;
+import org.nzdl.gsdl.util.NzdlServiceFactory;
 
 /**
@@ -71,4 +72,5 @@
  * @see org.nzdl.gsdl.service.NzdlService
  * @see org.nzdl.gsdl.service.NzdlServiceClient
+ * @see org.nzdl.gsdl.util.NzdlServiceFactory
  * @see gnu.getopt.Getopt
  * @see gnu.getopt.LongOpt
@@ -77,17 +79,15 @@
 public class SearchAllCollections implements Cloneable, Serializable {
 
-  /** The collection of CORBA IORs we know about */
-  protected Properties knownIORs = null;
   /** The underlying CORBA inferface */
   NzdlService nzdl = null;
 
-  /** The name of the properties file */
-  String propertiesFileName = "knownIORs.properties";
-  /** The name of the file we look for IOR's in */
-  String IORFileName = "/tmp/localcorba.objid";
   /** Look for an IOR in the file first */
   boolean useFileFirst = false;
   /** The IOR that was specified on the commandline */
   String IORFromCommandLine = null;
+  /** The URL that was specified on the commandline */
+  String URLFromCommandLine = null;
+  /** The name of the file we look for IOR's in */
+  static String IORFileName = "/tmp/localcorba.objid";
 
   /** The query to use */
@@ -98,54 +98,31 @@
 
     SearchAllCollections() {
-	init(null);
-    }
-    
+	nzdl = NzdlServiceFactory.createNzdlService(null, 
+						    System.getProperties(), 
+						    URLFromCommandLine,
+						    IORFileName, 
+						    IORFromCommandLine);
+	if (nzdl == null)
+	    throw new Error("URK! unable to find an IOR...");
+    }
+    
+
+    /** 
+     * Normal constructor. the args are passed into the orb 
+     * initialisation code so they can extract obscure args ...
+     */ 
     SearchAllCollections(String [] args) {
-	parseArgs(args);
-	init(args);
-    }
-
-    void init(String [] args)  {
-	
-	// Load prevously seen IORs from property file
-	knownIORs = new Properties();
-	
-	File file = new File(propertiesFileName);
-	try {
-	    if (file.exists()) {
-		knownIORs.load(new FileInputStream(file));
-	    } 
-	} catch (IOException i) {
-	    System.err.println("Error reading properties file:" + i);
-	}
-
-	// Attempt to initialise client with ORs from property file
-	Enumeration e = knownIORs.keys();
-	while (e.hasMoreElements() && nzdl == null) {
-	    String IOR = (String) e.nextElement();
-	    attemptToInitialise(args, null, IOR);
-	    
-	}
-	
-	// Attempt to initialise client with IOR from file
-	if (nzdl == null) {
-	    String IOR = getIorKey(IORFileName);
-	    attemptToInitialise(args, null, IOR);
-	    knownIORs.put(IOR,"");
-	}
-	
-    }
-    
+	// parseArgs(args);
+	nzdl = NzdlServiceFactory.createNzdlService(args, 
+						    System.getProperties(), 
+						    URLFromCommandLine, 
+						    IORFileName, 
+						    IORFromCommandLine);
+	if (nzdl == null)
+	    throw new Error("Unable to find an IOR.");
+    }
+
     public void finalize(){
-	tidy();
-    }
-
-    void tidy() {
-	try {
-	    File file = new File(propertiesFileName);
-	    knownIORs.store(new FileOutputStream(file),"These are CORBA IOR's that the SearchAllCollections client has seen and will check again...");
-	} catch (IOException i) {
-	    System.err.println("Error writing properties file:" + i);
-	}
+
     }
 
@@ -190,19 +167,4 @@
     
 
-    private boolean attemptToInitialise(String [] _args, 
-					Properties _props, 
-					String _IOR) {
-	try {
-	    nzdl = new NzdlServiceClient( _args, _props, _IOR);
-	} catch (Throwable t) {
-	    System.err.println ("Failed to initialise using:");
-	    System.err.println (_IOR);
-	    nzdl = null;
-	    return false;
-	}
-	return true;
-    }
-
-  
     static String getHelpText() {
 	String s = "";
@@ -345,8 +307,6 @@
 	
 	SearchAllCollections client = new SearchAllCollections(args);
-	
 	client.queryAllCollections();
-	client.tidy();
-
+ 
     } //main
     
