ingo@100: /* ingo@100: * Copyright (c) 2010 by Intevation GmbH ingo@100: * ingo@100: * This program is free software under the LGPL (>=v2.1) ingo@100: * Read the file LGPL.txt coming with the software for details ingo@100: * or visit http://www.gnu.org/licenses/ if it does not exist. ingo@100: */ ingo@100: sascha@10: package de.intevation.artifactdatabase; sascha@10: sascha@207: import de.intevation.artifacts.common.utils.XMLUtils; sascha@207: sascha@91: import de.intevation.artifacts.Artifact; sascha@91: import de.intevation.artifacts.ArtifactFactory; sascha@91: import de.intevation.artifacts.CallContext; ingo@297: import de.intevation.artifacts.CallMeta; sascha@91: tim@75: import java.io.IOException; tim@75: import java.io.OutputStream; tim@75: tim@75: import org.apache.log4j.Logger; sascha@91: sascha@10: import org.w3c.dom.Document; sascha@10: sascha@10: /** sascha@91: * Trivial implementation of an artifact. Useful to be subclassed. sascha@77: * @author Sascha L. Teichmann sascha@10: */ sascha@10: public class DefaultArtifact sascha@10: implements Artifact sascha@10: { sascha@17: private static Logger logger = Logger.getLogger(DefaultArtifact.class); sascha@47: sascha@87: /** sascha@87: * The identifier of the artifact. sascha@87: */ sascha@10: protected String identifier; sascha@10: felix@367: sascha@87: /** sascha@87: * Default constructor. sascha@87: */ sascha@10: public DefaultArtifact() { sascha@10: } sascha@10: ingo@81: ingo@81: public void setIdentifier(String identifier) { ingo@81: if (logger.isDebugEnabled()) { ingo@81: logger.debug("Change identifier: " ingo@81: + this.identifier + " -> " + identifier); ingo@81: } ingo@81: this.identifier = identifier; ingo@81: } ingo@81: sascha@10: public String identifier() { sascha@42: if (logger.isDebugEnabled()) { sascha@42: logger.debug("DefaultArtifact.identifier: " + identifier); sascha@42: } sascha@10: return this.identifier; sascha@10: } sascha@10: felix@367: sascha@10: public String hash() { sascha@42: String hash = String.valueOf(hashCode()); sascha@42: if (logger.isDebugEnabled()) { sascha@47: logger.debug("DefaultArtifact.hashCode: " sascha@42: + identifier + " (" + hash + ")"); sascha@42: } sascha@42: return hash; sascha@10: } sascha@10: sascha@55: public Document describe(Document data, CallContext context) { sascha@42: if (logger.isDebugEnabled()) { sascha@42: logger.debug("DefaultArtifact.describe: " + identifier); sascha@42: } sascha@26: return XMLUtils.newDocument(); sascha@10: } sascha@10: sascha@32: public Document advance(Document target, CallContext context) { sascha@42: if (logger.isDebugEnabled()) { sascha@42: logger.debug("DefaultArtifact.advance: " + identifier); sascha@42: } sascha@26: return XMLUtils.newDocument(); sascha@10: } sascha@10: sascha@32: public Document feed(Document target, CallContext context) { sascha@42: if (logger.isDebugEnabled()) { sascha@42: logger.debug("DefaultArtifact.feed: " + identifier); sascha@42: } sascha@26: return XMLUtils.newDocument(); sascha@10: } sascha@10: sascha@31: public void out( sascha@31: Document format, sascha@31: OutputStream out, sascha@32: CallContext context sascha@31: ) sascha@31: throws IOException sascha@31: { sascha@42: if (logger.isDebugEnabled()) { sascha@42: logger.debug("DefaultArtifact.out: " + identifier); sascha@42: } sascha@10: } sascha@10: ingo@269: public void out( ingo@269: String type, ingo@269: Document format, ingo@269: OutputStream out, ingo@269: CallContext context ingo@269: ) ingo@269: throws IOException ingo@269: { ingo@269: if (logger.isDebugEnabled()) { ingo@269: logger.debug("DefaultArtifact.out: " + identifier); ingo@269: } ingo@269: } ingo@269: felix@367: public void setup(String identifier, felix@367: ArtifactFactory factory, felix@367: Object context, felix@367: CallMeta callMeta, felix@367: Document data) felix@367: { sascha@42: if (logger.isDebugEnabled()) { sascha@42: logger.debug("DefaultArtifact.setup: " + identifier); sascha@42: } sascha@10: this.identifier = identifier; sascha@10: } sascha@10: sascha@10: public void endOfLife(Object context) { sascha@42: if (logger.isDebugEnabled()) { sascha@42: logger.debug("DefaultArtifact.endOfLife: " + identifier); sascha@42: } sascha@10: } ingo@82: ingo@82: public void cleanup(Object context) { sascha@91: if (logger.isDebugEnabled()) { sascha@91: logger.debug("DefaultArtifact.cleanup: " + identifier); sascha@91: } ingo@82: } sascha@10: } sascha@91: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :