1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63 package org.astrogrid.filestore.client ;
64
65 import java.rmi.Remote ;
66 import java.rmi.RemoteException ;
67
68 import org.astrogrid.filestore.common.FileStore ;
69 import org.astrogrid.filestore.common.file.FileProperty ;
70 import org.astrogrid.filestore.common.transfer.TransferProperties ;
71 import org.astrogrid.filestore.common.exception.FileStoreException ;
72 import org.astrogrid.filestore.common.exception.FileStoreNotFoundException ;
73 import org.astrogrid.filestore.common.exception.FileStoreIdentifierException ;
74 import org.astrogrid.filestore.common.exception.FileStoreServiceException ;
75 import org.astrogrid.filestore.common.exception.FileStoreTransferException ;
76
77 /***
78 * Public interface for the file store delegate.
79 * This mirrors the service interface, without the remote exceptions.
80 *
81 */
82 public interface FileStoreDelegate
83 {
84 /***
85 * Get the service identifier - used for testing.
86 * @return The ivo identifier for this service.
87 * @throws FileStoreServiceException if unable handle the request.
88 *
89 */
90 public String identifier()
91 throws FileStoreServiceException ;
92
93 /***
94 * Import (store) a string of data.
95 * @param properties An array of FileProperties describing the imported data.
96 * @param data The string of data to store.
97 * @return An array of FileProperties describing the imported data.
98 * @throws FileStoreException if the data string is null.
99 * @throws FileStoreServiceException if unable handle the request.
100 *
101 */
102 public FileProperty[] importString(FileProperty[] properties, String data)
103 throws FileStoreServiceException, FileStoreException ;
104
105 /***
106 * Import (store) a byte array of data.
107 * @param properties An array of FileProperties describing the imported data.
108 * @param data The byte array of data to store.
109 * @return An array of FileProperties describing the imported data.
110 * @throws FileStoreException if the data string is null.
111 * @throws FileStoreServiceException if unable handle the request.
112 *
113 */
114 public FileProperty[] importBytes(FileProperty[] properties, byte[] data)
115 throws FileStoreServiceException, FileStoreException ;
116
117 /***
118 * Append a string to existing data.
119 * @param ident The internal identifier of the target.
120 * @param data The string to append.
121 * @return An array of FileProperties describing the imported data.
122 * @throws FileStoreIdentifierException if the identifier is null or not valid.
123 * @throws FileStoreNotFoundException if unable to locate the file.
124 * @throws FileStoreException if the string is null.
125 * @throws FileStoreServiceException if unable handle the request.
126 *
127 */
128 public FileProperty[] appendString(String ident, String data)
129 throws FileStoreServiceException, FileStoreIdentifierException, FileStoreNotFoundException, FileStoreException ;
130
131 /***
132 * Append an array of bytes to existing data.
133 * @param ident The internal identifier of the target.
134 * @param data The bytes to append.
135 * @return An array of FileProperties describing the imported data.
136 * @throws FileStoreIdentifierException if the identifier is null or not valid.
137 * @throws FileStoreNotFoundException if unable to locate the file.
138 * @throws FileStoreException if the array is null.
139 * @throws FileStoreServiceException if unable handle the request.
140 *
141 */
142 public FileProperty[] appendBytes(String ident, byte[] data)
143 throws FileStoreServiceException, FileStoreIdentifierException, FileStoreNotFoundException, FileStoreException ;
144
145 /***
146 * Export (read) the contents of a file as a string.
147 * @param ident The internal identifier of the target file.
148 * @return The contents of a data object as a string.
149 * @throws FileStoreIdentifierException if the identifier is null or not valid.
150 * @throws FileStoreNotFoundException if unable to locate the file.
151 * @throws FileStoreServiceException if unable handle the request.
152 *
153 */
154 public String exportString(String ident)
155 throws FileStoreServiceException, FileStoreIdentifierException, FileStoreNotFoundException ;
156
157 /***
158 * Export (read) the contents of a file as an array of bytes.
159 * @param ident The internal identifier of the target file.
160 * @return The contents of a data object as a string.
161 * @throws FileStoreIdentifierException if the identifier is null or not valid.
162 * @throws FileStoreNotFoundException if unable to locate the file.
163 * @throws FileStoreServiceException if unable handle the request.
164 *
165 */
166 public byte[] exportBytes(String ident)
167 throws FileStoreServiceException, FileStoreIdentifierException, FileStoreNotFoundException ;
168
169 /***
170 * Create a local duplicate (copy) of a file.
171 * @param ident The internal identifier of the target file.
172 * @param properties An optional array of FileProperties describing the copy.
173 * @return An array of FileProperties describing the copied data.
174 * @throws FileStoreTransferException if unable to transfer the data.
175 * @throws FileStoreIdentifierException if the identifier is null or not valid.
176 * @throws FileStoreNotFoundException if unable to locate the file.
177 * @throws FileStoreServiceException if unable handle the request.
178 *
179 */
180 public FileProperty[] duplicate(String ident, FileProperty[] properties)
181 throws FileStoreServiceException, FileStoreIdentifierException, FileStoreNotFoundException, FileStoreTransferException ;
182
183 /***
184 * Delete a file.
185 * @param ident The internal identifier of the target file.
186 * @return An array of FileProperties describing the deleted data.
187 * @throws FileStoreIdentifierException if the identifier is null or not valid.
188 * @throws FileStoreNotFoundException if unable to locate the file.
189 * @throws FileStoreServiceException if unable handle the request.
190 *
191 */
192 public FileProperty[] delete(String ident)
193 throws FileStoreServiceException, FileStoreIdentifierException, FileStoreNotFoundException ;
194
195 /***
196 * Get the local meta data information for a file.
197 * @param ident The internal identifier of the target file.
198 * @return An array of FileProperties describing the data.
199 * @throws FileStoreIdentifierException if the identifier is null or not valid.
200 * @throws FileStoreNotFoundException if unable to locate the file.
201 * @throws FileStoreServiceException if unable handle the request.
202 *
203 */
204 public FileProperty[] properties(String ident)
205 throws FileStoreServiceException, FileStoreIdentifierException, FileStoreNotFoundException ;
206
207 /***
208 * Prepare to receive a file from a remote source.
209 * @param transfer A TransferProperties object describing the transfer.
210 * @return A new TransferProperties describing the transfer.
211 * @throws FileStoreTransferException If the input transfer properties are not valid.
212 * @throws FileStoreServiceException if unable handle the request.
213 *
214 */
215 public TransferProperties importInit(TransferProperties transfer)
216 throws FileStoreServiceException, FileStoreTransferException ;
217
218 /***
219 * Import a file from a remote source.
220 * @param transfer A TransferProperties object describing the transfer.
221 * @return A new TransferProperties describing the transfer.
222 * @throws FileStoreServiceException if unable handle the request.
223 * @throws FileStoreTransferException if the transfer properties are null.
224 *
225 */
226 public TransferProperties importData(TransferProperties transfer)
227 throws FileStoreTransferException, FileStoreServiceException ;
228
229 /***
230 * Prepare to send a file to a remote destination.
231 * @param transfer A TransferProperties object describing the transfer.
232 * @return A new TransferProperties describing the transfer.
233 * @throws FileStoreTransferException if the transfer properties are null.
234 * @throws FileStoreNotFoundException If unable to locate the target object.
235 * @throws FileStoreServiceException if unable handle the request.
236 *
237 */
238 public TransferProperties exportInit(TransferProperties transfer)
239 throws FileStoreNotFoundException, FileStoreTransferException, FileStoreServiceException ;
240
241 /***
242 * Export a file to a remote destination.
243 * @param transfer A TransferProperties object describing the transfer.
244 * @return A new TransferProperties describing the transfer.
245 * @throws FileStoreServiceException if unable handle the request.
246 *
247 */
248 public TransferProperties exportData(TransferProperties transfer)
249 throws FileStoreServiceException ;
250
251 /***
252 * Throw a FileStoreIdentifierException, useful for debugging the transfer of Exceptions via SOAP.
253 * @throws FileStoreIdentifierException unpacking it from the RemoteException when invoked via a SOAP call.
254 * @throws FileStoreServiceException if the service was unable to handle the request.
255 *
256 */
257 public void throwIdentifierException()
258 throws FileStoreIdentifierException, FileStoreServiceException ;
259
260 }
261