comparison artifacts/src/main/java/de/intevation/artifacts/Artifact.java @ 32:c2d53bd30ab8

Re-factored artifact API for better integration of background processing. artifacts/trunk@78 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 13 Sep 2009 14:50:53 +0000
parents c4d85a8532d1
children 4ae4dc99127d
comparison
equal deleted inserted replaced
31:c4d85a8532d1 32:c2d53bd30ab8
19 * of this artifact.</li> 19 * of this artifact.</li>
20 * <li>{@link #describe(Object)}: Returns a description of this artifact.</li> 20 * <li>{@link #describe(Object)}: Returns a description of this artifact.</li>
21 * <li>{@link #advance(Document, Object) advance()}: Advances this artifact 21 * <li>{@link #advance(Document, Object) advance()}: Advances this artifact
22 * to the next internal state</li> 22 * to the next internal state</li>
23 * <li>{@link #feed(Document, Object) feed()}: Feed new data into this artifact.</li> 23 * <li>{@link #feed(Document, Object) feed()}: Feed new data into this artifact.</li>
24 * <li>{@link #out(Document, Object) out()}: Produces output for this artifact.</li> 24 * <li>{@link #out(Document, OutputStream, CallContext) out()}: Produces output for this artifact.</li>
25 * </ol> 25 * </ol>
26 * 26 *
27 * There are two more methods involved with the life cycle of the are: 27 * There are two more methods involved with the life cycle of the are:
28 * <ol> 28 * <ol>
29 * <li>{@link #setup(String, ArtifactFactory, Object) setup()}: Called after created by the 29 * <li>{@link #setup(String, ArtifactFactory, Object) setup()}: Called after created by the
40 { 40 {
41 /** 41 /**
42 * Identify this artifact. 42 * Identify this artifact.
43 * @return Returns unique string to identify this artifact globally. 43 * @return Returns unique string to identify this artifact globally.
44 */ 44 */
45 public String identifier(); 45 String identifier();
46 46
47 /** 47 /**
48 * Internal hash of this artifact. 48 * Internal hash of this artifact.
49 * @return Returns hash that should stay the same if the internal 49 * @return Returns hash that should stay the same if the internal
50 * value has not changed. Useful for caching 50 * value has not changed. Useful for caching
51 */ 51 */
52 public String hash(); 52 String hash();
53 53
54 /** 54 /**
55 * A description used to build a interface to interact with this artifact. 55 * A description used to build a interface to interact with this artifact.
56 * @param context The global context of the runtime system. 56 * @param context The global context of the runtime system.
57 * @return An XML representation of the current state of the artifact. 57 * @return An XML representation of the current state of the artifact.
58 */ 58 */
59 public Document describe(Object context); 59 Document describe(CallContext context);
60 60
61 /** 61 /**
62 * Change the internal state of the artifact. 62 * Change the internal state of the artifact.
63 * @return An XML representation of the success of the advancing. 63 * @return An XML representation of the success of the advancing.
64 * @param target Target of internal state to move to. 64 * @param target Target of internal state to move to.
65 * @param context The global context of the runtime system. 65 * @param context The global context of the runtime system.
66 */ 66 */
67 public Document advance(Document target, Object context); 67 Document advance(Document target, CallContext context);
68 68
69 /** 69 /**
70 * Feed data into this artifact. 70 * Feed data into this artifact.
71 * @param data Data to feed artifact with. 71 * @param data Data to feed artifact with.
72 * @param context The global context of the runtime system. 72 * @param context The global context of the runtime system.
73 * @return An XML representation of the success of the feeding. 73 * @return An XML representation of the success of the feeding.
74 */ 74 */
75 public Document feed(Document data, Object context); 75 Document feed(Document data, CallContext context);
76 76
77 /** 77 /**
78 * Produce output from this artifact. 78 * Produce output from this artifact.
79 * @param format Specifies the format of the output. 79 * @param format Specifies the format of the output.
80 * @param context The global context of the runtime system. 80 * @param context The global context of the runtime system.
81 */ 81 */
82 public void out( 82 void out(
83 Document format, 83 Document format,
84 OutputStream out, 84 OutputStream out,
85 Object context) 85 CallContext context)
86 throws IOException; 86 throws IOException;
87 87
88 /** 88 /**
89 * When created by a factory this method is called to 89 * When created by a factory this method is called to
90 * initialize the artifact. 90 * initialize the artifact.
91 * @param identifier The identifier from artifact database 91 * @param identifier The identifier from artifact database
92 * @param factory The factory which created this artifact. 92 * @param factory The factory which created this artifact.
93 * @param context The global context of the runtime system. 93 * @param context The global context of the runtime system.
94 */ 94 */
95 public void setup(String identifier, ArtifactFactory factory, Object context); 95 public void setup(
96 String identifier,
97 ArtifactFactory factory,
98 Object context);
96 99
97 /** 100 /**
98 * Called from artifact database when an artifact is 101 * Called from artifact database when an artifact is
99 * going to be removed from system. 102 * going to be removed from system.
100 * @param context The global context of the runtime system. 103 * @param context The global context of the runtime system.

http://dive4elements.wald.intevation.org