View Javadoc

1   /*
2    * <cvs:source>$Source: /devel/astrogrid/filestore/client/src/java/org/astrogrid/filestore/client/FileStoreDelegate.java,v $</cvs:source>
3    * <cvs:author>$Author: jdt $</cvs:author>
4    * <cvs:date>$Date: 2004/11/25 00:19:20 $</cvs:date>
5    * <cvs:version>$Revision: 1.7 $</cvs:version>
6    * <cvs:log>
7    *   $Log: FileStoreDelegate.java,v $
8    *   Revision 1.7  2004/11/25 00:19:20  jdt
9    *   Merge from dave-dev-200410061224-200411221626
10   *
11   *   Revision 1.6.34.2  2004/10/29 20:57:11  dave
12   *   Updated delegate API to match exportInit.
13   *
14   *   Revision 1.6.34.1  2004/10/21 21:00:13  dave
15   *   Added mock://xyz URL handler to enable testing of transfer.
16   *   Implemented importInit to the mock service and created transfer tests.
17   *
18   *   Revision 1.6  2004/08/27 22:43:15  dave
19   *   Updated filestore and myspace to report file size correctly.
20   *
21   *   Revision 1.5.38.1  2004/08/26 22:40:05  dave
22   *   Updated client to handle file size.
23   *
24   *   Revision 1.5  2004/07/23 09:11:16  dave
25   *   Merged development branch, dave-dev-200407221513, into HEAD
26   *
27   *   Revision 1.4.6.1  2004/07/23 02:10:58  dave
28   *   Added IvornFactory and IvornParser
29   *
30   *   Revision 1.4  2004/07/21 18:11:55  dave
31   *   Merged development branch, dave-dev-200407201059, into HEAD
32   *
33   *   Revision 1.3.2.1  2004/07/21 12:25:59  dave
34   *   Updated client to inport from URL
35   *
36   *   Revision 1.3  2004/07/19 23:42:07  dave
37   *   Merged development branch, dave-dev-200407151443, into HEAD
38   *
39   *   Revision 1.2.4.1  2004/07/19 19:40:28  dave
40   *   Debugged and worked around Axis Exception handling
41   *
42   *   Revision 1.2  2004/07/14 13:50:29  dave
43   *   Merged development branch, dave-dev-200406301228, into HEAD
44   *
45   *   Revision 1.1.2.5  2004/07/13 16:37:29  dave
46   *   Refactored common and client to use an array of FileProperties (more SOAP friendly)
47   *
48   *   Revision 1.1.2.4  2004/07/12 14:39:03  dave
49   *   Added server repository classes
50   *
51   *   Revision 1.1.2.3  2004/07/08 07:31:30  dave
52   *   Added container impl and tests
53   *
54   *   Revision 1.1.2.2  2004/07/07 14:54:35  dave
55   *   Changed DataInfo to File Info (leaves room to use DataInfo for the more abstract VoStore interface).
56   *
57   *   Revision 1.1.2.1  2004/07/06 09:16:12  dave
58   *   Added delegate interface and mock implementation
59   *
60   * </cvs:log>
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