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

Last change on this file since 8620 was 8620, checked in by mdewsnip, 19 years ago

Moved all the local library server code in a new LocalLibraryServer class. This will make things a lot cleaner and more easily allow a few bugs and features to be done.

  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 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.util.*;
32import javax.swing.*;
33import org.greenstone.gatherer.feedback.ActionRecorderDialog;
34import org.greenstone.gatherer.gui.GUIManager;
35import org.greenstone.gatherer.gui.Splash;
36
37/** Containing the main() method for the Gatherer, this class is the
38 * starting point for the rest of the application. Using GetOpt and
39 * GathererBase it first parses the command line arguments, preparing to
40 * update the configuration as required. Next it loads several important
41 * support classes such as the Configuration and Dictionary. Finally it
42 * creates the other important managers and sends them on their way.
43 * @author John Thompson, Greenstone Digital Library, University of Waikato
44 * @version 2.3
45 */
46
47// How to catch All Exceptions including those from the AWT Event thread.
48// Step 1: register a handler class in your main()
49//
50// System.setProperty("sun.awt.exception.handler", "YourHandler");
51//
52// Step 2: implement your handler class.
53//
54// public class YourHandler {
55// public void handle(Throwable thrown) {
56// eat the exception without dumping to the console.
57// }
58// }
59
60public class GathererProg
61{
62 /** The entry point into the Gatherer. Parses arguments.
63 * @param args A collection of arguments that may include: initial screen size, dictionary, path to the GSDL etc.
64 * @see java.io.File
65 * @see java.io.FileInputStream
66 * @see java.lang.Exception
67 * @see java.util.Properties
68 * @see org.greenstone.gatherer.Dictionary
69 * @see org.greenstone.gatherer.Gatherer
70 * @see org.greenstone.gatherer.Gatherer
71 */
72 static public void main(String[] args) {
73 // A serious hack, but its good enough to stop crappy 'Could not
74 // lock user prefs' error messages. Thanks to Walter Schatz from
75 // the java forums.
76 System.setProperty("java.util.prefs.syncInterval","2000000");
77 // => results in One message every 600 hours!
78
79 // Override the exception handler with a new one which we can
80 // easily quiet the exceptions from.
81 // System.setProperty("sun.awt.exception.handler", "GLIExceptionHandler");
82
83 // Ensure platform specific LAF
84 try {
85 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
86 }
87 catch(Exception exception) {
88 exception.printStackTrace();
89 }
90
91 Gatherer gatherer = new Gatherer();
92
93 Dimension size = new Dimension(800, 540);
94
95 GetOpt go = new GetOpt(args);
96
97 if (go.feedback_enabled) {
98 // If feedback is enabled, set up the recorder dialog.
99 // Use the default locale for now - this will be changed by the
100 // Gatherer run method
101 Locale currLocale = Locale.getDefault();
102 ActionRecorderDialog dlg = new ActionRecorderDialog (currLocale);
103 gatherer.feedback_enabled = true;
104 gatherer.feedback_dialog = dlg;
105 }
106
107 // Splash screen.
108 Splash splash = new Splash();
109 GUIManager g_man
110 = gatherer.init(size, go.gsdl_path, go.gsdl3_path, go.local_library_path,
111 go.exec_path, go.debug, go.perl_path,
112 go.no_load, go.filename, go.site_name,
113 go.servlet_path, go.mirroring_enabled,
114 go.wget_version_str, go.wget_path);
115 gatherer.run(size,splash,g_man);
116 }
117
118// static public class GLIExceptionHandler {
119// public void handle(Throwable thrown) {
120// if(always_show_exceptions || debug != null) {
121// thrown.printStackTrace();
122// }
123// }
124// }
125}
Note: See TracBrowser for help on using the repository browser.