Index: /main/trunk/gli/classes/xml/configWebswing.xml
===================================================================
--- /main/trunk/gli/classes/xml/configWebswing.xml	(revision 37330)
+++ /main/trunk/gli/classes/xml/configWebswing.xml	(revision 37330)
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE Configuration [
+  <!ELEMENT Configuration  (GathererConfig, Other, DirectoryMappings, Associations)>
+  <!ELEMENT GathererConfig (Argument*)>
+  <!ELEMENT Argument       (#PCDATA)>
+  <!ATTLIST Argument
+            name           CDATA #REQUIRED>
+  <!ELEMENT Other          (Info*)>
+  <!ELEMENT Info           (Name, Desc, Arguments)>
+  <!ELEMENT Arguments      (Option*)>
+  <!ELEMENT Option         (Name, Desc, Type, Required, Default?, List?)>
+  <!ELEMENT Type           (#PCDATA)>
+  <!ELEMENT Required       (#PCDATA)>
+  <!ELEMENT Default        (#PCDATA)>
+  <!ELEMENT List           (Value*)>
+  <!ELEMENT Value          (Name, Desc?)>
+  <!ELEMENT Name           (#PCDATA)>
+  <!ELEMENT Desc           (#PCDATA)>
+  <!ELEMENT DirectoryMappings (Mapping*)>
+  <!ELEMENT Mapping           (#PCDATA)>
+  <!ATTLIST Mapping 
+            name              CDATA #REQUIRED
+	    file              CDATA #REQUIRED>
+  <!ELEMENT Associations (Entry*)>
+  <!ELEMENT Entry (#PCDATA)>
+  <!ATTLIST Entry
+            extension CDATA #REQUIRED>
+]>
+
+<Configuration version="svn-trunk">
+  <GathererConfig>
+    <!-- ***** General Options: apply globally to the GLI execution. ***** -->
+    <!-- The location and size of the main Gatherer window. -->
+    <Argument name="general.bounds">0, 0, 958, 600</Argument>
+    <!-- Are we expected to produce a debug file. Can be overidden at start up. default = [false] -->
+    <Argument name="general.debug">false</Argument>
+    <Argument name="general.email"/>
+    <!-- The standard font used in the Gatherer. [Verdana, BOLD, 12] -->
+    <Argument name="general.font">Verdana, BOLD, 12</Argument>
+    <Argument name="general.library_url_gs2"/>
+    <Argument name="general.library_url_gs3"/>
+    <Argument name="general.locale">en_NZ</Argument>
+    <!-- How many folders deep should we recurse before suspecting a cyclic path? [40] -->
+    <Argument name="general.max_folder_depth">40</Argument>
+    <!-- The mode controls what level a detail is presented to the user - ranging from a basic, no regex, no perl experience up to complete details for all processes. The values, ranging from lowest to highest detail, are: 1 = Assistant, 2 = Librarian, 3 = Systems, 4 = Expert [default 2]-->
+    <Argument name="general.mode">2</Argument>
+    <Argument name="general.open_collection_gs2"></Argument>
+    <Argument name="general.open_collection_gs3"></Argument>
+    <!-- The application launching command used when previewing the collection. [default -blank-] -->
+    <Argument name="general.preview_program"></Argument>
+    <Argument name="general.proxy_host"></Argument>
+    <Argument name="general.proxy_port">80</Argument>
+    <Argument name="general.show_file_size">false</Argument>
+    <!-- Do we expect to connect to the internet via a proxy server. [false] -->
+    <Argument name="general.use_proxy">false</Argument>
+    <Argument name="general.view_extracted_metadata">true</Argument>
+
+    <!-- Greenstone 3-specific -->	
+    <Argument name="general.site_name"></Argument>
+    <Argument name="general.servlet_path"></Argument>
+
+    <!-- Colouring -->
+    <Argument name="coloring.button_background">218, 237, 252</Argument>
+    <Argument name="coloring.button_foreground">0, 0, 0</Argument>
+    <Argument name="coloring.button_selected_background">128, 180, 216</Argument>
+    <Argument name="coloring.button_selected_foreground">255, 255, 255</Argument>
+    <Argument name="coloring.collection_heading_background">116, 186, 86</Argument>  <!-- green -->
+    <Argument name="coloring.collection_heading_foreground">0, 0, 0</Argument>
+    <Argument name="coloring.collection_selection_background">128, 180, 216</Argument>
+    <Argument name="coloring.collection_selection_foreground">0, 0, 0</Argument>
+    <Argument name="coloring.collection_tree_background">224, 240, 224</Argument>
+    <Argument name="coloring.collection_tree_foreground">0, 0, 0</Argument>
+    <Argument name="coloring.collection_noneditable_background">192, 192, 192</Argument>
+    <Argument name="coloring.collection_noneditable_foreground">0, 0, 0</Argument>
+    <Argument name="coloring.disabled">206, 206, 206</Argument>
+    <Argument name="coloring.editable_background">255, 255, 255</Argument>
+    <Argument name="coloring.editable_foreground">0, 0, 0</Argument>
+    <Argument name="coloring.error_background">255, 0, 0</Argument>
+    <Argument name="coloring.error_foreground">0, 0, 0</Argument>
+    <Argument name="coloring.scrollbar_background">192, 192, 192</Argument>
+    <Argument name="coloring.scrollbar_foreground">255, 255, 255</Argument>
+    <Argument name="coloring.workspace_heading_background">128, 180, 216</Argument>
+    <Argument name="coloring.workspace_heading_foreground">0, 0, 0</Argument>
+    <Argument name="coloring.workspace_selection_background">116, 186, 86</Argument> <!-- green -->
+    <Argument name="coloring.workspace_selection_foreground">0, 0, 0</Argument>
+    <Argument name="coloring.workspace_tree_background">218, 237, 252</Argument>
+    <Argument name="coloring.workspace_tree_foreground">0, 0, 0</Argument>
+
+    <!-- Mirroring -->
+    <!-- Mirroring has many particular options. These show the default settings. -->
+    <Argument name="mirroring.depth">0</Argument>
+    <Argument name="mirroring.no_parents">true</Argument>
+    <Argument name="mirroring.other_hosts">false</Argument>
+    <Argument name="mirroring.overwrite">false</Argument>
+    <Argument name="mirroring.page_requisites">true</Argument>
+    <Argument name="mirroring.quiet">true</Argument>
+    <Argument name="mirroring.remove_failed">false</Argument>
+
+    <!-- Warnings -->
+    <!-- Warnings can be disabled by the user. -->
+    <Argument name="warning.CollectionBuilt">true</Argument>
+    <Argument name="warning.ScheduleBuilt">true</Argument>
+    <Argument name="warning.DirectoryLevelMetadata">true</Argument>
+    <Argument name="warning.ExtractedMetadata">true</Argument>
+    <Argument name="warning.MissingEXEC">true</Argument>
+    <Argument name="warning.MissingEXEC_GS3">true</Argument>
+    <Argument name="warning.MissingGSDL">true</Argument>
+    <Argument name="warning.MissingImageMagick">true</Argument>
+    <Argument name="warning.MissingPDFBox">true</Argument>    
+    <Argument name="warning.MissingPERL">true</Argument>
+    <Argument name="warning.NoEncodingSupport">true</Argument>
+    <Argument name="warning.NonStandardCollectHome">true</Argument>
+    <Argument name="warning.NoPluginExpectedToProcessFile">true</Argument>
+    <Argument name="warning.LegacyCollection">true</Argument>
+    <Argument name="warning.MetadataSetNamespaceClash">true</Argument>
+    <Argument name="warning.ShowPreviousCollection">true</Argument>  
+
+    <!-- Workflow -->
+    <!-- Disabling a view here will cause it to be hidden from the Gatherer display. -->
+    <Argument name="workflow.download">true</Argument>
+    <Argument name="workflow.gather">true</Argument>
+    <Argument name="workflow.enrich">true</Argument>
+    <Argument name="workflow.design">true</Argument>
+    <Argument name="workflow.create">true</Argument>
+    <Argument name="workflow.format">true</Argument>
+    <Argument name="workflow.flax">true</Argument>
+
+    <Argument name="GEMS.Preferences.Selected_Languages">en</Argument>    
+  </GathererConfig>
+
+  <Other/>
+  <DirectoryMappings/>
+  <Associations>
+    <Entry extension="doc"/>
+    <Entry extension="gif"/>
+    <Entry extension="htm"/>
+    <Entry extension="html"/>
+    <Entry extension="jpg"/>
+    <Entry extension="jpeg"/>
+    <Entry extension="pdf"/>
+    <Entry extension="png"/>
+    <Entry extension="ps"/>
+    <Entry extension="rtf"/>
+    <Entry extension="txt"/>
+    <Entry extension="text"/>
+  </Associations>
+</Configuration>
Index: /main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java	(revision 37329)
+++ /main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java	(revision 37330)
@@ -170,5 +170,5 @@
 	static private URL default_gliserver_url=null;
     
-	public Gatherer(String[] args) 
+	public Gatherer(GetOpt go) 
 	{
 		// Display the version to make error reports a lot more useful
@@ -177,5 +177,5 @@
 		JarTools.initialise(this); 
 
-		GetOpt go = new GetOpt(args);
+		//GetOpt go = new GetOpt(args);
 
 		// Remember the GSDLOS value
@@ -246,4 +246,5 @@
 		}
 		else if (isWebswing) {
+		    Configuration.template_config_xml = Configuration.TEMPLATE_CONFIG_PREFIX +  Configuration.CONFIG_WEBSWING_XML; 
 		    Configuration.config_xml = Configuration.CONFIG_WEBSWING_XML;
 		}
@@ -266,4 +267,8 @@
 	}
 
+        public Gatherer(String[] args)
+        {
+	    this(new GetOpt(args));
+	}
 
 	public void init(String gsdl_path, String gsdl3_path, String gsdl3_src_path, 
@@ -287,4 +292,20 @@
 		    System.exit(0);
 		}
+
+		String username = webswingAuthenticator.getUsername();
+
+		// In webswing case, GathererProg does not have a username when it was initializing this
+		String gli_no_username_dir_path = Gatherer.getGLIUserDirectoryPath();
+
+		String gli_user_directory_path = gli_no_username_dir_path  + username + File.separator;
+		
+		File gli_user_directory = new File(gli_user_directory_path);
+		if (!gli_user_directory.exists() && !gli_user_directory.mkdir()) {
+		    System.err.println("Warning: Unable to make directory: " + gli_user_directory_path);
+		}
+		else {
+		    Gatherer.setGLIUserDirectoryPath(gli_user_directory_path);
+		}
+		
 	    }
 		// Create the debug stream if required
@@ -1976,4 +1997,9 @@
 	    }
 
+	    public String getUsername() {
+		return username;
+	    }
+
+
 	    public boolean authenticate(String library_url_string) {
 		PasswordAuthentication pa = getPasswordAuthentication();
Index: /main/trunk/gli/src/org/greenstone/gatherer/GathererProg.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/GathererProg.java	(revision 37329)
+++ /main/trunk/gli/src/org/greenstone/gatherer/GathererProg.java	(revision 37330)
@@ -61,12 +61,47 @@
 	}
 
+	GetOpt go = new GetOpt(args);
+			
 	// Determine the GLI user directory path
-	String gli_user_directory_path = System.getProperty("user.home") + File.separator;
-        if (Utility.isWindows()) {
-	    gli_user_directory_path += "Application Data" + File.separator + "Greenstone" + File.separator + "GLI" + File.separator;
-        }
-        else {
-            gli_user_directory_path += ".gli" + File.separator;
-        }
+	String gli_user_directory_path = null;
+	if (go.webswing) {
+	    if (go.gsdl3_src_path != null) {
+		// above is a (albeit a crude) test at this early stage of running,
+		// that makes sure we're running GS3
+
+		// "user.dir" resolves to the user's current-working-directory
+		// which is engineered through webswing.config to be the GLI home directory		
+		
+		gli_user_directory_path = System.getProperty("user.dir") + File.separator + "webswing-users" + File.separator;
+		
+		//gli_user_directory_path = go.gsdl3_src_path + File.separator;
+		
+		// or GSDL3SRCHOME ???
+		//gli_user_directory_path = System.getProperty("user.dir") + File.separator;
+		//gli_user_directory_path = System.getenv("GSDL3SRCHOME") + File.separator;
+
+		File gli_user_directory = new File(gli_user_directory_path);
+		
+		if (!gli_user_directory.exists() && !gli_user_directory.mkdir()) {
+		    System.err.println("Warning: Unable to make directory: " + gli_user_directory_path);
+		}
+	    }
+	    else {
+		System.err.println("Webswing for Greenstone2 not supported");
+		System.exit(1);
+	    }
+	}
+	else {
+	    gli_user_directory_path = System.getProperty("user.home") + File.separator;
+
+	
+	    if (Utility.isWindows()) {
+		gli_user_directory_path += "Application Data" + File.separator + "Greenstone" + File.separator + "GLI" + File.separator;
+	    }
+	    else {
+		gli_user_directory_path += ".gli" + File.separator;
+	    }
+	}
+	
 	Gatherer.setGLIUserDirectoryPath(gli_user_directory_path);
 
@@ -75,5 +110,5 @@
 	
 	// Create an instance of the Gatherer class, which will parse the args and prepare the rest of the GLI
-	final Gatherer gatherer = new Gatherer(args);
+	final Gatherer gatherer = new Gatherer(go);
 		
 	// TESTING circumventing the old GUI event dispatch thread exceptions in GLI. Follows
