ingo@100: /*
ingo@143: * Copyright (c) 2010, 2011 by Intevation GmbH
ingo@100: *
ingo@100: * This program is free software under the LGPL (>=v2.1)
ingo@100: * Read the file LGPL.txt coming with the software for details
ingo@100: * or visit http://www.gnu.org/licenses/ if it does not exist.
ingo@100: */
ingo@100:
sascha@29: package de.intevation.artifactdatabase.rest;
sascha@29:
sascha@93: import de.intevation.artifacts.ArtifactDatabase;
sascha@93: import de.intevation.artifacts.ArtifactDatabaseException;
ingo@143: import de.intevation.artifacts.CallMeta;
sascha@93:
sascha@29: import org.apache.log4j.Logger;
sascha@29:
ingo@101: import org.restlet.Request;
sascha@29:
sascha@29: import org.w3c.dom.Document;
sascha@29:
sascha@29: /**
sascha@88: * Resource to serve the out()-outputs of artifacts.
sascha@77: * @author Sascha L. Teichmann
ingo@143: * @author Ingo Weinzierl
sascha@29: */
sascha@29: public class ArtifactOutResource
ingo@143: extends BaseOutResource
sascha@29: {
sascha@88: /**
sascha@88: * server URL where to find the resource.
sascha@88: */
sascha@29: public static final String PATH = "/artifact/{uuid}/{type}";
sascha@29:
sascha@29: private static Logger logger = Logger.getLogger(ArtifactOutResource.class);
sascha@29:
sascha@29:
ingo@143: /**
ingo@143: * Returns the identifier of the collection.
ingo@143: *
ingo@143: * @return the identifier of the collection.
ingo@143: */
ingo@143: protected String getIdentifier() {
sascha@40: Request request = getRequest();
sascha@40:
ingo@143: return (String) request.getAttributes().get("uuid");
ingo@143: }
sascha@29:
sascha@29:
ingo@143: /**
ingo@143: * Call the ArtifactDatabase.out method.
ingo@143: */
ingo@143: protected ArtifactDatabase.DeferredOutput doOut(
ingo@143: String identifier,
ingo@143: Document input,
ingo@143: ArtifactDatabase db,
ingo@143: CallMeta meta)
ingo@143: throws ArtifactDatabaseException
ingo@143: {
ingo@143: logger.debug("ArtifactOutResource.doOut");
ingo@143:
ingo@143: return db.out(identifier, input, meta);
sascha@29: }
sascha@29: }
sascha@88: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :