Mercurial > dive4elements > framework
comparison artifacts/src/main/java/org/dive4elements/artifacts/ArtifactCollection.java @ 471:1a87cb24a446
Moved directories to org.dive4elements
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 10:50:31 +0200 |
parents | artifacts/src/main/java/de/intevation/artifacts/ArtifactCollection.java@942a54670a72 |
children | 415df0fc4fa1 |
comparison
equal
deleted
inserted
replaced
470:19cb9729bd17 | 471:1a87cb24a446 |
---|---|
1 /* | |
2 * Copyright (c) 2011 by Intevation GmbH | |
3 * | |
4 * This program is free software under the LGPL (>=v2.1) | |
5 * Read the file LGPL.txt coming with the software for details | |
6 * or visit http://www.gnu.org/licenses/ if it does not exist. | |
7 */ | |
8 | |
9 package de.intevation.artifacts; | |
10 | |
11 import org.w3c.dom.Document; | |
12 | |
13 import java.io.IOException; | |
14 import java.io.OutputStream; | |
15 import java.io.Serializable; | |
16 | |
17 import java.util.Date; | |
18 | |
19 public interface ArtifactCollection | |
20 extends Serializable | |
21 { | |
22 /** | |
23 * Set a new identifier for this collection. | |
24 * @param identifier New identifier for this collection. | |
25 */ | |
26 void setIdentifier(String identifier); | |
27 | |
28 /** | |
29 * Identify this collection. | |
30 * @return Returns unique string to identify this collection globally. | |
31 */ | |
32 String identifier(); | |
33 | |
34 String getName(); | |
35 | |
36 void setName(String name); | |
37 | |
38 Date getCreationTime(); | |
39 | |
40 void setCreationTime(Date creationTime); | |
41 | |
42 long getTTL(); | |
43 | |
44 void setTTL(long ttl); | |
45 | |
46 Document getAttribute(); | |
47 | |
48 void setAttribute(Document attribute); | |
49 | |
50 /** | |
51 * Set a new owner of this collection. | |
52 * @param user New owner for this collection. | |
53 */ | |
54 void setUser(User user); | |
55 | |
56 /** | |
57 * Identify the owner of the collection. | |
58 * @return Returns owner of the collection. | |
59 */ | |
60 User getUser(); // FIXME: Is ArtifactCollectionFactory needed? | |
61 | |
62 /** | |
63 * When created by a factory this method is called to | |
64 * initialize the collection. | |
65 * @param identifier The identifier from collection database | |
66 * @param factory The factory which created this collection. | |
67 * @param context The global context of the runtime system. | |
68 * @param data The data which can be use to setup a collection with | |
69 * more details. | |
70 */ | |
71 void setup( | |
72 String identifier, | |
73 String name, | |
74 Date creationTime, | |
75 long ttl, | |
76 ArtifactCollectionFactory factory, | |
77 Object context, | |
78 Document data); | |
79 | |
80 | |
81 Document describe(CallContext context); | |
82 | |
83 //TODO: create LifeCycle interface | |
84 /** | |
85 * Called from artifact database when an artifact is | |
86 * going to be removed from system. | |
87 * @param context The global context of the runtime system. | |
88 */ | |
89 void endOfLife(Object context); | |
90 | |
91 /** | |
92 * Internal hash of this collection. | |
93 * @return Returns hash that should stay the same if the internal | |
94 * value has not changed. Useful for caching | |
95 */ | |
96 String hash(); | |
97 | |
98 | |
99 /** | |
100 * Called from artifact database before an artifact is | |
101 * going to be exported as xml document. | |
102 * @param context The global context of the runtime system. | |
103 */ | |
104 void cleanup(Object context); | |
105 | |
106 void addArtifact(Artifact artifact, Document attributes, CallContext context); | |
107 | |
108 void removeArtifact(Artifact artifact, CallContext context); | |
109 | |
110 Artifact [] getArtifacts(CallContext context); | |
111 | |
112 Document getAttribute(Artifact artifactCall, CallContext context); | |
113 | |
114 void setAttribute(Artifact artifact, Document document, CallContext context); | |
115 | |
116 /** | |
117 * Produce output for this collection. | |
118 * @param type Specifies the output type of the action. | |
119 * @param format Specifies the format of the output. | |
120 * @param out Stream to write the result data to. | |
121 * @param context The global context of the runtime system. | |
122 * @throws IOException Thrown if an I/O occurs. | |
123 */ | |
124 void out( | |
125 String type, | |
126 Document format, | |
127 OutputStream out, | |
128 CallContext context) | |
129 throws IOException; | |
130 } | |
131 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |