view artifacts/src/main/java/de/intevation/artifacts/Artifact.java @ 1:11c82d3f125e

Checked in the central interfaces of the artifact system. artifacts/trunk@6 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 02 Sep 2009 14:03:48 +0000
parents
children 141457e0d7b1
line wrap: on
line source
package de.intevation.artifacts;

import org.w3c.dom.Document;

import java.io.Serializable;

/**
 * Interface of the core component of the artifact system: <strong>The artifact</strong>.
 * <br>
 *
 * An artifact is an abstract data type offering the following methods:
 *
 * <ol>
 *   <li>{@link #identifier() identifier()}: Returns a gobally unique identfier
 *        of this artifact.</li>
 *   <li>{@link #hash() hash()}: Returns a hash value over the internal state 
 *        of this artifact.</li>
 *   <li>{@link #describe()}: Returns a description of this artifact.</li>
 *   <li>{@link #advance(String) advance()}: Advances this artifact 
 *       to the next internal state</li>
 *   <li>{@link #feed(Document) feed()}: Feed new data into this artifact.</li>
 *   <li>{@link #out(Document) out()}: Produces output for this artifact.</li>
 * </ol>
 *
 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de)
 */
public interface Artifact
extends          Serializable
{
    /**
     * Identify this artifact.
     * @return Returns unique string to identify this artifact globally.
     */
    public String identifier();

    /**
     * Internal hash of this artifact.
     * @return Returns hash that should stay the same if the internal
     *         value has not changed. Useful for caching
     */
    public String hash();

    /**
     * A description used to build a interface to interact with this artifact.
     * @return An XML representation of the current state of the artifact.
     */
    public Document describe();

    /**
     * Change the internal state of the artifact.
     * @param target Target of internal state to move to.
     * @return An XML representation of the success of the advancing.
     */
    public Document advance(String target);

    /**
     * Feed data into this artifact.
     * @param data Data to feed artifact with.
     * @return An XML representation of the success of the feeding.
     */
    public Document feed(Document data);

    /**
     * Produce output from this artifact.
     * @param format Specifies the format of the output.
     * @return a byte representation of the output.
     */
    public byte [] out(Document format);
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org