Mercurial > dive4elements > framework
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifact-database/src/main/java/org/dive4elements/artifactdatabase/DefaultArtifact.java Thu Apr 25 10:57:18 2013 +0200 @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2010 by Intevation GmbH + * + * This program is free software under the LGPL (>=v2.1) + * Read the file LGPL.txt coming with the software for details + * or visit http://www.gnu.org/licenses/ if it does not exist. + */ + +package de.intevation.artifactdatabase; + +import de.intevation.artifacts.common.utils.XMLUtils; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallContext; +import de.intevation.artifacts.CallMeta; + +import java.io.IOException; +import java.io.OutputStream; + +import org.apache.log4j.Logger; + +import org.w3c.dom.Document; + +/** + * Trivial implementation of an artifact. Useful to be subclassed. + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> + */ +public class DefaultArtifact +implements Artifact +{ + private static Logger logger = Logger.getLogger(DefaultArtifact.class); + + /** + * The identifier of the artifact. + */ + protected String identifier; + + + /** + * Default constructor. + */ + public DefaultArtifact() { + } + + + public void setIdentifier(String identifier) { + if (logger.isDebugEnabled()) { + logger.debug("Change identifier: " + + this.identifier + " -> " + identifier); + } + this.identifier = identifier; + } + + public String identifier() { + if (logger.isDebugEnabled()) { + logger.debug("DefaultArtifact.identifier: " + identifier); + } + return this.identifier; + } + + + public String hash() { + String hash = String.valueOf(hashCode()); + if (logger.isDebugEnabled()) { + logger.debug("DefaultArtifact.hashCode: " + + identifier + " (" + hash + ")"); + } + return hash; + } + + public Document describe(Document data, CallContext context) { + if (logger.isDebugEnabled()) { + logger.debug("DefaultArtifact.describe: " + identifier); + } + return XMLUtils.newDocument(); + } + + public Document advance(Document target, CallContext context) { + if (logger.isDebugEnabled()) { + logger.debug("DefaultArtifact.advance: " + identifier); + } + return XMLUtils.newDocument(); + } + + public Document feed(Document target, CallContext context) { + if (logger.isDebugEnabled()) { + logger.debug("DefaultArtifact.feed: " + identifier); + } + return XMLUtils.newDocument(); + } + + public void out( + Document format, + OutputStream out, + CallContext context + ) + throws IOException + { + if (logger.isDebugEnabled()) { + logger.debug("DefaultArtifact.out: " + identifier); + } + } + + public void out( + String type, + Document format, + OutputStream out, + CallContext context + ) + throws IOException + { + if (logger.isDebugEnabled()) { + logger.debug("DefaultArtifact.out: " + identifier); + } + } + + public void setup(String identifier, + ArtifactFactory factory, + Object context, + CallMeta callMeta, + Document data) + { + if (logger.isDebugEnabled()) { + logger.debug("DefaultArtifact.setup: " + identifier); + } + this.identifier = identifier; + } + + public void endOfLife(Object context) { + if (logger.isDebugEnabled()) { + logger.debug("DefaultArtifact.endOfLife: " + identifier); + } + } + + public void cleanup(Object context) { + if (logger.isDebugEnabled()) { + logger.debug("DefaultArtifact.cleanup: " + identifier); + } + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :