Index: trunk/gli/src/org/greenstone/gatherer/RemoteGreenstoneServer.java
===================================================================
--- trunk/gli/src/org/greenstone/gatherer/RemoteGreenstoneServer.java	(revision 10252)
+++ 	(revision )
@@ -1,236 +1,0 @@
-/**
- *#########################################################################
- *
- * A component of the Gatherer application, part of the Greenstone digital
- * library suite from the New Zealand Digital Library Project at the
- * University of Waikato, New Zealand.
- *
- * Author: David Bainbridge, Greenstone Digital Library, University of Waikato
- *
- * Copyright (C) 2005 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.
- *########################################################################
- */
-
-package org.greenstone.gatherer;
-
-import java.io.*;
-import java.net.*;
-import org.greenstone.gatherer.shell.GShell;
-
-
-public class RemoteGreenstoneServer
-{
-    static public void download_url_zip(String col_name, String dir, GShell source, String accept_expr, String reject_expr)
-    {
-	try {
-	    String download_cgi  = Gatherer.cgiBase + "download";
-
-	    // Send col_name and dir arguments to download cgi
-	    String col_name_encoded = URLEncoder.encode(col_name,"UTF-8");
-	    String dir_encoded = URLEncoder.encode(dir,"UTF-8");
-	    String cgi_args = "c=" + col_name_encoded;
-	    cgi_args += "&dir=" + dir_encoded + "&a=" + accept_expr + "&r=" + reject_expr;
-
-	    URL download_url = new URL(download_cgi);
-
-	    System.err.println("**** download cgi = '" + download_cgi + "'");
-	    System.err.println("**** cgi args = '" + cgi_args + "'");
-
-	    URLConnection dl_connection = download_url.openConnection();
-	    dl_connection.setDoOutput(true);	    
-	    OutputStream dl_os = dl_connection.getOutputStream();
-
-	    PrintWriter dl_out = new PrintWriter(dl_os);
-	    dl_out.println(cgi_args);
-	    dl_out.close();
-
-	    // Download result from running cgi script
-	    InputStream dl_is = dl_connection.getInputStream();
-	    BufferedInputStream dl_bis = new BufferedInputStream(dl_is); 
-	    DataInputStream dl_dbis = new DataInputStream(dl_bis);
-		    
-	    // set up output stream for zip download
-	    String col_dir;
-	    if (col_name.startsWith("/")) {
-		col_dir = Configuration.gsdl_path;
-	    }
-	    else {
-		col_dir = Gatherer.getCollectDirectoryPath();
-	    }
-
-	    String zip_fname = col_dir + col_name + ".zip";
-	    FileOutputStream zip_fos = new FileOutputStream(zip_fname);
-	    BufferedOutputStream zip_bfos = new BufferedOutputStream(zip_fos);
-	    
-	    byte[] buf = new byte[1024];
-	    int len;
-
-	    while ((len = dl_dbis.read(buf)) >= 0 && !source.hasSignalledStop()) {
-		zip_bfos.write(buf,0,len);
-	    }
-
-	    dl_dbis.close();
-	    dl_bis.close();
-	    dl_is.close();
-
-	    zip_bfos.close();
-	    zip_fos.close();
-
-	    if(source.hasSignalledStop()) {
-		//A cancel has been called. Delete the zip file.
-		DebugStream.println("download_url_zip() cancelled. Cleaning up.");
-		if(new File(zip_fname).delete()) {
-		    DebugStream.println("Zip file " + zip_fname + " deleted");
-		}
-		else {
-		    DebugStream.println("Zip file " + zip_fname + " NOT deleted (no big deal). Does it exist?");
-		}
-	    }
-	}
-	catch (Exception error) {
-	    error.printStackTrace();
-	}
-	DebugStream.println("Exited download_url_zip");
-    }
-
-
-    static public void upload_url_zip(String col_name, String dir, String delete_type, GShell source)
-    {
-	final String lineEnd = "\r\n";
-	final String twoHyphens = "--";
-	final String boundary =  "*****";
-	final int maxBufferSize = 1024;
-
-	String col_dir;
-	if (col_name.startsWith("/")) {
-	    col_dir = Configuration.gsdl_path;
-	}
-	else {
-	    col_dir = Gatherer.getCollectDirectoryPath();
-	}
-
-	String zip_fname = col_dir + col_name + ".zip";
-	String upload_cgi = Gatherer.cgiBase + "upload";
-
-	HttpURLConnection conn = null;
-
-	try {
-	    // Send zip file to server
-	    File file = new File(zip_fname);
-	    FileInputStream fileInputStream = new FileInputStream(file);
-
-	    // open a URL connection to the Servlet 
-	    URL url = new URL(upload_cgi);
-	    System.err.println("**** Uploading to: " + upload_cgi);
-
-	    // Open a HTTP connection to the URL
-	    conn = (HttpURLConnection) url.openConnection();
-
-	    conn.setDoInput(true);         // Allow Inputs
-	    conn.setDoOutput(true);        // Allow Outputs
-	    conn.setUseCaches(false);      // Don't use a cached copy.
-	    conn.setRequestMethod("POST"); // Use a post method.
-
-	    conn.setRequestProperty("Connection", "Keep-Alive");	    
-	    conn.setRequestProperty("Content-Type", "multipart/form-data;boundary="+boundary);
-
-	    DataOutputStream dos = new DataOutputStream( conn.getOutputStream() );
-
-	    dos.writeBytes(twoHyphens + boundary + lineEnd);
-	    dos.writeBytes("Content-Disposition: form-data; name=\"c\"" + lineEnd + lineEnd);
-	    dos.writeBytes(col_name + lineEnd);
-	    System.err.println("**** c="+col_name);
-
-	    dos.writeBytes(twoHyphens + boundary + lineEnd);
-	    dos.writeBytes("Content-Disposition: form-data; name=\"dir\"" + lineEnd + lineEnd);
-	    dos.writeBytes(dir + lineEnd);	
-	    System.err.println("**** dir="+dir);
-    
-	    dos.writeBytes(twoHyphens + boundary + lineEnd);
-	    dos.writeBytes("Content-Disposition: form-data; name=\"del\"" + lineEnd + lineEnd);
-	    dos.writeBytes(delete_type + lineEnd);	
-	    System.err.println("**** del="+delete_type);
-
-	    dos.writeBytes(twoHyphens + boundary + lineEnd);
-	    dos.writeBytes("Content-Disposition: form-data; name=\"zip\";"
-			   + " filename=\"" + zip_fname +"\"" + lineEnd);
-	    dos.writeBytes(lineEnd);
-	    System.err.println("**** zip (filename)="+zip_fname);
-
-	    // create a buffer of maximum size	           	    
-	    int bytesAvailable = fileInputStream.available();
-	    int bufferSize = Math.min(bytesAvailable, maxBufferSize);
-	    byte[] buffer = new byte[bufferSize];
-	    
-	    // read file and write it into form...
-	    int bytesRead = fileInputStream.read(buffer, 0, bufferSize);
-
-	    while (bytesRead > 0) {
-		// Check to see if action has been cancelled.
-		if (source != null && source.hasSignalledStop()) {
-		    break;
-		}
-		dos.write(buffer, 0, bufferSize);
-		bytesAvailable = fileInputStream.available();
-		bufferSize = Math.min(bytesAvailable, maxBufferSize);
-		bytesRead = fileInputStream.read(buffer, 0, bufferSize);
-	    }
-	    
-	    // send multipart form data necesssary after file data...
-	    
-	    dos.writeBytes(lineEnd);
-	    dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
-	    
-	    // close streams
-	    
-	    fileInputStream.close();
-	    dos.flush();
-	    dos.close();
-
-	    // delete zip file
-	    boolean file_deleted = file.delete();
-	    if (file_deleted) {
-		System.err.println("Zip file " + file.toString() + " deleted");
-	    }
-	    else {
-		System.err.println("Zip file " + file.toString() + " NOT deleted");
-	    }
-	}
-	catch (MalformedURLException ex) {
-	    System.err.println("Failed on: "+ex);
-	}
-	
-	catch (IOException ioe) {
-	    System.err.println("Failed on: "+ioe);
-	}
-	
-	// Read server response
-	try {
-	    InputStreamReader isr = new InputStreamReader(conn.getInputStream() );
-	    BufferedReader bisr = new BufferedReader (isr);
-	    String str;
-	    while (( str = bisr.readLine()) != null) {
-		System.err.println(str);
-	    }
-	    bisr.close();
-	    
-	}
-	catch (IOException ioex) {
-	    System.err.println("From (ServerResponse): "+ioex);
-	}
-    }
-}
Index: trunk/gli/src/org/greenstone/gatherer/cdm/CollectionDesignManager.java
===================================================================
--- trunk/gli/src/org/greenstone/gatherer/cdm/CollectionDesignManager.java	(revision 10252)
+++ trunk/gli/src/org/greenstone/gatherer/cdm/CollectionDesignManager.java	(revision 10259)
@@ -38,5 +38,5 @@
 import org.greenstone.gatherer.Gatherer;
 import org.greenstone.gatherer.LocalLibraryServer;
-import org.greenstone.gatherer.RemoteGreenstoneServer;
+import org.greenstone.gatherer.remote.RemoteGreenstoneServer;
 import org.greenstone.gatherer.util.Utility;
 import org.greenstone.gatherer.util.ZipTools;
Index: trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java
===================================================================
--- trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java	(revision 10252)
+++ trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java	(revision 10259)
@@ -48,10 +48,8 @@
 import org.greenstone.gatherer.Dictionary;
 import org.greenstone.gatherer.Gatherer;
-import org.greenstone.gatherer.RemoteGreenstoneServer;
 import org.greenstone.gatherer.cdm.SearchTypeManager;
 import org.greenstone.gatherer.cdm.CollectionDesignManager;
 import org.greenstone.gatherer.collection.Collection;
-import org.greenstone.gatherer.util.Utility;
-import org.greenstone.gatherer.util.ZipTools;
+import org.greenstone.gatherer.remote.RemoteGreenstoneServer;
 import org.greenstone.gatherer.shell.GBasicProgressMonitor;
 import org.greenstone.gatherer.shell.GBuildProgressMonitor;
@@ -63,4 +61,6 @@
 import org.greenstone.gatherer.util.AppendLineOnlyFileDocument;
 import org.greenstone.gatherer.util.StaticStrings;
+import org.greenstone.gatherer.util.Utility;
+import org.greenstone.gatherer.util.ZipTools;
 
 /** This class provides a GUI view showing some statistics on your current collection, and options for building it. As the collection is built this initial view is replaced with one showing progress bars and a message log of the creation process. This log can be later accessed via the options tree located in the center of the initial pane. This class is also responsible for creating the GShellProgressMonitors that are then attatched to external shell processes, and calling the methods in the CollectionManager for actually importing and building the collection. <br><BR>
Index: trunk/gli/src/org/greenstone/gatherer/remote/RemoteGreenstoneServer.java
===================================================================
--- trunk/gli/src/org/greenstone/gatherer/remote/RemoteGreenstoneServer.java	(revision 10259)
+++ trunk/gli/src/org/greenstone/gatherer/remote/RemoteGreenstoneServer.java	(revision 10259)
@@ -0,0 +1,239 @@
+/**
+ *#########################################################################
+ *
+ * A component of the Gatherer application, part of the Greenstone digital
+ * library suite from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * Author: David Bainbridge, Greenstone Digital Library, University of Waikato
+ *
+ * Copyright (C) 2005 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.
+ *########################################################################
+ */
+
+package org.greenstone.gatherer.remote;
+
+import java.io.*;
+import java.net.*;
+import org.greenstone.gatherer.Configuration;
+import org.greenstone.gatherer.DebugStream;
+import org.greenstone.gatherer.Gatherer;
+import org.greenstone.gatherer.shell.GShell;
+
+
+public class RemoteGreenstoneServer
+{
+    static public void download_url_zip(String col_name, String dir, GShell source, String accept_expr, String reject_expr)
+    {
+	try {
+	    String download_cgi  = Gatherer.cgiBase + "download";
+
+	    // Send col_name and dir arguments to download cgi
+	    String col_name_encoded = URLEncoder.encode(col_name,"UTF-8");
+	    String dir_encoded = URLEncoder.encode(dir,"UTF-8");
+	    String cgi_args = "c=" + col_name_encoded;
+	    cgi_args += "&dir=" + dir_encoded + "&a=" + accept_expr + "&r=" + reject_expr;
+
+	    URL download_url = new URL(download_cgi);
+
+	    System.err.println("**** download cgi = '" + download_cgi + "'");
+	    System.err.println("**** cgi args = '" + cgi_args + "'");
+
+	    URLConnection dl_connection = download_url.openConnection();
+	    dl_connection.setDoOutput(true);	    
+	    OutputStream dl_os = dl_connection.getOutputStream();
+
+	    PrintWriter dl_out = new PrintWriter(dl_os);
+	    dl_out.println(cgi_args);
+	    dl_out.close();
+
+	    // Download result from running cgi script
+	    InputStream dl_is = dl_connection.getInputStream();
+	    BufferedInputStream dl_bis = new BufferedInputStream(dl_is); 
+	    DataInputStream dl_dbis = new DataInputStream(dl_bis);
+		    
+	    // set up output stream for zip download
+	    String col_dir;
+	    if (col_name.startsWith("/")) {
+		col_dir = Configuration.gsdl_path;
+	    }
+	    else {
+		col_dir = Gatherer.getCollectDirectoryPath();
+	    }
+
+	    String zip_fname = col_dir + col_name + ".zip";
+	    FileOutputStream zip_fos = new FileOutputStream(zip_fname);
+	    BufferedOutputStream zip_bfos = new BufferedOutputStream(zip_fos);
+	    
+	    byte[] buf = new byte[1024];
+	    int len;
+
+	    while ((len = dl_dbis.read(buf)) >= 0 && !source.hasSignalledStop()) {
+		zip_bfos.write(buf,0,len);
+	    }
+
+	    dl_dbis.close();
+	    dl_bis.close();
+	    dl_is.close();
+
+	    zip_bfos.close();
+	    zip_fos.close();
+
+	    if(source.hasSignalledStop()) {
+		//A cancel has been called. Delete the zip file.
+		DebugStream.println("download_url_zip() cancelled. Cleaning up.");
+		if(new File(zip_fname).delete()) {
+		    DebugStream.println("Zip file " + zip_fname + " deleted");
+		}
+		else {
+		    DebugStream.println("Zip file " + zip_fname + " NOT deleted (no big deal). Does it exist?");
+		}
+	    }
+	}
+	catch (Exception error) {
+	    error.printStackTrace();
+	}
+	DebugStream.println("Exited download_url_zip");
+    }
+
+
+    static public void upload_url_zip(String col_name, String dir, String delete_type, GShell source)
+    {
+	final String lineEnd = "\r\n";
+	final String twoHyphens = "--";
+	final String boundary =  "*****";
+	final int maxBufferSize = 1024;
+
+	String col_dir;
+	if (col_name.startsWith("/")) {
+	    col_dir = Configuration.gsdl_path;
+	}
+	else {
+	    col_dir = Gatherer.getCollectDirectoryPath();
+	}
+
+	String zip_fname = col_dir + col_name + ".zip";
+	String upload_cgi = Gatherer.cgiBase + "upload";
+
+	HttpURLConnection conn = null;
+
+	try {
+	    // Send zip file to server
+	    File file = new File(zip_fname);
+	    FileInputStream fileInputStream = new FileInputStream(file);
+
+	    // open a URL connection to the Servlet 
+	    URL url = new URL(upload_cgi);
+	    System.err.println("**** Uploading to: " + upload_cgi);
+
+	    // Open a HTTP connection to the URL
+	    conn = (HttpURLConnection) url.openConnection();
+
+	    conn.setDoInput(true);         // Allow Inputs
+	    conn.setDoOutput(true);        // Allow Outputs
+	    conn.setUseCaches(false);      // Don't use a cached copy.
+	    conn.setRequestMethod("POST"); // Use a post method.
+
+	    conn.setRequestProperty("Connection", "Keep-Alive");	    
+	    conn.setRequestProperty("Content-Type", "multipart/form-data;boundary="+boundary);
+
+	    DataOutputStream dos = new DataOutputStream( conn.getOutputStream() );
+
+	    dos.writeBytes(twoHyphens + boundary + lineEnd);
+	    dos.writeBytes("Content-Disposition: form-data; name=\"c\"" + lineEnd + lineEnd);
+	    dos.writeBytes(col_name + lineEnd);
+	    System.err.println("**** c="+col_name);
+
+	    dos.writeBytes(twoHyphens + boundary + lineEnd);
+	    dos.writeBytes("Content-Disposition: form-data; name=\"dir\"" + lineEnd + lineEnd);
+	    dos.writeBytes(dir + lineEnd);	
+	    System.err.println("**** dir="+dir);
+    
+	    dos.writeBytes(twoHyphens + boundary + lineEnd);
+	    dos.writeBytes("Content-Disposition: form-data; name=\"del\"" + lineEnd + lineEnd);
+	    dos.writeBytes(delete_type + lineEnd);	
+	    System.err.println("**** del="+delete_type);
+
+	    dos.writeBytes(twoHyphens + boundary + lineEnd);
+	    dos.writeBytes("Content-Disposition: form-data; name=\"zip\";"
+			   + " filename=\"" + zip_fname +"\"" + lineEnd);
+	    dos.writeBytes(lineEnd);
+	    System.err.println("**** zip (filename)="+zip_fname);
+
+	    // create a buffer of maximum size	           	    
+	    int bytesAvailable = fileInputStream.available();
+	    int bufferSize = Math.min(bytesAvailable, maxBufferSize);
+	    byte[] buffer = new byte[bufferSize];
+	    
+	    // read file and write it into form...
+	    int bytesRead = fileInputStream.read(buffer, 0, bufferSize);
+
+	    while (bytesRead > 0) {
+		// Check to see if action has been cancelled.
+		if (source != null && source.hasSignalledStop()) {
+		    break;
+		}
+		dos.write(buffer, 0, bufferSize);
+		bytesAvailable = fileInputStream.available();
+		bufferSize = Math.min(bytesAvailable, maxBufferSize);
+		bytesRead = fileInputStream.read(buffer, 0, bufferSize);
+	    }
+	    
+	    // send multipart form data necesssary after file data...
+	    
+	    dos.writeBytes(lineEnd);
+	    dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
+	    
+	    // close streams
+	    
+	    fileInputStream.close();
+	    dos.flush();
+	    dos.close();
+
+	    // delete zip file
+	    boolean file_deleted = file.delete();
+	    if (file_deleted) {
+		System.err.println("Zip file " + file.toString() + " deleted");
+	    }
+	    else {
+		System.err.println("Zip file " + file.toString() + " NOT deleted");
+	    }
+	}
+	catch (MalformedURLException ex) {
+	    System.err.println("Failed on: "+ex);
+	}
+	
+	catch (IOException ioe) {
+	    System.err.println("Failed on: "+ioe);
+	}
+	
+	// Read server response
+	try {
+	    InputStreamReader isr = new InputStreamReader(conn.getInputStream() );
+	    BufferedReader bisr = new BufferedReader (isr);
+	    String str;
+	    while (( str = bisr.readLine()) != null) {
+		System.err.println(str);
+	    }
+	    bisr.close();
+	    
+	}
+	catch (IOException ioex) {
+	    System.err.println("From (ServerResponse): "+ioex);
+	}
+    }
+}
Index: trunk/gli/src/org/greenstone/gatherer/shell/GShell.java
===================================================================
--- trunk/gli/src/org/greenstone/gatherer/shell/GShell.java	(revision 10252)
+++ trunk/gli/src/org/greenstone/gatherer/shell/GShell.java	(revision 10259)
@@ -49,5 +49,4 @@
 import org.greenstone.gatherer.Dictionary;
 import org.greenstone.gatherer.Gatherer;
-import org.greenstone.gatherer.RemoteGreenstoneServer;
 import org.greenstone.gatherer.cdm.CollectionConfiguration;
 import org.greenstone.gatherer.cdm.CollectionDesignManager;
@@ -55,4 +54,5 @@
 import org.greenstone.gatherer.cdm.CollectionMeta;
 import org.greenstone.gatherer.metadata.DocXMLFileManager;
+import org.greenstone.gatherer.remote.RemoteGreenstoneServer;
 import org.greenstone.gatherer.util.StaticStrings; 
 import org.greenstone.gatherer.util.Utility;
