sascha@19: package de.intevation.artifactdatabase.rest; sascha@19: sascha@19: import de.intevation.artifacts.ArtifactDatabase; sascha@19: sascha@20: import java.util.concurrent.ConcurrentMap; sascha@20: sascha@19: import org.restlet.Application; sascha@19: import org.restlet.Restlet; sascha@20: import org.restlet.Context; sascha@19: sascha@19: import org.restlet.routing.Router; sascha@19: sascha@19: /** sascha@19: * sascha@19: * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) sascha@19: */ sascha@19: public class RestApp sascha@19: extends Application sascha@19: { sascha@19: protected ArtifactDatabase database; sascha@19: sascha@19: public RestApp() { sascha@19: } sascha@19: sascha@19: public RestApp(ArtifactDatabase database) { sascha@19: this.database = database; sascha@19: } sascha@19: sascha@19: public Restlet createRoot() { sascha@19: sascha@20: Context context = getContext(); sascha@19: sascha@20: ConcurrentMap map = context.getAttributes(); sascha@20: map.put("database", database); sascha@20: sascha@20: Router router = new Router(context); sascha@20: sascha@29: router.attach(FactoriesResource.PATH, FactoriesResource.class); sascha@29: router.attach(CreateResource.PATH, CreateResource.class); sascha@29: router.attach(ArtifactResource.PATH, ArtifactResource.class); sascha@29: router.attach(ArtifactOutResource.PATH, ArtifactOutResource.class); sascha@19: sascha@19: return router; sascha@19: } sascha@19: } sascha@19: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: