view artifact-database/src/main/java/de/intevation/artifactdatabase/rest/RestApp.java @ 72:b01e47317a78

Added '/services' url to web server to list the available services in XML. artifacts/trunk@600 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 22 Jan 2010 11:40:26 +0000
parents 22b03d5c84c5
children d1b8c91b4506
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.Restlet;
import org.restlet.Context;

import org.restlet.routing.Router;

/**
 *
 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de)
 */
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(FactoriesResource.PATH,   FactoriesResource.class);
        router.attach(CreateResource.PATH,      CreateResource.class);
        router.attach(ArtifactResource.PATH,    ArtifactResource.class);
        router.attach(ArtifactOutResource.PATH, ArtifactOutResource.class);

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

http://dive4elements.wald.intevation.org