view artifact-database/src/main/java/de/intevation/artifactdatabase/rest/OutRepresentation.java @ 30:88972c6daa4f

Added a cleanup thread which periodically removes outdated artifacts from database and calls there endOfLife() method. artifacts/trunk@70 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 10 Sep 2009 23:16:18 +0000
parents 22b03d5c84c5
children c4d85a8532d1
line wrap: on
line source
package de.intevation.artifactdatabase.rest;

import org.restlet.representation.OutputRepresentation;

import de.intevation.artifacts.Artifact;

import org.restlet.data.MediaType;

import java.io.OutputStream;
import java.io.IOException;

import org.w3c.dom.Document;

/**
 * @author Sascha L. Teichmann (sascha.teichmann@intevation)
 */
public class OutRepresentation
extends      OutputRepresentation
{
    protected Artifact artifact;
    protected Document document;
    protected Object   context;

    public OutRepresentation(
        MediaType mediaType, 
        Artifact  artifact, 
        Document  document,
        Object    context
    ) {
        super(mediaType);
        this.artifact = artifact;
        this.document = document;
        this.context  = context;
    }

    public void write(OutputStream outputStream) throws IOException {
        byte [] bytes = artifact.out(document, context);
        outputStream.write(bytes);
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org