[7738] | 1 | /**
|
---|
| 2 | *#########################################################################
|
---|
| 3 | *
|
---|
| 4 | * A component of the Gatherer application, part of the Greenstone digital
|
---|
| 5 | * library suite from the New Zealand Digital Library Project at the
|
---|
| 6 | * University of Waikato, New Zealand.
|
---|
| 7 | *
|
---|
| 8 | * Author: John Thompson, Greenstone Digital Library, University of Waikato
|
---|
| 9 | *
|
---|
| 10 | * Copyright (C) 1999 New Zealand Digital Library Project
|
---|
| 11 | *
|
---|
| 12 | * This program is free software; you can redistribute it and/or modify
|
---|
| 13 | * it under the terms of the GNU General Public License as published by
|
---|
| 14 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 15 | * (at your option) any later version.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful,
|
---|
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 20 | * GNU General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, write to the Free Software
|
---|
| 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 25 | *########################################################################
|
---|
| 26 | */
|
---|
| 27 | package org.greenstone.gatherer;
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | import java.awt.*;
|
---|
[9092] | 31 | import java.io.*;
|
---|
[7738] | 32 | import java.util.*;
|
---|
| 33 | import javax.swing.*;
|
---|
| 34 | import org.greenstone.gatherer.feedback.ActionRecorderDialog;
|
---|
| 35 | import org.greenstone.gatherer.gui.GUIManager;
|
---|
[9092] | 36 | import org.greenstone.gatherer.util.Utility;
|
---|
[7738] | 37 |
|
---|
[9058] | 38 |
|
---|
[7738] | 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
|
---|
| 47 | */
|
---|
| 48 | public class GathererProg
|
---|
| 49 | {
|
---|
| 50 | /** The entry point into the Gatherer. Parses arguments.
|
---|
| 51 | * @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
|
---|
| 58 | */
|
---|
| 59 | static public void main(String[] args) {
|
---|
| 60 | // A serious hack, but its good enough to stop crappy 'Could not
|
---|
| 61 | // lock user prefs' error messages. Thanks to Walter Schatz from
|
---|
| 62 | // the java forums.
|
---|
| 63 | System.setProperty("java.util.prefs.syncInterval","2000000");
|
---|
| 64 | // => results in One message every 600 hours!
|
---|
| 65 |
|
---|
| 66 | // Ensure platform specific LAF
|
---|
| 67 | try {
|
---|
| 68 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
---|
| 69 | }
|
---|
[9092] | 70 | catch (Exception exception) {
|
---|
[7738] | 71 | exception.printStackTrace();
|
---|
| 72 | }
|
---|
[9092] | 73 |
|
---|
| 74 | // Ensure the GLI user directory exists
|
---|
| 75 | File gli_user_directory = Utility.getGLIUserFolder();
|
---|
| 76 | if (!gli_user_directory.exists()) {
|
---|
| 77 | gli_user_directory.mkdirs();
|
---|
| 78 | }
|
---|
| 79 |
|
---|
[7738] | 80 | Gatherer gatherer = new Gatherer();
|
---|
| 81 |
|
---|
| 82 | Dimension size = new Dimension(800, 540);
|
---|
| 83 |
|
---|
| 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 | }
|
---|
[9055] | 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 |
|
---|
[7738] | 101 | GUIManager g_man
|
---|
[8620] | 102 | = gatherer.init(size, go.gsdl_path, go.gsdl3_path, go.local_library_path,
|
---|
[8629] | 103 | go.library_url_string, go.debug, go.perl_path,
|
---|
[7738] | 104 | go.no_load, go.filename, go.site_name,
|
---|
[9217] | 105 | go.servlet_path, go.wget_path);
|
---|
[9058] | 106 | gatherer.run(size, g_man);
|
---|
[9039] | 107 |
|
---|
| 108 | // If there was an open collection last session, reopen it.
|
---|
| 109 | if (Gatherer.open_collection_file_path != null) {
|
---|
| 110 | Gatherer.c_man.loadCollection(Gatherer.open_collection_file_path);
|
---|
| 111 | }
|
---|
[7738] | 112 | }
|
---|
| 113 | }
|
---|