comparison artifact-database/src/main/java/org/dive4elements/artifactdatabase/DefaultArtifact.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/DefaultArtifact.java@6431b7efe240
children 415df0fc4fa1
comparison
equal deleted inserted replaced
472:783cc1b6b615 473:d0ac790a6c89
1 /*
2 * Copyright (c) 2010 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
9 package de.intevation.artifactdatabase;
10
11 import de.intevation.artifacts.common.utils.XMLUtils;
12
13 import de.intevation.artifacts.Artifact;
14 import de.intevation.artifacts.ArtifactFactory;
15 import de.intevation.artifacts.CallContext;
16 import de.intevation.artifacts.CallMeta;
17
18 import java.io.IOException;
19 import java.io.OutputStream;
20
21 import org.apache.log4j.Logger;
22
23 import org.w3c.dom.Document;
24
25 /**
26 * Trivial implementation of an artifact. Useful to be subclassed.
27 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
28 */
29 public class DefaultArtifact
30 implements Artifact
31 {
32 private static Logger logger = Logger.getLogger(DefaultArtifact.class);
33
34 /**
35 * The identifier of the artifact.
36 */
37 protected String identifier;
38
39
40 /**
41 * Default constructor.
42 */
43 public DefaultArtifact() {
44 }
45
46
47 public void setIdentifier(String identifier) {
48 if (logger.isDebugEnabled()) {
49 logger.debug("Change identifier: "
50 + this.identifier + " -> " + identifier);
51 }
52 this.identifier = identifier;
53 }
54
55 public String identifier() {
56 if (logger.isDebugEnabled()) {
57 logger.debug("DefaultArtifact.identifier: " + identifier);
58 }
59 return this.identifier;
60 }
61
62
63 public String hash() {
64 String hash = String.valueOf(hashCode());
65 if (logger.isDebugEnabled()) {
66 logger.debug("DefaultArtifact.hashCode: "
67 + identifier + " (" + hash + ")");
68 }
69 return hash;
70 }
71
72 public Document describe(Document data, CallContext context) {
73 if (logger.isDebugEnabled()) {
74 logger.debug("DefaultArtifact.describe: " + identifier);
75 }
76 return XMLUtils.newDocument();
77 }
78
79 public Document advance(Document target, CallContext context) {
80 if (logger.isDebugEnabled()) {
81 logger.debug("DefaultArtifact.advance: " + identifier);
82 }
83 return XMLUtils.newDocument();
84 }
85
86 public Document feed(Document target, CallContext context) {
87 if (logger.isDebugEnabled()) {
88 logger.debug("DefaultArtifact.feed: " + identifier);
89 }
90 return XMLUtils.newDocument();
91 }
92
93 public void out(
94 Document format,
95 OutputStream out,
96 CallContext context
97 )
98 throws IOException
99 {
100 if (logger.isDebugEnabled()) {
101 logger.debug("DefaultArtifact.out: " + identifier);
102 }
103 }
104
105 public void out(
106 String type,
107 Document format,
108 OutputStream out,
109 CallContext context
110 )
111 throws IOException
112 {
113 if (logger.isDebugEnabled()) {
114 logger.debug("DefaultArtifact.out: " + identifier);
115 }
116 }
117
118 public void setup(String identifier,
119 ArtifactFactory factory,
120 Object context,
121 CallMeta callMeta,
122 Document data)
123 {
124 if (logger.isDebugEnabled()) {
125 logger.debug("DefaultArtifact.setup: " + identifier);
126 }
127 this.identifier = identifier;
128 }
129
130 public void endOfLife(Object context) {
131 if (logger.isDebugEnabled()) {
132 logger.debug("DefaultArtifact.endOfLife: " + identifier);
133 }
134 }
135
136 public void cleanup(Object context) {
137 if (logger.isDebugEnabled()) {
138 logger.debug("DefaultArtifact.cleanup: " + identifier);
139 }
140 }
141 }
142 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org