Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/de/intevation/artifactdatabase/rest/CollectionOutResource.java @ 143:7e20702a90ed
Implemented an abstract class for the output of artifacts and collections. Added a CollectionOutResource.
artifacts/trunk@1368 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 02 Mar 2011 16:02:47 +0000 |
parents | |
children | d9a99b28a847 |
comparison
equal
deleted
inserted
replaced
142:e986e32bc7d4 | 143:7e20702a90ed |
---|---|
1 /* | |
2 * Copyright (c) 2011 by Intevation GmbH | |
3 * | |
4 * This program is free software under the LGPL (>=v2.1) | |
5 * Read the file LGPL.txt coming with the software for details | |
6 * or visit http://www.gnu.org/licenses/ if it does not exist. | |
7 */ | |
8 package de.intevation.artifactdatabase.rest; | |
9 | |
10 import de.intevation.artifacts.ArtifactDatabase; | |
11 import de.intevation.artifacts.ArtifactDatabaseException; | |
12 import de.intevation.artifacts.CallMeta; | |
13 | |
14 import org.apache.log4j.Logger; | |
15 | |
16 import org.restlet.Request; | |
17 | |
18 import org.w3c.dom.Document; | |
19 | |
20 | |
21 /** | |
22 * Resource to serve the out()-outputs of collections. | |
23 * | |
24 * @author <a href="mailto:ingo.weinzierl@intevation">Ingo Weinzierl</a> | |
25 */ | |
26 public class CollectionOutResource | |
27 extends BaseOutResource | |
28 { | |
29 /** The logger used in this class.*/ | |
30 private static Logger logger = Logger.getLogger(CollectionOutResource.class); | |
31 | |
32 /** server URL where to find the resource.*/ | |
33 public static final String PATH = "/collection/{uuid}/{type}"; | |
34 | |
35 | |
36 /** | |
37 * Returns the identifier of the collection. | |
38 * | |
39 * @return the identifier of the collection. | |
40 */ | |
41 protected String getIdentifier() { | |
42 Request request = getRequest(); | |
43 | |
44 return (String) request.getAttributes().get("uuid"); | |
45 } | |
46 | |
47 | |
48 /** | |
49 * Call the ArtifactDatabase.outCollection method. | |
50 */ | |
51 protected ArtifactDatabase.DeferredOutput doOut( | |
52 String identifier, | |
53 Document input, | |
54 ArtifactDatabase db, | |
55 CallMeta meta) | |
56 throws ArtifactDatabaseException | |
57 { | |
58 logger.debug("CollectionOutResource.doOut"); | |
59 | |
60 return db.outCollection(identifier, input, meta); | |
61 } | |
62 } | |
63 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |