Ignore:
Timestamp:
2005-07-13T14:10:18+12:00 (19 years ago)
Author:
mdewsnip
Message:

Moved a lot of the duplicated code out of GathererProg and GathererApplet and into Gatherer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/GathererProg.java

    r9877 r10242  
    66 * University of Waikato, New Zealand.
    77 *
    8  * Author: John Thompson, Greenstone Digital Library, University of Waikato
     8 * Author: John Thompson, NZDL Project, University of Waikato
    99 *
    10  * Copyright (C) 1999 New Zealand Digital Library Project
     10 * Copyright (C) 2005 New Zealand Digital Library Project
    1111 *
    1212 * This program is free software; you can redistribute it and/or modify
     
    2828
    2929
    30 import java.awt.*;
    3130import java.io.*;
    32 import java.util.*;
    3331import javax.swing.*;
    34 import org.greenstone.gatherer.feedback.ActionRecorderDialog;
    35 import org.greenstone.gatherer.gui.GUIManager;
    3632import org.greenstone.gatherer.util.Utility;
    3733
    3834
    39 /** Containing the main() method for the Gatherer, this class is the
    40  * starting point for the rest of the application. Using GetOpt and
    41  * GathererBase it first parses the command line arguments, preparing to
    42  * update the configuration as required. Next it loads several important
    43  * support classes such as the Configuration and Dictionary. Finally it
    44  * creates the other important managers and sends them on their way.
    45  * @author John Thompson, Greenstone Digital Library, University of Waikato
    46  * @version 2.3
     35/**
     36 * Containing the main() method, this class is the entry point for the
     37 * stand-alone (non-Applet) GLI. The main point of this class is to set
     38 * some stand-alone specific properties and then create an instance of the
     39 * Gatherer class.
     40 * @author John Thompson, NZDL Project, University of Waikato
    4741 */
    4842public class GathererProg
    4943{
    50     /** The entry point into the Gatherer. Parses arguments.
     44    /** The entry point into the stand-alone GLI.
    5145     * @param args A collection of arguments that may include: initial screen size, dictionary, path to the GSDL etc.
    52      * @see java.io.File
    53      * @see java.io.FileInputStream
    54      * @see java.lang.Exception
    55      * @see java.util.Properties
    56      * @see org.greenstone.gatherer.Dictionary
    57      * @see org.greenstone.gatherer.Gatherer
    5846     */
    59     static public void main(String[] args) {
     47    static public void main(String[] args)
     48    {
    6049    // A serious hack, but its good enough to stop crappy 'Could not
    6150    // lock user prefs' error messages.  Thanks to Walter Schatz from
    6251    // the java forums.
    6352    System.setProperty("java.util.prefs.syncInterval","2000000");
    64     // => results in One message every 600 hours!
     53    // => results in one message every 600 hours!
    6554
    6655    // Ensure platform specific LAF
     
    7362
    7463    // Ensure the GLI user directory exists
    75     File gli_user_directory = Utility.setGLIUserFolder(null); // # defaults to user's home area
    76     if (!gli_user_directory.exists()) {
    77         gli_user_directory.mkdirs();
     64        File gli_user_directory = Utility.setGLIUserFolder(null);  // Defaults to user's home area
     65    if (!gli_user_directory.exists() && !gli_user_directory.mkdirs()) {
     66        System.err.println("Error: Unable to make directory: " + gli_user_directory.toString());
    7867    }
    7968
    80     Gatherer gatherer = new Gatherer();
     69    // Create an instance of the Gatherer class, which will parse the args and prepare the rest of the GLI
     70    Gatherer gatherer = new Gatherer(args);
    8171
    82     Dimension size = new Dimension(800, 540);
     72    // Display the GUI immediately
     73    gatherer.openGUI();
    8374
    84     GetOpt go = new GetOpt(args);
    85 
    86     if (go.feedback_enabled) {
    87         // If feedback is enabled, set up the recorder dialog.
    88         // Use the default locale for now - this will be changed by the
    89         // Gatherer run method
    90         Locale currLocale = Locale.getDefault();
    91         ActionRecorderDialog dlg = new ActionRecorderDialog (currLocale);
    92         gatherer.feedback_enabled = true;
    93         gatherer.feedback_dialog = dlg;
    94     }
    95 
    96     if (go.collect_directory_path != null) {
    97         // Use non-standard collect directory (for when running one GLI in a network environment)
    98         Gatherer.setCollectDirectoryPath(go.collect_directory_path);
    99     }
    100 
    101     GUIManager g_man
    102         = gatherer.init(size, go.gsdl_path, go.gsdl3_path, go.local_library_path,
    103                  go.library_url_string, go.debug, go.perl_path,
    104                  go.no_load, go.filename, go.site_name,
    105                  go.servlet_path, go.wget_path);
    106     gatherer.run(size, g_man);
    107 
    108     // If there was an open collection last session, reopen it.
     75    // If there was an open collection last session, reopen it
    10976    if (Gatherer.open_collection_file_path != null) {
    11077        Gatherer.c_man.loadCollection(Gatherer.open_collection_file_path);
Note: See TracChangeset for help on using the changeset viewer.