1 | /**
|
---|
2 | *#########################################################################
|
---|
3 | *
|
---|
4 | * A component of the Greenstone Administrator Interface, 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: Chi-Yu Huang, 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 |
|
---|
28 | package org.greenstone.admin;
|
---|
29 |
|
---|
30 | import java.awt.*;
|
---|
31 | import java.awt.event.*;
|
---|
32 | import java.io.*;
|
---|
33 | import java.lang.*;
|
---|
34 | import java.net.*;
|
---|
35 | import java.util.*;
|
---|
36 | import javax.swing.*;
|
---|
37 | import javax.swing.plaf.*;
|
---|
38 | import javax.swing.text.*;
|
---|
39 |
|
---|
40 | import org.greenstone.gsdl3.util.Dictionary;
|
---|
41 | import org.greenstone.admin.gui.SetServerPane;
|
---|
42 |
|
---|
43 | /** Containing the top-level "core" for the GAI(Greenstone Administrator
|
---|
44 | * Interface) this class is the common core for the GAI application and
|
---|
45 | * applet. It first parses the command line arguments, preparing to update
|
---|
46 | * the configuration as required. Next it loads several important support
|
---|
47 | * classes such as the Configuration and Dictionary. Finally it creates the
|
---|
48 | * other important managers and sends them on their way.
|
---|
49 | * @author Chi-Yu Huang, Greenstone Digital Library, University of Waikato
|
---|
50 | * @version ###
|
---|
51 | */
|
---|
52 | public class GAI
|
---|
53 | {
|
---|
54 | public static Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
|
---|
55 | public static String gsdl3_src_home;
|
---|
56 | public static String gsdl3_web_home;
|
---|
57 | public static String tomcat_home;
|
---|
58 |
|
---|
59 | public static File build_properties_file;
|
---|
60 |
|
---|
61 | public static String images_path;
|
---|
62 | /** A public reference to the GAIManager. */
|
---|
63 | static public GAIManager ga_man;
|
---|
64 |
|
---|
65 | /** a public reference to the Dictionary */
|
---|
66 | static public Dictionary dictionary = null;
|
---|
67 |
|
---|
68 | public GAI(String gsdl3_src_home, String gsdl3_web_home)
|
---|
69 | {
|
---|
70 | this.gsdl3_src_home = gsdl3_src_home;
|
---|
71 | this.gsdl3_web_home = gsdl3_web_home;
|
---|
72 |
|
---|
73 | // set up the Configuration
|
---|
74 | new Configuration();
|
---|
75 |
|
---|
76 | // Read Dictionary
|
---|
77 | this.dictionary = new Dictionary("gai", Configuration.getLocale("general.locale"));
|
---|
78 | this.build_properties_file = new File(this.gsdl3_src_home, "build.properties");
|
---|
79 | // this may change if using preinstalled tomcat
|
---|
80 | this.tomcat_home = this.gsdl3_src_home+File.separatorChar+"packages"+File.separatorChar+"tomcat";
|
---|
81 |
|
---|
82 | // should come from classpath ??
|
---|
83 | this.images_path = this.gsdl3_src_home+File.separatorChar+"resources"+File.separatorChar+"images"+File.separatorChar;
|
---|
84 | // start the GAIManager
|
---|
85 | ga_man = new GAIManager(screen_size);
|
---|
86 | ga_man.display();
|
---|
87 |
|
---|
88 | }
|
---|
89 |
|
---|
90 | public static void main (String[] args){
|
---|
91 | // A serious hack, but its good enough to stop crappy 'Could not
|
---|
92 | // lock user prefs' error messages. Thanks to Walter Schatz from
|
---|
93 | // the java forums.
|
---|
94 | System.setProperty("java.util.prefs.syncInterval","2000000");
|
---|
95 |
|
---|
96 | if (args.length != 2) {
|
---|
97 | System.err.println("Usage: java org.greenstone.admin.GAI <gsdl3 src home> <gsdl3 web home>");
|
---|
98 | System.exit(1);
|
---|
99 | }
|
---|
100 |
|
---|
101 | File gsdl3_src_dir = new File(args[0]);
|
---|
102 | File gsdl3_web_dir = new File(args[1]);
|
---|
103 | if (!gsdl3_src_dir.isDirectory() || !gsdl3_web_dir.isDirectory()) {
|
---|
104 | System.err.println("Usage: java org.greenstone.admin.GAI <gsdl3 src home> <gsdl3 web home>");
|
---|
105 | System.err.println("src or web directory does not exist!");
|
---|
106 | System.exit(1);
|
---|
107 | }
|
---|
108 |
|
---|
109 | GAI gai = new GAI(args[0], args[1]);
|
---|
110 |
|
---|
111 | }
|
---|
112 |
|
---|
113 | }
|
---|
114 |
|
---|
115 |
|
---|