Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java @ 913:9976d99aea34
Added loadMany-function to LoadArtifactService.
flys-client/trunk@2774 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 16 Sep 2011 11:09:39 +0000 |
parents | d5fb88ba99d2 |
children | ab8eb2f544f2 |
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 |
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
|
12 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
|
13 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
|
14 |
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
|
15 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
|
16 |
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.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
|
18 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
|
19 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
|
20 import de.intevation.flys.client.shared.model.WINFOArtifact; |
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 |
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
|
22 |
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
|
23 /** |
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
|
24 * 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
|
25 * 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
|
26 * 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
|
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 * @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
|
29 */ |
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 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
|
31 |
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
|
32 /** 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
|
33 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
|
34 |
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
|
35 /** 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
|
36 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
|
37 |
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
|
38 /** 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
|
39 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
|
40 |
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
|
41 /** 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
|
42 * background.*/ |
870
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
43 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
|
44 "/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
|
45 |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
46 /** 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
|
47 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
|
48 "/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
|
49 |
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
|
50 |
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
|
51 /** |
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
|
52 * 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
|
53 */ |
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
|
54 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
|
55 } |
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
|
56 |
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
|
57 |
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
|
58 /** |
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 * 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
|
60 * 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
|
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 * @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
|
63 * 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
|
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 * @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
|
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 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
|
68 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
|
69 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
|
70 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
|
71 |
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
|
72 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
|
73 } |
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
|
74 |
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
|
75 |
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 /** |
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 * 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
|
78 * 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
|
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 * @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
|
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 * @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
|
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 protected Artifact extractArtifact(Document 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
|
85 System.out.println("FLYSArtifactCreator - extractArtifact()"); |
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 |
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 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
|
88 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
|
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 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
|
91 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
|
92 |
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
|
93 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
|
94 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
|
95 |
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
|
96 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
|
97 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
|
98 |
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
|
99 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
|
100 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
|
101 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
|
102 } |
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
|
103 |
870
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
104 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
|
105 |
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
|
106 System.out.println("NEW Artifact UUID: " + 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
|
107 System.out.println("NEW Artifact HASH: " + hash); |
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
|
108 System.out.println("NEW Artifact NAME: " + name); |
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
|
109 System.out.println("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
|
110 |
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
|
111 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
|
112 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
|
113 } |
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
|
114 |
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
|
115 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
|
116 |
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
|
117 if (name.length() > 0 && name.equals("winfo")) { |
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 System.out.println("+++++ 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
|
119 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
|
120 } |
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
|
121 |
870
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
122 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
|
123 } |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
124 |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
125 |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
126 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
|
127 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
|
128 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
|
129 ArtifactNamespaceContext.INSTANCE); |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
130 |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
131 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
|
132 |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
133 System.out.println("Found " + len + " background messages."); |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
134 |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
135 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
|
136 |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
137 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
|
138 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
|
139 (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
|
140 |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
141 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
|
142 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
|
143 } |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
144 } |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
145 |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
146 return res; |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
147 } |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
148 |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
149 |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
150 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
|
151 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
|
152 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
|
153 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
|
154 |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
155 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
|
156 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
|
157 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
|
158 |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
159 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
|
160 try { |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
161 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
|
162 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
|
163 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
|
164 message); |
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 } |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
167 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
|
168 nfe.printStackTrace(); |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
169 } |
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 |
d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
862
diff
changeset
|
172 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
|
173 } |
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
|
174 } |
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
|
175 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |