Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/DepositorAction.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/DepositorAction.java	(revision 28201)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/DepositorAction.java	(revision 28202)
@@ -78,6 +78,5 @@
 		}
 
-		DerbyWrapper database = new DerbyWrapper();
-		database.connectDatabase(GlobalProperties.getGSDL3Home() + File.separator + "sites" + File.separator + this.config_params.get(GSConstants.SITE_NAME) + File.separatorChar + "etc" + File.separatorChar + "usersDB", false);
+		DerbyWrapper database = new DerbyWrapper(GlobalProperties.getGSDL3Home() + File.separatorChar + "etc" + File.separatorChar + "usersDB");
 		if (pageNumParseFail)
 		{
@@ -361,4 +360,5 @@
 		{
 			database.clearUserData();
+			database.clearTrackerData();
 		}
 		else
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/GeneralAction.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/GeneralAction.java	(revision 28201)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/GeneralAction.java	(revision 28202)
@@ -1,11 +1,3 @@
 package org.greenstone.gsdl3.action;
-
-import org.greenstone.gsdl3.util.*;
-import org.greenstone.util.GlobalProperties;
-// XML classes
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
 
 import java.io.File;
@@ -21,4 +13,15 @@
 import javax.xml.transform.stream.StreamResult;
 
+import org.greenstone.gsdl3.util.GSFile;
+import org.greenstone.gsdl3.util.GSParams;
+import org.greenstone.gsdl3.util.GSPath;
+import org.greenstone.gsdl3.util.GSXML;
+import org.greenstone.gsdl3.util.UserContext;
+import org.greenstone.util.GlobalProperties;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
 public class GeneralAction extends Action
 {
@@ -81,5 +84,5 @@
 		}
 
-		if (request_type.equals("r") || request_type.equals("s"))
+		if (request_type.equals("r") || request_type.equals("s") || request_type.equals("ro"))
 		{
 			//do the request
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/Authentication.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/Authentication.java	(revision 28201)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/Authentication.java	(revision 28202)
@@ -17,5 +17,4 @@
 import org.greenstone.gsdl3.util.DerbyWrapper;
 import org.greenstone.gsdl3.util.GSXML;
-import org.greenstone.gsdl3.util.UserContext;
 import org.greenstone.gsdl3.util.UserQueryResult;
 import org.greenstone.gsdl3.util.UserTermInfo;
@@ -851,8 +850,9 @@
 		if (_derbyWrapper == null)
 		{
-			_derbyWrapper = new DerbyWrapper();
-
 			// check the usersDb database, if it isn't existing, check the etc dir, create the etc dir if it isn't existing, then create the  user database and add a "admin" user
 			String usersDB_dir = GlobalProperties.getGSDL3Home() + File.separatorChar + "etc" + File.separatorChar + "usersDB";
+
+			_derbyWrapper = new DerbyWrapper(usersDB_dir);
+
 			File usersDB_file = new File(usersDB_dir);
 			if (!usersDB_file.exists())
@@ -869,12 +869,8 @@
 					}
 				}
-				_derbyWrapper.connectDatabase(usersDB_dir, true);
 				_derbyWrapper.createDatabase();
 			}
-			else
-			{
-				_derbyWrapper.connectDatabase(usersDB_dir, false);
-			}
-		}
+		}
+
 		return true;
 	}
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/UserTracker.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/UserTracker.java	(revision 28202)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/UserTracker.java	(revision 28202)
@@ -0,0 +1,131 @@
+package org.greenstone.gsdl3.service;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.apache.log4j.Logger;
+import org.greenstone.gsdl3.util.DerbyWrapper;
+import org.greenstone.gsdl3.util.GSXML;
+import org.greenstone.util.GlobalProperties;
+import org.w3c.dom.Element;
+
+public class UserTracker extends ServiceRack
+{
+	static Logger logger = Logger.getLogger(org.greenstone.gsdl3.service.DocXMLUtil.class.getName());
+
+	/**************************************************
+	 * The list of services the User Tracker supports *
+	 *************************************************/
+	protected static final String RECORD_USER_ACTION = "RecordUserAction";
+	protected static final String GET_ACTIVITY_ON_PAGE = "GetActivityOnPage";
+	/*************************************************/
+
+	String[] services = { RECORD_USER_ACTION, GET_ACTIVITY_ON_PAGE };
+
+	/** configure this service */
+	public boolean configure(Element info, Element extra_info)
+	{
+		if (!super.configure(info, extra_info))
+		{
+			return false;
+		}
+
+		logger.info("Configuring DocXMLUtil...");
+		this.config_info = info;
+
+		for (int i = 0; i < services.length; i++)
+		{
+			Element service = this.doc.createElement(GSXML.SERVICE_ELEM);
+			service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_RETRIEVE);
+			service.setAttribute(GSXML.NAME_ATT, services[i]);
+			this.short_service_info.appendChild(service);
+		}
+
+		return true;
+	}
+
+	protected Element getServiceDescription(String service_id, String lang, String subset)
+	{
+		for (int i = 0; i < services.length; i++)
+		{
+			if (service_id.equals(services[i]))
+			{
+				Element service_elem = this.doc.createElement(GSXML.SERVICE_ELEM);
+				service_elem.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_RETRIEVE);
+				service_elem.setAttribute(GSXML.NAME_ATT, services[i]);
+				return service_elem;
+			}
+		}
+
+		return null;
+	}
+
+	protected synchronized Element processRecordUserAction(Element request)
+	{
+		Element result = GSXML.createBasicResponse(this.doc, RECORD_USER_ACTION);
+
+		Element paramList = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
+		if (paramList == null)
+		{
+			GSXML.addError(this.doc, result, "Request has no parameter list");
+			return result;
+		}
+
+		HashMap<String, Serializable> params = GSXML.extractParams(paramList, true);
+		String username = (String) params.get("username");
+		String collection = (String) params.get("collection");
+		String site = (String) params.get("site");
+		String oid = (String) params.get("oid");
+		String action = (String) params.get("action");
+
+		DerbyWrapper database = new DerbyWrapper(GlobalProperties.getGSDL3Home() + File.separatorChar + "etc" + File.separatorChar + "usersDB");
+		database.addUserAction(username, site, collection, oid, action);
+		database.closeDatabase();
+
+		return result;
+	}
+
+	protected synchronized Element processGetActivityOnPage(Element request)
+	{
+		System.err.println("CALLED");
+		Element result = GSXML.createBasicResponse(this.doc, GET_ACTIVITY_ON_PAGE);
+		try
+		{
+
+			Element paramList = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
+			if (paramList == null)
+			{
+				System.err.println("WHA?");
+				GSXML.addError(this.doc, result, "Request has no parameter list");
+				return result;
+			}
+
+			HashMap<String, Serializable> params = GSXML.extractParams(paramList, true);
+			String collection = (String) params.get("collection");
+			String site = (String) params.get("site");
+			String oid = (String) params.get("oid");
+
+			DerbyWrapper database = new DerbyWrapper(GlobalProperties.getGSDL3Home() + File.separatorChar + "etc" + File.separatorChar + "usersDB");
+			ArrayList<HashMap<String, String>> userActions = database.getMostRecentUserActions(site, collection, oid);
+
+			System.err.println(userActions.size());
+
+			Element userList = this.doc.createElement("userList");
+			for (HashMap<String, String> userAction : userActions)
+			{
+				Element user = this.doc.createElement("user");
+				user.setAttribute("username", userAction.get("username"));
+				user.setAttribute("action", userAction.get("action"));
+				userList.appendChild(user);
+			}
+			result.appendChild(userList);
+		}
+		catch (Exception ex)
+		{
+			ex.printStackTrace();
+		}
+		return result;
+	}
+}
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/ModifyUsersDB.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/ModifyUsersDB.java	(revision 28201)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/ModifyUsersDB.java	(revision 28202)
@@ -25,97 +25,123 @@
 // To run this from the command-line, first make sure that the tomcat server is stopped, then run:
 // java -cp /full/path/to/GS3/web/WEB-INF/lib/gsdl3.jar:/full/path/to/GS3/web/WEB-INF/lib/derby.jar org.greenstone.gsdl3.util.usersDB2txt web/etc/usersDB/
-public class ModifyUsersDB {
-    
-    public static void main(String[] args) throws SQLException {
-	
-	if (args.length < 3) { // at minimum one field belonging to a username has to be changed
-	    System.out.println("Usage: java org.greenstone.gsdl3.ModifyUsersDB <full_path_of_the_usersDB> <username> [-noAdd] [password=pwd] [groups=grp] [accounstatus=status] [comment=cmt] [email=address]");
-	    System.exit(0);
+public class ModifyUsersDB
+{
+
+	public static void main(String[] args) throws SQLException
+	{
+
+		if (args.length < 3)
+		{ // at minimum one field belonging to a username has to be changed
+			System.out.println("Usage: java org.greenstone.gsdl3.ModifyUsersDB <full_path_of_the_usersDB> <username> [-noAdd] [password=pwd] [groups=grp] [accounstatus=status] [comment=cmt] [email=address]");
+			System.exit(0);
+		}
+
+		String usersDB = args[0];
+		String username = args[1];
+
+		String password = "";
+		String groups = "";
+		String accountstatus = "true";
+		String comment = "";
+		String email = "";
+
+		boolean noAdd = false;
+
+		// If the user specifically sets any of the fields on the cmdline, they'll be overwritten in the db, 
+		// even if the user had set them to empty. Except the password which must be between 3 and 8 characters.
+		for (int i = 2; i < args.length; i++)
+		{
+			if (args[i].startsWith("password="))
+			{
+				password = args[i].substring("password=".length());
+
+				if (password.length() < 3 || password.length() > 8)
+				{
+					if (!password.equals(""))
+					{
+						System.out.println("Password not updated. It should be between 3 and 8 characters (inclusive).");
+					}
+				}
+				else
+				{
+					// Use the same encryption technique used by the Admin Authentication page
+					// This ensures that the password generated for a string remains consistent
+					//System.err.println("**** Password entered was: " + password);
+					password = Authentication.hashPassword(password);
+				}
+
+			}
+			else if (args[i].startsWith("groups="))
+			{
+				groups = args[i].substring("groups=".length());
+			}
+			else if (args[i].startsWith("accountstatus="))
+			{
+				accountstatus = args[i].substring("accountstatus=".length());
+			}
+			else if (args[i].startsWith("comment="))
+			{
+				comment = args[i].substring("comment=".length());
+			}
+			else if (args[i].startsWith("email="))
+			{
+				email = args[i].substring("email=".length());
+			}
+			else if (args[i].equals("-noAdd"))
+			{
+				noAdd = true;
+			}
+		}
+
+		// find the user to modify
+		DerbyWrapper dw = new DerbyWrapper(usersDB);
+		UserQueryResult findUserResult = dw.findUser(username);
+
+		if (findUserResult == null)
+		{
+			if (noAdd)
+			{
+				System.out.println("Failed to update user. Cannot find user " + username + " in " + usersDB + " database.");
+			}
+			else
+			{ // add new user
+				//System.err.println("**** Trying to add user: ");
+				//System.err.println("**** " + username + " " + password + " " + groups + " " + accountstatus + " " + comment + " " + email);
+				dw.addUser(username, password, groups, accountstatus, comment, email);
+			}
+		}
+		else
+		{ // modify existing user data
+
+			// in case any of the other fields are not specified, get fallbacks from the database
+			UserTermInfo user = findUserResult.getUserTerms().get(0);
+
+			if (password.equals(""))
+			{
+				password = user.password; // already stored hashed-and-hexed in DB
+			}
+			if (groups.equals(""))
+			{
+				groups = user.groups;
+			}
+			if (accountstatus.equals(""))
+			{
+				accountstatus = user.accountstatus.equals("") ? "true" : user.accountstatus;
+			}
+			if (comment.equals(""))
+			{
+				comment = user.comment;
+			}
+			if (email.equals(""))
+			{
+				email = user.email;
+			}
+
+			//System.err.println("**** " + username + " " + password + " " + groups + " " + accountstatus + " " + comment + " " + email);
+			dw.modifyUserInfo(username, password, groups, accountstatus, comment, email); // other than username and pwd, remaining fields are allowed to be ""
+		}
+
+		dw.closeDatabase();
+
 	}
-
-	DerbyWrapper dw=new DerbyWrapper();
-	
-	String usersDB = args[0];
-	String username = args[1];
-
-	String password = "";
-	String groups = "";
-	String accountstatus = "true";
-	String comment = "";
-	String email = "";
-
-	boolean noAdd = false;
-	
-	// If the user specifically sets any of the fields on the cmdline, they'll be overwritten in the db, 
-	// even if the user had set them to empty. Except the password which must be between 3 and 8 characters.
-	for(int i = 2; i < args.length; i++) {
-	    if(args[i].startsWith("password=")) {
-		password = args[i].substring("password=".length());
-		
-		if(password.length() < 3 || password.length() > 8) {
-		    if(!password.equals("")) {
-			System.out.println("Password not updated. It should be between 3 and 8 characters (inclusive).");
-		    }
-		} else {
-		    // Use the same encryption technique used by the Admin Authentication page
-		    // This ensures that the password generated for a string remains consistent
-		    //System.err.println("**** Password entered was: " + password);
-		    password = Authentication.hashPassword(password);
-		}
-		
-	    } else if(args[i].startsWith("groups=")) {
-		groups = args[i].substring("groups=".length());
-	    } else if(args[i].startsWith("accountstatus=")) {
-		accountstatus = args[i].substring("accountstatus=".length());
-	    } else if(args[i].startsWith("comment=")) {
-		comment = args[i].substring("comment=".length());
-	    } else if(args[i].startsWith("email=")) {
-		email = args[i].substring("email=".length());
-	    } else if(args[i].equals("-noAdd")) {
-		noAdd = true;
-	    }
-	}
-	    
-
-	// find the user to modify
-	dw.connectDatabase(usersDB,false);
-	UserQueryResult findUserResult = dw.findUser(username);
-	
-	if(findUserResult == null) {
-	    if(noAdd) {
-		System.out.println("Failed to update user. Cannot find user " + username + " in " + usersDB + " database.");
-	    } else { // add new user
-		//System.err.println("**** Trying to add user: ");
-		//System.err.println("**** " + username + " " + password + " " + groups + " " + accountstatus + " " + comment + " " + email);
-		dw.addUser(username, password, groups, accountstatus, comment, email);
-	    }
-	}
-	else { // modify existing user data
-	    
-	    // in case any of the other fields are not specified, get fallbacks from the database
-	    UserTermInfo user = findUserResult.getUserTerms().get(0);
-
-	    if(password.equals("")) { 
-		password = user.password; // already stored hashed-and-hexed in DB
-	    }
-	    if(groups.equals("")) {
-		groups = user.groups;
-	    }
-	    if(accountstatus.equals("")) { 
-		accountstatus = user.accountstatus.equals("") ? "true" : user.accountstatus;
-	    }
-	    if(comment.equals("")) { 
-		comment = user.comment; 
-	    }
-	    if(email.equals("")) {
-		email = user.email;
-	    }    
-	    
-	    //System.err.println("**** " + username + " " + password + " " + groups + " " + accountstatus + " " + comment + " " + email);
-	    dw.modifyUserInfo(username, password, groups, accountstatus, comment, email); // other than username and pwd, remaining fields are allowed to be ""
-	}
-	    
-	dw.closeDatabase();
-	
-    }
 }
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/txt2usersDB.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/txt2usersDB.java	(revision 28201)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/txt2usersDB.java	(revision 28202)
@@ -27,163 +27,198 @@
 import org.greenstone.gsdl3.service.Authentication;
 
-public class txt2usersDB {
-    
-    public static void main(String[] args) throws SQLException{
-	boolean appending = false;
-
-	String usage = "Usage: java org.greenstone.gsdl3.txt2usersDB full_path_of_the_text_file full_path_of_the_usersDB [-append]";
-	if (args.length < 2){
-	    System.out.println(usage);
-	    System.exit(0);
+public class txt2usersDB
+{
+
+	public static void main(String[] args) throws SQLException
+	{
+		boolean appending = false;
+
+		String usage = "Usage: java org.greenstone.gsdl3.txt2usersDB full_path_of_the_text_file full_path_of_the_usersDB [-append]";
+		if (args.length < 2)
+		{
+			System.out.println(usage);
+			System.exit(0);
+		}
+		File txtfile = new File(args[0]);
+		if (!txtfile.exists())
+		{
+			System.out.println("File " + args[0] + " does not exist.");
+			System.out.println(usage);
+			System.exit(0);
+		}
+
+		try
+		{
+			BufferedReader in = new BufferedReader(new FileReader(args[0]));
+			String str;
+			DerbyWrapper dw = new DerbyWrapper(args[1]);
+
+			if (args.length > 2 && args[2].equals("-append"))
+			{
+				appending = true;
+			}
+			else
+			{
+				// no appending, replace existing database: the text file 
+				// represents the new database, so delete the existing DB first
+				boolean delete_rows = dw.deleteAllUser();
+				dw.closeDatabase();
+				if (!delete_rows)
+				{
+					System.out.println("Couldn't delete rows of the users table");
+					System.exit(0);
+				}
+			}
+
+			String username = null;
+			String password = null;
+			String groups = null;
+			String accountstatus = null;
+			String comment = null;
+			String email = null;
+
+			while ((str = in.readLine()) != null)
+			{
+				//ystem.out.println(str);
+
+				if (str.indexOf(" = ") != -1)
+				{ // works with DerbyWrapper.db2txt() and usersDB2txt.java. Fields listed as: USERNAME = admin
+					String field = str.substring(0, str.indexOf(" = "));
+					if (field.equalsIgnoreCase("email"))
+					{
+						email = str.substring(str.indexOf(" = ") + 3, str.length());
+					}
+					if (field.equalsIgnoreCase("comment"))
+					{
+						comment = str.substring(str.indexOf(" = ") + 3, str.length());
+					}
+					if (field.equalsIgnoreCase("status"))
+					{
+						accountstatus = str.substring(str.indexOf(" = ") + 3, str.length());
+					}
+					if (field.equalsIgnoreCase("groups"))
+					{
+						groups = str.substring(str.indexOf(" = ") + 3, str.length());
+					}
+					if (field.equalsIgnoreCase("password"))
+					{
+						//password=dw.rot13(str.substring(str.indexOf(">")+1,str.length()));
+						password = str.substring(str.indexOf(" = ") + 3, str.length());
+					}
+					if (field.equalsIgnoreCase("username"))
+					{
+						username = str.substring(str.indexOf(" = ") + 3, str.length());
+					}
+				}
+				else if (str.startsWith("<"))
+				{ // fields listed as: <username>admin
+					String field = str.substring(1, str.indexOf(">"));
+					if (field.equals("email"))
+					{
+						email = str.substring(str.indexOf(">") + 1, str.length());
+					}
+					if (field.equals("comment"))
+					{
+						comment = str.substring(str.indexOf(">") + 1, str.length());
+					}
+					if (field.equals("enabled") || field.equals("status"))
+					{
+						accountstatus = str.substring(str.indexOf(">") + 1, str.length());
+					}
+					if (field.equals("groups"))
+					{
+						groups = str.substring(str.indexOf(">") + 1, str.length());
+					}
+					if (field.equals("password"))
+					{
+						password = str.substring(str.indexOf(">") + 1, str.length());
+					}
+					if (field.equals("username"))
+					{
+						username = str.substring(str.indexOf(">") + 1, str.length());
+					}
+				}
+				else if (str.equals("----------------------------------------------------------------------") || str.equals("-------------------------------------"))
+				{
+
+					if ((username != null) && (password != null) && (groups != null) && (accountstatus != null) && (comment != null))
+					{
+						dw.connectDatabase(args[1], false);
+
+						// check if it's a new user or already exists in the database
+						UserQueryResult findUserResult = dw.findUser(username);
+
+						if (findUserResult == null)
+						{ // add new user
+							if (password.length() >= 3 && password.length() <= 8)
+							{ // if not yet encrypted, encrypt first
+								password = Authentication.hashPassword(password);
+							} // if > 8 chars, password for user being added was already encrypted (hashed-and-hexed)
+							dw.addUser(username, password, groups, accountstatus, comment, email);
+						}
+
+						else
+						{ // modify existing user
+							// if any of the other fields are not specified, get them from the database
+							UserTermInfo user = findUserResult.getUserTerms().get(0);
+
+							if (password.length() < 3 || password.length() > 8)
+							{ // includes empty string case
+								password = user.password;
+							}
+							else
+							{ // need to first encrypt (hash-and-hex) the user-entered password
+								// Use the same encryption technique used by the Admin Authentication page
+								// This ensures that the password generated for a string remains consistent
+								password = Authentication.hashPassword(password);
+							}
+							groups = groups.equals("") ? user.groups : groups;
+							accountstatus = accountstatus.equals("") ? user.accountstatus : accountstatus;
+							comment = comment.equals("") ? user.comment : comment;
+
+							if (email == null)
+							{ // special checking for backwards compatibility since old DB did not have email field
+								email = "";
+							}
+							if (user.email == null)
+							{
+								user.email = "";
+							}
+							if (email.equals(""))
+							{
+								email = user.email;
+							}
+
+							//System.err.println("**** Password: " + password);				
+							//System.err.println("**** " + username + " " + password + " " + groups + " " + accountstatus + " " + comment + " " + email);
+							dw.modifyUserInfo(username, password, groups, accountstatus, comment, email);
+						}
+
+						username = null;
+						password = null;
+						groups = null;
+						accountstatus = null;
+						comment = null;
+						email = null;
+						//dw.connectDatabase(args[1],false); // should this be closeDatabase()????
+						dw.closeDatabase();
+					}
+				}
+
+				// only true back when when hashed passwords weren't being converted to hex
+				//else { // encrypted passwords can span multiple lines for some reason
+				// assume that is the case here
+				//if(password != null) { 
+				//	password = password + "\n" + str;
+				//  }
+				//}
+
+			}
+			//dw.closeDatabase();
+			in.close();
+		}
+		catch (IOException e)
+		{
+		}
 	}
-	File txtfile = new File(args[0]);
-	if(!txtfile.exists()) {
-	    System.out.println("File " + args[0] + " does not exist.");
-	    System.out.println(usage);	    
-	    System.exit(0);
-	}
-
-	try {
-	    BufferedReader in = new BufferedReader(new FileReader(args[0]));
-	    String str;
-	    DerbyWrapper dw=new DerbyWrapper();
-	    dw.connectDatabase(args[1],false);
-
-	    if(args.length > 2 && args[2].equals("-append")) {
-		    appending = true;
-	    } else {
-		// no appending, replace existing database: the text file 
-		// represents the new database, so delete the existing DB first
-		boolean delete_rows = dw.deleteAllUser();
-		dw.closeDatabase();
-		if (!delete_rows){
-		    System.out.println("Couldn't delete rows of the users table");
-		    System.exit(0);
-		}
-	    } 
-
-	    String username=null;
-	    String password=null;
-	    String groups=null;
-	    String accountstatus=null;
-	    String comment=null;
-	    String email=null;
-
-	    while ((str = in.readLine()) != null) {
-		//ystem.out.println(str);
-		
-		if(str.indexOf(" = ") != -1) { // works with DerbyWrapper.db2txt() and usersDB2txt.java. Fields listed as: USERNAME = admin
-		    String field=str.substring(0,str.indexOf(" = "));
-		    if (field.equalsIgnoreCase("email")){
-			email=str.substring(str.indexOf(" = ")+3,str.length());
-		    }
-		    if (field.equalsIgnoreCase("comment")){
-			comment=str.substring(str.indexOf(" = ")+3,str.length());
-		    }
-		    if (field.equalsIgnoreCase("status")){
-			accountstatus=str.substring(str.indexOf(" = ")+3,str.length());
-		    }
-		    if (field.equalsIgnoreCase("groups")){
-			groups=str.substring(str.indexOf(" = ")+3,str.length());
-		    }
-		    if (field.equalsIgnoreCase("password")){
-			//password=dw.rot13(str.substring(str.indexOf(">")+1,str.length()));
-			password=str.substring(str.indexOf(" = ")+3,str.length());
-		    }
-		    if (field.equalsIgnoreCase("username")){
-			username=str.substring(str.indexOf(" = ")+3,str.length());
-		    }
-		}		
-		else if (str.startsWith("<")){ // fields listed as: <username>admin
-		    String field=str.substring(1,str.indexOf(">"));
-		    if (field.equals("email")){
-			email=str.substring(str.indexOf(">")+1,str.length());
-		    }
-		    if (field.equals("comment")){
-			comment=str.substring(str.indexOf(">")+1,str.length());
-		    }
-		    if (field.equals("enabled") || field.equals("status")){
-			accountstatus=str.substring(str.indexOf(">")+1,str.length());
-		    }
-		    if (field.equals("groups")){
-			groups=str.substring(str.indexOf(">")+1,str.length());
-		    }
-		    if (field.equals("password")){			
-			password=str.substring(str.indexOf(">")+1,str.length());
-		    }
-		    if (field.equals("username")){
-			username=str.substring(str.indexOf(">")+1,str.length());
-		    }
-		}
-		else if (str.equals("----------------------------------------------------------------------")
-			 || str.equals("-------------------------------------")) {
-		    
-		    if ((username!=null) && (password!=null) && (groups!=null) && (accountstatus!=null) && (comment!=null)) {
-			dw.connectDatabase(args[1],false);
-
-			// check if it's a new user or already exists in the database
-			UserQueryResult findUserResult = dw.findUser(username);
-			
-			if(findUserResult == null) { // add new user
-			    if(password.length() >= 3 && password.length() <= 8) { // if not yet encrypted, encrypt first
-				password = Authentication.hashPassword(password);
-			    } // if > 8 chars, password for user being added was already encrypted (hashed-and-hexed)
-			    dw.addUser(username, password, groups, accountstatus, comment, email);
-			} 
-
-			else { // modify existing user
-			    // if any of the other fields are not specified, get them from the database
-			    UserTermInfo user = findUserResult.getUserTerms().get(0);
-			    
-			    if(password.length() < 3 || password.length() > 8) { // includes empty string case
-				password = user.password;
-			    } else { // need to first encrypt (hash-and-hex) the user-entered password
-				// Use the same encryption technique used by the Admin Authentication page
-				// This ensures that the password generated for a string remains consistent
-				password = Authentication.hashPassword(password);
-			    }
-			    groups = groups.equals("") ? user.groups : groups;
-			    accountstatus = accountstatus.equals("") ? user.accountstatus : accountstatus;
-			    comment = comment.equals("") ? user.comment : comment;
-
-			    if (email == null) { // special checking for backwards compatibility since old DB did not have email field
-				email = "";
-			    }
-			    if(user.email == null) {
-				user.email = "";
-			    }
-			    if(email.equals("")) {
-				email = user.email; 
-			    }
-			    
-			    //System.err.println("**** Password: " + password);				
-			    //System.err.println("**** " + username + " " + password + " " + groups + " " + accountstatus + " " + comment + " " + email);
-			    dw.modifyUserInfo(username, password, groups, accountstatus, comment, email);
-			}
-			
-			username=null;
-			password=null;
-			groups=null;
-			accountstatus=null;
-			comment=null;
-			email=null;
-			//dw.connectDatabase(args[1],false); // should this be closeDatabase()????
-			dw.closeDatabase();
-		    }
-		}
-		
-		// only true back when when hashed passwords weren't being converted to hex
-		//else { // encrypted passwords can span multiple lines for some reason
-		       // assume that is the case here
-		//if(password != null) { 
-		//	password = password + "\n" + str;
-		//  }
-		//}
-
-	    }
-	    //dw.closeDatabase();
-	    in.close();
-	} catch (IOException e) {
-	}
-    }
 }
