Index: trunk/gli/src/org/greenstone/gatherer/GathererApplet.java
===================================================================
--- trunk/gli/src/org/greenstone/gatherer/GathererApplet.java	(revision 10239)
+++ trunk/gli/src/org/greenstone/gatherer/GathererApplet.java	(revision 10240)
@@ -249,210 +249,3 @@
 	}
     }
-
-
-    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 10239)
+++ trunk/gli/src/org/greenstone/gatherer/cdm/CollectionDesignManager.java	(revision 10240)
@@ -37,6 +37,6 @@
 import org.greenstone.gatherer.Dictionary;
 import org.greenstone.gatherer.Gatherer;
-import org.greenstone.gatherer.GathererApplet;
 import org.greenstone.gatherer.LocalLibraryServer;
+import org.greenstone.gatherer.RemoteGreenstoneServer;
 import org.greenstone.gatherer.util.Utility;
 import org.w3c.dom.*;
@@ -233,5 +233,5 @@
 	    //upload etc/collect.cfg to the server to immediately reflect these changes.
 	    Utility.zipup(Gatherer.getCollectDirectoryPath(), collection_name, Utility.CONFIG_FILE, null, "", "");
-	    GathererApplet.upload_url_zip(collection_name, "etc", "", null);
+	    RemoteGreenstoneServer.upload_url_zip(collection_name, "etc", "", null);
 	}
 	
Index: trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java
===================================================================
--- trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java	(revision 10239)
+++ trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java	(revision 10240)
@@ -48,5 +48,5 @@
 import org.greenstone.gatherer.Dictionary;
 import org.greenstone.gatherer.Gatherer;
-import org.greenstone.gatherer.GathererApplet;
+import org.greenstone.gatherer.RemoteGreenstoneServer;
 import org.greenstone.gatherer.cdm.SearchTypeManager;
 import org.greenstone.gatherer.cdm.CollectionDesignManager;
@@ -690,5 +690,5 @@
 		    //First upload the collect.cfg file
 		    Utility.zipup(Gatherer.getCollectDirectoryPath(), collection_name, Utility.CONFIG_FILE, null, "", "");
-		    GathererApplet.upload_url_zip(collection_name, "etc", "", null);
+		    RemoteGreenstoneServer.upload_url_zip(collection_name, "etc", "", null);
 
 		    //Just run the buildcol command.
Index: trunk/gli/src/org/greenstone/gatherer/shell/GShell.java
===================================================================
--- trunk/gli/src/org/greenstone/gatherer/shell/GShell.java	(revision 10239)
+++ trunk/gli/src/org/greenstone/gatherer/shell/GShell.java	(revision 10240)
@@ -49,5 +49,5 @@
 import org.greenstone.gatherer.Dictionary;
 import org.greenstone.gatherer.Gatherer;
-import org.greenstone.gatherer.GathererApplet;
+import org.greenstone.gatherer.RemoteGreenstoneServer;
 import org.greenstone.gatherer.cdm.CollectionConfiguration;
 import org.greenstone.gatherer.cdm.CollectionDesignManager;
@@ -244,5 +244,5 @@
 		    if(hasSignalledStop()) { return; }
 		    // upload it to gsdl server
-		    GathererApplet.upload_url_zip(col_name, "import", "files", this);
+		    RemoteGreenstoneServer.upload_url_zip(col_name, "import", "files", this);
 
 		    Gatherer.c_man.getCollection().setFilesChanged(false);
@@ -255,5 +255,5 @@
 		    if(hasSignalledStop()) { return; }
 		    // upload it to gsdl server
-		    GathererApplet.upload_url_zip(col_name, "import", "metadata", this);
+		    RemoteGreenstoneServer.upload_url_zip(col_name, "import", "metadata", this);
 		    Gatherer.c_man.getCollection().setMetadataChanged(false);
 		    System.err.println("Finished uploading metadata.");
@@ -265,5 +265,5 @@
 
 		if(hasSignalledStop()) { return; }
-		GathererApplet.upload_url_zip(col_name, "etc", "", this);
+		RemoteGreenstoneServer.upload_url_zip(col_name, "etc", "", this);
 
 		String collection_directory_path = Gatherer.c_man.getCollectionDirectoryPath(col_name);
@@ -275,5 +275,5 @@
 
 		    if(hasSignalledStop()) { return; }
-		    GathererApplet.upload_url_zip(col_name, "images", "", this);
+		    RemoteGreenstoneServer.upload_url_zip(col_name, "images", "", this);
 
 		    System.err.println("collect_directory_path: " + collect_directory_path);
@@ -552,5 +552,5 @@
 	    if (type == NEW) {
 		if (Gatherer.isGsdlRemote) {
-		    GathererApplet.download_url_zip(col_name, ".", this, "", "");
+		    RemoteGreenstoneServer.download_url_zip(col_name, ".", this, "", "");
 		    if (!hasSignalledStop()) {
 			Utility.unzip(Gatherer.getCollectDirectoryPath(), col_name);
@@ -569,5 +569,5 @@
 		    Utility.delete(Gatherer.c_man.getCollectionArchivesDirectoryPath()); // remove current archives
 		    //new File(Gatherer.c_man.getCollectionArchivesDirectoryPath()).mkdir(); //Make a clean dir
-		    GathererApplet.download_url_zip(col_name, "archives", this, ".*doc\\.xml", "");
+		    RemoteGreenstoneServer.download_url_zip(col_name, "archives", this, ".*doc\\.xml", "");
 		    if (hasSignalledStop()) {
 			// Clean up, then exit
@@ -609,5 +609,5 @@
  		    Utility.delete(buildDir); // remove current build dir
 		    //Only need build.cfg
-		    GathererApplet.download_url_zip(col_name, "building", this, ".*build\\.cfg", "");
+		    RemoteGreenstoneServer.download_url_zip(col_name, "building", this, ".*build\\.cfg", "");
 		    if (!hasSignalledStop()) {
 			Utility.unzip(Gatherer.getCollectDirectoryPath(), col_name);
@@ -652,5 +652,5 @@
 
 		    Utility.delete(full_local_cd_dir); // remove current cd-rom dir, if it exists
-		    GathererApplet.download_url_zip(user_tmp_dir,cd_dir,this,"","");
+		    RemoteGreenstoneServer.download_url_zip(user_tmp_dir,cd_dir,this,"","");
 
 		    Utility.unzip(Configuration.gsdl_path, user_tmp_dir.substring(1));
