comparison artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/State.java @ 473:d0ac790a6c89 dive4elements-move

Moved directories to org.dive4elements
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 10:57:18 +0200
parents artifact-database/src/main/java/de/intevation/artifactdatabase/state/State.java@fd32dc33a24c
children 415df0fc4fa1
comparison
equal deleted inserted replaced
472:783cc1b6b615 473:d0ac790a6c89
1 /*
2 * Copyright (c) 2011 by Intevation GmbH
3 *
4 * This program is free software under the LGPL (>=v2.1)
5 * Read the file LGPL.txt coming with the software for details
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
7 */
8 package de.intevation.artifactdatabase.state;
9
10 import java.io.Serializable;
11 import java.util.List;
12 import java.util.Map;
13
14 import org.w3c.dom.Document;
15 import org.w3c.dom.Element;
16 import org.w3c.dom.Node;
17
18 import de.intevation.artifacts.Artifact;
19 import de.intevation.artifacts.CallContext;
20 import de.intevation.artifacts.CallMeta;
21
22 import de.intevation.artifactdatabase.data.StateData;
23
24
25 /**
26 * This interface describes the basic methods a concrete state class needs to
27 * implement.
28 *
29 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
30 */
31 public interface State extends Serializable {
32
33 /**
34 * Return the id of the state.
35 *
36 * @return the id.
37 */
38 public String getID();
39
40
41 /**
42 * Return the description of the state.
43 *
44 * @return the description of the state.
45 */
46 public String getDescription();
47
48
49 /**
50 * Returns the help text configured for the state.
51 *
52 * @return the help text configured for the state.
53 */
54 public String getHelpText();
55
56
57 /**
58 * Returns the data provided by this state.
59 *
60 * @return the data stored in this state.
61 */
62 public Map<String, StateData> getData();
63
64
65 /**
66 * Returns a single desired StateData object based on its name.
67 *
68 * @param name The name of the desired StateData object.
69 *
70 * @return the desired StateData object.
71 */
72 public StateData getData(String name);
73
74
75 /**
76 * This method should be used to add a new {@link StateData} object to the
77 * data pool of the state.
78 *
79 * @param name The name of the data object.
80 * @param data The data object.
81 */
82 public void addData(String name, StateData data);
83
84
85 /**
86 * Returns the list of possible outputs of this state. The list is empty
87 * if no output is available for this state.
88 *
89 * @return a list of possible outputs of this state.
90 */
91 public List<Output> getOutputs();
92
93
94 /**
95 * Initialize the state based on the state node in the configuration.
96 *
97 * @param config The state configuration node.
98 */
99 public void setup(Node config);
100
101
102 /**
103 * Initializes the internal state of this State based on an other State.
104 *
105 * @param orig The owner Artifact or the original State.
106 * @param owner The owner Artifact of this State.
107 * @param context The context object.
108 * @param callMeta The CallMeta of the current call.
109 */
110 public void initialize(
111 Artifact orig,
112 Artifact owner,
113 Object context,
114 CallMeta callMeta);
115
116
117 /**
118 * This method is called when an artifacts retrieves a describe request. It
119 * creates the user interface description of the current state.
120 *
121 * @param artifact A reference to the artifact this state belongs to.
122 * @param document Describe doucment.
123 * @param rootNode Parent node for all new elements.
124 * @param context The CallContext.
125 * @param uuid The uuid of an artifact.
126 */
127 public Element describe(
128 Artifact artifact,
129 Document document,
130 Node rootNode,
131 CallContext context,
132 String uuid
133 );
134
135
136 /**
137 * This method should be called by an Artifact that removes this State
138 * (current State and previous States). E.g. this might be interesting to
139 * remove generated files or stuff like that.
140 *
141 * @param artifact A parent Artifact.
142 * @param context The CallContext.
143 */
144 public void endOfLife(Artifact artifact, Object context);
145 }
146 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org