annotate artifacts/src/main/java/de/intevation/artifacts/Artifact.java @ 77:48d1a9a082c2 0.5

Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>' to make the sources to be able to be formatted with jalopy (http://jalopy.sourceforge.net). artifacts/trunk@695 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 21 Feb 2010 23:05:32 +0000
parents d4c4c23847f5
children 55eefe63a777
rev   line source
1
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.artifacts;
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
75
d4c4c23847f5 Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents: 55
diff changeset
3 import java.io.IOException;
d4c4c23847f5 Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents: 55
diff changeset
4 import java.io.OutputStream;
d4c4c23847f5 Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents: 55
diff changeset
5 import java.io.Serializable;
d4c4c23847f5 Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents: 55
diff changeset
6
1
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7 import org.w3c.dom.Document;
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 /**
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 * Interface of the core component of the artifact system: <strong>The artifact</strong>.
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 * <br>
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 *
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 * An artifact is an abstract data type offering the following methods:
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 *
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 * <ol>
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 * <li>{@link #identifier() identifier()}: Returns a gobally unique identfier
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 * of this artifact.</li>
2
141457e0d7b1 Created a new sub project for artifact database server.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1
diff changeset
18 * <li>{@link #hash() hash()}: Returns a hash value over the internal state
1
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 * of this artifact.</li>
4
13a12b607baf Added mechanism to create an share a global context in the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2
diff changeset
20 * <li>{@link #describe(Object)}: Returns a description of this artifact.</li>
13a12b607baf Added mechanism to create an share a global context in the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2
diff changeset
21 * <li>{@link #advance(Document, Object) advance()}: Advances this artifact
1
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22 * to the next internal state</li>
4
13a12b607baf Added mechanism to create an share a global context in the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2
diff changeset
23 * <li>{@link #feed(Document, Object) feed()}: Feed new data into this artifact.</li>
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
24 * <li>{@link #out(Document, OutputStream, CallContext) out()}: Produces output for this artifact.</li>
1
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 * </ol>
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 *
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 9
diff changeset
27 * There are two more methods involved with the life cycle of the are:
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 9
diff changeset
28 * <ol>
47
4ae4dc99127d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
29 * <li>{@link #setup(String, ArtifactFactory, Object) setup()}: Called after created by the
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 9
diff changeset
30 * factory.</li>
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 9
diff changeset
31 * <li>{@link #endOfLife(Object) endOfLife()}: Called when the artifact
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 9
diff changeset
32 * is going to be removed from
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 9
diff changeset
33 * system. Useful to clean up.</li>
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 9
diff changeset
34 * </ol>
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 9
diff changeset
35 *
77
48d1a9a082c2 Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 75
diff changeset
36 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
1
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 */
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 public interface Artifact
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 extends Serializable
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 {
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 /**
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 * Identify this artifact.
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 * @return Returns unique string to identify this artifact globally.
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 */
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
45 String identifier();
1
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47 /**
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 * Internal hash of this artifact.
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 * @return Returns hash that should stay the same if the internal
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50 * value has not changed. Useful for caching
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 */
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
52 String hash();
1
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54 /**
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55 * A description used to build a interface to interact with this artifact.
4
13a12b607baf Added mechanism to create an share a global context in the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2
diff changeset
56 * @param context The global context of the runtime system.
1
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 * @return An XML representation of the current state of the artifact.
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 */
55
9a29899b31e5 describe() in REST interface is also handled as POST to pass
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 47
diff changeset
59 Document describe(Document data, CallContext context);
1
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61 /**
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 * Change the internal state of the artifact.
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63 * @return An XML representation of the success of the advancing.
4
13a12b607baf Added mechanism to create an share a global context in the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2
diff changeset
64 * @param target Target of internal state to move to.
13a12b607baf Added mechanism to create an share a global context in the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2
diff changeset
65 * @param context The global context of the runtime system.
1
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66 */
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
67 Document advance(Document target, CallContext context);
1
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69 /**
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70 * Feed data into this artifact.
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71 * @param data Data to feed artifact with.
4
13a12b607baf Added mechanism to create an share a global context in the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2
diff changeset
72 * @param context The global context of the runtime system.
1
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73 * @return An XML representation of the success of the feeding.
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 */
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
75 Document feed(Document data, CallContext context);
1
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
77 /**
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 * Produce output from this artifact.
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79 * @param format Specifies the format of the output.
4
13a12b607baf Added mechanism to create an share a global context in the artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2
diff changeset
80 * @param context The global context of the runtime system.
1
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81 */
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
82 void out(
31
c4d85a8532d1 Artifact.out() is now called with an java.io.Outpustream
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 24
diff changeset
83 Document format,
47
4ae4dc99127d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
84 OutputStream out,
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
85 CallContext context)
31
c4d85a8532d1 Artifact.out() is now called with an java.io.Outpustream
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 24
diff changeset
86 throws IOException;
9
a5a279a0ee35 Laid tracks for artifacts being removed from artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4
diff changeset
87
a5a279a0ee35 Laid tracks for artifacts being removed from artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4
diff changeset
88 /**
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 9
diff changeset
89 * When created by a factory this method is called to
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 9
diff changeset
90 * initialize the artifact.
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 9
diff changeset
91 * @param identifier The identifier from artifact database
24
d5dc2900392f * Added callback parameter to Artifact.setup()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 10
diff changeset
92 * @param factory The factory which created this artifact.
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 9
diff changeset
93 * @param context The global context of the runtime system.
75
d4c4c23847f5 Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents: 55
diff changeset
94 * @param data The data which can be use to setup an Artifact with
d4c4c23847f5 Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents: 55
diff changeset
95 * more details.
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 9
diff changeset
96 */
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
97 public void setup(
47
4ae4dc99127d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
98 String identifier,
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
99 ArtifactFactory factory,
75
d4c4c23847f5 Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents: 55
diff changeset
100 Object context,
d4c4c23847f5 Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents: 55
diff changeset
101 Document data);
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 9
diff changeset
102
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 9
diff changeset
103 /**
9
a5a279a0ee35 Laid tracks for artifacts being removed from artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4
diff changeset
104 * Called from artifact database when an artifact is
a5a279a0ee35 Laid tracks for artifacts being removed from artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4
diff changeset
105 * going to be removed from system.
a5a279a0ee35 Laid tracks for artifacts being removed from artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4
diff changeset
106 * @param context The global context of the runtime system.
a5a279a0ee35 Laid tracks for artifacts being removed from artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4
diff changeset
107 */
a5a279a0ee35 Laid tracks for artifacts being removed from artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4
diff changeset
108 public void endOfLife(Object context);
1
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
109 }
11c82d3f125e Checked in the central interfaces of the artifact system.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
110 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org