Changeset 18673 for greenstone3
- Timestamp:
- 2009-03-13T13:27:00+13:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
greenstone3/trunk/src/java/org/greenstone/server/BaseServer.java
r18558 r18673 4 4 import java.awt.Dimension; 5 5 import java.awt.Toolkit; 6 import java.io.BufferedReader; 6 7 import java.io.File; 7 import java.io.InputStream; 8 import java.io.FileInputStream; 9 import java.io.InputStreamReader; 8 10 import java.util.Properties; 9 import java.io.BufferedReader;10 import java.io.InputStream;11 import java.io.InputStreamReader;12 11 13 12 import org.apache.log4j.*; 14 13 15 14 import org.greenstone.gsdl3.util.Dictionary; 16 import org.greenstone.gsdl3.util.GlobalProperties;17 15 18 16 public abstract class BaseServer … … 23 21 static protected String STOP_CMD; 24 22 25 protected static final int SERVER_STARTED = 0; 26 protected static final int SERVER_START_FAILED = 1; 27 protected static final int BROWSER_LAUNCHED = 2; 28 protected static final int BROWSER_LAUNCH_FAILED = 3; 29 23 static protected final int SERVER_STARTED = 0; 24 static protected final int SERVER_START_FAILED = 1; 25 static protected final int BROWSER_LAUNCHED = 2; 26 static protected final int BROWSER_LAUNCH_FAILED = 3; 27 28 static protected Properties build_properties; 29 static protected Logger logger_; 30 31 static public File build_properties_file; 32 static public Dictionary dictionary; 33 static public BaseProperty Property; 34 30 35 protected int server_state_ = -1; 31 32 36 protected boolean configure_required_ = true; 33 34 public static File build_properties_file; 35 protected static Properties build_properties; 36 public static Dictionary dictionary; 37 38 public static BaseProperty Property; 39 37 protected String gsdl_home; 40 38 protected BaseServerControl server_control_; 41 42 static protected Logger logger_; 43 44 public BaseServer(String gsdl_home, String lang) 45 { 39 40 protected BaseServer(String gsdl_home, String lang, String build_properties_path) 41 { 42 this.gsdl_home = gsdl_home; 43 44 // make sure we write to the correct logs 45 initLogger(); 46 46 logger_ = Logger.getLogger(BaseServer.class.getName()); 47 47 48 String build_properties_path=gsdl_home+File.separatorChar+"build.properties";49 48 build_properties_file = new File(build_properties_path); 50 49 … … 60 59 61 60 } 61 62 // override to write to the correct logs 63 protected void initLogger() {} 62 64 63 65 public void autoStart() … … 103 105 recordError(CONFIGURE_CMD); 104 106 } 105 GlobalProperties.reload(); // properties file may have changed, so reload it107 reload(); 106 108 configure_required_ = false; 107 109 } … … 126 128 127 129 protected void recordError(String message){ 128 message = dictionary.get("ServerControl.Error",new String[]{message, GlobalProperties.getGSDL3Home()});130 message = dictionary.get("ServerControl.Error",new String[]{message,gsdl_home}); 129 131 server_control_.displayMessage(message); 130 132 logger_.error(dictionary.get("ServerControl.Failed",new String[]{message})); … … 133 135 134 136 protected void recordError(String message, Exception e){ 135 message = dictionary.get("ServerControl.Error",new String[]{message, GlobalProperties.getGSDL3Home()});137 message = dictionary.get("ServerControl.Error",new String[]{message,gsdl_home}); 136 138 server_control_.displayMessage(message); 137 139 logger_.error(dictionary.get("ServerControl.Failed",new String[]{message}),e); … … 145 147 146 148 149 public abstract String getBrowserURL(); 150 public abstract void reload(); // reload properties, since they may have changed 151 147 152 public void launchBrowser() { 148 153 server_state_ = -1; … … 150 155 String message = dictionary.get("ServerControl.LaunchingBrowser"); 151 156 server_control_.displayMessage(message); 152 String url = GlobalProperties.getGSDL3WebAddress()+ build_properties.getProperty(BaseServer.Property.DEFAULT_SERVLET); 157 String url = getBrowserURL(); 158 //recordError("**** browserURL: " + url); 153 159 BrowserLauncher launcher = new BrowserLauncher(build_properties.getProperty(BaseServer.Property.BROWSER_PATH),url); 154 160 logger_.info(message); … … 208 214 public void reloadBuildProperties() { 209 215 try { 210 InputStream in = this.getClass().getClassLoader().getResourceAsStream("build.properties"); 211 216 //InputStream in = this.getClass().getClassLoader().getResourceAsStream("build.properties"); 217 FileInputStream in = new FileInputStream(build_properties_file); 218 212 219 if (in != null) { 213 220 logger_.info("loading build properties");
Note:
See TracChangeset
for help on using the changeset viewer.