Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/org/dive4elements/artifactdatabase/rest/ArtifactOutResource.java @ 473:d0ac790a6c89 dive4elements-move
Moved directories to org.dive4elements
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 10:57:18 +0200 |
parents | artifact-database/src/main/java/de/intevation/artifactdatabase/rest/ArtifactOutResource.java@d9a99b28a847 |
children | 415df0fc4fa1 |
comparison
equal
deleted
inserted
replaced
472:783cc1b6b615 | 473:d0ac790a6c89 |
---|---|
1 /* | |
2 * Copyright (c) 2010, 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 | |
9 package de.intevation.artifactdatabase.rest; | |
10 | |
11 import de.intevation.artifacts.ArtifactDatabase; | |
12 import de.intevation.artifacts.ArtifactDatabaseException; | |
13 import de.intevation.artifacts.CallMeta; | |
14 | |
15 import org.apache.log4j.Logger; | |
16 | |
17 import org.restlet.Request; | |
18 | |
19 import org.w3c.dom.Document; | |
20 | |
21 /** | |
22 * Resource to serve the out()-outputs of artifacts. | |
23 * @author <a href="mailto:sascha.teichmann@intevation">Sascha L. Teichmann</a> | |
24 * @author <a href="mailto:ingo.weinzierl@intevation">Ingo Weinzierl</a> | |
25 */ | |
26 public class ArtifactOutResource | |
27 extends BaseOutResource | |
28 { | |
29 /** | |
30 * server URL where to find the resource. | |
31 */ | |
32 public static final String PATH = "/artifact/{uuid}/{type}"; | |
33 | |
34 private static Logger logger = Logger.getLogger(ArtifactOutResource.class); | |
35 | |
36 | |
37 /** | |
38 * Returns the identifier of the collection. | |
39 * | |
40 * @return the identifier of the collection. | |
41 */ | |
42 protected String getIdentifier() { | |
43 Request request = getRequest(); | |
44 | |
45 return (String) request.getAttributes().get("uuid"); | |
46 } | |
47 | |
48 | |
49 protected String getType() { | |
50 Request request = getRequest(); | |
51 | |
52 return (String) request.getAttributes().get("type"); | |
53 } | |
54 | |
55 | |
56 /** | |
57 * Call the ArtifactDatabase.out method. | |
58 */ | |
59 protected ArtifactDatabase.DeferredOutput doOut( | |
60 String identifier, | |
61 String type, | |
62 Document input, | |
63 ArtifactDatabase db, | |
64 CallMeta meta) | |
65 throws ArtifactDatabaseException | |
66 { | |
67 logger.debug("ArtifactOutResource.doOut"); | |
68 | |
69 return db.out(identifier, type, input, meta); | |
70 } | |
71 } | |
72 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |