teichmann@5863: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5863: * Software engineering by Intevation GmbH teichmann@5863: * teichmann@5994: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5863: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5994: * documentation coming with Dive4Elements River for details. teichmann@5863: */ teichmann@5863: teichmann@5831: package org.dive4elements.river.exports; ingo@294: ingo@299: import java.io.IOException; ingo@294: import java.io.OutputStream; ingo@294: ingo@294: import org.w3c.dom.Document; teichmann@7037: import org.w3c.dom.Element; ingo@294: teichmann@5831: import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; teichmann@5831: import org.dive4elements.artifactdatabase.state.Settings; teichmann@5831: import org.dive4elements.artifacts.Artifact; teichmann@5831: import org.dive4elements.artifacts.CallContext; teichmann@5867: import org.dive4elements.river.collections.D4EArtifactCollection; teichmann@6905: import org.dive4elements.river.themes.ThemeDocument; ingo@294: felix@1962: ingo@294: /** ingo@294: * An OutGenerator is used to create a collected outputs of a list of Artifacts. ingo@294: * ingo@294: * @author Ingo Weinzierl ingo@294: */ ingo@294: public interface OutGenerator { ingo@294: ingo@294: /** teichmann@7037: * Pre-initialize generator from configuration. teichmann@7037: */ teichmann@7087: void setup(Object config); teichmann@7037: teichmann@7037: /** ingo@294: * Initializes the OutGenerator with meta information which are necessary ingo@294: * for the output generation. ingo@294: * teichmann@7077: * @param outName The name of the out to serve. ingo@294: * @param request The incomding request document. ingo@294: * @param out The output stream. ingo@294: * @param context The CallContext that provides further information and ingo@294: * objects used for the output generation. ingo@294: */ teichmann@7077: void init(String outName, Document request, OutputStream out, CallContext context); ingo@294: ingo@294: /** ingo@412: * This method is used to tell the OutGenerator which artifact is the master ingo@412: * artifact which is used for special operations. ingo@412: * ingo@412: * @param master The master artifact. ingo@412: */ ingo@412: void setMasterArtifact(Artifact master); ingo@412: ingo@412: /** ingo@3422: * This method is used to set the Collection of the OutGenerator. ingo@3422: * ingo@3422: * @param collection A reference to the collection. ingo@3422: */ teichmann@5867: void setCollection(D4EArtifactCollection collection); ingo@3422: ingo@3422: /** ingo@294: * Creates the output of an Artifact and appends that single output to the ingo@294: * total output. ingo@294: * felix@3270: * @param bundle The Facet and artifact that provides information and data for the ingo@294: * single output. ingo@294: * @param attr A document that might contain some attributes used while ingo@294: * producing the output. ingo@1684: * @param visible Specifies, if this output should be visible or not. ingo@294: */ teichmann@6905: void doOut(ArtifactAndFacet bundle, ThemeDocument attr, boolean visible); ingo@294: ingo@294: /** ingo@294: * Writes the collected output of all artifacts specified in the ingo@294: * request (see init()) document to the OutputStream out (see ingo@294: * init()). ingo@294: */ ingo@299: void generate() throws IOException; ingo@1979: ingo@1979: /** ingo@2047: * This method is used to set a Settings object for the Output ingo@2047: * that is produced by this OutGenerator. ingo@2047: * ingo@2047: * @param settings The Settings that might be used while ingo@2047: * Output creation. ingo@2047: */ ingo@2047: void setSettings(Settings settings); ingo@2047: ingo@2047: /** ingo@1979: * Returns the Settings for the Output produced by this OutGenerator. ingo@1979: * ingo@1979: * @return the Settings for the Output produced by this OutGenerator. ingo@1979: */ ingo@1979: Settings getSettings(); ingo@294: } ingo@294: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :