sascha@1: package de.intevation.artifacts;
sascha@1:
sascha@1: import org.w3c.dom.Document;
sascha@1:
sascha@1: import java.io.Serializable;
sascha@1:
sascha@1: /**
sascha@1: * Interface of the core component of the artifact system: The artifact.
sascha@1: *
sascha@1: *
sascha@1: * An artifact is an abstract data type offering the following methods:
sascha@1: *
sascha@1: *
sascha@1: * - {@link #identifier() identifier()}: Returns a gobally unique identfier
sascha@1: * of this artifact.
sascha@1: * - {@link #hash() hash()}: Returns a hash value over the internal state
sascha@1: * of this artifact.
sascha@1: * - {@link #describe()}: Returns a description of this artifact.
sascha@1: * - {@link #advance(String) advance()}: Advances this artifact
sascha@1: * to the next internal state
sascha@1: * - {@link #feed(Document) feed()}: Feed new data into this artifact.
sascha@1: * - {@link #out(Document) out()}: Produces output for this artifact.
sascha@1: *
sascha@1: *
sascha@1: * @author Sascha L. Teichmann (sascha.teichmann@intevation.de)
sascha@1: */
sascha@1: public interface Artifact
sascha@1: extends Serializable
sascha@1: {
sascha@1: /**
sascha@1: * Identify this artifact.
sascha@1: * @return Returns unique string to identify this artifact globally.
sascha@1: */
sascha@1: public String identifier();
sascha@1:
sascha@1: /**
sascha@1: * Internal hash of this artifact.
sascha@1: * @return Returns hash that should stay the same if the internal
sascha@1: * value has not changed. Useful for caching
sascha@1: */
sascha@1: public String hash();
sascha@1:
sascha@1: /**
sascha@1: * A description used to build a interface to interact with this artifact.
sascha@1: * @return An XML representation of the current state of the artifact.
sascha@1: */
sascha@1: public Document describe();
sascha@1:
sascha@1: /**
sascha@1: * Change the internal state of the artifact.
sascha@1: * @param target Target of internal state to move to.
sascha@1: * @return An XML representation of the success of the advancing.
sascha@1: */
sascha@1: public Document advance(String target);
sascha@1:
sascha@1: /**
sascha@1: * Feed data into this artifact.
sascha@1: * @param data Data to feed artifact with.
sascha@1: * @return An XML representation of the success of the feeding.
sascha@1: */
sascha@1: public Document feed(Document data);
sascha@1:
sascha@1: /**
sascha@1: * Produce output from this artifact.
sascha@1: * @param format Specifies the format of the output.
sascha@1: * @return a byte representation of the output.
sascha@1: */
sascha@1: public byte [] out(Document format);
sascha@1: }
sascha@1: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: