ingo@104: /*
ingo@104: * Copyright (c) 2011 by Intevation GmbH
ingo@104: *
ingo@104: * This program is free software under the LGPL (>=v2.1)
ingo@104: * Read the file LGPL.txt coming with the software for details
ingo@104: * or visit http://www.gnu.org/licenses/ if it does not exist.
ingo@104: */
ingo@104: package de.intevation.artifactdatabase.state;
ingo@104:
ingo@104: import java.io.Serializable;
ingo@104: import java.util.Map;
ingo@104:
ingo@104: import org.w3c.dom.Document;
ingo@104: import org.w3c.dom.Node;
ingo@104:
ingo@104: import de.intevation.artifacts.CallContext;
ingo@104:
ingo@104: import de.intevation.artifactdatabase.data.StateData;
ingo@104:
ingo@104:
ingo@104: /**
ingo@104: * This interface describes the basic methods a concrete state class needs to
ingo@104: * implement.
ingo@104: *
ingo@104: * @author Ingo Weinzierl
ingo@104: */
ingo@104: public interface State extends Serializable {
ingo@104:
ingo@104: /**
ingo@104: * Return the id of the state.
ingo@104: *
ingo@104: * @return the id.
ingo@104: */
ingo@104: public String getID();
ingo@104:
ingo@104:
ingo@104: /**
ingo@104: * Return the description of the state.
ingo@104: *
ingo@104: * @return the description of the state.
ingo@104: */
ingo@104: public String getDescription();
ingo@104:
ingo@104:
ingo@104: /**
ingo@104: * Returns the data provided by this state.
ingo@104: *
ingo@104: * @return the data stored in this state.
ingo@104: */
ingo@104: public Map getData();
ingo@104:
ingo@104:
ingo@104: /**
ingo@110: * This method should be used to add a new {@link StateData} object to the
ingo@110: * data pool of the state.
ingo@110: *
ingo@110: * @param name The name of the data object.
ingo@110: * @param data The data object.
ingo@110: */
ingo@110: public void addData(String name, StateData data);
ingo@110:
ingo@110:
ingo@110: /**
ingo@104: * Initialize the state based on the state node in the configuration.
ingo@104: *
ingo@104: * @param config The state configuration node.
ingo@104: */
ingo@104: public void setup(Node config);
ingo@104:
ingo@104:
ingo@104: /**
ingo@104: * This method is called when an artifacts retrieves a describe request. It
ingo@104: * creates the user interface description of the current state.
ingo@104: *
ingo@104: * @param document Describe doucment.
ingo@104: * @param rootNode Parent node for all new elements.
ingo@104: * @param context The CallContext.
ingo@104: * @param uuid The uuid of an artifact.
ingo@104: */
ingo@104: public void describe(
ingo@104: Document document,
ingo@104: Node rootNode,
ingo@104: CallContext context,
ingo@104: String uuid
ingo@104: );
ingo@104: }
ingo@104: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :