comparison artifact-database/src/main/java/de/intevation/artifactdatabase/App.java @ 19:1259d192e3c3

* New configuration based on config directory * Artifact database launches REST web server at startup. artifacts/trunk@43 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 09 Sep 2009 07:55:44 +0000
parents 0d6badf6af42
children 88972c6daa4f
comparison
equal deleted inserted replaced
18:63a8aa276693 19:1259d192e3c3
1 package de.intevation.artifactdatabase; 1 package de.intevation.artifactdatabase;
2
3 import de.intevation.artifactdatabase.rest.Standalone;
4
5 import java.io.File;
6
7 import java.net.MalformedURLException;
8
9 import org.apache.log4j.PropertyConfigurator;
2 10
3 /** 11 /**
4 * Starting point of the artifact database. 12 * Starting point of the artifact database.
5 * 13 *
6 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) 14 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de)
7 */ 15 */
8 public class App 16 public class App
9 { 17 {
18 public static final String LOG4J_PROPERTIES =
19 "log4j.properties";
20
21 public static final void configureLogging() {
22 File configDir = Config.getConfigDirectory();
23 File propFile = new File(configDir, LOG4J_PROPERTIES);
24
25 if (propFile.isFile() && propFile.canRead()) {
26 try {
27 PropertyConfigurator.configure(propFile.toURI().toURL());
28 }
29 catch (MalformedURLException mue) {
30 mue.printStackTrace(System.err);
31 }
32 }
33 }
34
10 public static void main(String[] args) { 35 public static void main(String[] args) {
36
37 configureLogging();
38
11 FactoryBootstrap bootstrap = new FactoryBootstrap(); 39 FactoryBootstrap bootstrap = new FactoryBootstrap();
12 40
13 bootstrap.boot(); 41 bootstrap.boot();
14 42
15 Backend backend = new Backend(); 43 Backend backend = new Backend();
16 44
17 ArtifactDatabaseImpl db = new ArtifactDatabaseImpl( 45 ArtifactDatabaseImpl db = new ArtifactDatabaseImpl(
18 bootstrap, backend); 46 bootstrap, backend);
47
48 Standalone.startAsServer(db);
19 } 49 }
20 } 50 }
21 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: 51 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org