Index: branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/ConfPane.java
===================================================================
--- branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/ConfPane.java	(revision 9972)
+++ branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/ConfPane.java	(revision 9972)
@@ -0,0 +1,915 @@
+/**
+ *#########################################################################
+ *
+ * A component of the GAI application, part of the Greenstone digital
+ * library suite from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * <BR><BR>
+ *
+ * Author: Chi-Yu Huang, Greenstone Digital Library, University of Waikato
+ * Modified: 03.2005
+ *
+ * <BR><BR>
+ *
+ * Copyright (C) 1999 New Zealand Digital Library Project
+ *
+ * <BR><BR>
+ *
+ * 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.
+ *
+ * <BR><BR>
+ *
+ * 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.
+ *
+ * <BR><BR>
+ *
+ * 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.admin.gui;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.io.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.lang.Object;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.tree.*;
+import javax.swing.table.*;
+import java.awt.event.MouseEvent;
+import java.net.*;
+import java.sql.*;
+
+import org.greenstone.admin.GAI;
+import org.greenstone.admin.GAIManager;
+import org.greenstone.admin.gui.ThreadControl;
+import org.greenstone.core.Configuration;
+import org.greenstone.core.Dictionary;
+import org.greenstone.core.util.Utility;
+import org.greenstone.core.ParsingProgress;
+
+/** The Configuration pane is to view the status of relevant configure files in GSIII
+ * @author Chi-Yu Huang, Greenstone Digital Library, University of Waikato
+ * @version
+ */
+public class ConfPane
+    extends JPanel
+    implements ActionListener {
+    
+    /* The pane to demonstrate Configuration information, including the build property file
+     * being monitored and their content, and control functions */
+    protected JSplitPane main_conf_pane = null;
+    
+    protected JPanel main_contentPane = null;
+    
+    /** The panel that contains a Conf_list */
+    private JPanel confList_pane =  null;
+    
+    /** The panel that contains the conf content. */
+    private JPanel confContent_pane =  null;
+    private JScrollPane conf_table_pane = null;
+
+    /** The List showing all the Configuration files concerned. */
+    private JList conf_list=null;
+    private JTree conf_tree = null;
+
+    /** The pane area into which the Configuration content is placed. */
+    //private JScrollPane conf_content = null;
+
+    /** The label at the top of the confList_pane. */
+    private JLabel confList_label =  null;
+    /** The label shown at the top of the confContent Pane. */
+    private JLabel confContent_label  =  null;
+
+    // The control buttons used to manipulate Configuration Pane
+    protected JPanel outter_button_pane = null;
+    protected JPanel outter_control_pane = null;
+    protected JPanel inner_button_pane = null;
+    protected JPanel inner_control_pane = null;
+    protected JPanel tomcat_button_pane = null;
+    protected JPanel mysql_button_pane = null;
+    protected JPanel setting_shown_pane = null;
+    
+    /**Buttons in inner button pane */
+    private JButton startup_tomcat_button = null;
+    private JButton shutdown_tomcat_button = null;
+    private JButton restart_tomcat_button = null;
+    private JButton startup_mysql_button = null;
+    private JButton shutdown_mysql_button = null;
+    private JButton restart_mysql_button = null;
+      
+    private JButton save_button = null;
+
+    /** Buttons in outter button pane*/
+    //private JButton reload_button = null;
+    //private JButton delete_button = null;
+    //private JButton exit_button = null;
+
+    private JLabel conf_label = null;
+    private JLabel conf_setting_label = null;
+    private JTextField conf_field = null;
+
+    //control tomcat and mysql server running status
+    private String tomcat_server;
+    private String tomcat_port;
+    private String mysql_adminuser;
+    private String mysql_server;
+    private String mysql_port;
+    private boolean tomcat_server_up = false;
+    private boolean mysql_server_up = false;
+
+    protected JTextArea text_area = null;
+      
+    /** The various sizes for the screen layout*/
+    static private Dimension MIN_SIZE = new Dimension( 90,  90);
+    static private Dimension LIST_SIZE  = new Dimension(200, 450);
+    static private Dimension CONTENT_SIZE = new Dimension (600,450);
+    static private Dimension TABLE_SIZE = new Dimension(500,200);
+    
+    private JTable conf_setting_table = null;
+
+    private int num_of_setting;
+    private int num_of_change = 0;
+
+    //The details display in the table
+    int rowLength = 20;
+    int colLength = 3;
+    private Object[][] conf_display = new Object [rowLength][colLength];
+    private Object[][] conf_setting;
+    
+    //An array to store all the details in the build.properties file
+    private ArrayList conf_array;
+    
+    // all the relevant details from the build.properties
+    private static boolean valueChanged =false;
+    
+    ConfTableModel conf_table_model;
+    DefaultMutableTreeNode top = new DefaultMutableTreeNode("Configuration Files");
+
+    //Constructor
+    public ConfPane() {
+	// create all the control button panes
+	inner_control_pane = new JPanel();
+	inner_button_pane = new JPanel();
+	tomcat_button_pane = new JPanel();
+	mysql_button_pane = new JPanel();
+	outter_control_pane = new JPanel();
+	outter_button_pane = new JPanel();
+	
+	// Main Configuration Pane
+	main_conf_pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
+       
+	// Main pane for Configuration Content Pane
+	main_contentPane = new JPanel();
+	
+	//Create a tree for a list Configuration files we are interested
+	DefaultMutableTreeNode child1 = new DefaultMutableTreeNode("Build");
+	DefaultMutableTreeNode compile = new DefaultMutableTreeNode("Compile");
+	DefaultMutableTreeNode tomcat = new DefaultMutableTreeNode("Tomcat");
+	DefaultMutableTreeNode proxy = new DefaultMutableTreeNode("Proxy");
+	DefaultMutableTreeNode mysql = new DefaultMutableTreeNode("Mysql");	
+	DefaultMutableTreeNode gsdl = new DefaultMutableTreeNode("GSDL");
+	child1.add(compile);
+	child1.add(tomcat);
+	child1.add(proxy);
+	child1.add(mysql);
+	child1.add(gsdl);
+
+	DefaultMutableTreeNode child2 =
+	    new DefaultMutableTreeNode("Conf 2");
+	DefaultMutableTreeNode child3 =
+	    new DefaultMutableTreeNode("Conf 3");
+	top.add(child1);
+	top.add(child2);
+	top.add(child3);
+	conf_tree = new JTree(top);
+	conf_tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+	conf_tree.addTreeSelectionListener(new ConfTreeListener());
+
+	// inner button_pane Buttons
+	StartupTomcatButtonListener stbl = new StartupTomcatButtonListener();
+	ShutdownTomcatButtonListener stdbl = new ShutdownTomcatButtonListener();
+	RestartTomcatButtonListener rtbl = new RestartTomcatButtonListener();
+
+	StartupMysqlButtonListener smbl = new StartupMysqlButtonListener();
+	ShutdownMysqlButtonListener smdbl = new ShutdownMysqlButtonListener();
+	RestartMysqlButtonListener rmbl = new RestartMysqlButtonListener();
+	
+	//save button
+	SaveButtonListener sabl = new SaveButtonListener();
+	
+	//outter button_pane Buttons
+	//ReloadButtonListener rbl = new ReloadButtonListener();
+	//DeleteButtonListener dbl = new DeleteButtonListener();
+	//ExitButtonListener ebl = new ExitButtonListener();
+	//ImageIcon reloadButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/Refresh16.gif");
+	//ImageIcon deleteButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/Delete16.gif");
+	//ImageIcon exitButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/exit16.gif");
+
+	ImageIcon startupTomcatButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/redo16.gif");
+	ImageIcon shutdownTomcatButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/stop16.gif");
+	ImageIcon restartTomcatButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/stop16.gif");
+	
+	ImageIcon startupMysqlButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/redo16.gif");
+	ImageIcon shutdownMysqlButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/stop16.gif");
+	ImageIcon restartMysqlButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/stop16.gif");
+	ImageIcon saveButtonIcon = new ImageIcon(GAI.admin_path  + "images/toolbarButtonGraphics/general/Save16.gif");
+
+	startup_tomcat_button = new JButton("Startup Tomcat", startupTomcatButtonIcon);
+	startup_tomcat_button.addActionListener(stbl);
+	startup_tomcat_button.setMnemonic(KeyEvent.VK_S);
+	startup_tomcat_button.setToolTipText("Click this button to startup the Tomcat server");
+	startup_tomcat_button.setEnabled(false);
+
+	shutdown_tomcat_button = new JButton("Shutdown Tomcat", shutdownTomcatButtonIcon);
+	shutdown_tomcat_button.addActionListener(stdbl);
+	shutdown_tomcat_button.setEnabled(false);
+	//shutdown_button.setMnemonic(KeyEvent.VK_h);
+	shutdown_tomcat_button.setToolTipText("Click this button to shutdown the Tomcat server");
+	
+	restart_tomcat_button = new JButton("Restart Tomcat",restartTomcatButtonIcon);
+	restart_tomcat_button.addActionListener(rtbl);
+	restart_tomcat_button.setEnabled(false);
+	//shutdown_button.setMnemonic(KeyEvent.VK_h);
+	restart_tomcat_button.setToolTipText("Click this button to restart the Tomcat server(which will shutdown Tomcat server and restart it again");
+	
+	startup_mysql_button = new JButton("Startup MYSQL", startupMysqlButtonIcon);
+	startup_mysql_button.addActionListener(smbl);
+	startup_mysql_button.setMnemonic(KeyEvent.VK_S);
+	startup_mysql_button.setToolTipText("Click this button to startup the MYSQL server");
+	startup_mysql_button.setEnabled(false);
+
+	shutdown_mysql_button = new JButton("Shutdown MYSQL", shutdownMysqlButtonIcon);
+	shutdown_mysql_button.addActionListener(smdbl);
+	shutdown_mysql_button.setEnabled(false);
+	//shutdown_button.setMnemonic(KeyEvent.VK_h);
+	shutdown_mysql_button.setToolTipText("Click this button to shutdown the MYSQL server");
+	
+	restart_mysql_button = new JButton("Restart MYSQL",restartMysqlButtonIcon);
+	restart_mysql_button.addActionListener(rmbl);
+	restart_mysql_button.setEnabled(false);
+	//shutdown_button.setMnemonic(KeyEvent.VK_h);
+	restart_tomcat_button.setToolTipText("Click this button to restart the MYSQL server(which will shutdown MYSQL server and restart it again");
+
+	save_button = new JButton("Save Change", saveButtonIcon);
+	save_button.addActionListener(sabl);
+	//save_button.setMnemonic(KeyEvent.VK_a);
+	save_button.setEnabled(false);
+	save_button.setToolTipText("Click this button to save the change of build property file");
+	
+	/*reload_button = new JButton("Reload", reloadButtonIcon);
+	reload_button.addActionListener(rbl);
+	reload_button.setMnemonic(KeyEvent.VK_R);
+	reload_button.setToolTipText("Click this button to reload the build properties file");*/
+	//Dictionary.registerBoth(build_button, "CreatePane.Build_Collection", "CreatePane.Build_Collection_Tooltip");
+
+	/*delete_button = new JButton("Delete", deleteButtonIcon);
+	 delete_button.addActionListener(dbl);
+	delete_button.setEnabled(false);
+	delete_button.setMnemonic(KeyEvent.VK_D);
+	delete_button.setToolTipText("Click this button to delete the Configuration file");*/
+	//Dictionary.registerBoth(cancel_button, "CreatePane.Cancel_Build", "CreatePane.Cancel_Build_Tooltip");*/
+
+	/*exit_button = new JButton("Exit", exitButtonIcon);
+	exit_button.setToolTipText("Click this button to exit the viewing");	
+	exit_button.addActionListener(ebl);
+	exit_button.setEnabled(true);
+	exit_button.setMnemonic(KeyEvent.VK_E);*/
+
+	//tomcat buttons
+	stbl = null;
+	stdbl = null;
+	rtbl = null;
+
+	//restart mysql button
+	smbl = null;
+	smdbl = null;
+	rmbl = null;
+
+	//rbl = null;
+	//dbl = null;
+	//ebl = null;
+	
+	//read in build properties
+	getConfContent();
+    }
+
+    /** Any implementation of ActionListener requires this method so that when an 
+     **action is performed the appropriate effect can occur.*/
+
+    public void actionPerformed(ActionEvent event) {
+    }
+
+    /** This method is callsed to actually layout the components.*/
+    public void display() {
+	//Create Components.
+	//KeyListenerImpl key_listener = new KeyListenerImpl();
+	//MouseListenerImpl mouse_listener = new MouseListenerImpl();
+	//this.addKeyListener(key_listener);
+
+	// confList_Pane
+	confList_pane = new JPanel();
+	confList_pane.setBorder(BorderFactory.createLoweredBevelBorder());
+	confList_pane.setPreferredSize(LIST_SIZE);
+	confList_pane.setSize(LIST_SIZE);
+	confList_label = new JLabel("Configuration Files");
+	confList_label.setOpaque(true);
+	confList_label.setBackground(Configuration.getColor("coloring.workspace_heading_background", false));
+	confList_label.setForeground(Configuration.getColor("coloring.workspace_heading_foreground", false));
+	//Dictionary.registerText(logList_label, "Log.List");
+
+	// confContent_Pane
+	confContent_pane = new JPanel();
+	//confContent_pane.setBorder(BorderFactory.createLoweredBevelBorder());
+	confContent_pane.setBorder(BorderFactory.createEmptyBorder(10,20,10,20));
+	confContent_pane.setBackground(Configuration.getColor("coloring.workspace_selection_background", false));
+	confContent_pane.setForeground(Configuration.getColor("coloring.workspace_selection_foreground", false));
+
+	confContent_label = new JLabel("Configuration Content");
+	confContent_label.setOpaque(true);
+	confContent_label.setBackground(Configuration.getColor("coloring.workspace_heading_background", false));
+	confContent_label.setForeground(Configuration.getColor("coloring.workspace_heading_foreground", false));
+	//Dictionary.registerText(logContent_label, "Log.Content");
+	
+	conf_table_model = new ConfTableModel();
+	conf_setting_table = new JTable(conf_table_model){
+		public String getToolTipText(MouseEvent e){
+		    String tip = null;
+		    Point p = e.getPoint();
+		    int rowIndex = rowAtPoint(p);
+		    int colIndex = columnAtPoint(p);
+		    int realColumnIndex = convertColumnIndexToModel(colIndex);
+		    if (realColumnIndex == 0){
+			tip = conf_display[rowIndex][0].toString();
+		    } else {
+			tip = super.getToolTipText(e);
+		    }
+		    return tip;
+		}
+	    };
+			
+	//Set up tableHeader
+	JTableHeader header = conf_setting_table.getTableHeader();
+	header.setFont(new Font("Arial", Font.BOLD, 14));
+	
+	conf_setting_table.setRowHeight(30);
+	conf_table_pane = new JScrollPane(conf_setting_table);
+
+	// Layout Components
+	confList_pane.setLayout(new BorderLayout());
+	JScrollPane conf_treeView = new JScrollPane(conf_tree);
+	confList_pane.add(conf_treeView, BorderLayout.CENTER);
+	confList_pane.add(confList_label, BorderLayout.NORTH);
+	
+	confContent_pane.setLayout(new BorderLayout());
+	confContent_pane.add(conf_table_pane, BorderLayout.CENTER);
+	
+	inner_control_pane.setLayout (new BorderLayout());
+	inner_control_pane.setBorder(BorderFactory.createEmptyBorder(5,10,5,10));
+	inner_control_pane.setPreferredSize(new Dimension(50,50));
+	inner_control_pane.setSize(new Dimension(50,50));
+	inner_control_pane.add (inner_button_pane, BorderLayout.CENTER);
+	
+	// Outter Button Layout 
+	//outter_button_pane.setLayout (new GridLayout(1,2));
+	//outter_button_pane.add(reload_button);
+	//outter_button_pane.add(delete_button);
+	//outter_button_pane.add(exit_button);
+	
+	/*outter_control_pane.setLayout (new BorderLayout());
+	outter_control_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+	outter_control_pane.setPreferredSize(new Dimension(50,50));
+	outter_control_pane.setSize(new Dimension(50,50));
+	outter_control_pane.add (outter_button_pane, BorderLayout.CENTER);*/
+
+	main_contentPane.setLayout (new BorderLayout());
+	main_contentPane.add(confContent_label, BorderLayout.NORTH);
+	main_contentPane.add(confContent_pane, BorderLayout.CENTER);
+	main_contentPane.add(inner_control_pane, BorderLayout.SOUTH);
+	main_conf_pane.add(confList_pane, JSplitPane.LEFT);
+	main_conf_pane.add(main_contentPane, JSplitPane.RIGHT);
+	main_conf_pane.setDividerLocation(LIST_SIZE.width - 10);	
+	
+	this.setLayout(new BorderLayout());
+	this.add(main_conf_pane, BorderLayout.CENTER);
+    }
+    
+    /*private class ExitButtonListener
+	implements ActionListener {
+	// Exit the Adminstration tool 
+	public void actionPerformed(ActionEvent event) {
+	    if (valueChanged) {
+		int result = JOptionPane.showConfirmDialog((Component) null, "The value of configuration has been changed,do you really want to exit?", "Exit Confirmation", JOptionPane.YES_NO_OPTION);
+		if ( result == JOptionPane.YES_OPTION) {
+		    System.exit(1);
+		} else if (result == JOptionPane.NO_OPTION) {
+		    JOptionPane.showMessageDialog((Component) null,"Press Save Change button to save the change!");
+		}
+	    } else {
+		System.exit(1);
+	    }
+	}
+	}*/
+
+    private class StartupTomcatButtonListener
+	implements ActionListener {
+	public void actionPerformed(ActionEvent event) {
+	    tomcat_server_up = checkTomcatServer();
+	    if (!tomcat_server_up) {
+		//ParsingProgress progressBar = new ParsingProgress("Startup Tomcat Server", "Starting up the Tomcat Server", 10);
+		ThreadControl threadControl = new ThreadControl();
+		Runnable startupTomcatThread = threadControl.new startupTomcatServer("start-tomcat");
+		new Thread(startupTomcatThread).start();
+		//if over two seconds
+		// activae progress bar
+		/*progressBar.dispose();
+		progressBar.destroy();
+		progressBar = null;*/
+		threadControl.destroy();
+		tomcat_server_up = true;
+		JOptionPane.showMessageDialog((Component) null,"The Tomcat server has been Startup successfully!");  
+	    } else {
+		JOptionPane.showMessageDialog((Component) null,"Tomcat server is running");
+	    }
+	    changeTomcatButtonPane1();
+	}
+    }
+    
+    private class ShutdownTomcatButtonListener
+	implements ActionListener {
+	public void actionPerformed(ActionEvent event) {
+	    tomcat_server_up = checkTomcatServer();
+	    if (tomcat_server_up){
+		int result = JOptionPane.showConfirmDialog((Component) null, "Are you sure that you want to shutdown the Tomcat server?", "Shutdown Confirmation", JOptionPane.YES_NO_OPTION);
+		if (result == JOptionPane.YES_OPTION) {
+		    // ParsingProgress progressBar = new ParsingProgress("Shutdown Tomcat Server", "Shutting down the Tomcat Server", 10);
+		    ThreadControl threadControl = new ThreadControl();
+		    Runnable shutdownTomcatThread = threadControl.new shutdownTomcatServer("stop-tomcat");
+		    new Thread(shutdownTomcatThread).start();
+		    /*progressBar.dispose();
+		    progressBar.destroy();
+		    progressBar = null;*/
+		    threadControl.destroy();
+		    tomcat_server_up = false;			    
+		    JOptionPane.showMessageDialog((Component) null,"The Tomcat server has been Shutdown successfully !");
+		} else if (result == JOptionPane.NO_OPTION) {
+		    JOptionPane.showMessageDialog((Component) null,"Cancel to Shutdown the Tomcat server!");
+		}	
+	    } else {
+		JOptionPane.showMessageDialog((Component) null,"The Tomcat server was not running!");
+	    }
+	    changeTomcatButtonPane2();
+	}
+    }
+    
+    private class RestartTomcatButtonListener
+	implements ActionListener {
+	public void actionPerformed(ActionEvent event) {
+	    tomcat_server_up = checkTomcatServer();
+	    if (tomcat_server_up) {
+		ThreadControl threadControl = new ThreadControl();
+		Runnable restartTomcatThread = threadControl.new restartTomcatServer("restart-tomcat");
+		new Thread(restartTomcatThread).start();
+		threadControl.destroy();
+		tomcat_server_up = true;
+		JOptionPane.showMessageDialog((Component) null,"The Tomcat server has been Restarted successfully!"); 
+	    } else {
+		JOptionPane.showMessageDialog((Component) null,"Tomcat server was not running!"); 
+	    }
+	}
+    }
+
+
+    private class StartupMysqlButtonListener
+	implements ActionListener {
+	public void actionPerformed(ActionEvent event) {
+	    mysql_server_up = checkMysqlServer();
+	    if (!mysql_server_up) {
+		ThreadControl threadControl = new ThreadControl();
+		Runnable startupMysqlThread = threadControl.new startupMysqlServer("start-mysql");
+		new Thread(startupMysqlThread).start();
+		threadControl.destroy();
+		JOptionPane.showMessageDialog((Component) null,"The MYSQL server has been Startup successfully!");  
+		mysql_server_up = true;
+	    } else {
+		JOptionPane.showMessageDialog((Component) null,"MYSQL server has been running");  	
+	    }
+	    changeMysqlButtonPane1();
+	}
+    }  
+    
+    private class ShutdownMysqlButtonListener
+	implements ActionListener {
+	public void actionPerformed(ActionEvent event) {
+	    mysql_server_up = checkMysqlServer();
+	    if (mysql_server_up){
+		int result = JOptionPane.showConfirmDialog((Component) null, "Are you sure that you want to shutdown the MYSQL server?", "Shutdown Confirmation", JOptionPane.YES_NO_OPTION);
+		if (result == JOptionPane.YES_OPTION) {
+		    ThreadControl threadControl = new ThreadControl();
+		    Runnable shutdownMysqlThread = threadControl.new shutdownMysqlServer("stop-mysql");
+		    new Thread(shutdownMysqlThread).start();
+		    threadControl.destroy();
+		    JOptionPane.showMessageDialog((Component) null,"The MYSQL server has been Shutdown successfully !");
+		    mysql_server_up = false;
+		} else if (result == JOptionPane.NO_OPTION) {
+		    JOptionPane.showMessageDialog((Component) null,"Cancel to Shutdown the MYSQL server!");
+		}	
+	    } else {
+		JOptionPane.showMessageDialog((Component) null,"The MYSQL server was not running!");
+	    }
+	    changeMysqlButtonPane2();
+	}
+    }
+
+    private class RestartMysqlButtonListener
+	implements ActionListener {
+	public void actionPerformed(ActionEvent event) {
+	    mysql_server_up = checkMysqlServer();
+	    if (mysql_server_up) {
+		ThreadControl threadControl = new ThreadControl();
+		Runnable restartMysqlThread = threadControl.new restartMysqlServer("restart-mysql");
+		new Thread(restartMysqlThread).start();
+		threadControl.destroy();
+		JOptionPane.showMessageDialog((Component) null,"MYSQL server has been Restarted successfully!");  
+		mysql_server_up = true;
+	    } else { 
+		JOptionPane.showMessageDialog((Component) null,"MYSQL server was not running, use startup button to start the MYSQL server!"); 
+	    }
+	}
+    }
+
+    private class SaveButtonListener
+	implements ActionListener {
+	public void actionPerformed(ActionEvent event) {
+	    
+	    if (!valueChanged) {
+		JOptionPane.showMessageDialog((Component) null,"The configuration value has not been changed!"); 
+	    } else {
+		int result = JOptionPane.showConfirmDialog((Component) null, "Do you really want to save the change", "Save Confirmation", JOptionPane.YES_NO_OPTION);
+		if ( result == JOptionPane.YES_OPTION) {
+		    saveNewConfSetting();
+		    writeConfFile(GAI.build_file);
+		    valueChanged = false;
+		} else if (result == JOptionPane.NO_OPTION) {
+		    valueChanged = true;
+		}
+	    }
+	    
+	}
+    }
+    
+    public void saveNewConfSetting(){
+	String new_string;
+	for (int i=0; i < conf_display.length; i++){
+	    if (!conf_display[i][1].toString().matches("^\\s*$")){
+		for (int j=0; j < conf_array.size(); j++){
+		    if (((String)conf_array.get(j)).startsWith(conf_display[i][1].toString().toLowerCase())){
+			new_string = conf_display[i][1].toString()+"="+conf_display[i][2].toString();
+			conf_array.set(j, new_string.toLowerCase());
+		    }
+		}
+	    }
+	}
+	
+    }
+    
+
+    public void writeConfFile(File file){
+	String filename = file.getPath();
+	try {
+	    BufferedWriter conf_out = new BufferedWriter(new FileWriter(filename));
+	    for (int j=0 ; j < conf_array.size(); j++){
+		conf_out.write(conf_array.get(j).toString());
+		conf_out.newLine();
+	    }
+	    conf_out.close();
+	    getConfContent();
+	} catch (Exception e) {
+	    e.printStackTrace();
+	}
+    }
+
+
+    public void getConfContent(){
+	System.err.println("GAI Build file:" + GAI.build_file);
+
+	String filename = GAI.build_file.getPath();
+
+	if (!GAI.build_file.exists()){ 
+	    JOptionPane.showMessageDialog((Component) null,"Build property file does not exist");  
+	    //reload_button.setEnabled(false);
+	} else {
+	    readFile(filename);
+	}
+	save_button.setEnabled(true);
+    }
+    
+    public void readFile (String filename) {
+	String fileLine;
+	/*inside the array will store, the conf_setting[i][0]:Comment, 
+	 *conf_setting[i][1]:Para and conf_setting[i][2]:Value
+	 * conf_array[] store all the details from the build.properties*/
+	conf_array = new ArrayList();
+	conf_setting = new Object [rowLength][colLength];
+	try {
+	    BufferedReader conf_in = new BufferedReader(new FileReader(filename));
+	    int i = 0;
+	    int j = 0;
+	    while ((fileLine = conf_in.readLine()) != null) {
+		// This is an empty line
+		if (fileLine.matches("^\\s*$")) {
+		    // Do Nothing
+		} else if (fileLine.matches("##.+")){
+		    //This line shows the specific service for these conf setting
+		    conf_array.add(fileLine);
+		} else 	if (fileLine.matches("#.+")){
+		    //This line is Configuration Comment line
+		    conf_array.add(fileLine);
+		    conf_setting[i][0] = fileLine.substring(1); // use 1 to get rid of the # symbol.
+		} else if (!fileLine.matches("#.+") && !fileLine.matches("^\\s*$") ){
+		    //This line is Setting line
+		    int end_index = fileLine.indexOf("=");
+		    conf_setting[i][1] = fileLine.substring(0,end_index).toUpperCase();
+		    conf_setting[i][2] = fileLine.substring(end_index+1); 
+		    i++; //calculat the number of settings
+		    conf_array.add(fileLine);
+		} else {
+		    // Wrong character in the line
+		}
+	    }
+	    num_of_setting = i;
+	    conf_in.close();
+	} catch (Exception e) {
+	    e.printStackTrace();
+	}
+    }
+    
+    public void showConfSetting(String conf_param) {
+	clearTable();
+	int j=0;
+	for (int i=0; i< num_of_setting; i++){
+	    if (conf_setting[i][1].toString().matches("^("+ conf_param +").+")) {
+		if (conf_setting[i][1].toString().matches("TOMCAT.SERVER")){
+		    tomcat_server = conf_setting[i][2].toString();
+		}
+		if (conf_setting[i][1].toString().matches("TOMCAT.PORT")){
+		    tomcat_port = conf_setting[i][2].toString();
+		}
+		if (conf_setting[i][1].toString().matches("MYSQL.ADMIN.USER")){
+		    mysql_adminuser = conf_setting[i][2].toString();
+		}
+		if (conf_setting[i][1].toString().matches("MYSQL.SERVER")){
+		    mysql_server = conf_setting[i][2].toString();
+		}
+		if (conf_setting[i][1].toString().matches("MYSQL.PORT")){
+		    mysql_port = conf_setting[i][2].toString();
+		}	
+		conf_display[j][0] = conf_setting[i][0];
+	    	conf_display[j][1] = conf_setting[i][1];
+	   	conf_display[j][2] = conf_setting[i][2];
+		j++;
+	    }
+	}
+    }
+    
+    public void clearTable (){
+	for (int i=0; i< rowLength; i++){
+	    conf_display[i][0] = "";
+	    conf_display[i][1] = "";
+	    conf_display[i][2] = "";
+	}
+    }
+
+    private boolean checkTomcatServer (){
+	try {
+	    if (tomcat_server != "" && tomcat_port != ""){
+		String http_string = "http://" + tomcat_server+":"+tomcat_port+"/";
+		URL tomcatURL = new URL(http_string);
+		HttpURLConnection tomcatConn = (HttpURLConnection) tomcatURL.openConnection();
+		tomcatConn.connect();
+		//necessary to get a Response, even if you don't care about contents
+		InputStream connIn = tomcatConn.getInputStream(); 
+		int pageStatus = tomcatConn.getResponseCode();
+		if (pageStatus == HttpURLConnection.HTTP_NOT_FOUND) {//404 error
+		    //Tomcat is not running
+		    tomcat_server_up = false;
+		} else {
+		    tomcat_server_up = true;
+		}  
+	    } else {
+		System.err.println("Etiher tomcat server or tomcat port was not set properly");
+	    }
+	} catch (Exception ex) {
+	    System.err.println(ex.getMessage());
+	}
+	return tomcat_server_up;
+    }
+    
+    private boolean checkMysqlServer(){
+	Connection conn = null;
+	try {
+	    String mysql_userName ="gsdl3reader";
+	    String mysql_password = ""; 
+	    String mysql_url ="jdbc:mysql://"+mysql_server+":"+mysql_port+"/localsite_gs3mgdemo";
+	    System.err.println("what is Mysql_URL:" + mysql_url);
+	    Class.forName("com.mysql.jdbc.Driver").newInstance();
+	    conn = DriverManager.getConnection(mysql_url, mysql_userName, mysql_password);
+	    System.err.println("MYSQL Server connection:" + conn);
+	    if (conn == null) {
+		//System.err.println("Connection is failed");
+		mysql_server_up =false;
+	    } else {
+		mysql_server_up = true;
+	    }
+	} catch (Exception e) {
+	    System.err.println("Cannot connect to database server");
+	}
+	return mysql_server_up;
+    }
+	
+    class ConfTableModel extends AbstractTableModel {
+	String[] columnNames = {"Configuration Parameter",
+				"Configuration Value"};
+	
+	public int getColumnCount(){
+	    return columnNames.length;
+	}
+
+	public int getRowCount() {
+	    return conf_display.length;
+	}
+	
+	public String getColumnName(int col){
+	    return columnNames[col];
+	}
+
+	public Object getValueAt(int row,int col){
+	    return conf_display[row][col+1];
+	}
+	
+	public boolean isCellEditable(int row, int col){
+	    if (col == 0){
+		return false;
+	    } else {
+		return true;
+	    }
+	}
+
+	public void setValueAt(Object value, int row, int col){
+	    conf_display[row][col+1] = value;
+	    fireTableCellUpdated(row,col+1);
+	    valueChanged = true;
+	}
+    }
+
+    private class ConfTreeListener implements TreeSelectionListener{
+	String conf_param;
+	public void valueChanged (TreeSelectionEvent e){
+	    String option = conf_tree.getLastSelectedPathComponent().toString();
+	    if (option == "Compile"){
+		if (valueChanged){
+		    JOptionPane.showMessageDialog((Component) null,"The configuration setting has been changed, please save the change");
+		} else {
+		    conf_param = "COMPILE";
+		    //conf_tree.setToolTipText("The Configuration Setting for the Compilation ");
+		    inner_button_pane.removeAll();
+		    inner_button_pane.setLayout(new GridLayout(1,3));
+		    inner_button_pane.add(save_button);
+		    save_button.setEnabled(true);
+		    showConfSetting(conf_param);
+		    updateUI();
+		}
+	    } else if (option == "Tomcat"){
+		if (valueChanged) {
+		    JOptionPane.showMessageDialog((Component) null,"The configuration setting has been changed, please save the change");
+		} else {
+		    conf_param ="TOMCAT";
+		    showConfSetting(conf_param);
+		    //Setup Tomcat button control pane
+		    inner_button_pane.removeAll();
+		    inner_button_pane.setLayout(new GridLayout(1,3));
+		    if (checkTomcatServer()) {
+			changeTomcatButtonPane1();
+		    } else {
+			changeTomcatButtonPane2();
+		    }
+		    updateUI();
+		}
+	    } else if (option =="Proxy"){
+		if (valueChanged) {
+		    JOptionPane.showMessageDialog((Component) null,"The configuration setting has been changed, please save the change");
+		} else {	
+		    conf_param="PROXY";
+		    showConfSetting(conf_param);
+		    //conf_tree.setToolTipText("The Configuration Setting for the Proxy Server");
+		    inner_button_pane.removeAll();
+		    inner_button_pane.setLayout(new GridLayout(1,3));
+		    inner_button_pane.add(save_button);
+		    save_button.setEnabled(true);
+		    updateUI();
+		}
+	    } else if (option == "Mysql"){
+		if (valueChanged) {
+		    JOptionPane.showMessageDialog((Component) null,"The configuration setting has been changed, please save the change");
+		} else {
+		    conf_param="MYSQL";
+		    showConfSetting(conf_param);
+		    //conf_tree.setToolTipText("The Configuration Setting for the MYSQL Server");
+		    // Setup MySQL button control pane
+		    inner_button_pane.removeAll();
+		    inner_button_pane.setLayout(new GridLayout(1,3));
+		    if (checkMysqlServer()) {
+			changeMysqlButtonPane1();
+		    } else {
+			changeMysqlButtonPane2();
+		    }
+		    updateUI();
+		}
+	    } else if (option == "GSDL"){
+		if (valueChanged) {
+		    JOptionPane.showMessageDialog((Component) null,"The configuration setting has been changed, please save the change");
+		} else {
+		    showConfSetting(conf_param);
+		    //conf_tree.setToolTipText("The Configuration Setting for the GSDL");
+		    inner_button_pane.removeAll();
+		    inner_button_pane.setLayout(new GridLayout(1,3));
+		    inner_button_pane.add(save_button);
+		    save_button.setEnabled(true);		
+		    conf_param ="GSDL";
+		    updateUI();
+		}
+	    } else if (option == "Conf 2"){
+		//MysqlInstall mysql = 
+		JOptionPane.showMessageDialog((Component) null,"This has not been defined yet!"); 		
+	    } else if (option == "Conf 3") {
+		clearTable();
+		JOptionPane.showMessageDialog((Component) null,"This has not been defined yet!"); 
+	    }
+	}
+    }
+    public void modeChanged (int mode){
+	return;
+    }
+
+    public void gainFocus() {
+	return;
+    }
+
+    public void changeTomcatButtonPane1 (){
+	inner_button_pane.removeAll();
+	inner_button_pane.setLayout(new GridLayout(1,3));
+	inner_button_pane.add(restart_tomcat_button);
+	inner_button_pane.add(shutdown_tomcat_button);
+	inner_button_pane.add(save_button);
+	restart_tomcat_button.setEnabled (true);
+	shutdown_tomcat_button.setEnabled (true);
+	save_button.setEnabled (true);	
+	updateUI();
+    }
+    public void changeTomcatButtonPane2 (){
+	inner_button_pane.removeAll();
+	inner_button_pane.setLayout(new GridLayout(1,3));
+	inner_button_pane.add(startup_tomcat_button);
+	inner_button_pane.add(shutdown_tomcat_button);
+	inner_button_pane.add(save_button);
+	shutdown_tomcat_button.setEnabled (true);
+	startup_tomcat_button.setEnabled (true);
+	save_button.setEnabled (true);
+	updateUI();
+    }	
+    public void changeMysqlButtonPane1 (){
+	inner_button_pane.removeAll();
+	inner_button_pane.setLayout(new GridLayout(1,3));
+	inner_button_pane.add(restart_mysql_button);
+	inner_button_pane.add(shutdown_mysql_button);
+	inner_button_pane.add(save_button);
+	restart_mysql_button.setEnabled (true);
+	shutdown_mysql_button.setEnabled (true);
+	save_button.setEnabled (true);	
+	updateUI();
+    }
+    public void changeMysqlButtonPane2 (){
+	inner_button_pane.removeAll();
+	inner_button_pane.setLayout(new GridLayout(1,3));
+	inner_button_pane.add(startup_mysql_button);
+	inner_button_pane.add(shutdown_mysql_button);
+	inner_button_pane.add(save_button);
+	shutdown_mysql_button.setEnabled (true);
+	startup_mysql_button.setEnabled (true);
+	save_button.setEnabled (true);
+	updateUI();
+    }	
+}
+       
+
Index: branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/DeleteLogFilePrompt.java
===================================================================
--- branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/DeleteLogFilePrompt.java	(revision 9972)
+++ branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/DeleteLogFilePrompt.java	(revision 9972)
@@ -0,0 +1,123 @@
+/**
+ *#########################################################################
+ *
+ * A component of the GAI application, part of the Greenstone digital
+ * library suite from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * <BR><BR>
+ *
+ * Author: John Thompson, Greenstone Digital Library, University of Waikato
+ * Modified by: Chi-Yu Huang
+ *
+ * <BR><BR>
+ *
+ * Copyright (C) 1999 New Zealand Digital Library Project
+ *
+ * <BR><BR>
+ *
+ * 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.
+ *
+ * <BR><BR>
+ *
+ * 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.
+ *
+ * <BR><BR>
+ *
+ * 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.admin.gui;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.io.*;
+import java.net.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import org.greenstone.core.Configuration;
+import org.greenstone.core.DebugStream;
+
+/*import org.greenstone.gatherer.Dictionary;
+import org.greenstone.gatherer.Gatherer;
+import org.greenstone.gatherer.LocalLibraryServer;
+import org.greenstone.gatherer.collection.BasicCollectionConfiguration;
+import org.greenstone.gatherer.file.WorkspaceTree;  // !!! Don't like this here
+import org.greenstone.gatherer.util.ArrayTools;
+import org.greenstone.gatherer.util.StaticStrings;*/
+
+//import org.greenstone.gatherer.core.Utility;
+
+/** This class provides the functionality to delete current collections from the 
+ ** GSDLHOME/collect/ directory. The user chooses the collection from a list, where 
+ ** each entry also displays details about itself, confirms the delete of a collection 
+ ** by checking a checkbox then presses the ok button to actually delete the collection.
+ * @author Chi-Yu Huang, Greenstone Digital Library, University of Waikato
+ * @version 1.0
+ */
+public class DeleteLogFilePrompt 
+	extends JDialog {
+    
+    /** A reference to ourself so any inner-classes can dispose of us. */
+    private DeleteLogFilePrompt prompt = null;
+    private File log_file = null;
+
+    //A flag showing the deleting status
+    private boolean current_logfile_deleted = false;
+
+    /** The size of the delete prompt screen. */
+    static final Dimension SIZE = new Dimension(500, 500);
+
+    // Constructor.
+    public DeleteLogFilePrompt() {
+	super();
+	prompt = this;
+    }
+    
+    /** Destructor. */
+    public void destroy() {
+	prompt = null;
+    }
+
+    /** This method causes the Delete Confirmation Dialog to be displayed. 
+     * returns true if it has deleted the log file that is currently open */
+    public boolean display(File log_file) {
+	int result = JOptionPane.showConfirmDialog((Component) null, "Do you really want to delete this log file", "Delete Confirmation", JOptionPane.YES_NO_OPTION);
+	if ( result == JOptionPane.YES_OPTION) {
+	    log_file.delete();
+	    current_logfile_deleted = true;
+	    JOptionPane.showMessageDialog(prompt,log_file.getPath() + " log file has been deleted. You have to restart the action to create the log file");
+	} else if (result == JOptionPane.NO_OPTION) {
+	    current_logfile_deleted = false;
+	    JOptionPane.showMessageDialog(prompt, "Cancel deleting the " + log_file.getPath() +" log file");
+	    prompt.dispose();
+	}
+	return current_logfile_deleted;
+    }
+    
+    
+    /** Shows a delete complete prompt. 
+     * @param success A <strong>boolean</strong> indicating if the collection was successfully deleted.
+     * @see org.greenstone.gatherer.collection.Collection
+     */
+    /*public void resultPrompt(boolean success) {
+	if (success) {
+	    JOptionPane.showMessageDialog(prompt,"Selected log file has been deleted. You have to restart the action to create the log file");
+	} else {
+	    JOptionPane.showMessageDialog(prompt, "Cancel deleting the log file");
+	}
+	}*/
+    
+    /** Any implementation of ActionListener requires this method so that when an 
+     **action is performed the appropriate effect can occur.*/
+    public void actionPerformed(ActionEvent event) {
+    }
+}
Index: branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/LogPane.java
===================================================================
--- branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/LogPane.java	(revision 9972)
+++ branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/LogPane.java	(revision 9972)
@@ -0,0 +1,450 @@
+/**
+ *#########################################################################
+ *
+ * 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.
+ *
+ * <BR><BR>
+ *
+ * Author: Chi-Yu Huang, Greenstone Digital Library, University of Waikato
+ * Modified: 03.2005
+ *
+ * <BR><BR>
+ *
+ * Copyright (C) 1999 New Zealand Digital Library Project
+ *
+ * <BR><BR>
+ *
+ * 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.
+ *
+ * <BR><BR>
+ *
+ * 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.
+ *
+ * <BR><BR>
+ *
+ * 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.admin.gui;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.io.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.tree.*;
+
+import org.greenstone.core.Configuration;
+import org.greenstone.core.Dictionary;
+import org.greenstone.core.util.Utility;
+import org.greenstone.admin.GAIManager;
+import org.greenstone.admin.GAI;
+
+/** The Log pane is to view the status of relevant log files in GSIII
+ * @author Chi-Yu Huang, Greenstone Digital Library, University of Waikato
+ * @version
+ */
+public class LogPane
+    extends JPanel
+    implements ActionListener {
+
+    // Main Pane
+    //protected JSplitPane main_pane = null;
+
+    /* The pane to demonstrate log information, including  the log files being 
+     *monitored and their content*/
+    protected JSplitPane main_log_pane = null;
+
+    /** The panel that contains a log_list */
+    private JPanel logList_pane =  null;
+
+    /** The panel that contains the log content. */
+    private JPanel logContent_pane =  null;
+
+    /** The List showing all the log files concerned. */
+    private JList log_list=null;
+
+    /** The scrollable area into which the log content is placed. */
+    private JScrollPane log_content = null;
+
+    /** The label at the top of the logList_pane. */
+    private JLabel logList_label =  null;
+
+    /** The label shown at the top of the logContent Pane. */
+    private JLabel logContent_label  =  null;
+
+    /* Log TEXT AREA*/
+    private JTextArea log_textarea = null;
+
+    // The control buttons used to manipulate log Pane
+    protected JPanel button_pane = null;
+    
+    /** Buttons */
+    private JButton reload_button = null;
+    private JButton delete_button = null;
+    private JButton exit_button = null;
+
+    /*The pane which contains the controls for log files */
+    private JPanel control_pane = null;
+
+    private File log_file = null;
+      
+    /** The various sizes for the screen layout*/
+    static private Dimension MIN_SIZE = new Dimension( 90,  90);
+    static private Dimension LIST_SIZE  = new Dimension(200, 450);
+    static private Dimension LOGPANE_SIZE = new Dimension (800,450);
+
+    //Constructor
+    public LogPane() {
+
+	// create all the necessary panes
+	control_pane = new JPanel();
+	button_pane = new JPanel();
+
+	// Log_Pane
+	main_log_pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
+	main_log_pane.setPreferredSize(LOGPANE_SIZE);
+	//log_pane.setSize(LOGPANE_SIZE);
+	
+	// Log_list
+	String[] log_files = { "Tomcat log file", "Log file 2", "Log file 3"};
+	log_list = new JList(log_files);
+	log_list.setBorder(BorderFactory.createLoweredBevelBorder());
+	log_list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+	log_list.setVisibleRowCount(4);
+	log_list.setBackground (Configuration.getColor("coloring.workspace_tree_background", false));
+	log_list.setForeground (Configuration.getColor("coloring.workspace_tree_foreground", false));
+	log_list.addListSelectionListener(new LogListListener());
+	
+	// Log_TextArea
+	log_textarea = new JTextArea();
+	log_textarea.setEditable(false);
+		
+	// Buttons
+	ReloadButtonListener rbl = new ReloadButtonListener();
+	DeleteButtonListener dbl = new DeleteButtonListener();
+	//ExitButtonListener ebl = new ExitButtonListener();
+	ImageIcon reloadButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/Refresh16.gif");
+	ImageIcon deleteButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/Delete16.gif");
+	ImageIcon exitButtonIcon = new ImageIcon(GAI.admin_path + "images/exit16.gif");
+	
+	reload_button = new JButton("Reload", reloadButtonIcon);
+	reload_button.addActionListener(rbl);
+	reload_button.setMnemonic(KeyEvent.VK_R);
+	reload_button.setToolTipText("Click this button to reload the log file");
+	//Dictionary.registerBoth(build_button, "CreatePane.Build_Collection", "CreatePane.Build_Collection_Tooltip");
+
+	delete_button = new JButton("Delete", deleteButtonIcon);
+	delete_button.addActionListener(dbl);
+	delete_button.setEnabled(false);
+	delete_button.setMnemonic(KeyEvent.VK_D);
+	delete_button.setToolTipText("Click this button to delete the log file");
+	//Dictionary.registerBoth(cancel_button, "CreatePane.Cancel_Build", "CreatePane.Cancel_Build_Tooltip");*/
+
+	/*exit_button = new JButton("Exit", exitButtonIcon);
+	exit_button.setToolTipText("Click this button to exit the viewing");	
+	exit_button.addActionListener(ebl);
+	exit_button.setEnabled(true);
+	exit_button.setMnemonic(KeyEvent.VK_E);*/
+
+	rbl = null;
+	dbl = null;
+	//ebl = null;	
+    }
+
+    /** Any implementation of ActionListener requires this method so that when an 
+     **action is performed the appropriate effect can occur.*/
+
+    public void actionPerformed(ActionEvent event) {
+    }
+
+
+    /** This method is callsed to actually layout the components.*/
+    public void display() {
+	// Create Components.
+	//KeyListenerImpl key_listener = new KeyListenerImpl();
+	//MouseListenerImpl mouse_listener = new MouseListenerImpl();
+	//this.addKeyListener(key_listener);
+
+	// logList_Pane
+	logList_pane = new JPanel();
+	logList_pane.setBorder(BorderFactory.createLoweredBevelBorder());
+	logList_label = new JLabel("Log Files");
+	logList_label.setOpaque(true);
+	logList_label.setBackground(Configuration.getColor("coloring.workspace_heading_background", false));
+	logList_label.setForeground(Configuration.getColor("coloring.workspace_heading_foreground", false));
+	//Dictionary.registerText(logList_label, "Log.List");
+
+	// logContent_Pane
+	logContent_pane = new JPanel();
+	logContent_pane.setBorder(BorderFactory.createLoweredBevelBorder());
+	logContent_pane.setBackground(Configuration.getColor("coloring.workspace_selection_background", false));
+	logContent_pane.setForeground(Configuration.getColor("coloring.workspace_selection_foreground", false));
+	logContent_label = new JLabel("Log Content");
+	logContent_label.setOpaque(true);
+	logContent_label.setBackground(Configuration.getColor("coloring.workspace_heading_background", false));
+	logContent_label.setForeground(Configuration.getColor("coloring.workspace_heading_foreground", false));
+	//Dictionary.registerText(logContent_label, "Log.Content");
+
+	// TEXTAREA Layout
+	log_content = new JScrollPane(log_textarea);
+
+	// Button Layout 
+	button_pane.setLayout (new GridLayout(1,3));
+	button_pane.add(reload_button);
+	button_pane.add(delete_button);
+	//button_pane.add(exit_button);
+	
+	control_pane.setLayout (new BorderLayout());
+	//control_pane.setBorder(BorderFactory.createLoweredBevelBorder());
+	control_pane.setBorder(BorderFactory.createEmptyBorder(05,10,5,10));
+	control_pane.setPreferredSize(new Dimension(50,50));
+	control_pane.setSize(new Dimension(50,50));
+	control_pane.add (button_pane, BorderLayout.CENTER);
+
+	// Layout Components
+	logList_pane.setLayout(new BorderLayout());
+	logList_pane.add(log_list, BorderLayout.CENTER);
+	logList_pane.add(logList_label, BorderLayout.NORTH);
+		
+	logContent_pane.setLayout(new BorderLayout());
+	logContent_pane.add(log_content,BorderLayout.CENTER);
+	logContent_pane.add(logContent_label, BorderLayout.NORTH);
+	logContent_pane.add(control_pane, BorderLayout.SOUTH);
+	
+	main_log_pane.add(logList_pane, JSplitPane.LEFT);
+	main_log_pane.add(logContent_pane, JSplitPane.RIGHT);
+	main_log_pane.setDividerLocation(LIST_SIZE.width - 10);
+	
+	this.setLayout(new BorderLayout());
+	this.add(main_log_pane, BorderLayout.CENTER);
+	//this.add(control_pane, BorderLayout.SOUTH);
+    }
+
+    /** Called whenever this pane gains focus, this method ensures that the various 
+     **tree renderers are correctly colouring the tree (as these settings sometimes get lost).
+     * @param event A <strong>FocusEvent</strong> containing details about the focus action performed.
+     */
+    /*public void focusGained(FocusEvent event) {
+	DefaultTreeCellRenderer def = new DefaultTreeCellRenderer();
+	DefaultTreeCellRenderer w = (DefaultTreeCellRenderer)workspace_tree.getCellRenderer();
+	DefaultTreeCellRenderer c = (DefaultTreeCellRenderer)collection_tree.getCellRenderer();
+	if(event.getSource() == workspace_tree) {
+	    w.setBackgroundSelectionColor(def.getBackgroundSelectionColor());
+	    c.setBackgroundSelectionColor(Color.lightGray);
+	}
+	else if(event.getSource() == collection_tree) {
+	    c.setBackgroundSelectionColor(def.getBackgroundSelectionColor());
+	    w.setBackgroundSelectionColor(Color.lightGray);
+	}
+	repaint();
+	}*/
+
+    /** Implementation side-effect, not used in any way.
+     * @param event A <strong>FocusEvent</strong> containing details about the focus action performed.
+     */
+    /*public void focusLost(FocusEvent event) {
+      }*/
+
+    /** Called to inform this control panel that it has just gained focus as an effect of the user clicking on its tab.
+     */
+    public void gainFocus() {
+	// Update the meta-audit view to show the current selection, if any.
+	//Gatherer.g_man.meta_audit.setRecords(getCollectionTreeSelection());
+    }
+    
+    /** Called whenever the detail mode changes to ensure the filters are at an appropriate 
+     **level (ie only editable by those that understand regular expression matching)
+     * @param mode the mode level as an int
+     */
+    /*  public void modeChanged(int mode) {
+	collection_filter.setEditable(mode > Configuration.LIBRARIAN_MODE);
+	workspace_filter.setEditable(mode > Configuration.LIBRARIAN_MODE);
+	}*/
+
+
+    /** Refresh this pane, depending on what has just happened (refresh_reason). */
+    /*public void refresh(int refresh_reason, boolean collection_loaded)
+    {
+	if (collection_loaded) {
+	    // Update collection label
+	    Dictionary.registerText(collection_label, "Collection.Collection");
+	    collection_label.setBackground(Configuration.getColor("coloring.collection_heading_background", false));
+	    collection_label.setForeground(Configuration.getColor("coloring.collection_heading_foreground", false));
+
+	    // Update collection tree
+	    if (refresh_reason == Gatherer.COLLECTION_OPENED) {
+		collection_tree.setModel(Gatherer.c_man.getCollectionTreeModel());
+	    }
+	    // Update collection filter
+	    collection_filter.setBackground(Configuration.getColor("coloring.collection_heading_background", false));
+	}
+	else {
+	    // Update collection label
+	    String[] args = new String[1];
+	    args[0] = Dictionary.get("Collection.No_Collection");
+	    Dictionary.registerText(collection_label, "Collection.Collection", args);
+	    collection_label.setBackground(Color.lightGray);
+	    collection_label.setForeground(Color.black);
+
+	    // Update collection tree
+	    collection_tree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("Error")));
+
+	    // Update collection filter
+	    collection_filter.setBackground(Color.lightGray);
+	}
+
+	// Enable or disable the controls
+	workspace_tree.setEnabled(true);
+	collection_tree.setEnabled(collection_loaded);
+	collection_filter.setEnabled(collection_loaded);
+	bin_button.setEnabled(collection_loaded);
+	new_folder.setEnabled(collection_loaded);
+	
+	// Ensure that this collection tree view is synchronized with all others
+	collection_tree_sync.add(collection_tree);
+	}*/
+    
+    private class KeyListenerImpl
+	extends KeyAdapter {
+	private boolean vk_left_pressed = false;
+	public void keyReleased(KeyEvent event) {
+	}
+	
+	// we need to watch for left clicks on an unopened folder - should shift the focus to the
+	//parent folder. But because there is some other mysterious key listener that does opening and 
+	//closing folders on right and left clicks, we must detect the situation before the other handler 
+	//has done its job, and process it after.*/
+	
+	public void keyPressed(KeyEvent event) {
+	    if (event.getKeyCode() == KeyEvent.VK_LEFT) {
+		
+	    }
+	}     
+    }
+
+    /** This class listens for mouse clicks and responds right mouse button clicks (popup menu)., left
+     **  mouse button:log file selected */
+    private class MouseListenerImpl
+	extends MouseAdapter {
+	/* Any subclass of MouseAdapter can override this method to respond to mouse click events. 
+	 *In this case we want to open a pop-up menu if we detect a right mouse click over one of our 
+	 *registered components, and start an external application if someone double clicks on a certain 
+	 *file record. */
+	
+	/*public void mouseReleased(MouseEvent e) {}
+	  public void mouseExited(MouseEvent e) {}
+	public void mousePressed(MouseEvent e) {}
+	public void mouseEntered(MouseEvent e) {}*/
+	
+    }
+    
+    /** This class serves as the listener for actions on the build button. */
+    private class ReloadButtonListener
+	implements ActionListener {
+	/** As the log files could be modified in the runtime environment
+	 *  This button is to reload the log file whenever user want to */
+	public void actionPerformed(ActionEvent event) {
+	    // Remember that for lower thresholds the above doesn't work, so try this instead
+	    reload_button.setEnabled(true);
+	    delete_button.setEnabled(true);
+	    updateLogsContent(log_file.getPath());
+	}
+    }
+    
+    private class DeleteButtonListener
+	implements ActionListener {
+	public void actionPerformed(ActionEvent event) {
+	    //log_file.
+	    if (!log_file.exists()){
+		JOptionPane.showMessageDialog((Component) null,log_file.getPath() + " log file does not exist");
+		return;
+	    } else {
+		DeleteLogFilePrompt dfp  = new DeleteLogFilePrompt();
+		boolean file_deleted = dfp.display(log_file);
+		if (file_deleted) {
+		    log_textarea.setText("");
+		}
+	    }
+	    delete_button.setEnabled(true);
+	}
+    }
+    
+    /*    private class ExitButtonListener
+	implements ActionListener {
+	// Exit the Adminstration tool 
+	public void actionPerformed(ActionEvent event) {
+	    System.exit(1);
+	}
+	}*/
+
+    public void updateLogsContent(String filename){
+	if (!log_file.exists()){ 
+	    log_textarea.setText("");
+	    JOptionPane.showMessageDialog((Component) null, filename+" log file does not exist");  
+	    delete_button.setEnabled(false);
+	} else {
+	    readFile(filename);
+	}
+    }
+
+    public void readFile (String filename) {
+	log_textarea.setText("");
+	String fileLine;
+	int line_number = 0;
+	try {
+	    BufferedReader in = new BufferedReader(new FileReader(filename));
+	    while ((fileLine = in.readLine()) != null) {
+		log_textarea.append(fileLine);
+		log_textarea.append("\n");
+		line_number =line_number + 1;
+	    }
+	} catch (Exception e) {
+	    e.printStackTrace();
+	}	    
+    }
+   
+    private class LogListListener implements ListSelectionListener {
+	public void valueChanged (ListSelectionEvent e){
+	    if (e.getValueIsAdjusting() == false){
+		if (log_list.getSelectedIndex() == -1){
+		    //no selection
+		} else if (log_list.getSelectedIndex () == 0 ) {
+		    log_file = new File (GAI.tomcat_file_path+"catalina.out");
+		    String filename = log_file.getPath();
+		    updateLogsContent(filename);
+		    reload_button.setEnabled(true);
+		    delete_button.setEnabled(true);
+		} else if (log_list.getSelectedIndex () == 1) {
+		    /*log_file = new File (GAI.gsdl3_path+"/ant_out.log");
+		    String filename = log_file.getPath();
+		    updateLogsContent(filename);
+		    delete_button.setEnabled(true);*/
+		    log_textarea.setText("");
+		    JOptionPane.showMessageDialog((Component) null,"This file has not been defined yet");	
+		    delete_button.setEnabled(false);
+		    reload_button.setEnabled(false);
+		} else if (log_list.getSelectedIndex () == 2) {
+		    log_textarea.setText("");
+		    JOptionPane.showMessageDialog((Component) null,"This file has not been defined yet");	
+		    delete_button.setEnabled(false);
+		    reload_button.setEnabled(false);
+		}
+	    }
+	}
+    }
+    public void modeChanged (int mode){
+	return;
+    }
+}
Index: branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/MenuBar.java
===================================================================
--- branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/MenuBar.java	(revision 9972)
+++ branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/MenuBar.java	(revision 9972)
@@ -0,0 +1,292 @@
+/**
+ *#########################################################################
+ *
+ * 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.
+ *
+ * <BR><BR>
+ *
+ *
+ * <BR><BR>
+ *
+ * Copyright (C) 1999 New Zealand Digital Library Project
+ *
+ * <BR><BR>
+ *
+ * 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.
+ *
+ * <BR><BR>
+ *
+ * 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.
+ *
+ * <BR><BR>
+ * Author: Chi-Yu Huang, Greenstone Digital Library, University of Waikato
+ *
+ * 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.admin.gui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+
+import org.greenstone.admin.GAI;
+import org.greenstone.core.util.Utility;
+
+/** The menu bar for the Administration tools main GUI. 
+ * @author Chi-Yu Huang, Greenstone Digital Library, University of Waikato
+ * @version
+ */
+
+public class MenuBar
+    extends JMenuBar {
+    /** The icon to be displayed alongside the context choosen help file. */
+    private int current_tab = -1;
+    
+    private JMenu file = null;
+    private JMenu edit = null;
+    public JMenu help  = null;
+    //public JMenuItem file_associations;
+    // public JMenuItem file_cdimage    = null;
+    // public JMenuItem file_close      = null;
+    //public JMenuItem file_delete     = null;
+    public JMenuItem file_exit       = null;
+    // public JMenuItem file_exportas   = null;
+    // public JMenuItem file_new        = null;
+    //public JMenuItem file_open       = null;
+    //public JMenuItem file_options    = null;
+    // public JMenuItem file_save       = null;
+    // public JMenuItem edit_copy;
+    //public JMenuItem edit_cut;
+    // public JMenuItem edit_paste;
+    public JMenuItem help_conf;
+    public JMenuItem help_ext;
+    public JMenuItem help_monitor;
+    public JMenuItem help_log;
+    //public JMenuItem help_gather;
+    //public JMenuItem help_enrich;
+    //public JMenuItem help_design;
+    //public JMenuItem help_create;
+    public JMenuItem help_about;
+
+    //public static String imagePath = "/research/chi/gsdl3/src/java/org/greenstone/admin/images/";
+    public static String imagePath = "/research/chi/gsdl3-test/gsdl3/src/java/org/greenstone/admin/images/";
+    
+    static public ImageIcon HELP_ICON = null; 
+
+    //    public MenuBar(MenuListener Menu_listener)
+    public MenuBar()
+    {
+	HELP_ICON = new ImageIcon("images/help.gif");
+	file = new JMenu("File");
+	file.setMnemonic(KeyEvent.VK_F);
+	//Dictionary.registerText(file, "Menu.File");
+
+	/*file_associations = new JMenuItem();
+	file_associations.addActionListener(Gatherer.g_man);	  
+	file_associations.setMnemonic(KeyEvent.VK_A);
+	Dictionary.registerText(file_associations, "Menu.File_Associations");
+
+	file_cdimage = new JMenuItem();
+	file_cdimage.addActionListener(Gatherer.g_man);
+	file_cdimage.setMnemonic(KeyEvent.VK_I);
+	Dictionary.registerText(file_cdimage, "Menu.File_CDimage");
+
+	file_close = new JMenuItem();
+	file_close.addActionListener(Gatherer.g_man);
+	file_close.setEnabled(false);
+	file_close.setMnemonic(KeyEvent.VK_C);
+	Dictionary.registerText(file_close, "Menu.File_Close");
+
+	file_delete = new JMenuItem();
+	file_delete.addActionListener(Gatherer.g_man);
+	file_delete.setMnemonic(KeyEvent.VK_D);
+	Dictionary.registerText(file_delete, "Menu.File_Delete");*/
+
+	file_exit = new JMenuItem("Exit");
+	file_exit.addActionListener(GAI.ga_man);
+	file_exit.setMnemonic(KeyEvent.VK_X);
+	//Dictionary.registerText(file_exit, "Menu.File_Exit");
+
+	/*file_exportas = new JMenuItem();
+	file_exportas.addActionListener(Gatherer.g_man);
+	file_exportas.setMnemonic(KeyEvent.VK_E);
+	Dictionary.registerText(file_exportas, "Menu.File_ExportAs");*/
+
+	/*file_new = new JMenuItem();
+	file_new.addActionListener(Gatherer.g_man);
+	file_new.setMnemonic(KeyEvent.VK_N);
+	Dictionary.registerText(file_new, "Menu.File_New");
+
+	file_open = new JMenuItem();
+	file_open.addActionListener(Gatherer.g_man);
+	file_open.setMnemonic(KeyEvent.VK_O);
+	Dictionary.registerText(file_open, "Menu.File_Open");
+
+	file_options = new JMenuItem();
+	file_options.addActionListener(Gatherer.g_man);
+	file_options.setMnemonic(KeyEvent.VK_P);
+	Dictionary.registerText(file_options, "Menu.File_Options");
+
+	file_save = new JMenuItem();
+	file_save.addActionListener(Gatherer.g_man);
+	file_save.setEnabled(false);
+	file_save.setMnemonic(KeyEvent.VK_S);
+	Dictionary.registerText(file_save, "Menu.File_Save");*/
+
+	// Layout (file menu)
+	/*file.add(file_new);
+	file.add(file_open);
+	file.add(file_save);
+	file.add(file_close);*/
+	file.add(new JSeparator());
+	/*file.add(file_delete);
+	file.add(file_exportas);
+	file.add(file_cdimage);
+	file.add(new JSeparator());
+	file.add(file_associations);
+	file.add(file_options);
+	file.add(new JSeparator());*/
+	file.add(file_exit);
+
+	// Edit menu
+	edit = new JMenu("Edit");
+	edit.setMnemonic(KeyEvent.VK_E);
+	//Dictionary.registerText(edit, "Menu.Edit");
+		  
+	/*edit_cut = new JMenuItem();
+	edit_cut.addActionListener(Gatherer.g_man);
+	edit_cut.setMnemonic(KeyEvent.VK_X);
+	Dictionary.registerText(edit_cut, "Menu.Edit_Cut");
+
+	edit_copy = new JMenuItem();
+	edit_copy.addActionListener(Gatherer.g_man);
+	edit_copy.setMnemonic(KeyEvent.VK_C);
+	Dictionary.registerText(edit_copy, "Menu.Edit_Copy");
+
+	edit_paste = new JMenuItem();
+	edit_paste.addActionListener(Gatherer.g_man);
+	edit_paste.setMnemonic(KeyEvent.VK_V);
+	Dictionary.registerText(edit_paste, "Menu.Edit_Paste");
+
+	// Layout (edit menu)
+	edit.add(edit_cut);
+	edit.add(edit_copy);
+	edit.add(edit_paste);*/
+
+	// Help menu
+	help = new JMenu("Help");
+	help.setMnemonic(KeyEvent.VK_H);
+	help.setIcon(HELP_ICON);
+	//Dictionary.setText(help, "Menu.Help");
+
+	help_conf = new JMenuItem("Configuration");
+	//help_log.addActionListener(Gatherer.g_man);
+	//Dictionary.registerText(help_general, "Source.General");
+
+	help_ext = new JMenuItem("Ext");
+	help_monitor = new JMenuItem("Monitor");
+	help_log = new JMenuItem("Log");
+
+	/*help_gather = new JMenuItem(Utility.BLANK_ICON);
+	help_gather.addActionListener(Gatherer.g_man);
+	Dictionary.registerText(help_gather, "GUI.Gather");
+
+	help_enrich = new JMenuItem(Utility.BLANK_ICON);
+	help_enrich.addActionListener(Gatherer.g_man);
+	Dictionary.registerText(help_enrich, "GUI.Enrich");
+
+	help_design = new JMenuItem(Utility.BLANK_ICON);
+	help_design.addActionListener(Gatherer.g_man);
+	Dictionary.registerText(help_design, "GUI.Design");
+
+	help_create = new JMenuItem(Utility.BLANK_ICON);
+	help_create.addActionListener(Gatherer.g_man);
+	Dictionary.registerText(help_create, "GUI.Create");*/
+
+	help_about = new JMenuItem("About");
+	//help_about.addActionListener(Gatherer.g_man);
+	//Dictionary.registerText(help_about, "Menu.Help_About");
+
+	// Layout (help menu)
+	help.add(help_conf);
+	help.add(help_ext);
+	help.add(help_monitor);
+	help.add(help_log);
+	help.add(new JSeparator());
+
+	/*if (Configuration.get("workflow.download", true)) {
+	    help.add(help_download);
+	}
+	if (Configuration.get("workflow.gather", true)) {
+	    help.add(help_gather);
+	}
+	if (Configuration.get("workflow.enrich", true)) {
+	    help.add(help_enrich);
+	}
+	if (Configuration.get("workflow.design", true)) {
+	    help.add(help_design);
+	}
+	if (Configuration.get("workflow.create", true)) {
+	    help.add(help_create);
+	    }*/
+	
+	help.add(new JSeparator());
+	help.add(help_about);
+
+	// Layout (menu bar)
+	add(file);
+	add(Box.createHorizontalStrut(15));
+	add(edit);
+	add(Box.createHorizontalGlue());
+	add(help);
+    }
+
+    /** Once a quit has been requested by the user, prevent any further menu selections. */
+    public void exit() {
+	file.setEnabled(false);
+	edit.setEnabled(false);
+	help.setEnabled(false);
+    }
+
+    /*public void refresh(int refresh_reason, boolean ready)
+    {
+	file_close.setEnabled(ready);
+	file_save.setEnabled(ready);
+	}*/
+
+
+    /** In order to provide context aware help advice we keep track of which
+     *  tab the user has open, and then highlight that help menu item with
+     *  separators.
+     *  @param tab_index The index of the selected tab (0-7).
+     */
+    public void tabSelected(int tab_index) {
+	JMenuItem selected;
+	if(current_tab != -1) {
+	    // Remove the image
+	    selected = help.getItem(current_tab);
+	    if(selected != null) {
+		selected.setIcon(Utility.BLANK_ICON);
+	    }
+	}
+	current_tab = tab_index + 2;
+	selected = help.getItem(current_tab);
+	if(selected != null) {
+	    //selected.setIcon(Utility.HELP_ICON);
+	    //
+	}
+	selected = null;
+    }
+}
Index: branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/SaveChangePrompt.java
===================================================================
--- branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/SaveChangePrompt.java	(revision 9972)
+++ branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/SaveChangePrompt.java	(revision 9972)
@@ -0,0 +1,111 @@
+/**
+ *#########################################################################
+ *
+ * A component of the GAI application, part of the Greenstone digital
+ * library suite from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * <BR><BR>
+ *
+ * Author: Chi-Yu Huang, Greenstone Digital Library, University of Waikato
+ *
+ * <BR><BR>
+ *
+ * Copyright (C) 1999 New Zealand Digital Library Project
+ *
+ * <BR><BR>
+ *
+ * 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.
+ *
+ * <BR><BR>
+ *
+ * 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.
+ *
+ * <BR><BR>
+ *
+ * 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.admin.gui;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.io.*;
+import java.net.*;
+import javax.swing.*;
+import javax.swing.event.*;
+
+import org.greenstone.admin.gui.ConfPane;
+
+import org.greenstone.core.Configuration;
+import org.greenstone.core.DebugStream;
+
+/** This class provides the functionality to show a prompt to save changed file  
+ * @author Chi-Yu Huang, Greenstone Digital Library, University of Waikato
+ * @version 1.0
+ */
+public class SaveChangePrompt
+    extends JDialog {
+    
+    /** A reference to ourself so any inner-classes can dispose of us. */
+    private SaveChangePrompt prompt = null;
+    private File file = null;
+        
+    //A flag showing the saving change status
+    private boolean current_change_saved = false;
+    
+    /** The size of the save prompt screen. */
+    static final Dimension SIZE = new Dimension(500, 500);
+    
+    // Constructor.
+    public SaveChangePrompt() {
+	super();
+	prompt = this;
+    }
+    
+    /** Destructor. */
+    public void destroy() {
+	prompt = null;
+    }
+    
+    /** This method causes the Save Change Confirmation Dialog to be displayed.
+     * returns true if it has save the change file that is currently open */
+    public boolean display(File file) {
+	int result = JOptionPane.showConfirmDialog((Component) null, "Do you really want to save the change", "Save Confirmation", JOptionPane.YES_NO_OPTION);
+	if ( result == JOptionPane.YES_OPTION) {
+	    ConfPane confPane = new ConfPane();
+	    confPane.saveNewConfSetting();
+	    confPane.writeConfFile(file);
+	    current_change_saved = true;
+	} else if (result == JOptionPane.NO_OPTION) {
+	    current_change_saved = false;
+	    prompt.dispose();
+	}
+	resultPrompt(current_change_saved);
+	return current_change_saved;
+    }
+    
+    /** Shows a save complete prompt. 
+     * @param success A <strong>boolean</strong> indicating if the collection was successfully saved
+     */
+    public void resultPrompt(boolean success) {
+	if (success) {
+	    JOptionPane.showMessageDialog(prompt,"The build property file has been saved.");
+	} else {
+	    JOptionPane.showMessageDialog(prompt, "Cancel saving the change to build property file");
+	}
+    }
+    
+    /** Any implementation of ActionListener requires this method so that when an 
+     **action is performed the appropriate effect can occur.*/
+    public void actionPerformed(ActionEvent event) {
+    }
+}
Index: branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/SetServerPane.java
===================================================================
--- branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/SetServerPane.java	(revision 9972)
+++ branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/SetServerPane.java	(revision 9972)
@@ -0,0 +1,375 @@
+/**
+ *#########################################################################
+ *
+ * A component of the GAI application, part of the Greenstone digital
+ * library suite from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * <BR><BR>
+ *
+ * Author: Chi-Yu Huang, Greenstone Digital Library, University of Waikato
+ * Date: 05.2005
+ *
+ * <BR><BR>
+ *
+ * Copyright (C) 1999 New Zealand Digital Library Project
+ *
+ * <BR><BR>
+ *
+ * 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.
+ *
+ * <BR><BR>
+ *
+ * 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.
+ *
+ * <BR><BR>
+ *
+ * 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.
+ *########################################################################
+ */
+/* This program is intended to confirm the initial user's setting about
+ * the Tomcat server and MySQL server they would like to run GSDL3 with
+ */
+package org.greenstone.admin.gui;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.io.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.lang.Object;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.tree.*;
+import javax.swing.table.*;
+import java.awt.event.MouseEvent;
+import java.net.*;
+import java.sql.*;
+
+import org.greenstone.core.Configuration;
+import org.greenstone.core.Dictionary;
+import org.greenstone.core.ParsingProgress;
+import org.greenstone.admin.GAI;
+
+
+/** The initial setting pane is to request the user to input the preferred 
+ * Tomcat and Mysql server,they would like to run GSDL3 with
+ *  @author Chi-Yu Huang, Greenstone Digital Library, University of Waikato
+ *  @version
+ */
+public class SetServerPane
+    extends JFrame
+    implements ActionListener {
+
+    /* This pane is to allow the user to set up their own running Tomcat/Mysql server 
+     * before the installation of the GSDL3*/
+    // protected JScrollPane setting_message_pane = null;
+    protected JPanel main_pane = null;
+    protected JPanel button_pane = null;
+    protected JPanel outter_control_pane = null;
+    protected JScrollPane setting_table_pane = null;
+    protected JTable server_setting_table = null;
+    
+    private JButton save_button = null;
+    private JButton install_button = null;
+    private JButton exit_button = null;
+
+    ServerSettingTableModel server_setting_table_model = null;
+    private boolean setting_confirm = false;
+    private ArrayList conf_array;
+    private boolean success = false;
+    private boolean file_saved = true;
+    
+    /** The various sizes for the screen layout*/
+    static private Dimension MIN_SIZE = new Dimension( 90,  90);
+    static private Dimension LIST_SIZE  = new Dimension(200, 450);
+    static private Dimension DIALOG_SIZE = new Dimension (400,300);
+    static private Dimension FRAME_SIZE = new Dimension (500, 450);
+    static private Dimension TABLE_SIZE = new Dimension(500,200);
+    static final Dimension SIZE = new Dimension(400,400);
+    
+    //Constructor
+    public SetServerPane() {
+	super();
+	this.setDefaultCloseOperation(EXIT_ON_CLOSE);
+	this.setSize(FRAME_SIZE);
+	this.setTitle("Setting Tomcat/MYSQL Servers");
+	
+	// create all the control button panes
+	button_pane  = new JPanel();
+
+	//First time running button
+	SaveButtonListener ybl = new SaveButtonListener();
+	InstallButtonListener nbl = new InstallButtonListener();
+	ExitButtonListener ebl = new ExitButtonListener();
+	
+	// ImagesIcon for the buttons
+	ImageIcon SaveButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/Refresh16.gif");
+	ImageIcon InstallButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/exit16.gif");
+	ImageIcon ExitButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/exit16.gif");
+
+	save_button = new JButton("Save Setting", SaveButtonIcon);
+	save_button.addActionListener(ybl);
+	save_button.setMnemonic(KeyEvent.VK_S);
+	save_button.setToolTipText("Click this button to save up the setting");
+	save_button.setEnabled(false);
+	//Dictionary.registerBoth(build_button, "CreatePane.Build_Collection", "CreatePane.Build_Collection_Tooltip");
+
+	install_button = new JButton("Install GSDL3", InstallButtonIcon);
+	install_button.addActionListener(nbl);
+	install_button.setEnabled(false);
+	install_button.setMnemonic(KeyEvent.VK_I);
+	install_button.setToolTipText("Click this button to Install Greenstone III");
+	//Dictionary.registerBoth(build_button, "CreatePane.Build_Collection", "CreatePane.Build_Collection_Tooltip");
+
+	exit_button = new JButton("Exit Setting and Installation", ExitButtonIcon);
+	exit_button.addActionListener(ebl);
+	exit_button.setEnabled(false);
+	install_button.setMnemonic(KeyEvent.VK_I);
+	install_button.setToolTipText("Click this button to Exit the Setting and Installation of Greenstone III");
+	//Dictionary.registerBoth(build_button, "CreatePane.Build_Collection", "CreatePane.Build_Collection_Tooltip");
+
+	//Setting&Installation buttons
+	ybl = null;
+	nbl = null;
+	ebl = null;
+    }
+
+    /** Any implementation of ActionListener requires this method so that when an 
+     **action is performed the appropriate effect can occur.*/
+    public void actionPerformed(ActionEvent event) {
+    }
+
+    /** This method is callsed to actually layout the components.*/
+    public void display() {
+	//KeyListenerImpl key_listener = new KeyListenerImpl();
+	//MouseListenerImpl mouse_listener = new MouseListenerImpl();
+	//this.addKeyListener(key_listener);
+	
+	server_setting_table_model = new ServerSettingTableModel();
+	server_setting_table = new JTable(server_setting_table_model) {
+		protected String[] rowToolTips = {
+		    "The name of the machine that Tomcat is/will be run on",
+		    "The port number that Tomcat is/will be run on",
+		    "The base directory for the existing Tomcat installation",
+		    "The name of the machine that Mysql is/will be run on",
+		    "The port number that Mysql is/will be run on",
+		    "The base directory for the existing MYSQL installations",
+		    "The user name for the administrator of using MySQL",
+		    "The socket that Mysql is/will be run on"};
+		
+		public String getToolTipText(MouseEvent e){
+		    String tip = null;
+		    Point p = e.getPoint();
+		    int rowIndex = rowAtPoint(p);
+		    int colIndex = columnAtPoint(p);
+		    int realColumnIndex = convertColumnIndexToModel(colIndex);
+		    if (realColumnIndex == 0){
+			tip = rowToolTips[rowIndex];
+		    } else {
+			tip = super.getToolTipText(e);
+		    }
+		    return tip;
+		}
+	    };
+	
+	//Set up tableHeader
+	JTableHeader header = server_setting_table.getTableHeader();
+	header.setFont(new Font("Arial", Font.BOLD, 14));
+	
+	server_setting_table.setRowHeight(30);
+	setting_table_pane = new JScrollPane(server_setting_table);
+	
+	// Button Control Layout 
+	save_button.setEnabled(true);
+	install_button.setEnabled(true);
+	exit_button.setEnabled(true);
+	
+	button_pane.setLayout (new GridLayout(1,3));
+	button_pane.add(save_button);
+	button_pane.add(install_button);
+	button_pane.add(exit_button);
+
+	outter_control_pane = new JPanel();
+	outter_control_pane.setLayout (new BorderLayout());
+	outter_control_pane.setBorder(BorderFactory.createLoweredBevelBorder());
+	outter_control_pane.setPreferredSize(new Dimension(50,50));
+	outter_control_pane.setSize(new Dimension(50,50));
+	outter_control_pane.add (button_pane, BorderLayout.CENTER);
+	
+	main_pane = (JPanel) getContentPane();
+	main_pane.setLayout (new BorderLayout());
+	main_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+	main_pane.add(setting_table_pane, BorderLayout.CENTER);
+	main_pane.add(outter_control_pane, BorderLayout.SOUTH);
+	main_pane.setBackground(Configuration.getColor("coloring.workspace_selection_background", false));
+	main_pane.setForeground(Configuration.getColor("coloring.workspace_selection_foreground", false));
+	
+	// Center and display
+	Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
+	setLocation((screen_size.width - SIZE.width) / 2,
+		    (screen_size.height - SIZE.height) / 2);
+	setVisible(true);
+    }
+    
+    public void destroy() {
+    }
+        
+    /** This class serves as the listener for actions on the build button.*/
+    private class SaveButtonListener
+	implements ActionListener {
+	/** This button is to save any change you have added
+	 ** to the Tomcat/Mysql servers setting*/
+	public void actionPerformed(ActionEvent event) {
+	    setting_confirm = true;
+	    int result = JOptionPane.showConfirmDialog((Component) null, "Do you really want to save the setting?", "Save Confirmation", JOptionPane.YES_NO_OPTION);
+	    if ( result == JOptionPane.YES_OPTION) {
+		updateSetting (GAI.build_file);
+		file_saved = writeFile (GAI.build_file);
+		if (file_saved) {
+		    JOptionPane.showMessageDialog((Component) null,"Change has been saved succefully!");
+		} else {
+		    JOptionPane.showMessageDialog((Component) null,"Change has not been saved succefully!");
+		    file_saved = false;
+		} 
+	    } else if (result == JOptionPane.NO_OPTION) {
+		JOptionPane.showMessageDialog((Component) null,"Change has not been saved!");
+		file_saved = false;
+	    }
+	}
+    }
+
+    public void updateSetting(File build_file) {
+	readFile (GAI.build_file);
+	String new_string;
+	for (int i=0; i < server_setting_table_model.getRowCount(); i++){
+	    //System.err.println("What is the value here:" + server_setting_table_model.getValueAt(i,0).toString());
+	    if (!server_setting_table_model.getValueAt(i,1).toString().matches("^\\s*$")){
+		for (int j=0; j < conf_array.size(); j++){
+		    if (((String)conf_array.get(j)).startsWith(server_setting_table_model.getValueAt(i,0).toString().toLowerCase())){
+			//System.err.println("What is the value in conf_array:" + conf_array.get(j));
+			new_string = server_setting_table_model.getValueAt(i,0).toString()+"="+server_setting_table_model.getValueAt(i,1).toString();
+			conf_array.set(j, new_string.toLowerCase());
+		    }
+		}
+	    }
+	}
+	
+    }
+    public void readFile (File build_file) {
+	String filename = build_file.getPath();
+	String fileLine;
+	/*conf_array[] store all the details from the build.properties*/
+	conf_array = new ArrayList();
+	try {
+	    BufferedReader conf_in = new BufferedReader(new FileReader(filename));
+	    while ((fileLine = conf_in.readLine()) != null) {
+		// Besides an empty line, all the other lines will be stored in the conf_array
+		if (!fileLine.matches("^\\s*$")) {
+		    conf_array.add(fileLine);
+		} 
+	    }
+	    conf_in.close();
+	} catch (Exception e) {
+	    e.printStackTrace();
+	}
+    }
+    
+    public boolean writeFile(File build_file){
+	String filename = build_file.getPath();
+	try {
+	    BufferedWriter conf_out = new BufferedWriter(new FileWriter(filename));
+	    for (int j=0 ; j < conf_array.size(); j++){
+		conf_out.write(conf_array.get(j).toString());
+		conf_out.newLine();
+	    }
+	    success = true;
+	    conf_out.close();
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    success = false;
+	}
+	return success;
+    }
+
+    private class InstallButtonListener
+	implements ActionListener {
+	// Exit the Adminstration tool 
+	public void actionPerformed(ActionEvent event) {
+	    setting_confirm = false;
+	    /*if (!setting_confirm) {
+	      GAIManager gai = new GAIManager("/research/chi/gsdl3-test/gsdl3", screen_size);
+	      }*/
+	}
+    }
+    
+    private class ExitButtonListener
+	implements ActionListener {
+	// Exit the Adminstration tool 
+	public void actionPerformed(ActionEvent event) {
+	    if (!file_saved) {
+		int result = JOptionPane.showConfirmDialog((Component) null, "The value of configuration has been changed,do you really want to exit?", "Exit Confirmation", JOptionPane.YES_NO_OPTION);
+		if ( result == JOptionPane.YES_OPTION) {
+		    System.exit(1);
+		} else if (result == JOptionPane.NO_OPTION) {
+		    JOptionPane.showMessageDialog((Component) null,"Press Save button to save the change!");
+		}
+	    } else {
+		System.exit(1);
+	    }	    
+	}
+    }
+    
+    class ServerSettingTableModel extends AbstractTableModel {
+	String[] columnNames = {"Configuration Parameter",
+				"Configuration Value"};
+	Object [][] conf_display = {{"TOMCAT.SERVER", ""},
+				    {"TOMCAT.PORT", ""},
+				    {"TOMCAT.INSTALLED.PATH",""},
+				    {"MYSQL.SERVER",""},
+				    {"MYSQL.PORT",""},
+				    {"MYSQL.INSTALLED.PATH",""},
+				    {"MYSQL.ADMIN.USER",""},
+				    {"MYSQL.SOCKET",""}};
+	
+	public int getColumnCount(){
+	    return columnNames.length;
+	}
+	
+	public int getRowCount() {
+	    return conf_display.length;
+	}
+	
+	public String getColumnName(int col){
+	    return columnNames[col];
+	}
+	
+	public Object getValueAt(int row,int col){
+	    return conf_display[row][col];
+	}
+	
+	public boolean isCellEditable(int row, int col){
+	    if (col == 0){
+		return false;
+	    } else {
+		return true;
+	    }
+	}
+
+	public void setValueAt(Object value, int row, int col){
+	    conf_display[row][col] = value;
+	    fireTableCellUpdated(row,col);
+	}
+    }
+
+}
+       
+
Index: branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/TabbedPane.java
===================================================================
--- branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/TabbedPane.java	(revision 9972)
+++ branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/TabbedPane.java	(revision 9972)
@@ -0,0 +1,90 @@
+/**
+ *#########################################################################
+ *
+ * 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: Chi-Yu Huang, Greenstone Digital Library, University of Waikato
+ *
+ * Copyright (C) 1999 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.admin.gui;
+
+
+import javax.swing.JTabbedPane;
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JFrame;
+import javax.swing.JComponent;
+import java.awt.*;
+import java.awt.event.KeyEvent;
+
+public class TabbedPane extends JPanel {
+
+    private static final Dimension SIZE = new Dimension(800, 540);
+
+    public TabbedPane() {
+	super(new GridLayout(1, 1));
+	setBackground(new Color(176,208,176));
+	
+        JTabbedPane tabbedPane = new JTabbedPane();
+        JComponent panel1 = makeTextPanel("Log information Pane");
+	/*   tabbedPane.addTab("Log Pane", icon, panel1,
+	     "Log Pane");*/
+	panel1.setPreferredSize(SIZE);
+	panel1.setBackground(new Color(176,208,176));
+	tabbedPane.addTab("Log Pane", panel1);
+	tabbedPane.setMnemonicAt(0, KeyEvent.VK_L);
+      
+
+        JComponent panel2 = makeTextPanel("Runtime Status");
+        /*tabbedPane.addTab("Status Pane", icon, panel2,
+	  "Status Pane");*/
+
+	panel2.setPreferredSize(SIZE);
+	panel2.setBackground(new Color(176,208,176));
+	tabbedPane.addTab("Status Pane", panel2);
+        tabbedPane.setMnemonicAt(1, KeyEvent.VK_R);
+
+        //Add the tabbed pane to this panel.
+        add(tabbedPane);
+    }
+
+    protected JComponent makeTextPanel(String text) {
+        JPanel panel = new JPanel(false);
+        JLabel filler = new JLabel(text);
+        filler.setHorizontalAlignment(JLabel.CENTER);
+        panel.setLayout(new GridLayout(1, 1));
+        panel.add(filler);
+        return panel;
+    }
+
+    /** Returns an ImageIcon, or null if the path was invalid. */
+    protected static ImageIcon createImageIcon(String path) {
+        java.net.URL imgURL = TabbedPane.class.getResource(path);
+        if (imgURL != null) {
+            return new ImageIcon(imgURL);
+        } else {
+            System.err.println("Couldn't find file: " + path);
+            return null;
+        }
+    }
+}
Index: branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/ThreadControl.java
===================================================================
--- branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/ThreadControl.java	(revision 9972)
+++ branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/ThreadControl.java	(revision 9972)
@@ -0,0 +1,369 @@
+/**
+ *#########################################################################
+ *
+ * A component of the GAI application, part of the Greenstone digital
+ * library suite from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * <BR><BR>
+ *
+ * Author: Chi-Yu Huang, Greenstone Digital Library, University of Waikato
+ *
+ * <BR><BR>
+ *
+ * Copyright (C) 1999 New Zealand Digital Library Project
+ *
+ * <BR><BR>
+ *
+ * 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.
+ *
+ * <BR><BR>
+ *
+ * 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.
+ *
+ * <BR><BR>
+ *
+ * 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.admin.gui;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.io.*;
+import java.net.*;
+import javax.swing.*;
+import javax.swing.event.*;
+
+import org.greenstone.admin.GAI;
+import org.greenstone.admin.gui.LogPane;
+import org.greenstone.core.ParsingProgress;
+import org.apache.tools.ant.*;
+import org.apache.tools.ant.helper.ProjectHelperImpl;
+
+
+public class ThreadControl 
+    extends Thread {
+    
+    //boolean ant_success = false;
+
+    public ThreadControl(){
+    }
+
+    public void run(){
+    }   
+
+    
+    public void executeAntTarget(String command_string) throws IOException  {
+	Project ant = new Project();
+	File buildFile = new File (GAI.gsdl3_path + File.separator + "build.xml");
+	
+	//Set up a PrintStream pointing at a file
+	//FileOutputStream ant_out =
+	//   new FileOutputStream(GAI.gsdl3_path + File.separator + "ant_out.log");
+	//FileOutputStream ant_err = 
+	//   new FileOutputStream(GAI.gsdl3_path + File.separator + "ant_err.log");
+	
+	//	BufferedOutputStream ant_out_buffer = 
+	//   new BufferedOutputStream(ant_out, 1024);
+	//BufferedOutputStream ant_err_buffer = 
+	///   new BufferedOutputStream(ant_err, 1024);
+	
+	//PrintStream ant_out_ps =
+	//   new PrintStream(ant_out_buffer, false);
+	//PrintStream ant_err_ps =
+	//   new PrintStream(ant_err_buffer, false);
+	
+	DefaultLogger log = new DefaultLogger();
+        //log.setErrorPrintStream(ant_err_ps);
+	//log.setOutputPrintStream(ant_out_ps);
+
+	log.setErrorPrintStream(System.err);
+	log.setOutputPrintStream(System.out);
+        log.setMessageOutputLevel(Project.MSG_INFO);
+	ant.addBuildListener(log);
+	try {
+	    ant.init();
+	    ant.fireBuildStarted();
+	    ProjectHelper helper = ProjectHelper.getProjectHelper();
+	    helper.parse(ant, buildFile);
+	    ant.executeTarget(command_string);
+	    ant.fireBuildFinished(null);
+	}
+	catch (BuildException e) {
+	    e.printStackTrace(System.err); 
+	    ant.fireBuildFinished(e);
+	}
+	/*finally {
+	    System.setOut(ant_out_ps);
+	    System.setErr(ant_err_ps);
+	    }*/
+
+	//boolean ant_success = checkAntResult();
+	//ant_out_ps.close();
+	//ant_err_ps.close();
+	/*if (!ant_success){
+	    int result = JOptionPane.showConfirmDialog((Component) null, "Ant building call was failed, do you want to see the log file?", "Exit Confirmation", JOptionPane.YES_NO_OPTION);
+	    if ( result == JOptionPane.YES_OPTION) {
+		//System.exit(1);
+		// Showing ant_out.log content
+	    } else if (result == JOptionPane.NO_OPTION) {
+		JOptionPane.showMessageDialog((Component) null,"You can see the log file from Log Pane!");
+	    } 
+	} else {
+	    //System.err.println("****Ant build successed");
+	    //JOptionPane.showMessageDialog((Component) null,"You can see the log file from Log Pane!");
+	    
+	    }*/
+    }
+
+    /*public boolean checkAntResult(){
+	try {
+	    String filename = GAI.gsdl3_path + File.separator +"ant_out.log";
+	    String fileLine;
+	    
+	    BufferedReader ant_result = new BufferedReader(new FileReader(filename));
+	    
+	    while ((fileLine = ant_result.readLine()) != null) {
+		if (fileLine.matches("BUILD SUCCESSFUL")){
+		    //return true;
+		    return false;
+		} else if (fileLine.matches("BUILD FAILED")){
+		    //System.err.println("***Ant result"+fileLine);
+		    return false;
+		}
+	    }
+	} catch (Exception e) {
+	    e.printStackTrace();
+	   
+	}	
+	return false;
+	}*/
+    
+
+    public class restartTomcatServer 
+	implements Runnable {
+	private String command_string = null;
+	/* Construct a restartTomcatServer Object*/
+	public restartTomcatServer(String command_string) {
+	    this.command_string = command_string;
+	}
+	
+	public void run() {
+	    try { 
+		executeAntTarget(this.command_string);
+	    } catch(Exception e) { 
+		System.out.println(e.getMessage()); 
+	    }
+	}
+    }
+
+    public class startupTomcatServer 
+	implements Runnable {
+	private String command_string = null;
+	/* Construct a startupTomcatServer Object*/
+	public startupTomcatServer(String command_string) {
+	    this.command_string = command_string;
+	}
+	public void run() {
+	    try { 
+		executeAntTarget(this.command_string);
+	    } catch(Exception e) { 
+		System.out.println(e.getMessage()); 
+	    }
+	}
+    }
+
+    public class shutdownTomcatServer 
+	implements Runnable {
+	private String command_string = null;
+	/* Construct a shutdownTomcatServer Object*/
+	public shutdownTomcatServer(String command_string) {
+	    this.command_string = command_string;
+	}
+	public void run() {
+	    try { 
+		executeAntTarget(this.command_string);
+	    } catch(Exception e) { 
+		System.out.println(e.getMessage()); 
+	    }
+	}
+    }
+
+    public class startupMysqlServer 
+	implements Runnable {
+	private String command_string = null;
+
+	/* Construct a startupMysqlServer Object*/
+	public startupMysqlServer(String command_string) {
+	    this.command_string = command_string;
+	}
+	public void run() {
+	    try { 
+		executeAntTarget(this.command_string);
+		// ant_success;
+	    } catch(Exception e) { 
+		System.out.println(e.getMessage()); 
+	    }
+	}
+    }
+
+    public class shutdownMysqlServer 
+	implements Runnable {
+	private String command_string = null;
+	/* Construct a shutdownMysqlServer Object*/
+	public shutdownMysqlServer(String command_string) {
+	    this.command_string = command_string;
+	}
+	public void run() {
+	    try { 
+		executeAntTarget(this.command_string);
+	    } catch(Exception e) { 
+		System.out.println(e.getMessage()); 
+	    }
+	}
+    }
+
+    public class restartMysqlServer 
+	implements Runnable {
+	private String command_string = null;
+	/* Construct a restartMysqlServer Object*/
+	public restartMysqlServer(String command_string) {
+	    this.command_string = command_string;
+	}
+	public void run() {
+	    try { 
+		executeAntTarget(this.command_string);
+	    } catch(Exception e) { 
+		System.out.println(e.getMessage()); 
+	    }
+	}
+    }
+    
+    public void destroy(){
+    }
+}
+
+
+/***
+ * This program shows how you can time a set of threads.  The main()
+ * program demonstrates the timing classes by spawning and timing a
+ * set of threads that just execute a dummy loop.
+ ***/
+/*public class ThreadTiming {
+
+    /** Times a group of threads.  Works with TimingWrapper. */
+//    public static class ThreadTimer {
+//	private boolean __resultReady;
+//	private int __monitor[], __numThreads;
+//	private long __begin, __end;
+	
+	/** Creates a ThreadTimer that can time a given number of threads. */
+//	public ThreadTimer(int numThreads) {
+//	    __monitor     = new int[1];
+//	    __monitor[0]  = 0;
+//	    __numThreads  = numThreads;
+//	    __resultReady = false;
+//	}
+	
+	/** Starts the timer when all the threads are ready to start. */
+//	public void start() {
+//    synchronized(__monitor) {
+//		if(++__monitor[0] >= __numThreads) {
+//		    __begin = System.currentTimeMillis();
+//		    __monitor.notifyAll();
+//		} else {
+//		    while(true) {
+//			try {
+//			    __monitor.wait();
+//			} catch(InterruptedException e) {
+//			    continue;
+//			}
+//			break;
+//		    }
+//		}
+//	    }
+//	}
+	
+	/** Stops the timer when the last thread is done. */
+//	public void stop() {
+//	    synchronized(__monitor) {
+//	if(--__monitor[0] <= 0) {
+//		    __end   = System.currentTimeMillis();
+//		    synchronized(this) {
+//		__resultReady = true;
+//		notify();
+//	    }
+//	}
+//   }
+//}/
+	
+	/** Calling thread waits until timing result is ready. */
+//	public synchronized void waitForResult() {
+//	    while(!__resultReady) {
+//		try {
+///	    wait();
+//	} catch(InterruptedException e) {
+//	}
+//    }
+//    __resultReady = false;
+//}
+//
+///** Returns elapsed time in milliseconds. */
+//public long getElapsedTime() {
+//	    return (__end - __begin);
+//}
+//  }
+//  
+    /** Wraps a thread so it can be timed with a group. */
+//    public static class TimingWrapper implements Runnable {
+//	private Runnable __runMe;
+//private ThreadTimer __timer;
+
+//	public TimingWrapper(Runnable runMe, ThreadTimer timer) {
+//    __runMe   = runMe;
+//    __timer   = timer;
+//}
+	
+//public void run() {
+//    // Note, this timing approach does not measure thread creation
+//    // and thread joining overhead.
+//    __timer.start();
+//    __runMe.run();
+//    __timer.stop();
+//}
+//  }
+
+
+//public static final int NUM_THREADS = 10;
+//public static final int NUM_LOOPS   = 10000000;
+    
+//   public static void main(String[] args) {
+//int thread;
+//ThreadTimer timer;
+//
+//	timer = new ThreadTimer(NUM_THREADS);
+
+	// Start a number of threads that iterate a dummy loop
+//	for(thread = 0; thread < NUM_THREADS; thread++)
+//    new Thread(new TimingWrapper(new Runnable() {
+//	    public void run() {
+//		for(int i=0; i < NUM_LOOPS; i++);
+//	    }
+//	}, timer)).start();
+//
+//timer.waitForResult();
+	
+//	System.out.println("Elapsed Seconds: " +
+//			   ((double)timer.getElapsedTime())/1000.0);
+//   }
+    
+//}*/
