annotate artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifact.java @ 92:73d0ebae81d7

Last bunch of javadoc artifacts/trunk@848 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 28 Mar 2010 14:16:05 +0000
parents 730ff077a58c
children 933bbc9fc11f
rev   line source
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.artifactdatabase;
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
91
730ff077a58c More javadoc, some code formatting.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 87
diff changeset
3 import de.intevation.artifacts.Artifact;
730ff077a58c More javadoc, some code formatting.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 87
diff changeset
4 import de.intevation.artifacts.ArtifactFactory;
730ff077a58c More javadoc, some code formatting.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 87
diff changeset
5 import de.intevation.artifacts.CallContext;
730ff077a58c More javadoc, some code formatting.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 87
diff changeset
6
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
7 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
8 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
9
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
10 import org.apache.log4j.Logger;
91
730ff077a58c More javadoc, some code formatting.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 87
diff changeset
11
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 import org.w3c.dom.Document;
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 /**
91
730ff077a58c More javadoc, some code formatting.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 87
diff changeset
15 * Trivial implementation of an artifact. Useful to be subclassed.
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
16 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 */
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 public class DefaultArtifact
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 implements Artifact
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 10
diff changeset
21 private static Logger logger = Logger.getLogger(DefaultArtifact.class);
47
4ae4dc99127d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 42
diff changeset
22
87
0f48188a6e02 Added some javadoc to the artifactdatabase module. Not done yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 86
diff changeset
23 /**
0f48188a6e02 Added some javadoc to the artifactdatabase module. Not done yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 86
diff changeset
24 * The identifier of the artifact.
0f48188a6e02 Added some javadoc to the artifactdatabase module. Not done yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 86
diff changeset
25 */
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 protected String identifier;
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27
87
0f48188a6e02 Added some javadoc to the artifactdatabase module. Not done yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 86
diff changeset
28 /**
0f48188a6e02 Added some javadoc to the artifactdatabase module. Not done yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 86
diff changeset
29 * Default constructor.
0f48188a6e02 Added some javadoc to the artifactdatabase module. Not done yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 86
diff changeset
30 */
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 public DefaultArtifact() {
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33
81
e9c80fdfee13 Set new identifiers on artifacts after an artifact import.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
34
e9c80fdfee13 Set new identifiers on artifacts after an artifact import.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
35 public void setIdentifier(String identifier) {
e9c80fdfee13 Set new identifiers on artifacts after an artifact import.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
36 if (logger.isDebugEnabled()) {
e9c80fdfee13 Set new identifiers on artifacts after an artifact import.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
37 logger.debug("Change identifier: "
e9c80fdfee13 Set new identifiers on artifacts after an artifact import.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
38 + this.identifier + " -> " + identifier);
e9c80fdfee13 Set new identifiers on artifacts after an artifact import.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
39 }
e9c80fdfee13 Set new identifiers on artifacts after an artifact import.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
40 this.identifier = identifier;
e9c80fdfee13 Set new identifiers on artifacts after an artifact import.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
41 }
e9c80fdfee13 Set new identifiers on artifacts after an artifact import.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
42
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 public String identifier() {
42
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
44 if (logger.isDebugEnabled()) {
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
45 logger.debug("DefaultArtifact.identifier: " + identifier);
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
46 }
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47 return this.identifier;
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50 public String hash() {
42
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
51 String hash = String.valueOf(hashCode());
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
52 if (logger.isDebugEnabled()) {
47
4ae4dc99127d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 42
diff changeset
53 logger.debug("DefaultArtifact.hashCode: "
42
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
54 + identifier + " (" + hash + ")");
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
55 }
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
56 return hash;
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
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 public Document describe(Document data, CallContext context) {
42
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
60 if (logger.isDebugEnabled()) {
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
61 logger.debug("DefaultArtifact.describe: " + identifier);
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
62 }
26
83a059c204f8 Connected /create with artifact db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 24
diff changeset
63 return XMLUtils.newDocument();
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
65
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
66 public Document advance(Document target, CallContext context) {
42
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
67 if (logger.isDebugEnabled()) {
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
68 logger.debug("DefaultArtifact.advance: " + identifier);
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
69 }
26
83a059c204f8 Connected /create with artifact db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 24
diff changeset
70 return XMLUtils.newDocument();
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72
32
c2d53bd30ab8 Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 31
diff changeset
73 public Document feed(Document target, CallContext context) {
42
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
74 if (logger.isDebugEnabled()) {
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
75 logger.debug("DefaultArtifact.feed: " + identifier);
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
76 }
26
83a059c204f8 Connected /create with artifact db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 24
diff changeset
77 return XMLUtils.newDocument();
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79
31
c4d85a8532d1 Artifact.out() is now called with an java.io.Outpustream
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 26
diff changeset
80 public void out(
c4d85a8532d1 Artifact.out() is now called with an java.io.Outpustream
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 26
diff changeset
81 Document format,
c4d85a8532d1 Artifact.out() is now called with an java.io.Outpustream
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 26
diff changeset
82 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
83 CallContext context
31
c4d85a8532d1 Artifact.out() is now called with an java.io.Outpustream
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 26
diff changeset
84 )
c4d85a8532d1 Artifact.out() is now called with an java.io.Outpustream
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 26
diff changeset
85 throws IOException
c4d85a8532d1 Artifact.out() is now called with an java.io.Outpustream
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 26
diff changeset
86 {
42
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
87 if (logger.isDebugEnabled()) {
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
88 logger.debug("DefaultArtifact.out: " + identifier);
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
89 }
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
90 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
91
86
b2e0cb83631c Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 82
diff changeset
92 public void setup(String identifier, 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
93 Object context, Document data) {
42
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
94 if (logger.isDebugEnabled()) {
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
95 logger.debug("DefaultArtifact.setup: " + identifier);
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
96 }
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
97 this.identifier = identifier;
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
98 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
99
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
100 public void endOfLife(Object context) {
42
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
101 if (logger.isDebugEnabled()) {
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
102 logger.debug("DefaultArtifact.endOfLife: " + identifier);
5fbd8e65bdf5 Added debug output to DefaultArtifact tracing of artifact lifecyle easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 32
diff changeset
103 }
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
104 }
82
efe752c4f8b2 Call cleanup method to remove special data stored by an 'out'-target before exporting an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 81
diff changeset
105
efe752c4f8b2 Call cleanup method to remove special data stored by an 'out'-target before exporting an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 81
diff changeset
106 public void cleanup(Object context) {
91
730ff077a58c More javadoc, some code formatting.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 87
diff changeset
107 if (logger.isDebugEnabled()) {
730ff077a58c More javadoc, some code formatting.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 87
diff changeset
108 logger.debug("DefaultArtifact.cleanup: " + identifier);
730ff077a58c More javadoc, some code formatting.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 87
diff changeset
109 }
82
efe752c4f8b2 Call cleanup method to remove special data stored by an 'out'-target before exporting an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 81
diff changeset
110 }
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
111 }
91
730ff077a58c More javadoc, some code formatting.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 87
diff changeset
112 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org