view artifact-database/src/main/java/de/intevation/artifactdatabase/rest/RestApp.java @ 83:8c4638abd518

Installed a SLF4J bridge to route incoming jul logs (used by restlet) to log4j. artifacts/trunk@820 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 22 Mar 2010 15:54:06 +0000
parents 8447467cef86
children 69c84cf7c5d7
line wrap: on
line source
package de.intevation.artifactdatabase.rest;

import de.intevation.artifacts.ArtifactDatabase;

import java.util.concurrent.ConcurrentMap;

import org.restlet.Application;
import org.restlet.Context;
import org.restlet.Restlet;

import org.restlet.routing.Router;

/**
 *
 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
 */
public class RestApp
extends      Application
{
    protected ArtifactDatabase database;

    public RestApp() {
    }

    public RestApp(ArtifactDatabase database) {
        this.database = database;
    }

    public Restlet createRoot() {

        Context context = getContext();

        ConcurrentMap map = context.getAttributes();
        map.put("database", database);

        Router router = new Router(context);

        router.attach(ServicesResource.PATH,    ServicesResource.class);
        router.attach(ServiceResource.PATH,     ServiceResource.class);
        router.attach(FactoriesResource.PATH,   FactoriesResource.class);
        router.attach(CreateResource.PATH,      CreateResource.class);
        router.attach(ArtifactResource.PATH,    ArtifactResource.class);
        router.attach(ArtifactOutResource.PATH, ArtifactOutResource.class);
        router.attach(ExportResource.PATH,      ExportResource.class);
        router.attach(ImportResource.PATH,      ImportResource.class);

        return router;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org