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