View Javadoc

1   package org.minetti.astrodevice.server.core;
2   
3   import org.apache.log4j.Logger;
4   import org.minetti.astrodevice.server.core.config.xml.XmlServerConfiguration;
5   import org.minetti.astrodevice.server.core.module.ModuleManager;
6   
7   /**
8    * Class responsible of server startup.
9    * @author Jean-Philippe MINETTI
10   */
11  public final class Startup {
12  
13  	/**
14  	 * Logger.
15  	 */
16  	private static final Logger LOGGER = Logger.getLogger(Startup.class);
17  
18  	/**
19  	 * Main function.
20  	 * @param args Arguments on the command line.
21  	 */
22  	public static void main (final String[] args) {
23  		try {
24  			About.getInstance().load();
25  			Startup.LOGGER.info(About.getInstance() + " starting");
26  			XmlServerConfiguration.getInstance().load();
27  			ServerClassLoader.initialize();
28  			Runtime.getRuntime().addShutdownHook(new Thread(new Shutdown(), "shutdown"));
29  			ModuleManager.start();
30  
31  			// TODO Auto-generated method stub
32  
33  			Startup.LOGGER.info(About.getInstance() + " started");
34  		}
35  		catch (final ExceptionInInitializerError e) {
36  			Startup.LOGGER.fatal(e.getCause() != null ? e.getCause() : e);
37  			System.exit(-1);
38  		}
39  		catch (final Throwable e) {
40  			Startup.LOGGER.fatal(About.getInstance() + " could not start", e);
41  			System.exit(-1);
42  		}
43  	}
44  
45  }