/** *######################################################################### * * 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: John Thompson, 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.gatherer; import java.awt.*; import java.io.*; import java.util.*; import javax.swing.*; import org.greenstone.gatherer.feedback.ActionRecorderDialog; import org.greenstone.gatherer.gui.GUIManager; import org.greenstone.gatherer.util.Utility; /** Containing the main() method for the Gatherer, this class is the * starting point for the rest of the application. Using GetOpt and * GathererBase it first parses the command line arguments, preparing to * update the configuration as required. Next it loads several important * support classes such as the Configuration and Dictionary. Finally it * creates the other important managers and sends them on their way. * @author John Thompson, Greenstone Digital Library, University of Waikato * @version 2.3 */ public class GathererProg { /** The entry point into the Gatherer. Parses arguments. * @param args A collection of arguments that may include: initial screen size, dictionary, path to the GSDL etc. * @see java.io.File * @see java.io.FileInputStream * @see java.lang.Exception * @see java.util.Properties * @see org.greenstone.gatherer.Dictionary * @see org.greenstone.gatherer.Gatherer */ static public void main(String[] args) { // A serious hack, but its good enough to stop crappy 'Could not // lock user prefs' error messages. Thanks to Walter Schatz from // the java forums. System.setProperty("java.util.prefs.syncInterval","2000000"); // => results in One message every 600 hours! // Ensure platform specific LAF try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception exception) { exception.printStackTrace(); } // Ensure the GLI user directory exists File gli_user_directory = Utility.getGLIUserFolder(); if (!gli_user_directory.exists()) { gli_user_directory.mkdirs(); } Gatherer gatherer = new Gatherer(); Dimension size = new Dimension(800, 540); GetOpt go = new GetOpt(args); if (go.feedback_enabled) { // If feedback is enabled, set up the recorder dialog. // Use the default locale for now - this will be changed by the // Gatherer run method Locale currLocale = Locale.getDefault(); ActionRecorderDialog dlg = new ActionRecorderDialog (currLocale); gatherer.feedback_enabled = true; gatherer.feedback_dialog = dlg; } if (go.collect_directory_path != null) { // Use non-standard collect directory (for when running one GLI in a network environment) Gatherer.setCollectDirectoryPath(go.collect_directory_path); } GUIManager g_man = gatherer.init(size, go.gsdl_path, go.gsdl3_path, go.local_library_path, go.library_url_string, go.debug, go.perl_path, go.no_load, go.filename, go.site_name, go.servlet_path, go.wget_path); gatherer.run(size, g_man); // If there was an open collection last session, reopen it. if (Gatherer.open_collection_file_path != null) { Gatherer.c_man.loadCollection(Gatherer.open_collection_file_path); } } }