Mercurial > dive4elements > framework
annotate artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java @ 235:3e29395ebac6
The XML documents stored aside users, collections and collection items are now compressed/decompressed transparently.
artifacts/trunk@1642 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 04 Apr 2011 09:28:54 +0000 |
parents | 16cd059945e5 |
children | a8a06bbe306c |
rev | line source |
---|---|
100
933bbc9fc11f
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
94
diff
changeset
|
1 /* |
933bbc9fc11f
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
94
diff
changeset
|
2 * Copyright (c) 2010 by Intevation GmbH |
933bbc9fc11f
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
94
diff
changeset
|
3 * |
933bbc9fc11f
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
94
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
933bbc9fc11f
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
94
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
933bbc9fc11f
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
94
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
933bbc9fc11f
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
94
diff
changeset
|
7 */ |
933bbc9fc11f
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
94
diff
changeset
|
8 |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 package de.intevation.artifactdatabase; |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
207
b2115f484edb
Move Config and XMLUtils totally to commons package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
11 import de.intevation.artifacts.common.utils.XMLUtils; |
b2115f484edb
Move Config and XMLUtils totally to commons package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
12 |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
13 import de.intevation.artifactdatabase.Backend.PersistentArtifact; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
14 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
15 import de.intevation.artifacts.Artifact; |
158
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
16 import de.intevation.artifacts.ArtifactCollection; |
155
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
17 import de.intevation.artifacts.ArtifactCollectionFactory; |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
18 import de.intevation.artifacts.ArtifactDatabase; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
19 import de.intevation.artifacts.ArtifactDatabaseException; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
20 import de.intevation.artifacts.ArtifactFactory; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
21 import de.intevation.artifacts.ArtifactNamespaceContext; |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
22 import de.intevation.artifacts.ArtifactSerializer; |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
23 import de.intevation.artifacts.CallContext; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
24 import de.intevation.artifacts.CallMeta; |
189
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
25 import de.intevation.artifacts.CollectionItem; |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
26 import de.intevation.artifacts.Service; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
27 import de.intevation.artifacts.ServiceFactory; |
149
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
28 import de.intevation.artifacts.User; |
130
147610c43863
The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
29 import de.intevation.artifacts.UserFactory; |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
30 |
75
d4c4c23847f5
Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
31 import java.io.IOException; |
d4c4c23847f5
Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
32 import java.io.OutputStream; |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
33 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
34 import java.security.MessageDigest; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
35 import java.security.NoSuchAlgorithmException; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
36 |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
37 import java.util.Arrays; |
168
f70977cf2faf
Avoid Nullpointer exception in listCollections() when no creation time of the collection is returned.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
167
diff
changeset
|
38 import java.util.Date; |
75
d4c4c23847f5
Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
39 import java.util.HashMap; |
d4c4c23847f5
Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
40 import java.util.HashSet; |
230
fbd57d2eeaef
Changed semantics of locked artifact ids.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
228
diff
changeset
|
41 import java.util.Set; |
75
d4c4c23847f5
Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
42 |
160
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
43 import javax.xml.xpath.XPathConstants; |
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
44 |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
45 import org.apache.commons.codec.binary.Base64; |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
46 import org.apache.commons.codec.binary.Hex; |
75
d4c4c23847f5
Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
47 |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
48 import org.apache.log4j.Logger; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
49 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
50 import org.w3c.dom.Document; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
51 import org.w3c.dom.Element; |
160
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
52 import org.w3c.dom.Node; |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
53 |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 /** |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
55 * The core implementation of artifact database. This layer exposes |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
56 * the needed methods to the artifact runtime system which e.g. may |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
57 * expose them via REST. The concrete persistent representation of the |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
58 * artifacts is handled by the {@link Backend backend}. |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
59 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 */ |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 public class ArtifactDatabaseImpl |
233
16cd059945e5
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
230
diff
changeset
|
62 implements ArtifactDatabase, |
230
fbd57d2eeaef
Changed semantics of locked artifact ids.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
228
diff
changeset
|
63 DatabaseCleaner.LockedIdsProvider, |
fbd57d2eeaef
Changed semantics of locked artifact ids.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
228
diff
changeset
|
64 Backend.FactoryLookup |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 { |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
66 private static Logger logger = |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
67 Logger.getLogger(ArtifactDatabaseImpl.class); |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 |
153
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
69 /** Message that is returned if an operation was successful.*/ |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
70 public static final String OPERATION_SUCCESSFUL = |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
71 "SUCCESS"; |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
72 |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
73 /** Message that is returned if an operation failed.*/ |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
74 public static final String OPERATION_FAILURE = |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
75 "FAILURE"; |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
76 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
77 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
78 * Error message issued if a requested artifact factory |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
79 * is not registered to this database. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
80 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
81 public static final String NO_SUCH_FACTORY = |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
82 "No such factory"; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
83 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
84 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
85 * Error message issued if a requested artifact is not found |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
86 * in this database. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
87 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
88 public static final String NO_SUCH_ARTIFACT = |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
89 "No such artifact"; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
90 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
91 /** |
222
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
92 * Error message issued if a requested artifact is not found |
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
93 * in this database. |
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
94 */ |
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
95 public static final String NO_SUCH_COLLECTION = |
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
96 "No such collection"; |
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
97 |
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
98 /** |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
99 * Error message issued if the creation of an artifact failed. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
100 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
101 public static final String CREATION_FAILED = |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
102 "Creation of artifact failed"; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
103 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
104 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
105 * Error message if an severe internal error occurred. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
106 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
107 public static final String INTERNAL_ERROR = |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
108 "Creation of artifact failed"; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
109 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
110 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
111 * Error message issued if a requested service is not |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
112 * offered by this database. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
113 */ |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
114 public static final String NO_SUCH_SERVICE = |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
115 "No such service"; |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
116 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
117 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
118 * Default digest hash to be used while im-/exporting artifacts. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
119 */ |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
120 public static final String DIGEST_ALGORITHM = |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
121 "SHA-1"; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
122 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
123 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
124 * XPath to get the checksum from an XML representation of |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
125 * an exported artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
126 */ |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
127 public static final String XPATH_IMPORT_CHECKSUM = |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
128 "/art:action/art:data/@checksum"; |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
129 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
130 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
131 * XPath to get the name of the factory which should be |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
132 * used to revive an antrifact that is going to be imported. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
133 */ |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
134 public static final String XPATH_IMPORT_FACTORY = |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
135 "/art:action/art:data/@factory"; |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
136 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
137 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
138 * XPath to get the base64 encoded data of an artifact |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
139 * that is going to be imported. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
140 */ |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
141 public static final String XPATH_IMPORT_DATA = |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
142 "/art:action/art:data/text()"; |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
143 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
144 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
145 * Error message issued if the checksum of an |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
146 * artifact to be imported has an invalid syntax. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
147 */ |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
148 public static final String INVALID_CHECKSUM = |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
149 "Invalid checksum"; |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
150 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
151 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
152 * Error message issued the checksum validation |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
153 * of an artifact to be imported fails. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
154 */ |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
155 public static final String CHECKSUM_MISMATCH = |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
156 "Mismatching checksum"; |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
157 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
158 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
159 * Error message issued if an artifact to be imported |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
160 * does not have any data. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
161 */ |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
162 public static final String NO_DATA = |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
163 "No data"; |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
164 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
165 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
166 * Error message issued if the deserialization of |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
167 * an artifact to be imported fails. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
168 */ |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
169 public static final String INVALID_ARTIFACT = |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
170 "Invalid artifact"; |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
171 |
149
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
172 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
173 // User constants |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
174 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
175 /** |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
176 * Error message issued if the creation of a user failed. |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
177 */ |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
178 public static final String USER_CREATION_FAILED = |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
179 "Creation of user failed."; |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
180 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
181 /** XPath to figure out the name of a new user.*/ |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
182 public static final String XPATH_USERNAME = |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
183 "/art:action/art:user/@name"; |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
184 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
185 /** XPath to figure out the role of a new user.*/ |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
186 public static final String XPATH_USERROLE = |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
187 "/art:action/art:user/art:role"; |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
188 |
152
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
189 /** Error message if a specified user does not exist.*/ |
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
190 public static final String NO_SUCH_USER = |
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
191 "No such user"; |
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
192 |
149
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
193 /** Error message if no username is given for user creation.*/ |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
194 public static final String NO_USERNAME = |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
195 "Invalid username"; |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
196 |
158
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
197 // Collection constants |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
198 |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
199 /** |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
200 * Error message issued if the creation of a collection failed. |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
201 */ |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
202 public static final String COLLECTION_CREATION_FAILED = |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
203 "Creation of collection failed"; |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
204 |
162
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
205 /** |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
206 * XPath to figure out the name of a collection described in the incoming |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
207 * document. |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
208 */ |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
209 public static final String XPATH_COLLECTION_NAME = |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
210 "/art:action/art:type/art:collection/@name"; |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
211 |
189
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
212 /** |
198
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
213 * XPath to figure out the attributes for a collection. |
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
214 */ |
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
215 public static final String XPATH_COLLECTION_ATTRIBUTE = |
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
216 "/art:action/art:type/art:collection/art:attribute"; |
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
217 |
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
218 /** |
189
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
219 * XPath to figure out the attributes for an artifact that is put into a |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
220 * collection. |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
221 */ |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
222 public static final String XPATH_COLLECTION_ITEM_ATTRIBUTE = |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
223 "/art:action/art:type/art:artifact/art:attribute"; |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
224 |
149
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
225 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
226 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
227 * This inner class allows the deferral of writing the output |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
228 * of the artifact's out() call. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
229 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
230 public class DeferredOutputImpl |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
231 implements DeferredOutput |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
232 { |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
233 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
234 * The persistence wrapper around a living artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
235 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
236 protected PersistentArtifact artifact; |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
237 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
238 * The input document for the artifact's out() call. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
239 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
240 protected Document format; |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
241 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
242 * The meta information of the artifact's out() call. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
243 */ |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
244 protected CallMeta callMeta; |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
245 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
246 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
247 * Default constructor. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
248 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
249 public DeferredOutputImpl() { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
250 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
251 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
252 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
253 * Constructor to create a deferred execution unit for |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
254 * the artifact's out() call given an artifact, an input document |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
255 * an the meta information. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
256 * @param artifact The persistence wrapper around a living artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
257 * @param format The input document for the artifact's out() call. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
258 * @param callMeta The meta information of the artifact's out() call. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
259 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
260 public DeferredOutputImpl( |
47
4ae4dc99127d
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
41
diff
changeset
|
261 PersistentArtifact artifact, |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
262 Document format, |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
263 CallMeta callMeta |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
264 ) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
265 this.artifact = artifact; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
266 this.format = format; |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
267 this.callMeta = callMeta; |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
268 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
269 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
270 public void write(OutputStream output) throws IOException { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
271 |
219
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
272 ArtifactCallContext cc = new ArtifactCallContext( |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
273 ArtifactDatabaseImpl.this, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
274 CallContext.TOUCH, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
275 callMeta, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
276 context, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
277 artifact); |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
278 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
279 try { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
280 artifact.getArtifact().out(format, output, cc); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
281 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
282 finally { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
283 cc.postCall(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
284 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
285 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
286 } // class DeferredOutputImpl |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
287 |
228
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
288 |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
289 /** |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
290 * This inner class allows the deferral of writing the output |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
291 * of the artifact's out() call. |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
292 */ |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
293 public class DeferredCollectionOutputImpl |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
294 implements DeferredOutput |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
295 { |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
296 /** |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
297 * The persistence wrapper around a living collection. |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
298 */ |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
299 protected ArtifactCollection collection; |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
300 /** |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
301 * The input document for the collection's out() call. |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
302 */ |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
303 protected Document format; |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
304 /** |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
305 * The meta information of the collection's out() call. |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
306 */ |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
307 protected CallMeta callMeta; |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
308 |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
309 /** |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
310 * Default constructor. |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
311 */ |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
312 public DeferredCollectionOutputImpl() { |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
313 } |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
314 |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
315 /** |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
316 * Constructor to create a deferred execution unit for |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
317 * the collection's out() call given a collection, an input document |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
318 * an the meta information. |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
319 * @param collection The collection. |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
320 * @param format The input document for the collection's out() call. |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
321 * @param callMeta The meta information of the collection's out() call. |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
322 */ |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
323 public DeferredCollectionOutputImpl( |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
324 ArtifactCollection collection, |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
325 Document format, |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
326 CallMeta callMeta |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
327 ) { |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
328 this.collection = collection; |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
329 this.format = format; |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
330 this.callMeta = callMeta; |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
331 } |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
332 |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
333 public void write(OutputStream output) throws IOException { |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
334 |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
335 CollectionCallContext cc = new CollectionCallContext( |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
336 ArtifactDatabaseImpl.this, |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
337 CallContext.TOUCH, |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
338 callMeta, |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
339 context, |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
340 collection); |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
341 |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
342 try { |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
343 collection.out(format, output, cc); |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
344 } |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
345 finally { |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
346 cc.postCall(); |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
347 } |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
348 } |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
349 } // class DeferredCollectionOutputImpl |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
350 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
351 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
352 * List of name/description pairs needed for |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
353 * {@link #artifactFactoryNamesAndDescriptions() }. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
354 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
355 protected String [][] factoryNamesAndDescription; |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
356 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
357 * Map to access artifact factories by there name. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
358 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
359 protected HashMap name2factory; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
360 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
361 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
362 * List of name/description pairs needed for |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
363 * {@link #serviceNamesAndDescriptions() }. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
364 */ |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
365 protected String [][] serviceNamesAndDescription; |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
366 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
367 * Map to access services by there name. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
368 */ |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
369 protected HashMap name2service; |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
370 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
371 /** |
155
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
372 * The factory that is used to create new artifact collections. |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
373 */ |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
374 protected ArtifactCollectionFactory collectionFactory; |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
375 |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
376 /** |
127
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
377 * The factory that is used to create and list users. |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
378 */ |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
379 protected UserFactory userFactory; |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
380 |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
381 /** |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
382 * Reference to the storage backend. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
383 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
384 protected Backend backend; |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
385 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
386 * Reference of the global context of the artifact runtime system. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
387 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
388 protected Object context; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
389 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
390 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
391 * The signing secret to be used for ex-/importing artifacts. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
392 */ |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
393 protected byte [] exportSecret; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
394 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
395 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
396 * A set of ids of artifact which currently running in background. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
397 * This artifacts should not be removed from the database by the |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
398 * database cleaner. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
399 */ |
230
fbd57d2eeaef
Changed semantics of locked artifact ids.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
228
diff
changeset
|
400 protected HashSet<Integer> backgroundIds; |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
401 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
402 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
403 * Default constructor. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
404 */ |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
405 public ArtifactDatabaseImpl() { |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
406 } |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
407 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
408 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
409 * Constructor to create a artifact database with the given |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
410 * bootstrap parameters like artifact- and service factories et. al. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
411 * Created this way the artifact database has no backend. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
412 * @param bootstrap The parameters to start this artifact database. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
413 */ |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
414 public ArtifactDatabaseImpl(FactoryBootstrap bootstrap) { |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
415 this(bootstrap, null); |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
416 } |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
417 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
418 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
419 * Constructor to create a artifact database with the a given |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
420 * backend and |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
421 * bootstrap parameters like artifact- and service factories et. al. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
422 * @param bootstrap The parameters to start this artifact database. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
423 * @param backend The storage backend. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
424 */ |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
425 public ArtifactDatabaseImpl(FactoryBootstrap bootstrap, Backend backend) { |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
426 |
230
fbd57d2eeaef
Changed semantics of locked artifact ids.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
228
diff
changeset
|
427 backgroundIds = new HashSet<Integer>(); |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
428 |
155
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
429 setupArtifactCollectionFactory(bootstrap); |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
430 setupArtifactFactories(bootstrap); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
431 setupServices(bootstrap); |
127
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
432 setupUserFactory(bootstrap); |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
433 |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
434 context = bootstrap.getContext(); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
435 exportSecret = bootstrap.getExportSecret(); |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
436 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
437 wireWithBackend(backend); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
438 } |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
439 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
440 /** |
155
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
441 * Used to extract the artifact collection factory from bootstrap. |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
442 * |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
443 * @param bootstrap The bootstrap parameters. |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
444 */ |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
445 protected void setupArtifactCollectionFactory(FactoryBootstrap bootstrap) { |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
446 collectionFactory = bootstrap.getArtifactCollectionFactory(); |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
447 } |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
448 |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
449 /** |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
450 * Used to extract the artifact factories from the bootstrap |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
451 * parameters and building the internal lookup tables. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
452 * @param bootstrap The bootstrap parameters. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
453 */ |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
454 protected void setupArtifactFactories(FactoryBootstrap bootstrap) { |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
455 name2factory = new HashMap(); |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
456 |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
457 ArtifactFactory [] factories = bootstrap.getArtifactFactories(); |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
458 factoryNamesAndDescription = new String[factories.length][]; |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
459 |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
460 for (int i = 0; i < factories.length; ++i) { |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
461 |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
462 ArtifactFactory factory = factories[i]; |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
463 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
464 String name = factory.getName(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
465 String description = factory.getDescription(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
466 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
467 factoryNamesAndDescription[i] = |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
468 new String [] { name, description }; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
469 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
470 name2factory.put(name, factory); |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
471 } |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
472 } |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
473 |
127
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
474 |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
475 /** |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
476 * Used to extract the user factory from the bootstrap. |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
477 */ |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
478 protected void setupUserFactory(FactoryBootstrap bootstrap) { |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
479 userFactory = bootstrap.getUserFactory(); |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
480 } |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
481 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
482 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
483 * Used to extract the service factories from the bootstrap |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
484 * parameters, setting up the services and building the internal |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
485 * lookup tables. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
486 * @param bootstrap The bootstrap parameters. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
487 */ |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
488 protected void setupServices(FactoryBootstrap bootstrap) { |
26
83a059c204f8
Connected /create with artifact db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
13
diff
changeset
|
489 |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
490 name2service = new HashMap(); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
491 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
492 ServiceFactory [] serviceFactories = |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
493 bootstrap.getServiceFactories(); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
494 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
495 serviceNamesAndDescription = |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
496 new String[serviceFactories.length][]; |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
497 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
498 for (int i = 0; i < serviceFactories.length; ++i) { |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
499 ServiceFactory factory = serviceFactories[i]; |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
500 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
501 String name = factory.getName(); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
502 String description = factory.getDescription(); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
503 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
504 serviceNamesAndDescription[i] = |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
505 new String [] { name, description }; |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
506 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
507 name2service.put( |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
508 name, |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
509 factory.createService(bootstrap.getContext())); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
510 } |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
511 |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
512 } |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
513 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
514 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
515 * Wires a storage backend to this artifact database and |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
516 * establishes a callback to be able to revive artifacts |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
517 * via the serializers of this artifact factories. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
518 * @param backend The backend to be wired with this artifact database. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
519 */ |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
520 public void wireWithBackend(Backend backend) { |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
521 if (backend != null) { |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
522 this.backend = backend; |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
523 backend.setFactoryLookup(this); |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
524 } |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
525 } |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
526 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
527 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
528 * Called after an backgrounded artifact signals its |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
529 * will to be written back to the backend. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
530 * @param artifact The persistence wrapper around |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
531 * the backgrounded artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
532 * @param action The action to be performed. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
533 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
534 protected void fromBackground(PersistentArtifact artifact, int action) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
535 logger.warn("BACKGROUND processing is not fully implemented, yet!"); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
536 switch (action) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
537 case CallContext.NOTHING: |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
538 break; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
539 case CallContext.TOUCH: |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
540 artifact.touch(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
541 break; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
542 case CallContext.STORE: |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
543 artifact.store(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
544 break; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
545 default: |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
546 logger.warn("operation not allowed in fromBackground"); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
547 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
548 removeIdFromBackground(artifact.getId()); |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
549 } |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
550 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
551 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
552 * Removes an artifact's database id from the set of backgrounded |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
553 * artifacts. The database cleaner is now able to remove it safely |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
554 * from the database again. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
555 * @param id The database id of the artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
556 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
557 protected void removeIdFromBackground(int id) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
558 synchronized (backgroundIds) { |
230
fbd57d2eeaef
Changed semantics of locked artifact ids.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
228
diff
changeset
|
559 backgroundIds.remove(id); |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
560 } |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
561 } |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
562 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
563 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
564 * Adds an artifact's database id to the set of artifacts |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
565 * running in backgroound. To be in this set prevents the |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
566 * artifact to be removed from the database by the database cleaner. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
567 * @param id The database id of the artifact to be protected |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
568 * from being removed from the database. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
569 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
570 protected void addIdToBackground(int id) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
571 synchronized (backgroundIds) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
572 backgroundIds.add(Integer.valueOf(id)); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
573 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
574 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
575 |
230
fbd57d2eeaef
Changed semantics of locked artifact ids.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
228
diff
changeset
|
576 public Set<Integer> getLockedIds() { |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
577 synchronized (backgroundIds) { |
230
fbd57d2eeaef
Changed semantics of locked artifact ids.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
228
diff
changeset
|
578 return new HashSet<Integer>(backgroundIds); |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
579 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
580 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
581 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
582 public String [][] artifactFactoryNamesAndDescriptions() { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
583 return factoryNamesAndDescription; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
584 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
585 |
66
89e3de0ee05f
Implemented some methods to get access to ArtifactFactories which are stored in the ArtifactDatabase.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
586 public ArtifactFactory getInternalArtifactFactory(String factoryName) { |
89e3de0ee05f
Implemented some methods to get access to ArtifactFactories which are stored in the ArtifactDatabase.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
587 return getArtifactFactory(factoryName); |
89e3de0ee05f
Implemented some methods to get access to ArtifactFactories which are stored in the ArtifactDatabase.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
588 } |
89e3de0ee05f
Implemented some methods to get access to ArtifactFactories which are stored in the ArtifactDatabase.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
589 |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
590 public ArtifactFactory getArtifactFactory(String factoryName) { |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
591 return (ArtifactFactory)name2factory.get(factoryName); |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
592 } |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
593 |
149
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
594 public UserFactory getUserFactory() { |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
595 return userFactory; |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
596 } |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
597 |
158
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
598 public ArtifactCollectionFactory getArtifactCollectionFactory() { |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
599 return collectionFactory; |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
600 } |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
601 |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
602 public Document createArtifactWithFactory( |
86
b2e0cb83631c
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
84
diff
changeset
|
603 String factoryName, |
75
d4c4c23847f5
Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
604 CallMeta callMeta, |
d4c4c23847f5
Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
605 Document data |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
606 ) |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
607 throws ArtifactDatabaseException |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
608 { |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
609 ArtifactFactory factory = getArtifactFactory(factoryName); |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
610 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
611 if (factory == null) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
612 throw new ArtifactDatabaseException(NO_SUCH_FACTORY); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
613 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
614 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
615 Artifact artifact = factory.createArtifact( |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
616 backend.newIdentifier(), |
75
d4c4c23847f5
Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
617 context, |
d4c4c23847f5
Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
618 data); |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
619 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
620 if (artifact == null) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
621 throw new ArtifactDatabaseException(CREATION_FAILED); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
622 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
623 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
624 PersistentArtifact persistentArtifact; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
625 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
626 try { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
627 persistentArtifact = backend.storeInitially( |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
628 artifact, |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
629 factory, |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
630 factory.timeToLiveUntouched(artifact, context)); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
631 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
632 catch (Exception e) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
633 logger.error(e.getLocalizedMessage(), e); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
634 throw new ArtifactDatabaseException(CREATION_FAILED); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
635 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
636 |
219
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
637 ArtifactCallContext cc = new ArtifactCallContext( |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
638 ArtifactDatabaseImpl.this, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
639 CallContext.NOTHING, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
640 callMeta, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
641 context, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
642 persistentArtifact); |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
643 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
644 try { |
55
9a29899b31e5
describe() in REST interface is also handled as POST to pass
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
48
diff
changeset
|
645 return artifact.describe(null, cc); |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
646 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
647 finally { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
648 cc.postCall(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
649 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
650 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
651 |
94
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
652 public Document describe( |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
653 String identifier, |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
654 Document data, |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
655 CallMeta callMeta |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
656 ) |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
657 throws ArtifactDatabaseException |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
658 { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
659 // TODO: Handle background tasks |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
660 PersistentArtifact artifact = backend.getArtifact(identifier); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
661 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
662 if (artifact == null) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
663 throw new ArtifactDatabaseException(NO_SUCH_ARTIFACT); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
664 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
665 |
219
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
666 ArtifactCallContext cc = new ArtifactCallContext( |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
667 ArtifactDatabaseImpl.this, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
668 CallContext.TOUCH, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
669 callMeta, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
670 context, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
671 artifact); |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
672 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
673 try { |
55
9a29899b31e5
describe() in REST interface is also handled as POST to pass
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
48
diff
changeset
|
674 return artifact.getArtifact().describe(data, cc); |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
675 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
676 finally { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
677 cc.postCall(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
678 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
679 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
680 |
94
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
681 public Document advance( |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
682 String identifier, |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
683 Document target, |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
684 CallMeta callMeta |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
685 ) |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
686 throws ArtifactDatabaseException |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
687 { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
688 // TODO: Handle background tasks |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
689 PersistentArtifact artifact = backend.getArtifact(identifier); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
690 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
691 if (artifact == null) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
692 throw new ArtifactDatabaseException(NO_SUCH_ARTIFACT); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
693 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
694 |
219
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
695 ArtifactCallContext cc = new ArtifactCallContext( |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
696 ArtifactDatabaseImpl.this, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
697 CallContext.STORE, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
698 callMeta, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
699 context, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
700 artifact); |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
701 |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
702 try { |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
703 return artifact.getArtifact().advance(target, cc); |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
704 } |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
705 finally { |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
706 cc.postCall(); |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
707 } |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
708 } |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
709 |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
710 public Document feed(String identifier, Document data, CallMeta callMeta) |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
711 throws ArtifactDatabaseException |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
712 { |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
713 // TODO: Handle background tasks |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
714 PersistentArtifact artifact = backend.getArtifact(identifier); |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
715 |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
716 if (artifact == null) { |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
717 throw new ArtifactDatabaseException(NO_SUCH_ARTIFACT); |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
718 } |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
719 |
219
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
720 ArtifactCallContext cc = new ArtifactCallContext( |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
721 ArtifactDatabaseImpl.this, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
722 CallContext.STORE, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
723 callMeta, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
724 context, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
725 artifact); |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
726 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
727 try { |
36
f7d2cd59a0d5
Bugfix done. Now the feed Method works fine
Tim Englich <tim.englich@intevation.de>
parents:
32
diff
changeset
|
728 return artifact.getArtifact().feed(data, cc); |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
729 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
730 finally { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
731 cc.postCall(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
732 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
733 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
734 |
94
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
735 public DeferredOutput out( |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
736 String identifier, |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
737 Document format, |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
738 CallMeta callMeta |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
739 ) |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
740 throws ArtifactDatabaseException |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
741 { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
742 // TODO: Handle background tasks |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
743 PersistentArtifact artifact = backend.getArtifact(identifier); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
744 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
745 if (artifact == null) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
746 throw new ArtifactDatabaseException(NO_SUCH_ARTIFACT); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
747 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
748 |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
749 return new DeferredOutputImpl(artifact, format, callMeta); |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
750 } |
68
541814404822
Added interfaces for XML processing services. TODO: Implement them!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
66
diff
changeset
|
751 |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
752 public Document exportArtifact(String artifact, CallMeta callMeta) |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
753 throws ArtifactDatabaseException |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
754 { |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
755 final String [] factoryName = new String[1]; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
756 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
757 byte [] bytes = (byte [])backend.loadArtifact( |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
758 artifact, |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
759 new Backend.ArtifactLoader() { |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
760 public Object load( |
86
b2e0cb83631c
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
84
diff
changeset
|
761 ArtifactFactory factory, |
84
72e2dd4feb31
Added the time to live of an artifact to the CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
82
diff
changeset
|
762 Long ttl, |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
763 byte [] bytes, |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
764 int id |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
765 ) { |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
766 factoryName[0] = factory.getName(); |
82
efe752c4f8b2
Call cleanup method to remove special data stored by an 'out'-target before exporting an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
81
diff
changeset
|
767 |
efe752c4f8b2
Call cleanup method to remove special data stored by an 'out'-target before exporting an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
81
diff
changeset
|
768 ArtifactSerializer serializer = factory.getSerializer(); |
efe752c4f8b2
Call cleanup method to remove special data stored by an 'out'-target before exporting an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
81
diff
changeset
|
769 |
efe752c4f8b2
Call cleanup method to remove special data stored by an 'out'-target before exporting an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
81
diff
changeset
|
770 Artifact artifact = serializer.fromBytes(bytes); |
efe752c4f8b2
Call cleanup method to remove special data stored by an 'out'-target before exporting an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
81
diff
changeset
|
771 artifact.cleanup(context); |
efe752c4f8b2
Call cleanup method to remove special data stored by an 'out'-target before exporting an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
81
diff
changeset
|
772 |
efe752c4f8b2
Call cleanup method to remove special data stored by an 'out'-target before exporting an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
81
diff
changeset
|
773 return serializer.toBytes(artifact); |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
774 } |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
775 }); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
776 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
777 if (bytes == null) { |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
778 throw new ArtifactDatabaseException(NO_SUCH_ARTIFACT); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
779 } |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
780 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
781 return createExportDocument( |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
782 factoryName[0], |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
783 bytes, |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
784 exportSecret); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
785 } |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
786 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
787 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
788 * Creates an exteral XML representation of an artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
789 * @param factoryName The name of the factory which is responsible |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
790 * for the serialized artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
791 * @param artifact The byte data of the artifact itself. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
792 * @param secret The signing secret. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
793 * @return An XML document containing the external representation |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
794 * of the artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
795 */ |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
796 protected static Document createExportDocument( |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
797 String factoryName, |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
798 byte [] artifact, |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
799 byte [] secret |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
800 ) { |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
801 Document document = XMLUtils.newDocument(); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
802 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
803 MessageDigest md; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
804 try { |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
805 md = MessageDigest.getInstance(DIGEST_ALGORITHM); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
806 } |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
807 catch (NoSuchAlgorithmException nsae) { |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
808 logger.error(nsae.getLocalizedMessage(), nsae); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
809 return document; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
810 } |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
811 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
812 md.update(artifact); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
813 md.update(secret); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
814 |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
815 String checksum = Hex.encodeHexString(md.digest()); |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
816 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
817 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
818 document, |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
819 ArtifactNamespaceContext.NAMESPACE_URI, |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
820 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
821 |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
822 Element root = ec.create("action"); |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
823 document.appendChild(root); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
824 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
825 Element type = ec.create("type"); |
183
9b8923043a38
Repaired the namespaces of the xml element attributes in the collecton context of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
176
diff
changeset
|
826 ec.addAttr(type, "name", "export", true); |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
827 root.appendChild(type); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
828 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
829 Element data = ec.create("data"); |
183
9b8923043a38
Repaired the namespaces of the xml element attributes in the collecton context of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
176
diff
changeset
|
830 ec.addAttr(data, "checksum", checksum, true); |
9b8923043a38
Repaired the namespaces of the xml element attributes in the collecton context of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
176
diff
changeset
|
831 ec.addAttr(data, "factory", factoryName, true); |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
832 data.setTextContent(Base64.encodeBase64String(artifact)); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
833 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
834 root.appendChild(data); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
835 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
836 return document; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
837 } |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
838 |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
839 public Document importArtifact(Document input, CallMeta callMeta) |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
840 throws ArtifactDatabaseException |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
841 { |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
842 String factoryName = XMLUtils.xpathString( |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
843 input, |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
844 XPATH_IMPORT_FACTORY, |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
845 ArtifactNamespaceContext.INSTANCE); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
846 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
847 ArtifactFactory factory; |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
848 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
849 if (factoryName == null |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
850 || (factoryName = factoryName.trim()).length() == 0 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
851 || (factory = getArtifactFactory(factoryName)) == null) { |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
852 throw new ArtifactDatabaseException(NO_SUCH_FACTORY); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
853 } |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
854 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
855 String checksumString = XMLUtils.xpathString( |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
856 input, |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
857 XPATH_IMPORT_CHECKSUM, |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
858 ArtifactNamespaceContext.INSTANCE); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
859 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
860 byte [] checksum; |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
861 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
862 if (checksumString == null |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
863 || (checksumString = checksumString.trim()).length() == 0 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
864 || (checksum = StringUtils.decodeHex(checksumString)) == null |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
865 ) { |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
866 throw new ArtifactDatabaseException(INVALID_CHECKSUM); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
867 } |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
868 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
869 checksumString = null; |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
870 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
871 String dataString = XMLUtils.xpathString( |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
872 input, |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
873 XPATH_IMPORT_DATA, |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
874 ArtifactNamespaceContext.INSTANCE); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
875 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
876 if (dataString == null |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
877 || (dataString = dataString.trim()).length() == 0) { |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
878 throw new ArtifactDatabaseException(NO_DATA); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
879 } |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
880 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
881 byte [] data = Base64.decodeBase64(dataString); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
882 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
883 dataString = null; |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
884 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
885 MessageDigest md; |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
886 try { |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
887 md = MessageDigest.getInstance(DIGEST_ALGORITHM); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
888 } |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
889 catch (NoSuchAlgorithmException nsae) { |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
890 logger.error(nsae.getLocalizedMessage(), nsae); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
891 return XMLUtils.newDocument(); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
892 } |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
893 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
894 md.update(data); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
895 md.update(exportSecret); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
896 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
897 byte [] digest = md.digest(); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
898 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
899 if (!Arrays.equals(checksum, digest)) { |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
900 throw new ArtifactDatabaseException(CHECKSUM_MISMATCH); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
901 } |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
902 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
903 ArtifactSerializer serializer = factory.getSerializer(); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
904 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
905 Artifact artifact = serializer.fromBytes(data); data = null; |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
906 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
907 if (artifact == null) { |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
908 throw new ArtifactDatabaseException(INVALID_ARTIFACT); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
909 } |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
910 |
81
e9c80fdfee13
Set new identifiers on artifacts after an artifact import.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
80
diff
changeset
|
911 artifact.setIdentifier(backend.newIdentifier()); |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
912 PersistentArtifact persistentArtifact; |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
913 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
914 try { |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
915 persistentArtifact = backend.storeOrReplace( |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
916 artifact, |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
917 factory, |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
918 factory.timeToLiveUntouched(artifact, context)); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
919 } |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
920 catch (Exception e) { |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
921 logger.error(e.getLocalizedMessage(), e); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
922 throw new ArtifactDatabaseException(CREATION_FAILED); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
923 } |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
924 |
219
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
925 ArtifactCallContext cc = new ArtifactCallContext( |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
926 ArtifactDatabaseImpl.this, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
927 CallContext.NOTHING, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
928 callMeta, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
929 context, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
930 persistentArtifact); |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
931 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
932 try { |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
933 return artifact.describe(input, cc); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
934 } |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
935 finally { |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
936 cc.postCall(); |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
79
diff
changeset
|
937 } |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
938 } |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
939 |
68
541814404822
Added interfaces for XML processing services. TODO: Implement them!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
66
diff
changeset
|
940 public String [][] serviceNamesAndDescriptions() { |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
941 return serviceNamesAndDescription; |
68
541814404822
Added interfaces for XML processing services. TODO: Implement them!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
66
diff
changeset
|
942 } |
541814404822
Added interfaces for XML processing services. TODO: Implement them!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
66
diff
changeset
|
943 |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
944 public Document process( |
86
b2e0cb83631c
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
84
diff
changeset
|
945 String serviceName, |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
946 Document input, |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
947 CallMeta callMeta |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
948 ) |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
949 throws ArtifactDatabaseException |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
950 { |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
951 Service service = (Service)name2service.get(serviceName); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
952 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
953 if (service == null) { |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
954 throw new ArtifactDatabaseException(NO_SUCH_SERVICE); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
955 } |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
956 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
957 return service.process(input, context, callMeta); |
68
541814404822
Added interfaces for XML processing services. TODO: Implement them!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
66
diff
changeset
|
958 } |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
959 |
118
0e0c27bc0b90
Added creation time to collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
117
diff
changeset
|
960 // User API |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
961 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
962 public Document listUsers(CallMeta callMeta) |
150
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
963 throws ArtifactDatabaseException |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
964 { |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
965 UserFactory factory = getUserFactory(); |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
966 |
150
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
967 if (factory == null) { |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
968 throw new ArtifactDatabaseException(NO_SUCH_FACTORY); |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
969 } |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
970 |
157
6e6965873a48
Simplified creation of users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
155
diff
changeset
|
971 User [] users = backend.getUsers(factory, context); |
150
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
972 |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
973 if (users != null) { |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
974 logger.debug(users.length + " users found in the backend."); |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
975 } |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
976 |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
977 Document result = XMLUtils.newDocument(); |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
978 |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
979 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
980 result, |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
981 ArtifactNamespaceContext.NAMESPACE_URI, |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
982 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
983 |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
984 Element root = ec.create("users"); |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
985 result.appendChild(root); |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
986 |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
987 for (User user: users) { |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
988 Element ue = ec.create("user"); |
183
9b8923043a38
Repaired the namespaces of the xml element attributes in the collecton context of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
176
diff
changeset
|
989 ec.addAttr(ue, "uuid", user.identifier(), true); |
9b8923043a38
Repaired the namespaces of the xml element attributes in the collecton context of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
176
diff
changeset
|
990 ec.addAttr(ue, "name", user.getName(), true); |
150
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
991 |
160
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
992 Document role = user.getRole(); |
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
993 |
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
994 if (role != null) { |
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
995 ue.appendChild(result.importNode(role.getFirstChild(), true)); |
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
996 } |
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
997 |
150
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
998 root.appendChild(ue); |
160
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
999 |
150
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
1000 } |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
1001 |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
1002 return result; |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1003 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1004 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1005 public Document createUser(Document data, CallMeta callMeta) |
149
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1006 throws ArtifactDatabaseException |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1007 { |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1008 UserFactory factory = getUserFactory(); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1009 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1010 if (factory == null) { |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1011 throw new ArtifactDatabaseException(NO_SUCH_FACTORY); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1012 } |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1013 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1014 String name = XMLUtils.xpathString( |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1015 data, XPATH_USERNAME, ArtifactNamespaceContext.INSTANCE); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1016 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1017 if (name == null || name.length() == 0) { |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1018 logger.warn("User without username not accepted!"); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1019 throw new ArtifactDatabaseException(NO_USERNAME); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1020 } |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1021 |
160
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
1022 Node tmp = (Node) XMLUtils.xpath( |
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
1023 data, |
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
1024 XPATH_USERROLE, |
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
1025 XPathConstants.NODE, |
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
1026 ArtifactNamespaceContext.INSTANCE); |
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
1027 |
149
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1028 Document role = XMLUtils.newDocument(); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1029 |
160
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
1030 if (tmp != null) { |
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
1031 Node clone = role.importNode(tmp, true); |
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
1032 role.appendChild(clone); |
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
1033 } |
dc687827439f
Enabled the artifact database to store and load roles of users.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
159
diff
changeset
|
1034 |
149
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1035 User newUser = null; |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1036 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1037 try { |
157
6e6965873a48
Simplified creation of users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
155
diff
changeset
|
1038 newUser = backend.createUser(name, role, userFactory, context); |
149
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1039 } |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1040 catch (Exception e) { |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1041 logger.error(e.getMessage(), e); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1042 throw new ArtifactDatabaseException(USER_CREATION_FAILED); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1043 } |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1044 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1045 Document result = XMLUtils.newDocument(); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1046 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1047 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1048 result, |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1049 ArtifactNamespaceContext.NAMESPACE_URI, |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1050 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1051 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1052 Element root = ec.create("result"); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1053 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1054 if (newUser != null) { |
153
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
1055 root.setTextContent(OPERATION_SUCCESSFUL); |
149
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1056 } |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1057 else { |
153
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
1058 root.setTextContent(OPERATION_FAILURE); |
149
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1059 } |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1060 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1061 result.appendChild(root); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1062 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1063 return result; |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1064 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1065 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1066 public Document deleteUser(String userId, CallMeta callMeta) |
152
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
1067 throws ArtifactDatabaseException |
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
1068 { |
153
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
1069 logger.debug("Delete user: " + userId); |
152
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
1070 |
153
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
1071 Document result = XMLUtils.newDocument(); |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
1072 |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
1073 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
1074 result, |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
1075 ArtifactNamespaceContext.NAMESPACE_URI, |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
1076 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
1077 |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
1078 Element root = ec.create("result"); |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
1079 result.appendChild(root); |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
1080 |
157
6e6965873a48
Simplified creation of users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
155
diff
changeset
|
1081 boolean success = backend.deleteUser(userId); |
154
1a72f08ce8d7
Propagate delete user errors correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
153
diff
changeset
|
1082 |
1a72f08ce8d7
Propagate delete user errors correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
153
diff
changeset
|
1083 root.setTextContent(success ? OPERATION_SUCCESSFUL: OPERATION_FAILURE); |
152
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
1084 |
153
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
1085 return result; |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1086 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1087 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1088 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1089 // Collection API |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1090 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1091 public Document listCollections(String userId, CallMeta callMeta) |
164
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1092 throws ArtifactDatabaseException |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1093 { |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1094 ArtifactCollectionFactory acf = getArtifactCollectionFactory(); |
167
c9c27aca2f70
Added code to list collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
166
diff
changeset
|
1095 UserFactory uf = getUserFactory(); |
164
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1096 |
167
c9c27aca2f70
Added code to list collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
166
diff
changeset
|
1097 if (acf == null || uf == null) { |
164
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1098 throw new ArtifactDatabaseException(NO_SUCH_FACTORY); |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1099 } |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1100 |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1101 logger.debug("Fetch the list of collection for user: " + userId); |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1102 |
167
c9c27aca2f70
Added code to list collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
166
diff
changeset
|
1103 ArtifactCollection [] ac = backend.listCollections( |
c9c27aca2f70
Added code to list collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
166
diff
changeset
|
1104 userId, |
c9c27aca2f70
Added code to list collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
166
diff
changeset
|
1105 null, // XXX: fetch from REST |
c9c27aca2f70
Added code to list collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
166
diff
changeset
|
1106 acf, uf, |
c9c27aca2f70
Added code to list collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
166
diff
changeset
|
1107 context); |
164
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1108 |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1109 Document result = XMLUtils.newDocument(); |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1110 |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1111 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1112 result, |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1113 ArtifactNamespaceContext.NAMESPACE_URI, |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1114 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1115 |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1116 Element root = ec.create("artifact-collections"); |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1117 result.appendChild(root); |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1118 |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1119 if (ac == null || ac.length == 0) { |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1120 logger.debug("No collections for the user existing."); |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1121 |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1122 return result; |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1123 } |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1124 |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1125 logger.debug("Found " + ac.length + " collections of the user."); |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1126 |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1127 for (ArtifactCollection c: ac) { |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1128 Element collection = ec.create("artifact-collection"); |
183
9b8923043a38
Repaired the namespaces of the xml element attributes in the collecton context of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
176
diff
changeset
|
1129 ec.addAttr(collection, "name", c.getName(), true); |
9b8923043a38
Repaired the namespaces of the xml element attributes in the collecton context of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
176
diff
changeset
|
1130 ec.addAttr(collection, "uuid", c.identifier(), true); |
168
f70977cf2faf
Avoid Nullpointer exception in listCollections() when no creation time of the collection is returned.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
167
diff
changeset
|
1131 |
f70977cf2faf
Avoid Nullpointer exception in listCollections() when no creation time of the collection is returned.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
167
diff
changeset
|
1132 Date creationTime = c.getCreationTime(); |
f70977cf2faf
Avoid Nullpointer exception in listCollections() when no creation time of the collection is returned.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
167
diff
changeset
|
1133 String creation = creationTime != null |
f70977cf2faf
Avoid Nullpointer exception in listCollections() when no creation time of the collection is returned.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
167
diff
changeset
|
1134 ? Long.toString(creationTime.getTime()) |
f70977cf2faf
Avoid Nullpointer exception in listCollections() when no creation time of the collection is returned.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
167
diff
changeset
|
1135 : ""; |
f70977cf2faf
Avoid Nullpointer exception in listCollections() when no creation time of the collection is returned.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
167
diff
changeset
|
1136 |
183
9b8923043a38
Repaired the namespaces of the xml element attributes in the collecton context of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
176
diff
changeset
|
1137 ec.addAttr(collection, "creation", creation, true); |
164
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1138 |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1139 root.appendChild(collection); |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1140 } |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1141 |
268c2972d4a7
Implemented the interface method listCollections() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
162
diff
changeset
|
1142 return result; |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1143 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1144 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1145 public Document createCollection(String ownerId, Document data, |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1146 CallMeta callMeta) |
158
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1147 throws ArtifactDatabaseException |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1148 { |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1149 ArtifactCollectionFactory acf = getArtifactCollectionFactory(); |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1150 |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1151 if (acf == null) { |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1152 throw new ArtifactDatabaseException(NO_SUCH_FACTORY); |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1153 } |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1154 |
162
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1155 String name = XMLUtils.xpathString( |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1156 data, XPATH_COLLECTION_NAME, ArtifactNamespaceContext.INSTANCE); |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1157 |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1158 logger.debug("Create new collection with name: " + name); |
159
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
158
diff
changeset
|
1159 |
198
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
1160 Document attr = XMLUtils.newDocument(); |
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
1161 |
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
1162 Node attrNode = (Node) XMLUtils.xpath( |
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
1163 data, |
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
1164 XPATH_COLLECTION_ATTRIBUTE, |
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
1165 XPathConstants.NODE, |
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
1166 ArtifactNamespaceContext.INSTANCE); |
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
1167 |
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
1168 if (attrNode != null) { |
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
1169 attr.appendChild(attr.importNode(attrNode, true)); |
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
1170 } |
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
1171 |
158
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1172 ArtifactCollection ac = backend.createCollection( |
198
6370369412e9
Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
196
diff
changeset
|
1173 ownerId, name, acf, attr, context); |
158
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1174 |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1175 if (ac == null) { |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1176 throw new ArtifactDatabaseException(COLLECTION_CREATION_FAILED); |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1177 } |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1178 |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1179 Document result = XMLUtils.newDocument(); |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1180 |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1181 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1182 result, |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1183 ArtifactNamespaceContext.NAMESPACE_URI, |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1184 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1185 |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1186 Element root = ec.create("result"); |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1187 result.appendChild(root); |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1188 |
169
2f575d594fdb
The document returned by the createCollection() method will now contain the uuid of the created collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
168
diff
changeset
|
1189 Element acElement = ec.create("artifact-collection"); |
183
9b8923043a38
Repaired the namespaces of the xml element attributes in the collecton context of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
176
diff
changeset
|
1190 ec.addAttr(acElement, "uuid", ac.identifier(), true); |
169
2f575d594fdb
The document returned by the createCollection() method will now contain the uuid of the created collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
168
diff
changeset
|
1191 |
2f575d594fdb
The document returned by the createCollection() method will now contain the uuid of the created collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
168
diff
changeset
|
1192 root.appendChild(acElement); |
158
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1193 |
d718a4d55662
Implemented the createCollection() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
1194 return result; |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1195 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1196 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1197 public Document deleteCollection(String collectionId, CallMeta callMeta) |
162
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1198 throws ArtifactDatabaseException |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1199 { |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1200 logger.debug("Delete collection: " + collectionId); |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1201 |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1202 Document result = XMLUtils.newDocument(); |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1203 |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1204 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1205 result, |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1206 ArtifactNamespaceContext.NAMESPACE_URI, |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1207 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1208 |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1209 Element root = ec.create("result"); |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1210 result.appendChild(root); |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1211 |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1212 boolean success = backend.deleteCollection(collectionId); |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1213 |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1214 root.setTextContent(success ? OPERATION_SUCCESSFUL: OPERATION_FAILURE); |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1215 |
4ac91485b4e0
Implemented the deleteCollection() interface method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
160
diff
changeset
|
1216 return result; |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1217 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1218 |
196
171b6200d26d
Added a describe() action for collections - the implementation in the artifact server is currently just a stub that throws an not implemented exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
192
diff
changeset
|
1219 public Document describeCollection(String collectionId, CallMeta callMeta) |
171b6200d26d
Added a describe() action for collections - the implementation in the artifact server is currently just a stub that throws an not implemented exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
192
diff
changeset
|
1220 throws ArtifactDatabaseException |
171b6200d26d
Added a describe() action for collections - the implementation in the artifact server is currently just a stub that throws an not implemented exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
192
diff
changeset
|
1221 { |
171b6200d26d
Added a describe() action for collections - the implementation in the artifact server is currently just a stub that throws an not implemented exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
192
diff
changeset
|
1222 logger.debug("Describe collection: " + collectionId); |
219
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1223 ArtifactCollectionFactory acf = getArtifactCollectionFactory(); |
196
171b6200d26d
Added a describe() action for collections - the implementation in the artifact server is currently just a stub that throws an not implemented exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
192
diff
changeset
|
1224 |
219
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1225 if (acf == null) { |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1226 throw new ArtifactDatabaseException(NO_SUCH_FACTORY); |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1227 } |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1228 |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1229 UserFactory uf = getUserFactory(); |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1230 if (uf == null) { |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1231 throw new ArtifactDatabaseException(NO_SUCH_FACTORY); |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1232 } |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1233 |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1234 ArtifactCollection c = backend.getCollection( |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1235 collectionId, acf, uf, context); |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1236 |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1237 if (c == null) { |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1238 logger.warn("No collection found with identifier: " + collectionId); |
222
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
1239 throw new ArtifactDatabaseException(NO_SUCH_COLLECTION); |
219
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1240 } |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1241 |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1242 CallContext cc = new CollectionCallContext( |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1243 ArtifactDatabaseImpl.this, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1244 CallContext.NOTHING, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1245 callMeta, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1246 context, |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1247 c); |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1248 |
cabe4c02ab64
Refactored the CallContextImpl - there are two concrete classes for Artifacts and ArtifactCollections now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
207
diff
changeset
|
1249 return c.describe(cc); |
196
171b6200d26d
Added a describe() action for collections - the implementation in the artifact server is currently just a stub that throws an not implemented exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
192
diff
changeset
|
1250 } |
171b6200d26d
Added a describe() action for collections - the implementation in the artifact server is currently just a stub that throws an not implemented exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
192
diff
changeset
|
1251 |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1252 public Document getCollectionAttribute(String collectionId, String artifactId, |
192
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1253 CallMeta callMeta) throws ArtifactDatabaseException |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1254 { |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1255 logger.debug("Fetch the attribute for the artifact: " + artifactId); |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1256 |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1257 return backend.getCollectionAttribute(collectionId, artifactId); |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1258 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1259 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1260 public Document setCollectionAttribute(String collectionId, String artifactId, |
192
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1261 Document source, CallMeta callMeta) |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1262 throws ArtifactDatabaseException |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1263 { |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1264 logger.debug("Set the attribute for the artifact: " + artifactId); |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1265 |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1266 Document attribute = XMLUtils.newDocument(); |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1267 |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1268 Node attr = (Node) XMLUtils.xpath( |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1269 source, |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1270 XPATH_COLLECTION_ITEM_ATTRIBUTE, |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1271 XPathConstants.NODE, |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1272 ArtifactNamespaceContext.INSTANCE); |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1273 |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1274 if (attr != null) { |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1275 attribute.appendChild(attribute.importNode(attr, true)); |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1276 } |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1277 |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1278 Document result = XMLUtils.newDocument(); |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1279 |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1280 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1281 result, |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1282 ArtifactNamespaceContext.NAMESPACE_URI, |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1283 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1284 |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1285 Element root = ec.create("result"); |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1286 result.appendChild(root); |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1287 |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1288 boolean success = backend.setCollectionAttribute( |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1289 collectionId, artifactId, attribute); |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1290 |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1291 root.setTextContent(success ? OPERATION_SUCCESSFUL: OPERATION_FAILURE); |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1292 |
dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
190
diff
changeset
|
1293 return result; |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1294 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1295 |
189
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1296 public Document addCollectionArtifact( |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1297 String collectionId, |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1298 String artifactId, |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1299 Document input, |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1300 CallMeta callMeta) |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1301 throws ArtifactDatabaseException |
166
89db80380f7f
Implemented the method addCollectionArtifact() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
164
diff
changeset
|
1302 { |
89db80380f7f
Implemented the method addCollectionArtifact() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
164
diff
changeset
|
1303 logger.debug( |
89db80380f7f
Implemented the method addCollectionArtifact() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
164
diff
changeset
|
1304 "Add artifact '" + artifactId + "' collection '" +collectionId+"'"); |
89db80380f7f
Implemented the method addCollectionArtifact() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
164
diff
changeset
|
1305 |
189
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1306 Document attr = XMLUtils.newDocument(); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1307 |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1308 Node attrNode = (Node) XMLUtils.xpath( |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1309 input, |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1310 XPATH_COLLECTION_ITEM_ATTRIBUTE, |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1311 XPathConstants.NODE, |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1312 ArtifactNamespaceContext.INSTANCE); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1313 |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1314 if (attrNode != null) { |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1315 attr.appendChild(attr.importNode(attrNode, true)); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1316 } |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1317 |
166
89db80380f7f
Implemented the method addCollectionArtifact() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
164
diff
changeset
|
1318 boolean success = backend.addCollectionArtifact( |
176
a0eff2227588
Added code to add artifacts to collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
169
diff
changeset
|
1319 collectionId, |
a0eff2227588
Added code to add artifacts to collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
169
diff
changeset
|
1320 artifactId, |
189
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1321 attr); |
166
89db80380f7f
Implemented the method addCollectionArtifact() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
164
diff
changeset
|
1322 |
222
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
1323 if (!success) { |
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
1324 Document result = XMLUtils.newDocument(); |
166
89db80380f7f
Implemented the method addCollectionArtifact() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
164
diff
changeset
|
1325 |
222
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
1326 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
1327 result, |
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
1328 ArtifactNamespaceContext.NAMESPACE_URI, |
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
1329 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
166
89db80380f7f
Implemented the method addCollectionArtifact() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
164
diff
changeset
|
1330 |
222
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
1331 Element root = ec.create("result"); |
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
1332 result.appendChild(root); |
166
89db80380f7f
Implemented the method addCollectionArtifact() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
164
diff
changeset
|
1333 |
222
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
1334 root.setTextContent(OPERATION_FAILURE); |
166
89db80380f7f
Implemented the method addCollectionArtifact() in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
164
diff
changeset
|
1335 |
222
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
1336 return result; |
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
1337 } |
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
1338 |
98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
219
diff
changeset
|
1339 return describeCollection(collectionId, callMeta); |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1340 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1341 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1342 public Document removeCollectionArtifact(String collectionId, String artifactId, |
190
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1343 CallMeta callMeta) throws ArtifactDatabaseException |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1344 { |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1345 logger.debug( |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1346 "Remove artifact '" + artifactId + "' from collection '" + |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1347 collectionId + "'"); |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1348 |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1349 Document attr = XMLUtils.newDocument(); |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1350 |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1351 boolean success = backend.removeCollectionArtifact( |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1352 collectionId, |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1353 artifactId); |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1354 |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1355 Document result = XMLUtils.newDocument(); |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1356 |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1357 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1358 result, |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1359 ArtifactNamespaceContext.NAMESPACE_URI, |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1360 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1361 |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1362 Element root = ec.create("result"); |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1363 result.appendChild(root); |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1364 |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1365 root.setTextContent(success ? OPERATION_SUCCESSFUL: OPERATION_FAILURE); |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1366 |
7acf4a325bfe
Implemented removeCollectionArtifact() method of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
189
diff
changeset
|
1367 return result; |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1368 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1369 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1370 public Document listCollectionArtifacts(String collectionId, |
189
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1371 CallMeta callMeta) throws ArtifactDatabaseException |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1372 { |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1373 CollectionItem[] items = backend.listCollectionArtifacts(collectionId); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1374 |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1375 Document result = XMLUtils.newDocument(); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1376 |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1377 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1378 result, |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1379 ArtifactNamespaceContext.NAMESPACE_URI, |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1380 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1381 |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1382 Element root = ec.create("result"); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1383 Element ac = ec.create("artifact-collection"); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1384 ec.addAttr(ac, "uuid", collectionId, true); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1385 |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1386 for (CollectionItem item: items) { |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1387 Element i = ec.create("collection-item"); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1388 Element attr = ec.create("attribute"); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1389 ec.addAttr(i, "uuid", item.getArtifactIdentifier(), true); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1390 |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1391 Document attribute = item.getAttribute(); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1392 if (attribute != null) { |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1393 Node firstChild = attribute.getFirstChild(); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1394 attr.appendChild(result.importNode(firstChild, true)); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1395 } |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1396 else { |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1397 logger.debug("No attributes for the collection item!"); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1398 } |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1399 |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1400 i.appendChild(attr); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1401 ac.appendChild(i); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1402 } |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1403 |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1404 root.appendChild(ac); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1405 result.appendChild(root); |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1406 |
fbaeb5931d10
Implemented addCollectionArtifact() and listCollectionArtifacts() of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
183
diff
changeset
|
1407 return result; |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1408 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1409 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1410 public DeferredOutput outCollection(String collectionId, |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1411 Document format, CallMeta callMeta) |
228
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1412 throws ArtifactDatabaseException |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1413 { |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1414 ArtifactCollectionFactory acf = getArtifactCollectionFactory(); |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1415 |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1416 if (acf == null) { |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1417 throw new ArtifactDatabaseException(NO_SUCH_FACTORY); |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1418 } |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1419 |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1420 UserFactory uf = getUserFactory(); |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1421 if (uf == null) { |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1422 throw new ArtifactDatabaseException(NO_SUCH_FACTORY); |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1423 } |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1424 |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1425 ArtifactCollection c = backend.getCollection( |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1426 collectionId, acf, uf, context); |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1427 |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1428 if (c == null) { |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1429 logger.warn("No collection found with identifier: " + collectionId); |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1430 throw new ArtifactDatabaseException(NO_SUCH_COLLECTION); |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1431 } |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1432 |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1433 CallContext cc = new CollectionCallContext( |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1434 ArtifactDatabaseImpl.this, |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1435 CallContext.NOTHING, |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1436 callMeta, |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1437 context, |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1438 c); |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1439 |
dd977fb7552e
Added an implementation of DeferredOutput for ArtifactCollections and implemented the out() operation of ArtifactCollections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
1440 return new DeferredCollectionOutputImpl(c, format, callMeta); |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1441 } |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1442 } |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
1443 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |