Mercurial > dive4elements > framework
annotate artifacts/src/main/java/de/intevation/artifacts/ArtifactCollection.java @ 141:5d40faf1484d
Added a Rest resource that lists all collections of a specific user.
artifacts/trunk@1366 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 02 Mar 2011 13:31:59 +0000 |
parents | 0e0c27bc0b90 |
children | db0d20440b92 |
rev | line source |
---|---|
115
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 /* |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 * Copyright (c) 2011 by Intevation GmbH |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 * |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 */ |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 package de.intevation.artifacts; |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import org.w3c.dom.Document; |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 import java.io.IOException; |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 import java.io.OutputStream; |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 import java.io.Serializable; |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 |
118
0e0c27bc0b90
Added creation time to collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
116
diff
changeset
|
17 import java.util.Date; |
0e0c27bc0b90
Added creation time to collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
116
diff
changeset
|
18 |
115
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 public interface ArtifactCollection |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 extends Serializable |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 { |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 /** |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 * Set a new identifier for this collection. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 * @param identifier New identifier for this collection. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 */ |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 void setIdentifier(String identifier); |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 /** |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 * Identify this collection. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 * @return Returns unique string to identify this collection globally. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 */ |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 String identifier(); |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 |
118
0e0c27bc0b90
Added creation time to collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
116
diff
changeset
|
34 Date getCreationTime(); |
0e0c27bc0b90
Added creation time to collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
116
diff
changeset
|
35 |
0e0c27bc0b90
Added creation time to collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
116
diff
changeset
|
36 void setCreationTime(Date creationTime); |
0e0c27bc0b90
Added creation time to collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
116
diff
changeset
|
37 |
115
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 /** |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 * Set a new owner of this collection. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 * @param user New owner for this collection. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 */ |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 void setUser(User user); |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 /** |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 * Identify the owner of the collection. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 * @return Returns owner of the collection. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 */ |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 User getUser(); // FIXME: Is ArtifactCollectionFactory needed? |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 /** |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 * When created by a factory this method is called to |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 * initialize the collection. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 * @param identifier The identifier from collection database |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 * @param factory The factory which created this collection. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 * @param context The global context of the runtime system. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 * @param data The data which can be use to setup a collection with |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 * more details. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 */ |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 void setup( |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 String identifier, |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 ArtifactCollectionFactory factory, |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 Object context, |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 Document data); |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 //TODO: create LifeCycle interface |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 /** |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 * Called from artifact database when an artifact is |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 * going to be removed from system. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 * @param context The global context of the runtime system. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 */ |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 void endOfLife(Object context); |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 /** |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 * Internal hash of this collection. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 * @return Returns hash that should stay the same if the internal |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 * value has not changed. Useful for caching |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 */ |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 String hash(); |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
80 |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 /** |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 * Called from artifact database before an artifact is |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 * going to be exported as xml document. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 * @param context The global context of the runtime system. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
85 */ |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 void cleanup(Object context); |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 |
116
2707b7ec273f
Added missing call contexts to API.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
115
diff
changeset
|
88 void addArtifact(Artifact artifact, Document attributes, CallContext context); |
115
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 |
116
2707b7ec273f
Added missing call contexts to API.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
115
diff
changeset
|
90 void removeArtifact(Artifact artifact, CallContext context); |
115
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 |
116
2707b7ec273f
Added missing call contexts to API.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
115
diff
changeset
|
92 Artifact [] getArtifacts(CallContext context); |
115
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 |
116
2707b7ec273f
Added missing call contexts to API.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
115
diff
changeset
|
94 Document getAttribute(Artifact artifactCall, CallContext context); |
2707b7ec273f
Added missing call contexts to API.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
115
diff
changeset
|
95 |
2707b7ec273f
Added missing call contexts to API.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
115
diff
changeset
|
96 void setAttribute(Artifact artifact, Document document, CallContext context); |
115
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 /** |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 * Produce output for this collection. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 * @param format Specifies the format of the output. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 * @param out Stream to write the result data to. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 * @param context The global context of the runtime system. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 * @throws IOException Thrown if an I/O occurs. |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 */ |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
105 void out( |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 Document format, |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
107 OutputStream out, |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 CallContext context) |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 throws IOException; |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 } |
a1200c6ed048
Initial interfaces to handle with Collections and Users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |