annotate artifact-database/src/main/java/de/intevation/artifactdatabase/rest/OutRepresentation.java @ 88:69c84cf7c5d7

Added javadoc to the REST package of the artifact database (complete). artifacts/trunk@840 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 26 Mar 2010 15:05:11 +0000
parents 48d1a9a082c2
children e27cf9c84eb8
rev   line source
29
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.artifactdatabase.rest;
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import org.restlet.representation.OutputRepresentation;
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 import org.restlet.data.MediaType;
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
7 import de.intevation.artifacts.ArtifactDatabase.DeferredOutput;
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
8
29
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 import java.io.IOException;
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
10 import java.io.OutputStream;
29
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 /**
88
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
13 * Special representation to serve the out()-outputs
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
14 * via DeferredOutput efficently .
77
48d1a9a082c2 Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
15 * @author <a href="mailto:sascha.teichmann@intevation">Sascha L. Teichmann</a>
29
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 */
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 public class OutRepresentation
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 extends OutputRepresentation
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 {
88
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
20 /**
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
21 * The deferred output fetched from ArtifactDatabase.out().
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
22 */
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
23 protected DeferredOutput out;
29
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24
88
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
25 /**
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
26 * Constructor to create representation with a given MIME type and
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
27 * a deferred output.
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
28 * @param mediaType The MIME type of this representation.
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
29 * @param out The deferred output from the ArtifactDatabase.out() call.
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
30 */
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
31 public OutRepresentation(MediaType mediaType, DeferredOutput out) {
29
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 super(mediaType);
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
33 this.out = out;
29
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 }
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35
88
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
36 /**
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
37 * Overwrites the write(OutputStream) of OutRepresentation to serve
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
38 * the data from the deferred output.
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
39 * @param output the stream where to write the data into.
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
40 * @throws IOException Thrown if an exception occurred while writing
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
41 * the data to the output stream.
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
42 */
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
43 public void write(OutputStream output) throws IOException {
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
44 out.write(output);
29
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45 }
22b03d5c84c5 Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46 }
88
69c84cf7c5d7 Added javadoc to the REST package of the artifact database (complete).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
47 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org