view artifact-database/src/main/java/de/intevation/artifactdatabase/App.java @ 30:88972c6daa4f

Added a cleanup thread which periodically removes outdated artifacts from database and calls there endOfLife() method. artifacts/trunk@70 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 10 Sep 2009 23:16:18 +0000
parents 1259d192e3c3
children c2d53bd30ab8
line wrap: on
line source
package de.intevation.artifactdatabase;

import de.intevation.artifactdatabase.rest.Standalone;

import java.io.File;

import java.net.MalformedURLException;

import org.apache.log4j.PropertyConfigurator;

/**
 * Starting point of the artifact database.
 *
 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de)
 */
public class App
{
    public static final String LOG4J_PROPERTIES =
        "log4j.properties";

    public static final void configureLogging() {
        File configDir = Config.getConfigDirectory();
        File propFile = new File(configDir, LOG4J_PROPERTIES);

        if (propFile.isFile() && propFile.canRead()) {
            try {
                PropertyConfigurator.configure(propFile.toURI().toURL());
            }
            catch (MalformedURLException mue) {
                mue.printStackTrace(System.err);
            }
        }
    }

    public static void main(String[] args) {

        configureLogging();

        FactoryBootstrap bootstrap = new FactoryBootstrap();

        bootstrap.boot();

        DatabaseCleaner cleaner = new DatabaseCleaner(
            bootstrap.getContext());

        cleaner.start();

        Backend backend = new Backend(cleaner);

        ArtifactDatabaseImpl db = new ArtifactDatabaseImpl(
            bootstrap, backend);

        Standalone.startAsServer(db);
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org