Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/de/intevation/artifactdatabase/rest/OutRepresentation.java @ 32:c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
artifacts/trunk@78 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 13 Sep 2009 14:50:53 +0000 |
parents | c4d85a8532d1 |
children | 48d1a9a082c2 |
comparison
equal
deleted
inserted
replaced
31:c4d85a8532d1 | 32:c2d53bd30ab8 |
---|---|
1 package de.intevation.artifactdatabase.rest; | 1 package de.intevation.artifactdatabase.rest; |
2 | 2 |
3 import org.restlet.representation.OutputRepresentation; | 3 import org.restlet.representation.OutputRepresentation; |
4 | 4 |
5 import de.intevation.artifacts.Artifact; | |
6 | |
7 import org.restlet.data.MediaType; | 5 import org.restlet.data.MediaType; |
8 | 6 |
7 import de.intevation.artifacts.ArtifactDatabase.DeferredOutput; | |
8 | |
9 import java.io.IOException; | |
9 import java.io.OutputStream; | 10 import java.io.OutputStream; |
10 import java.io.IOException; | |
11 | |
12 import org.w3c.dom.Document; | |
13 | 11 |
14 /** | 12 /** |
15 * @author Sascha L. Teichmann (sascha.teichmann@intevation) | 13 * @author Sascha L. Teichmann (sascha.teichmann@intevation) |
16 */ | 14 */ |
17 public class OutRepresentation | 15 public class OutRepresentation |
18 extends OutputRepresentation | 16 extends OutputRepresentation |
19 { | 17 { |
20 protected Artifact artifact; | 18 protected DeferredOutput out; |
21 protected Document document; | |
22 protected Object context; | |
23 | 19 |
24 public OutRepresentation( | 20 public OutRepresentation(MediaType mediaType, DeferredOutput out) { |
25 MediaType mediaType, | |
26 Artifact artifact, | |
27 Document document, | |
28 Object context | |
29 ) { | |
30 super(mediaType); | 21 super(mediaType); |
31 this.artifact = artifact; | 22 this.out = out; |
32 this.document = document; | |
33 this.context = context; | |
34 } | 23 } |
35 | 24 |
36 public void write(OutputStream outputStream) throws IOException { | 25 public void write(OutputStream output) throws IOException { |
37 artifact.out(document, outputStream, context); | 26 out.write(output); |
38 } | 27 } |
39 } | 28 } |
40 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: | 29 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: |