source: trunk/gli/src/org/greenstone/gatherer/GathererProg.java@ 9877

Last change on this file since 9877 was 9877, checked in by davidb, 19 years ago

GLIUserFolder can now take a parameter to override where on the file system
the GLI folder is located. Used in Applet version of GLI. For standalone
GLI explicitly pass in null to it uses default behaviour.

  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
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 */
27package org.greenstone.gatherer;
28
29
30import java.awt.*;
31import java.io.*;
32import java.util.*;
33import javax.swing.*;
34import org.greenstone.gatherer.feedback.ActionRecorderDialog;
35import org.greenstone.gatherer.gui.GUIManager;
36import org.greenstone.gatherer.util.Utility;
37
38
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 */
48public 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 }
70 catch (Exception exception) {
71 exception.printStackTrace();
72 }
73
74 // 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();
78 }
79
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 }
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.
109 if (Gatherer.open_collection_file_path != null) {
110 Gatherer.c_man.loadCollection(Gatherer.open_collection_file_path);
111 }
112 }
113}
Note: See TracBrowser for help on using the repository browser.