annotate artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifact.java @ 18:63a8aa276693

NameSpaceURL and NamespacePrefix added artifacts/trunk@34 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 08 Sep 2009 07:51:34 +0000
parents 5a6b6a3debc7
children d5dc2900392f
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
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import org.w3c.dom.Document;
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 import javax.xml.parsers.DocumentBuilderFactory;
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6 import javax.xml.parsers.ParserConfigurationException;
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 import de.intevation.artifacts.Artifact;
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 10
diff changeset
10 import org.apache.log4j.Logger;
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 10
diff changeset
11
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 /**
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de)
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 */
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 public class DefaultArtifact
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 implements Artifact
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 10
diff changeset
18 private static Logger logger = Logger.getLogger(DefaultArtifact.class);
18
63a8aa276693 NameSpaceURL and NamespacePrefix added
Tim Englich <tim.englich@intevation.de>
parents: 17
diff changeset
19
63a8aa276693 NameSpaceURL and NamespacePrefix added
Tim Englich <tim.englich@intevation.de>
parents: 17
diff changeset
20 /**
63a8aa276693 NameSpaceURL and NamespacePrefix added
Tim Englich <tim.englich@intevation.de>
parents: 17
diff changeset
21 * The URI of the Namespace of the Artifacts
63a8aa276693 NameSpaceURL and NamespacePrefix added
Tim Englich <tim.englich@intevation.de>
parents: 17
diff changeset
22 */
63a8aa276693 NameSpaceURL and NamespacePrefix added
Tim Englich <tim.englich@intevation.de>
parents: 17
diff changeset
23 public final static String NAMESPACE_URI = "http://www.intevation.de/2009/artifacts";
63a8aa276693 NameSpaceURL and NamespacePrefix added
Tim Englich <tim.englich@intevation.de>
parents: 17
diff changeset
24
63a8aa276693 NameSpaceURL and NamespacePrefix added
Tim Englich <tim.englich@intevation.de>
parents: 17
diff changeset
25 /**
63a8aa276693 NameSpaceURL and NamespacePrefix added
Tim Englich <tim.englich@intevation.de>
parents: 17
diff changeset
26 * The XML-Prefix for the Artifacts-Namespae
63a8aa276693 NameSpaceURL and NamespacePrefix added
Tim Englich <tim.englich@intevation.de>
parents: 17
diff changeset
27 */
63a8aa276693 NameSpaceURL and NamespacePrefix added
Tim Englich <tim.englich@intevation.de>
parents: 17
diff changeset
28 public final static String NAMESPACE_PREFIX = "art";
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 10
diff changeset
29
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 protected String identifier;
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 public DefaultArtifact() {
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 protected Document newDocument() {
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 try {
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 return DocumentBuilderFactory
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 .newInstance()
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 .newDocumentBuilder()
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 .newDocument();
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 catch (ParserConfigurationException pce) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 10
diff changeset
43 logger.error(pce.getLocalizedMessage(), pce);
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45 return null;
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 public String identifier() {
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 return this.identifier;
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 public String hash() {
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53 return String.valueOf(hashCode());
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56 public Document describe(Object context) {
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 return newDocument();
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60 public Document advance(Document target, Object context) {
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61 return newDocument();
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64 public Document feed(Document target, Object context) {
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
65 return newDocument();
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68 public byte [] out(Document format, Object context) {
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69 return new byte[0];
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70 }
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 public void setup(String identifier, Object context) {
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73 this.identifier = identifier;
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76 public void endOfLife(Object context) {
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
77 }
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org