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

Last change on this file since 7738 was 7738, checked in by davidb, 20 years ago

Restructuring of files to prepare the way for an applet version of GLI

  • Property svn:keywords set to Author Date Id Revision
File size: 6.0 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/**************************************************************************************
30 * Written: ??/??/02
31 * Revised: ??/??/02 - Commented
32 * ??/??/03 - Added support for local library server
33 * 20/07/03 - Rewrote argument parsing so that spaces no longer cause GLI to die. Also added time out when starting local library.
34 **************************************************************************************/
35
36//import com.l2fprod.gui.*;
37//import com.l2fprod.gui.plaf.skin.*;
38//import com.l2fprod.util.*;
39import java.awt.*;
40import java.awt.event.*;
41import java.io.*;
42import java.lang.*;
43import java.net.*;
44import java.util.*;
45import javax.swing.*;
46import javax.swing.plaf.*;
47import javax.swing.text.*;
48import org.greenstone.gatherer.Configuration;
49import org.greenstone.gatherer.GAuthenticator;
50import org.greenstone.gatherer.cdm.CommandTokenizer;
51import org.greenstone.gatherer.collection.CollectionManager;
52import org.greenstone.gatherer.feedback.ActionRecorderDialog;
53import org.greenstone.gatherer.file.FileManager;
54import org.greenstone.gatherer.file.FileAssociationManager;
55import org.greenstone.gatherer.gui.Coloring;
56import org.greenstone.gatherer.gui.GUIManager;
57import org.greenstone.gatherer.gui.ModalDialog;
58import org.greenstone.gatherer.gui.Splash;
59import org.greenstone.gatherer.gui.URLField;
60import org.greenstone.gatherer.gui.WarningDialog;
61import org.greenstone.gatherer.msm.MDSTest;
62import org.greenstone.gatherer.msm.MetadataSetManager;
63import org.greenstone.gatherer.util.ArrayTools;
64import org.greenstone.gatherer.util.GSDLSiteConfig;
65import org.greenstone.gatherer.util.StaticStrings;
66import org.greenstone.gatherer.util.Utility;
67import sun.misc.*;
68
69/** Containing the main() method for the Gatherer, this class is the
70 * starting point for the rest of the application. Using GetOpt and
71 * GathererBase it first parses the command line arguments, preparing to
72 * update the configuration as required. Next it loads several important
73 * support classes such as the Configuration and Dictionary. Finally it
74 * creates the other important managers and sends them on their way.
75 * @author John Thompson, Greenstone Digital Library, University of Waikato
76 * @version 2.3
77 */
78
79// How to catch All Exceptions including those from the AWT Event thread.
80// Step 1: register a handler class in your main()
81//
82// System.setProperty("sun.awt.exception.handler", "YourHandler");
83//
84// Step 2: implement your handler class.
85//
86// public class YourHandler {
87// public void handle(Throwable thrown) {
88// eat the exception without dumping to the console.
89// }
90// }
91
92public class GathererProg
93{
94
95 /** The entry point into the Gatherer. Parses arguments.
96 * @param args A collection of arguments that may include: initial screen size, dictionary, path to the GSDL etc.
97 * @see java.io.File
98 * @see java.io.FileInputStream
99 * @see java.lang.Exception
100 * @see java.util.Properties
101 * @see org.greenstone.gatherer.Dictionary
102 * @see org.greenstone.gatherer.Gatherer
103 * @see org.greenstone.gatherer.Gatherer
104 * @see org.greenstone.gatherer.gui.Splash
105 * @see org.greenstone.gatherer.util.StaticStrings
106 */
107 static public void main(String[] args) {
108 // A serious hack, but its good enough to stop crappy 'Could not
109 // lock user prefs' error messages. Thanks to Walter Schatz from
110 // the java forums.
111 System.setProperty("java.util.prefs.syncInterval","2000000");
112 // => results in One message every 600 hours!
113
114 // Override the exception handler with a new one which we can
115 // easily quiet the exceptions from.
116 // System.setProperty("sun.awt.exception.handler", "GLIExceptionHandler");
117
118 // Ensure platform specific LAF
119 try {
120 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
121 }
122 catch(Exception exception) {
123 exception.printStackTrace();
124 }
125
126 Gatherer gatherer = new Gatherer();
127
128 Dimension size = new Dimension(800, 540);
129
130 GetOpt go = new GetOpt(args);
131
132 if (go.feedback_enabled) {
133 // If feedback is enabled, set up the recorder dialog.
134 // Use the default locale for now - this will be changed by the
135 // Gatherer run method
136 Locale currLocale = Locale.getDefault();
137 ActionRecorderDialog dlg = new ActionRecorderDialog (currLocale);
138 gatherer.feedback_enabled = true;
139 gatherer.feedback_dialog = dlg;
140 }
141
142 // Splash screen.
143 Splash splash = new Splash();
144 GUIManager g_man
145 = gatherer.init(size, go.gsdl_path, go.gsdl3_path,
146 go.exec_path, go.debug, go.perl_path,
147 go.no_load, go.filename, go.site_name,
148 go.servlet_path, go.mirroring_enabled,
149 go.wget_version_str, go.wget_path);
150 gatherer.run(size,splash,g_man);
151 }
152
153// static public class GLIExceptionHandler {
154// public void handle(Throwable thrown) {
155// if(always_show_exceptions || debug != null) {
156// thrown.printStackTrace();
157// }
158// }
159// }
160}
Note: See TracBrowser for help on using the repository browser.