source: trunk/gsdl3/src/java/org/greenstone/server/Server.java@ 13229

Last change on this file since 13229 was 13229, checked in by kjdon, 17 years ago

initial implementation of local library server equivalent - little standalone java gui program that has a few settings and launches tomcat and a browser. Implemented initially by Quan, modified by Katherine

  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1
2package org.greenstone.server;
3
4import java.awt.Dimension;
5import java.awt.Toolkit;
6import java.io.File;
7import java.io.InputStream;
8import java.util.Properties;
9
10import org.greenstone.gsdl3.util.Dictionary;
11
12//import org.greenstone.gsdl3.util.GlobalProperties;
13
14public class Server
15{
16 public static Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
17 public static File build_properties_file;
18 public static String images_path; // should be in classpath??
19 public static Properties build_properties;
20 public static Dictionary dictionary;
21
22 public Server(String gsdl3_src_home)
23 {
24 //this.gsdl3_home = gsdl3_home;
25 //this.gsdl3_src_home = gsdl3_src_home;
26
27 //this.global_properties=gsdl3_home+File.separatorChar+"WEB-INF"+File.separatorChar+"classes"+File.separatorChar+"global.properties";
28 String build_properties_path=gsdl3_src_home+File.separatorChar+"build.properties";
29 this.build_properties_file = new File(build_properties_path);
30 if (!this.build_properties_file.exists()) {
31 System.err.println("Can't find build.properties file "+build_properties_path);
32 System.exit(1);
33 }
34 build_properties = new Properties();
35 reloadBuildProperties();
36 this.images_path = gsdl3_src_home+File.separatorChar+"resources"+File.separatorChar+"images"+File.separatorChar;
37
38 // make it dynamic language
39 this.dictionary = new Dictionary("server", "en", this.getClass().getClassLoader());
40 ServerControl serverControl = new ServerControl();
41 }
42
43 public static void reloadBuildProperties() {
44 try {
45 InputStream in = Class.forName("org.greenstone.server.Server").getClassLoader().getResourceAsStream("build.properties");
46 if (in != null) {
47 System.err.println("loading build properties");
48 build_properties.load(in);
49 in.close();
50 } else {
51 System.err.println("couldn't load build properties!");
52 }
53 } catch (Exception e) {
54 System.err.println("Exception trying to reload build.properties: "+e);
55 }
56
57
58 }
59 public static void main (String[] args){
60 System.out.println(args[0]);
61 if (args.length != 1) {
62 System.err.println("Usage: java org.greenstone.server.ServerMain <gsdl3 src home> ");
63 System.exit(1);
64 }
65
66 File gsdl3_src_dir = new File(args[0]);
67 if (!gsdl3_src_dir.isDirectory()) {
68 System.err.println("Usage: java org.greenstone.server.ServerMain <gsdl3 src home> ");
69 System.err.println("src directory does not exist!");
70 System.exit(1);
71 }
72 Server server = new Server(args[0]);
73 }
74}
Note: See TracBrowser for help on using the repository browser.