changeset 110:ff3335057f11

Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing. flys-artifacts/trunk@1296 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 04 Feb 2011 16:57:08 +0000
parents 9891d133f08d
children 7222d8fb53ea
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java
diffstat 2 files changed, 29 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Feb 04 11:18:59 2011 +0000
+++ b/flys-artifacts/ChangeLog	Fri Feb 04 16:57:08 2011 +0000
@@ -1,3 +1,9 @@
+2011-02-04  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java: Describe()
+	  returns the artifact's uuid and hash value. The whole implementation of
+	  describe() is still outstanding.
+
 2011-02-04  Ingo Weinzierl <ingo@intevation.de>
 
 	* doc/conf/artifacts/winfo.xml: Removed useless config stuff.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Fri Feb 04 11:18:59 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Fri Feb 04 16:57:08 2011 +0000
@@ -1,24 +1,23 @@
 package de.intevation.flys.artifacts;
 
-import java.io.IOException;
-import java.io.OutputStream;
 import java.util.List;
 
-import javax.xml.xpath.XPathConstants;
-
 import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
 import org.apache.log4j.Logger;
 
 import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.ArtifactNamespaceContext;
 import de.intevation.artifacts.CallContext;
 
+import de.intevation.artifactdatabase.DefaultArtifact;
+import de.intevation.artifactdatabase.ProtocolUtils;
+import de.intevation.artifactdatabase.state.State;
+import de.intevation.artifactdatabase.state.StateEngine;
+
 import de.intevation.artifacts.common.utils.XMLUtils;
 
-import de.intevation.artifactdatabase.DefaultArtifact;
-import de.intevation.artifactdatabase.state.State;
-import de.intevation.artifactdatabase.state.StateEngine;
-
 import de.intevation.flys.artifacts.context.FLYSContext;
 
 
@@ -46,7 +45,6 @@
      * The default constructor.
      */
     public WINFOArtifact() {
-        super();
     }
 
 
@@ -99,10 +97,23 @@
      * @return the description of this artifact.
      */
     public Document describe(Document data, CallContext context) {
-        logger.debug("Describe the artifact.");
-        logger.debug("The current state is: " + currentState.getID());
+        logger.debug("Describe: the current state is: " + currentState.getID());
 
-        return super.describe(data, context);
+        Document description = XMLUtils.newDocument();
+
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            description,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX);
+
+        Element root = ProtocolUtils.createRootNode(creator);
+        ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash());
+
+        logger.warn("TODO: Implement the whole description!");
+
+        description.appendChild(root);
+
+        return description;
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org