# HG changeset patch # User Ingo Weinzierl # Date 1302615993 0 # Node ID 7f7f6d2c4b2c7ee548b2a028b342a8de5bb9afb0 # Parent a13382876e5db5838cdbf0195b7653ee7d949b88 We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now. flys-client/trunk@1673 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r a13382876e5d -r 7f7f6d2c4b2c flys-client/ChangeLog --- a/flys-client/ChangeLog Tue Apr 12 13:11:46 2011 +0000 +++ b/flys-client/ChangeLog Tue Apr 12 13:46:33 2011 +0000 @@ -1,3 +1,17 @@ +2011-04-12 Ingo Weinzierl + + * src/main/java/de/intevation/flys/client/shared/model/Artifact.java, + src/main/java/de/intevation/flys/client/shared/model/DefaultArtifact.java: + An artifact knows its name now. It is retrievable via getName(). + + * src/main/java/de/intevation/flys/client/shared/model/WINFOArtifact.java: + New. A concrete class that represents an Artifact using the WINFO + parameterization. + + * src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java: + The ArtifactCreator builds up new Artifacts based on the name in the + DESCRIBE document. If no name is included, a DefaultArtifact is created. + 2011-04-12 Ingo Weinzierl * src/main/java/de/intevation/flys/client/shared/model/CollectionRecord.java: diff -r a13382876e5d -r 7f7f6d2c4b2c flys-client/src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java Tue Apr 12 13:11:46 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java Tue Apr 12 13:46:33 2011 +0000 @@ -9,6 +9,7 @@ import de.intevation.flys.client.shared.model.Artifact; import de.intevation.flys.client.shared.model.DefaultArtifact; +import de.intevation.flys.client.shared.model.WINFOArtifact; /** @@ -26,6 +27,9 @@ /** The XPath to the artifact's hash value.*/ public static final String XPATH_HASH = "/art:result/art:hash/@art:value"; + /** The XPath to the artifact's name value.*/ + public static final String XPATH_NAME = "/art:result/art:name/@art:value"; + /** * Creates a new instance of an {@link ArtifactCreator}. @@ -69,8 +73,23 @@ String hash = XMLUtils.xpathString( doc, XPATH_HASH, ArtifactNamespaceContext.INSTANCE); + String name = XMLUtils.xpathString( + doc, XPATH_NAME, ArtifactNamespaceContext.INSTANCE); + System.out.println("NEW Artifact UUID: " + uuid); System.out.println("NEW Artifact HASH: " + hash); + System.out.println("NEW Artifact NAME: " + name); + + if (name == null) { + return new DefaultArtifact(uuid, hash); + } + + name = name.trim(); + + if (name.length() > 0 && name.equals("winfo")) { + System.out.println("+++++ NEW WINFO ARTIFACT."); + return new WINFOArtifact(uuid, hash); + } return new DefaultArtifact(uuid, hash); } diff -r a13382876e5d -r 7f7f6d2c4b2c flys-client/src/main/java/de/intevation/flys/client/shared/model/Artifact.java --- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/Artifact.java Tue Apr 12 13:11:46 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/Artifact.java Tue Apr 12 13:46:33 2011 +0000 @@ -28,6 +28,13 @@ /** + * Returns the name of the artifact. + * + * @return the name- + */ + public String getName(); + + /** * Returns the ArtifactDescription. * * @return the artifact description. diff -r a13382876e5d -r 7f7f6d2c4b2c flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultArtifact.java --- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultArtifact.java Tue Apr 12 13:11:46 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultArtifact.java Tue Apr 12 13:46:33 2011 +0000 @@ -48,6 +48,11 @@ } + public String getName() { + return "default"; + } + + public ArtifactDescription getArtifactDescription() { return artifactDescription; } diff -r a13382876e5d -r 7f7f6d2c4b2c flys-client/src/main/java/de/intevation/flys/client/shared/model/WINFOArtifact.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/WINFOArtifact.java Tue Apr 12 13:46:33 2011 +0000 @@ -0,0 +1,28 @@ +package de.intevation.flys.client.shared.model; + + +/** + * The WINFO implementation of an Artifact. + * + * @author Ingo Weinzierl + */ +public class WINFOArtifact extends DefaultArtifact { + + /** The name of this artifact: 'winfo'.*/ + public static final String NAME = "winfo"; + + + public WINFOArtifact() { + } + + + public WINFOArtifact(String uuid, String hash) { + super(uuid, hash); + } + + + public String getName() { + return NAME; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :