annotate flys-client/src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java @ 1530:f1f0e9c75026

Added new artifact to be able to open existing 'new chart' projects. flys-client/trunk@3737 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 20 Jan 2012 09:25:00 +0000
parents f22713b5d29d
children fe67f1345687
rev   line source
14
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.server;
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
3 import java.util.ArrayList;
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
4 import java.util.List;
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
5
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
6 import javax.xml.xpath.XPathConstants;
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
7
14
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import org.w3c.dom.Document;
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
9 import org.w3c.dom.Element;
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
10 import org.w3c.dom.NodeList;
14
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
12 import org.apache.log4j.Logger;
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
13
16
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
14 import de.intevation.artifacts.common.utils.XMLUtils;
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
15 import de.intevation.artifacts.common.ArtifactNamespaceContext;
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
16
14
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import de.intevation.artifacts.httpclient.utils.ArtifactCreator;
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import de.intevation.flys.client.shared.model.Artifact;
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
20 import de.intevation.flys.client.shared.model.CalculationMessage;
14
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import de.intevation.flys.client.shared.model.DefaultArtifact;
227
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
22 import de.intevation.flys.client.shared.model.WINFOArtifact;
1513
f43862cc1e6e Added new artifact 'MapArtifact' for module 'new map'. This allows to open an
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1367
diff changeset
23 import de.intevation.flys.client.shared.model.MapArtifact;
1530
f1f0e9c75026 Added new artifact to be able to open existing 'new chart' projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1521
diff changeset
24 import de.intevation.flys.client.shared.model.ChartArtifact;
14
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 /**
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 * An implementation of an {@link ArtifactCreator}. This class uses the document
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 * that is returned by the artifact server to parse important information (like
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 * uuid, hash) and returns a new {@link Artifact} instance.
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 *
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 */
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 public class FLYSArtifactCreator implements ArtifactCreator {
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
36 private static final Logger logger =
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
37 Logger.getLogger(FLYSArtifactCreator.class);
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
38
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
39
16
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
40 /** The XPath to the artifact's uuid.*/
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
41 public static final String XPATH_UUID = "/art:result/art:uuid/@art:value";
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
42
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
43 /** The XPath to the artifact's hash value.*/
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
44 public static final String XPATH_HASH = "/art:result/art:hash/@art:value";
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
45
227
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
46 /** The XPath to the artifact's name value.*/
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
47 public static final String XPATH_NAME = "/art:result/art:name/@art:value";
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
48
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
49 /** The XPath to the value that determines if the artifact is processing in
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
50 * background.*/
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
51 public static final String XPATH_BACKGROUND_VALUE =
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
52 "/art:result/art:background-processing/@art:value";
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
53
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
54 /** The XPath that points to the (if existing) background messages.*/
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
55 public static final String XPATH_BACKGROUND =
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
56 "/art:result/art:background-processing";
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
57
16
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
58
14
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 /**
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 * Creates a new instance of an {@link ArtifactCreator}.
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 */
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 public FLYSArtifactCreator() {
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 }
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 /**
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 * This concreate implementation returns an instance of {@link Artifact}
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 * that is used in the FLYS GWT Client code.
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 *
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 * @param doc A document that describes the artifact that has been created
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 * in the artifact server.
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 *
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 * @return an instance if {@link Artifact}.
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 */
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 public Object create(Document doc) {
16
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
76 Artifact artifact = extractArtifact(doc);
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
77 artifact.setArtifactDescription(
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
78 ArtifactDescriptionFactory.createArtifactDescription(doc));
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
79
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
80 return artifact;
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
81 }
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
82
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
83
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
84 /**
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
85 * This method extracts the UUID und HASH information of the returned
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
86 * artifact document.
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
87 *
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
88 * @param doc The result of the CREATE operation.
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
89 *
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
90 * @return an instance of an {@link Artifact}.
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
91 */
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
92 protected Artifact extractArtifact(Document doc) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
93 logger.debug("FLYSArtifactCreator - extractArtifact()");
16
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
94
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
95 String uuid = XMLUtils.xpathString(
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
96 doc, XPATH_UUID, ArtifactNamespaceContext.INSTANCE);
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
97
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
98 String hash = XMLUtils.xpathString(
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
99 doc, XPATH_HASH, ArtifactNamespaceContext.INSTANCE);
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
100
227
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
101 String name = XMLUtils.xpathString(
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
102 doc, XPATH_NAME, ArtifactNamespaceContext.INSTANCE);
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
103
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
104 String backgroundStr = XMLUtils.xpathString(
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
105 doc, XPATH_BACKGROUND_VALUE, ArtifactNamespaceContext.INSTANCE);
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
106
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
107 boolean background = false;
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
108 if (backgroundStr != null && backgroundStr.length() > 0) {
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
109 background = Boolean.valueOf(backgroundStr);
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
110 }
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
111
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
112 List<CalculationMessage> msg = parseBackgroundMessages(doc);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
113
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
114 logger.debug("NEW Artifact UUID: " + uuid);
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
115 logger.debug("NEW Artifact HASH: " + hash);
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
116 logger.debug("NEW Artifact NAME: " + name);
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
117 logger.debug("NEW Artifact IN BACKGROUND: " + background);
227
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
118
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
119 if (name == null) {
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
120 return new DefaultArtifact(uuid, hash, background, msg);
227
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
121 }
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
122
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
123 name = name.trim();
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
124
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
125 if (name.length() > 0 && name.equals("winfo")) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
126 logger.debug("+++++ NEW WINFO ARTIFACT.");
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
127 return new WINFOArtifact(uuid, hash, background, msg);
227
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
128 }
1521
f22713b5d29d Repaired broken MapArtifact creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1513
diff changeset
129 else if (name.length() > 0 && name.equals("new_map")) {
1513
f43862cc1e6e Added new artifact 'MapArtifact' for module 'new map'. This allows to open an
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1367
diff changeset
130 logger.debug("+++++ NEW MAP ARTIFACT.");
f43862cc1e6e Added new artifact 'MapArtifact' for module 'new map'. This allows to open an
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1367
diff changeset
131 return new MapArtifact(uuid, hash, background, msg);
f43862cc1e6e Added new artifact 'MapArtifact' for module 'new map'. This allows to open an
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1367
diff changeset
132 }
1530
f1f0e9c75026 Added new artifact to be able to open existing 'new chart' projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1521
diff changeset
133 else if (name.length() > 0 && name.equals("new_chart")) {
f1f0e9c75026 Added new artifact to be able to open existing 'new chart' projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1521
diff changeset
134 logger.debug("+++++ NEW CHART ARTIFACT.");
f1f0e9c75026 Added new artifact to be able to open existing 'new chart' projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1521
diff changeset
135 return new ChartArtifact(uuid, hash, background, msg);
f1f0e9c75026 Added new artifact to be able to open existing 'new chart' projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1521
diff changeset
136 }
16
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
137
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
138 return new DefaultArtifact(uuid, hash, background, msg);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
139 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
140
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
141
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
142 public static List<CalculationMessage> parseBackgroundMessages(Document d) {
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
143 NodeList list = (NodeList) XMLUtils.xpath(
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
144 d, XPATH_BACKGROUND, XPathConstants.NODESET,
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
145 ArtifactNamespaceContext.INSTANCE);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
146
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
147 int len = list != null ? list.getLength() : 0;
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
148
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
149 logger.debug("Found " + len + " background messages.");
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
150
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
151 List<CalculationMessage> res = new ArrayList<CalculationMessage>(len);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
152
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
153 for (int i = 0; i < len; i++) {
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
154 CalculationMessage msg = parseBackgroundMessage(
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
155 (Element) list.item(i));
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
156
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
157 if (msg != null) {
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
158 res.add(msg);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
159 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
160 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
161
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
162 return res;
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
163 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
164
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
165
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
166 public static CalculationMessage parseBackgroundMessage(Element e) {
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
167 String steps = e.getAttribute("art:steps");
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
168 String currentStep = e.getAttribute("art:currentStep");
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
169 String message = e.getTextContent();
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
170
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
171 int lenCurStep = currentStep != null ? currentStep.length() : 0;
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
172 int lenSteps = steps != null ? steps.length() : 0;
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
173 int lenMessage = message != null ? message.length() : 0;
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
174
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
175 if (lenSteps > 0 && lenMessage > 0 && lenCurStep > 0) {
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
176 try {
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
177 return new CalculationMessage(
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
178 Integer.parseInt(steps),
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
179 Integer.parseInt(currentStep),
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
180 message);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
181
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
182 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
183 catch (NumberFormatException nfe) {
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
184 nfe.printStackTrace();
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
185 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
186 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
187
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
188 return null;
14
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189 }
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
190 }
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org