Mercurial > dive4elements > framework
annotate artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java @ 156:a76de72ad6d1
Added stubs for the collection handling in db backend.
Added missing attribute column to the collection item table.
artifacts/trunk@1381 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 03 Mar 2011 09:53:02 +0000 |
parents | f797093c60bd |
children | 6e6965873a48 |
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 |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
11 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
|
12 |
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.artifacts.Artifact; |
155
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
14 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
|
15 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
|
16 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
|
17 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
|
18 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
|
19 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
|
20 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
|
21 import de.intevation.artifacts.CallMeta; |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
22 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
|
23 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
|
24 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
|
25 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
|
26 |
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
|
27 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
|
28 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
|
29 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
30 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
|
31 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
|
32 |
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
|
33 import java.util.ArrayList; |
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
|
34 import java.util.Arrays; |
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
|
35 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
|
36 import java.util.HashSet; |
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
|
37 import java.util.List; |
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
|
38 |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
39 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
|
40 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
|
41 |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
42 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
|
43 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
44 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
|
45 import org.w3c.dom.Element; |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
46 |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 /** |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
48 * 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
|
49 * 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
|
50 * 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
|
51 * 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
|
52 * @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
|
53 */ |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 public class ArtifactDatabaseImpl |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
55 implements ArtifactDatabase, Id.Filter, Backend.FactoryLookup |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 { |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
57 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
|
58 Logger.getLogger(ArtifactDatabaseImpl.class); |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 |
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
|
60 /** 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
|
61 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
|
62 "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
|
63 |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
64 /** 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
|
65 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
|
66 "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
|
67 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
68 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
69 * Error message issued if a requested artifact factory |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
70 * is not registered to this database. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
71 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
72 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
|
73 "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
|
74 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
75 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
76 * 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
|
77 * in this database. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
78 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
79 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
|
80 "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
|
81 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
82 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
83 * Error message issued if one tries to remove a requested artifact |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
84 * from the list of artifacts running in background which is |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
85 * not in this list. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
86 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
87 public static final String NOT_IN_BACKGROUND = |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
88 "Not in background"; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
89 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
90 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
91 * Error message issued if an artifact wants to translate itself |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
92 * into a none valid persistent state. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
93 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
94 public static final String INVALID_CALL_STATE = |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
95 "Invalid after call state"; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
96 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
97 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
98 * 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
|
99 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
100 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
|
101 "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
|
102 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
103 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
104 * Error message if an severe internal error occurred. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
105 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
106 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
|
107 "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
|
108 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
109 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
110 * 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
|
111 * offered by this database. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
112 */ |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
113 public static final String NO_SUCH_SERVICE = |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
114 "No such service"; |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
115 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
116 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
117 * 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
|
118 */ |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
119 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
|
120 "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
|
121 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
122 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
123 * 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
|
124 * an exported artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
125 */ |
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
|
126 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
|
127 "/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
|
128 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
129 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
130 * 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
|
131 * 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
|
132 */ |
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
|
133 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
|
134 "/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
|
135 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
136 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
137 * 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
|
138 * that is going to be imported. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
139 */ |
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
|
140 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
|
141 "/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
|
142 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
143 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
144 * Error message issued if the checksum of an |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
145 * artifact to be imported has an invalid syntax. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
146 */ |
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
|
147 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
|
148 "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 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
150 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
151 * Error message issued the checksum validation |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
152 * of an artifact to be imported fails. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
153 */ |
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
|
154 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
|
155 "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
|
156 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
157 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
158 * 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
|
159 * does not have any data. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
160 */ |
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
|
161 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
|
162 "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 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
164 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
165 * Error message issued if the deserialization of |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
166 * an artifact to be imported fails. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
167 */ |
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
|
168 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
|
169 "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 |
149
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
171 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
172 // User constants |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
173 |
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 * 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
|
176 */ |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
177 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
|
178 "Creation of user failed."; |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
179 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
180 /** 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
|
181 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
|
182 "/art:action/art:user/@name"; |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
183 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
184 /** 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
|
185 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
|
186 "/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
|
187 |
152
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
188 /** 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
|
189 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
|
190 "No such user"; |
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
191 |
149
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
192 /** 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
|
193 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
|
194 "Invalid username"; |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
195 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
196 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
197 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
198 * Inner class that implements the call context handed |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
199 * to the methods calls describe(), feed(), etc. of the artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
200 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
201 public class CallContextImpl |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
202 implements CallContext |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
203 { |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
204 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
205 * The persistence wrapper around the living artifact |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
206 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
207 protected PersistentArtifact artifact; |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
208 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
209 * The action to be performed after the artifact calls |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
210 * desribe(), feed(), etc. return. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
211 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
212 protected int action; |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
213 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
214 * The meta information of the concrete call |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
215 * (preferred languages et. al.) |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
216 */ |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
217 protected CallMeta callMeta; |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
218 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
219 * Map to act like a clipboard when nesting calls |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
220 * like a proxy artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
221 */ |
58
39fec7d714dc
Added a real artifact proxy class to be more flexible with artifact replacements
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
55
diff
changeset
|
222 protected HashMap customValues; |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
223 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
224 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
225 * Constructor to create a call context with a given |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
226 * persistent artifact, a default action and meta informations. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
227 * @param artifact The persistent wrapper around a living artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
228 * @param action The action to be performed after the concrete |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
229 * artifact call has returned. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
230 * @param callMeta The meta information for this call context. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
231 */ |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
232 public CallContextImpl( |
86
b2e0cb83631c
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
84
diff
changeset
|
233 PersistentArtifact artifact, |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
234 int action, |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
235 CallMeta callMeta |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
236 ) { |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
237 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
|
238 this.action = action; |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
239 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
|
240 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
241 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
242 public void afterCall(int action) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
243 this.action = action; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
244 if (action == BACKGROUND) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
245 addIdToBackground(artifact.getId()); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
246 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
247 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
248 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
249 public void afterBackground(int action) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
250 if (this.action != BACKGROUND) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
251 throw new IllegalStateException(NOT_IN_BACKGROUND); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
252 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
253 fromBackground(artifact, action); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
254 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
255 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
256 public Object globalContext() { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
257 return context; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
258 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
259 |
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
|
260 public ArtifactDatabase getDatabase() { |
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
|
261 return ArtifactDatabaseImpl.this; |
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
|
262 } |
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
|
263 |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
264 public CallMeta getMeta() { |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
265 return callMeta; |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
266 } |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
267 |
84
72e2dd4feb31
Added the time to live of an artifact to the CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
82
diff
changeset
|
268 public Long getTimeToLive() { |
72e2dd4feb31
Added the time to live of an artifact to the CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
82
diff
changeset
|
269 return artifact.getTTL(); |
72e2dd4feb31
Added the time to live of an artifact to the CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
82
diff
changeset
|
270 } |
72e2dd4feb31
Added the time to live of an artifact to the CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
82
diff
changeset
|
271 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
272 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
273 * Dispatches and executes the persistence action after |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
274 * the return of the concrete artifact call. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
275 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
276 public void postCall() { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
277 switch (action) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
278 case NOTHING: |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
279 break; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
280 case TOUCH: |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
281 artifact.touch(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
282 break; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
283 case STORE: |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
284 artifact.store(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
285 break; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
286 case BACKGROUND: |
94
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
287 logger.warn( |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
288 "BACKGROUND processing is not fully implemented, yet!"); |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
289 artifact.store(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
290 break; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
291 default: |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
292 logger.error(INVALID_CALL_STATE + ": " + action); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
293 throw new IllegalStateException(INVALID_CALL_STATE); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
294 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
295 } |
58
39fec7d714dc
Added a real artifact proxy class to be more flexible with artifact replacements
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
55
diff
changeset
|
296 |
39fec7d714dc
Added a real artifact proxy class to be more flexible with artifact replacements
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
55
diff
changeset
|
297 public Object getContextValue(Object key) { |
39fec7d714dc
Added a real artifact proxy class to be more flexible with artifact replacements
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
55
diff
changeset
|
298 return customValues != null |
39fec7d714dc
Added a real artifact proxy class to be more flexible with artifact replacements
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
55
diff
changeset
|
299 ? customValues.get(key) |
39fec7d714dc
Added a real artifact proxy class to be more flexible with artifact replacements
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
55
diff
changeset
|
300 : null; |
39fec7d714dc
Added a real artifact proxy class to be more flexible with artifact replacements
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
55
diff
changeset
|
301 } |
39fec7d714dc
Added a real artifact proxy class to be more flexible with artifact replacements
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
55
diff
changeset
|
302 |
39fec7d714dc
Added a real artifact proxy class to be more flexible with artifact replacements
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
55
diff
changeset
|
303 public Object putContextValue(Object key, Object value) { |
39fec7d714dc
Added a real artifact proxy class to be more flexible with artifact replacements
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
55
diff
changeset
|
304 if (customValues == null) { |
39fec7d714dc
Added a real artifact proxy class to be more flexible with artifact replacements
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
55
diff
changeset
|
305 customValues = new HashMap(); |
39fec7d714dc
Added a real artifact proxy class to be more flexible with artifact replacements
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
55
diff
changeset
|
306 } |
39fec7d714dc
Added a real artifact proxy class to be more flexible with artifact replacements
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
55
diff
changeset
|
307 return customValues.put(key, value); |
39fec7d714dc
Added a real artifact proxy class to be more flexible with artifact replacements
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
55
diff
changeset
|
308 } |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
309 } // class CallContextImpl |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
310 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
311 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
312 * 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
|
313 * of the artifact's out() call. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
314 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
315 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
|
316 implements DeferredOutput |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
317 { |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
318 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
319 * The persistence wrapper around a living artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
320 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
321 protected PersistentArtifact artifact; |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
322 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
323 * 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
|
324 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
325 protected Document format; |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
326 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
327 * 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
|
328 */ |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
329 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
|
330 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
331 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
332 * Default constructor. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
333 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
334 public DeferredOutputImpl() { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
335 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
336 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
337 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
338 * Constructor to create a deferred execution unit for |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
339 * 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
|
340 * an the meta information. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
341 * @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
|
342 * @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
|
343 * @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
|
344 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
345 public DeferredOutputImpl( |
47
4ae4dc99127d
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
41
diff
changeset
|
346 PersistentArtifact artifact, |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
347 Document format, |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
348 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
|
349 ) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
350 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
|
351 this.format = format; |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
352 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
|
353 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
354 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
355 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
|
356 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
357 CallContextImpl cc = new CallContextImpl( |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
358 artifact, CallContext.TOUCH, callMeta); |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
359 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
360 try { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
361 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
|
362 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
363 finally { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
364 cc.postCall(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
365 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
366 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
367 } // class DeferredOutputImpl |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
368 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
369 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
370 * List of name/description pairs needed for |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
371 * {@link #artifactFactoryNamesAndDescriptions() }. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
372 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
373 protected String [][] factoryNamesAndDescription; |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
374 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
375 * Map to access artifact factories by there name. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
376 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
377 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
|
378 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
379 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
380 * List of name/description pairs needed for |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
381 * {@link #serviceNamesAndDescriptions() }. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
382 */ |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
383 protected String [][] serviceNamesAndDescription; |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
384 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
385 * Map to access services by there name. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
386 */ |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
387 protected HashMap name2service; |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
388 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
389 /** |
155
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
390 * 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
|
391 */ |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
392 protected ArtifactCollectionFactory collectionFactory; |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
393 |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
394 /** |
127
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
395 * 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
|
396 */ |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
397 protected UserFactory userFactory; |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
398 |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
399 /** |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
400 * Reference to the storage backend. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
401 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
402 protected Backend backend; |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
403 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
404 * 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
|
405 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
406 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
|
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 * 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
|
410 */ |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
411 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
|
412 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
413 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
414 * 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
|
415 * 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
|
416 * database cleaner. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
417 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
418 protected HashSet backgroundIds; |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
419 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
420 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
421 * Default constructor. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
422 */ |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
423 public ArtifactDatabaseImpl() { |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
424 } |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
425 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
426 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
427 * 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
|
428 * 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
|
429 * 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
|
430 * @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
|
431 */ |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
432 public ArtifactDatabaseImpl(FactoryBootstrap bootstrap) { |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
433 this(bootstrap, null); |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
434 } |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
435 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
436 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
437 * 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
|
438 * backend and |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
439 * 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
|
440 * @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
|
441 * @param backend The storage backend. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
442 */ |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
443 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
|
444 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
445 backgroundIds = new HashSet(); |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
446 |
155
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
447 setupArtifactCollectionFactory(bootstrap); |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
448 setupArtifactFactories(bootstrap); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
449 setupServices(bootstrap); |
127
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
450 setupUserFactory(bootstrap); |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
451 |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
452 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
|
453 exportSecret = bootstrap.getExportSecret(); |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
454 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
455 wireWithBackend(backend); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
456 } |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
457 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
458 /** |
155
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
459 * 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
|
460 * |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
461 * @param bootstrap The bootstrap parameters. |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
462 */ |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
463 protected void setupArtifactCollectionFactory(FactoryBootstrap bootstrap) { |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
464 collectionFactory = bootstrap.getArtifactCollectionFactory(); |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
465 } |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
466 |
f797093c60bd
Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
154
diff
changeset
|
467 /** |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
468 * 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
|
469 * parameters and building the internal lookup tables. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
470 * @param bootstrap The bootstrap parameters. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
471 */ |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
472 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
|
473 name2factory = new HashMap(); |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
474 |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
475 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
|
476 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
|
477 |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
478 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
|
479 |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
480 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
|
481 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
482 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
|
483 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
|
484 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
485 factoryNamesAndDescription[i] = |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
486 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
|
487 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
488 name2factory.put(name, factory); |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
489 } |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
490 } |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
491 |
127
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
492 |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
493 /** |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
494 * 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
|
495 */ |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
496 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
|
497 userFactory = bootstrap.getUserFactory(); |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
498 } |
0245a87df368
Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
118
diff
changeset
|
499 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
500 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
501 * 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
|
502 * 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
|
503 * lookup tables. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
504 * @param bootstrap The bootstrap parameters. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
505 */ |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
506 protected void setupServices(FactoryBootstrap bootstrap) { |
26
83a059c204f8
Connected /create with artifact db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
13
diff
changeset
|
507 |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
508 name2service = new HashMap(); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
509 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
510 ServiceFactory [] serviceFactories = |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
511 bootstrap.getServiceFactories(); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
512 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
513 serviceNamesAndDescription = |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
514 new String[serviceFactories.length][]; |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
515 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
516 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
|
517 ServiceFactory factory = serviceFactories[i]; |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
518 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
519 String name = factory.getName(); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
520 String description = factory.getDescription(); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
521 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
522 serviceNamesAndDescription[i] = |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
523 new String [] { name, description }; |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
524 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
525 name2service.put( |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
526 name, |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
527 factory.createService(bootstrap.getContext())); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
528 } |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
529 |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
530 } |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
531 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
532 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
533 * 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
|
534 * 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
|
535 * via the serializers of this artifact factories. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
536 * @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
|
537 */ |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
538 public void wireWithBackend(Backend backend) { |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
539 if (backend != null) { |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
540 this.backend = backend; |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
541 backend.setFactoryLookup(this); |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
542 } |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
543 } |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
544 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
545 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
546 * Called after an backgrounded artifact signals its |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
547 * will to be written back to the backend. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
548 * @param artifact The persistence wrapper around |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
549 * the backgrounded artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
550 * @param action The action to be performed. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
551 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
552 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
|
553 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
|
554 switch (action) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
555 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
|
556 break; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
557 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
|
558 artifact.touch(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
559 break; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
560 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
|
561 artifact.store(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
562 break; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
563 default: |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
564 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
|
565 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
566 removeIdFromBackground(artifact.getId()); |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
567 } |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
568 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
569 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
570 * 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
|
571 * 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
|
572 * from the database again. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
573 * @param id The database id of the artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
574 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
575 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
|
576 synchronized (backgroundIds) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
577 backgroundIds.remove(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
|
578 } |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
579 } |
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
580 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
581 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
582 * 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
|
583 * 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
|
584 * 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
|
585 * @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
|
586 * from being removed from the database. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
587 */ |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
588 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
|
589 synchronized (backgroundIds) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
590 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
|
591 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
592 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
593 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
594 public List filterIds(List ids) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
595 int N = ids.size(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
596 ArrayList out = new ArrayList(N); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
597 synchronized (backgroundIds) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
598 for (int i = 0; i < N; ++i) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
599 Id id = (Id)ids.get(i); |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
600 // only delete artifact if its not in background. |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
601 if (!backgroundIds.contains(Integer.valueOf(id.getId()))) { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
602 out.add(id); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
603 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
604 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
605 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
606 return out; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
607 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
608 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
609 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
|
610 return factoryNamesAndDescription; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
611 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
612 |
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
|
613 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
|
614 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
|
615 } |
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
|
616 |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
617 public ArtifactFactory getArtifactFactory(String factoryName) { |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
618 return (ArtifactFactory)name2factory.get(factoryName); |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
619 } |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
620 |
149
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
621 public UserFactory getUserFactory() { |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
622 return userFactory; |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
623 } |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
624 |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
625 public Document createArtifactWithFactory( |
86
b2e0cb83631c
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
84
diff
changeset
|
626 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
|
627 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
|
628 Document data |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
629 ) |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
630 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
|
631 { |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
632 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
|
633 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
634 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
|
635 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
|
636 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
637 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
638 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
|
639 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
|
640 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
|
641 data); |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
642 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
643 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
|
644 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
|
645 } |
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 PersistentArtifact persistentArtifact; |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
648 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
649 try { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
650 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
|
651 artifact, |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
36
diff
changeset
|
652 factory, |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
653 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
|
654 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
655 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
|
656 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
|
657 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
|
658 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
659 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
660 CallContextImpl cc = new CallContextImpl( |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
661 persistentArtifact, CallContext.NOTHING, callMeta); |
32
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
662 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
663 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
|
664 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
|
665 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
666 finally { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
667 cc.postCall(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
668 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
669 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
670 |
94
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
671 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
|
672 String identifier, |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
673 Document data, |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
674 CallMeta callMeta |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
675 ) |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
676 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
|
677 { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
678 // 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
|
679 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
|
680 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
681 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
|
682 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
|
683 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
684 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
685 CallContextImpl cc = new CallContextImpl( |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
686 artifact, CallContext.TOUCH, callMeta); |
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 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
|
689 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
|
690 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
691 finally { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
692 cc.postCall(); |
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 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
695 |
94
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
696 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
|
697 String identifier, |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
698 Document target, |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
699 CallMeta callMeta |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
700 ) |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
701 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
|
702 { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
703 // 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
|
704 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
|
705 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
706 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
|
707 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
|
708 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
709 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
710 CallContextImpl cc = new CallContextImpl( |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
711 artifact, CallContext.STORE, callMeta); |
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 try { |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
714 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
|
715 } |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
716 finally { |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
717 cc.postCall(); |
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 } |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
720 |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
721 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
|
722 throws ArtifactDatabaseException |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
723 { |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
724 // TODO: Handle background tasks |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
725 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
|
726 |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
727 if (artifact == null) { |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
728 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
|
729 } |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
730 |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
731 CallContextImpl cc = new CallContextImpl( |
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
732 artifact, CallContext.STORE, callMeta); |
32
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 try { |
36
f7d2cd59a0d5
Bugfix done. Now the feed Method works fine
Tim Englich <tim.englich@intevation.de>
parents:
32
diff
changeset
|
735 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
|
736 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
737 finally { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
738 cc.postCall(); |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
739 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
740 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
741 |
94
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
742 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
|
743 String identifier, |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
744 Document format, |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
745 CallMeta callMeta |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
746 ) |
5332d956729c
Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
92
diff
changeset
|
747 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
|
748 { |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
749 // 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
|
750 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
|
751 |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
752 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
|
753 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
|
754 } |
c2d53bd30ab8
Re-factored artifact API for better integration of background processing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
755 |
48
41c225c8bd41
Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
756 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
|
757 } |
68
541814404822
Added interfaces for XML processing services. TODO: Implement them!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
66
diff
changeset
|
758 |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
759 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
|
760 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
|
761 { |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
762 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
|
763 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
764 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
|
765 artifact, |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
766 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
|
767 public Object load( |
86
b2e0cb83631c
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
84
diff
changeset
|
768 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
|
769 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
|
770 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
|
771 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
|
772 ) { |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
773 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
|
774 |
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
|
775 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
|
776 |
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
|
777 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
|
778 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
|
779 |
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
|
780 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
|
781 } |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
782 }); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
783 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
784 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
|
785 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
|
786 } |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
787 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
788 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
|
789 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
|
790 bytes, |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
791 exportSecret); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
792 } |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
793 |
92
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
794 /** |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
795 * Creates an exteral XML representation of an artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
796 * @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
|
797 * for the serialized artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
798 * @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
|
799 * @param secret The signing secret. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
800 * @return An XML document containing the external representation |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
801 * of the artifact. |
73d0ebae81d7
Last bunch of javadoc
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
86
diff
changeset
|
802 */ |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
803 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
|
804 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
|
805 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
|
806 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
|
807 ) { |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
808 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
|
809 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
810 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
|
811 try { |
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 = 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
|
813 } |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
814 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
|
815 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
|
816 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
|
817 } |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
818 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
819 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
|
820 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
|
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 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
|
823 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
824 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
|
825 document, |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
826 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
|
827 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
|
828 |
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
|
829 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
|
830 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
|
831 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
832 Element type = ec.create("type"); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
833 ec.addAttr(type, "name", "export"); |
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(type); |
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 Element data = ec.create("data"); |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
837 ec.addAttr(data, "checksum", checksum); |
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
|
838 ec.addAttr(data, "factory", factoryName); |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
839 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
|
840 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
841 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
|
842 |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
843 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
|
844 } |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
845 |
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
|
846 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
|
847 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
|
848 { |
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
|
849 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
|
850 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
|
851 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
|
852 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
|
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 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
|
855 |
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 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
|
857 || (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
|
858 || (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
|
859 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
|
860 } |
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 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
|
863 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
|
864 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
|
865 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
|
866 |
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 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
|
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 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
|
870 || (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
|
871 || (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
|
872 ) { |
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 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
|
874 } |
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 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
|
877 |
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 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
|
879 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
|
880 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
|
881 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
|
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 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
|
884 || (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
|
885 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
|
886 } |
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 |
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 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
|
889 |
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 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
|
891 |
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 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
|
893 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
|
894 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
|
895 } |
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 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
|
897 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
|
898 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
|
899 } |
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 |
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 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
|
902 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
|
903 |
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 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
|
905 |
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 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
|
907 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
|
908 } |
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 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
|
911 |
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 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
|
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 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
|
915 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
|
916 } |
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 |
81
e9c80fdfee13
Set new identifiers on artifacts after an artifact import.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
80
diff
changeset
|
918 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
|
919 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
|
920 |
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 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
|
922 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
|
923 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
|
924 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
|
925 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
|
926 } |
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
|
927 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
|
928 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
|
929 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
|
930 } |
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 CallContextImpl cc = new CallContextImpl( |
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 persistentArtifact, CallContext.NOTHING, callMeta); |
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 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
|
936 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
|
937 } |
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
|
938 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
|
939 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
|
940 } |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
941 } |
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
942 |
68
541814404822
Added interfaces for XML processing services. TODO: Implement them!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
66
diff
changeset
|
943 public String [][] serviceNamesAndDescriptions() { |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
944 return serviceNamesAndDescription; |
68
541814404822
Added interfaces for XML processing services. TODO: Implement them!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
66
diff
changeset
|
945 } |
541814404822
Added interfaces for XML processing services. TODO: Implement them!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
66
diff
changeset
|
946 |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
947 public Document process( |
86
b2e0cb83631c
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
84
diff
changeset
|
948 String serviceName, |
70
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
949 Document input, |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
950 CallMeta callMeta |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
951 ) |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
952 throws ArtifactDatabaseException |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
953 { |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
954 Service service = (Service)name2service.get(serviceName); |
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 if (service == null) { |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
957 throw new ArtifactDatabaseException(NO_SUCH_SERVICE); |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
958 } |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
959 |
ce488c1d3fc4
Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
68
diff
changeset
|
960 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
|
961 } |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
962 |
118
0e0c27bc0b90
Added creation time to collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
117
diff
changeset
|
963 // User API |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
964 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
965 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
|
966 throws ArtifactDatabaseException |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
967 { |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
968 UserFactory factory = getUserFactory(); |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
969 |
150
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
970 if (factory == null) { |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
971 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
|
972 } |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
973 |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
974 User[] users = factory.getUsers(context); |
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 if (users != null) { |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
977 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
|
978 } |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
979 |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
980 Document result = XMLUtils.newDocument(); |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
981 |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
982 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
|
983 result, |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
984 ArtifactNamespaceContext.NAMESPACE_URI, |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
985 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
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 Element root = ec.create("users"); |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
988 result.appendChild(root); |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
989 |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
990 for (User user: users) { |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
991 Element ue = ec.create("user"); |
152
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
992 ec.addAttr(ue, "uuid", user.identifier()); |
150
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
993 ec.addAttr(ue, "name", user.getName()); |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
994 |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
995 // TODO append the role of the user. |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
996 root.appendChild(ue); |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
997 } |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
998 |
78a27a6b3f1f
Implemented the listUsers() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
149
diff
changeset
|
999 return result; |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1000 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1001 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1002 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
|
1003 throws ArtifactDatabaseException |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1004 { |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1005 UserFactory factory = getUserFactory(); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1006 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1007 if (factory == null) { |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1008 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
|
1009 } |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1010 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1011 String name = XMLUtils.xpathString( |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1012 data, XPATH_USERNAME, ArtifactNamespaceContext.INSTANCE); |
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 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
|
1015 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
|
1016 throw new ArtifactDatabaseException(NO_USERNAME); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1017 } |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1018 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1019 // TODO Extract the role is contained as node in the xml document. |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1020 Document role = XMLUtils.newDocument(); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1021 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1022 User newUser = null; |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1023 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1024 try { |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1025 newUser = factory.createUser(name, role, context); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1026 } |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1027 catch (Exception e) { |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1028 logger.error(e.getMessage(), e); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1029 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
|
1030 } |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1031 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1032 Document result = XMLUtils.newDocument(); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1033 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1034 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
|
1035 result, |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1036 ArtifactNamespaceContext.NAMESPACE_URI, |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1037 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1038 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1039 Element root = ec.create("result"); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1040 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1041 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
|
1042 root.setTextContent(OPERATION_SUCCESSFUL); |
149
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 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
|
1045 root.setTextContent(OPERATION_FAILURE); |
149
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 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1048 result.appendChild(root); |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1049 |
c69abd07bdd0
Implemented the createUser() method in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
1050 return result; |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1051 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1052 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1053 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
|
1054 throws ArtifactDatabaseException |
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
1055 { |
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
1056 UserFactory factory = getUserFactory(); |
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
1057 |
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
1058 if (factory == null) { |
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
1059 throw new ArtifactDatabaseException(NO_SUCH_FACTORY); |
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
1060 } |
7e5619115d5b
Implemented the deleteUser() method in the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
1061 |
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
|
1062 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
|
1063 |
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
|
1064 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
|
1065 |
bf596b83d984
Adjusted method signatures for deleting users in the UserFactory and in the Backend.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
152
diff
changeset
|
1066 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
|
1067 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
|
1068 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
|
1069 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
|
1070 |
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 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
|
1072 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
|
1073 |
154
1a72f08ce8d7
Propagate delete user errors correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
153
diff
changeset
|
1074 boolean success = factory.deleteUser(userId, context); |
1a72f08ce8d7
Propagate delete user errors correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
153
diff
changeset
|
1075 |
1a72f08ce8d7
Propagate delete user errors correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
153
diff
changeset
|
1076 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
|
1077 |
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
|
1078 return result; |
117
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1079 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1080 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1081 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1082 // Collection API |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1083 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1084 public Document listCollections(String userId, CallMeta callMeta) |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1085 throws ArtifactDatabaseException { |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1086 throw new ArtifactDatabaseException("Not implemented, yet!"); |
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 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
|
1090 CallMeta callMeta) |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1091 throws ArtifactDatabaseException { |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1092 throw new ArtifactDatabaseException("Not implemented, yet!"); |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1093 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1094 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1095 public Document deleteCollection(String collectionId, CallMeta callMeta) |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1096 throws ArtifactDatabaseException { |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1097 throw new ArtifactDatabaseException("Not implemented, yet!"); |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1098 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1099 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1100 public Document getCollectionAttribute(String collectionId, String artifactId, |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1101 CallMeta callMeta) throws ArtifactDatabaseException { |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1102 throw new ArtifactDatabaseException("Not implemented, yet!"); |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1103 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1104 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1105 public Document setCollectionAttribute(String collectionId, String artifactId, |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1106 Document attribute, CallMeta callMeta) |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1107 throws ArtifactDatabaseException { |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1108 throw new ArtifactDatabaseException("Not implemented, yet!"); |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1109 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1110 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1111 public Document addCollectionArtifact(String collectionId, String artifactId, |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1112 CallMeta callMeta) throws ArtifactDatabaseException { |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1113 throw new ArtifactDatabaseException("Not implemented, yet!"); |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1114 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1115 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1116 public Document removeCollectionArtifact(String collectionId, String artifactId, |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1117 CallMeta callMeta) throws ArtifactDatabaseException { |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1118 throw new ArtifactDatabaseException("Not implemented, yet!"); |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1119 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1120 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1121 public Document listCollectionArtifacts(String collectionId, |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1122 CallMeta callMeta) throws ArtifactDatabaseException { |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1123 throw new ArtifactDatabaseException("Not implemented, yet!"); |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1124 } |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1125 |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1126 public DeferredOutput outCollection(String collectionId, |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1127 Document format, CallMeta callMeta) |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1128 throws ArtifactDatabaseException{ |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1129 throw new ArtifactDatabaseException("Not implemented, yet!"); |
4d725248f8d1
Added external API for users and collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
100
diff
changeset
|
1130 } |
13
0d6badf6af42
Added not yet working backend to artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1131 } |
79
f69e5b87f05f
Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
75
diff
changeset
|
1132 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |