View Javadoc

1   /*
2    *
3    * <cvs:source>$Source: /devel/astrogrid/filestore/server/src/java/org/astrogrid/filestore/server/repository/RepositoryContainer.java,v $</cvs:source>
4    * <cvs:author>$Author: dave $</cvs:author>
5    * <cvs:date>$Date: 2004/09/17 16:46:14 $</cvs:date>
6    * <cvs:version>$Revision: 1.6 $</cvs:version>
7    * <cvs:log>
8    *   $Log: RepositoryContainer.java,v $
9    *   Revision 1.6  2004/09/17 16:46:14  dave
10   *   Fixed servlet deployment in FileStore ...
11   *   Changed tabs to spaces in source code ...
12   *
13   *   Revision 1.5.24.1  2004/09/17 15:10:32  dave
14   *   Uncommented the call to servlet deploy in the build script.
15   *   Replaced tabs with spaces in source code.
16   *
17   *   Revision 1.5  2004/08/27 22:43:15  dave
18   *   Updated filestore and myspace to report file size correctly.
19   *
20   *   Revision 1.4.12.1  2004/08/26 19:06:50  dave
21   *   Modified filestore to return file size in properties.
22   *
23   *   Revision 1.4  2004/08/18 19:00:01  dave
24   *   Myspace manager modified to use remote filestore.
25   *   Tested before checkin - integration tests at 91%.
26   *
27   *   Revision 1.3.16.1  2004/08/04 17:03:33  dave
28   *   Added container to servlet
29   *
30   *   Revision 1.3  2004/07/21 18:11:55  dave
31   *   Merged development branch, dave-dev-200407201059, into HEAD
32   *
33   *   Revision 1.2.6.1  2004/07/21 16:28:16  dave
34   *   Added content properties and tests
35   *
36   *   Revision 1.2  2004/07/14 13:50:29  dave
37   *   Merged development branch, dave-dev-200406301228, into HEAD
38   *
39   *   Revision 1.1.2.2  2004/07/14 10:34:08  dave
40   *   Reafctored server to use array of properties
41   *
42   *   Revision 1.1.2.1  2004/07/12 14:39:03  dave
43   *   Added server repository classes
44   *
45   *   Revision 1.1.2.1  2004/07/08 07:31:30  dave
46   *   Added container impl and tests
47   *
48   * </cvs:log>
49   *
50   */
51  package org.astrogrid.filestore.server.repository ;
52  
53  import java.net.URL ;
54  import java.io.IOException  ;
55  import java.io.InputStream  ;
56  import java.io.OutputStream ;
57  
58  import org.astrogrid.filestore.common.file.FileProperty ;
59  import org.astrogrid.filestore.common.file.FileProperties ;
60  import org.astrogrid.filestore.common.file.FileIdentifier ;
61  import org.astrogrid.filestore.common.exception.FileStoreServiceException ;
62  import org.astrogrid.filestore.common.exception.FileStoreNotFoundException ;
63  import org.astrogrid.filestore.common.exception.FileStoreTransferException ;
64  
65  /***
66   * Public interface for a file container.
67   *
68   */
69  public interface RepositoryContainer
70  	{
71  
72  	/***
73  	 * Access to our identifier.
74  	 * @return The internal identifier for the file.
75  	 *
76  	 */
77  	public FileIdentifier ident() ;
78  
79  	/***
80  	 * Access to our properties.
81  	 * @return The info for the file.
82  	 *
83  	 */
84  	public FileProperties properties() ;
85  
86  	/***
87  	 * Import an array of bytes.
88  	 * @param bytes The array of bytes to import into the container.
89  	 * @throws FileStoreServiceException If unable to complete the action.
90  	 *
91  	 */
92  	public void importBytes(byte[] bytes)
93  		throws FileStoreServiceException ;
94  
95  	/***
96  	 * Export our contents as bytes.
97  	 * @return An array of bytes from the container contents.
98  	 * @throws FileStoreNotFoundException If unable to locate the file.
99  	 * @throws FileStoreServiceException If unable to complete the action.
100 	 *
101 	 */
102     public byte[] exportBytes()
103         throws FileStoreServiceException, FileStoreNotFoundException ;
104 
105     /***
106      * Append an array of bytes.
107      * @param bytes The array of bytes to append to the container.
108      * @throws FileStoreNotFoundException If unable to locate the file.
109      * @throws FileStoreServiceException If unable to complete the action.
110      *
111      */
112     public void appendBytes(byte[] bytes)
113         throws FileStoreServiceException, FileStoreNotFoundException ;
114 
115     /***
116      * Delete the contents of the container.
117      * @throws FileStoreNotFoundException If unable to locate the file.
118      * @throws FileStoreServiceException If unable to complete the action.
119      *
120      */
121     public void delete()
122         throws FileStoreServiceException, FileStoreNotFoundException ;
123 
124     /***
125      * Get an input stream to the container contents.
126      * @throws FileStoreNotFoundException If unable to locate the file.
127      * @throws FileStoreServiceException If unable to open the file.
128      *
129      */
130     public InputStream getDataInputStream()
131         throws FileStoreServiceException, FileStoreNotFoundException ;
132 
133     /***
134      * Get an output stream to the container contents.
135      * @throws FileStoreServiceException If unable to open the local file.
136      *
137      */
138     public OutputStream getDataOutputStream()
139         throws FileStoreServiceException ;
140 
141     /***
142      * Import our data from a URL.
143      * @param url The URL to import the data from.
144      * @throws FileStoreTransferException If unable to complete the action.
145      * @throws FileStoreServiceException If unable to open the local file.
146      *
147      */
148     public void importData(URL url)
149         throws FileStoreTransferException, FileStoreServiceException ;
150 
151     /***
152      * Import our data from an InputStream.
153      * @param stream The input stream to import the data from.
154      * @throws FileStoreTransferException If unable to complete the action.
155      * @throws FileStoreServiceException If unable to open the local file.
156      *
157      */
158     public void importData(InputStream stream)
159         throws FileStoreTransferException, FileStoreServiceException ;
160 
161     /***
162      * Export our data to an OutputStream.
163      * @param stream The output stream to export the data to.
164      * @throws FileStoreTransferException If unable to complete the action.
165      * @throws FileStoreServiceException If unable to open the local file.
166      *
167      */
168     public void exportData(OutputStream stream)
169         throws FileStoreServiceException, FileStoreNotFoundException, FileStoreTransferException ;
170 
171     /***
172      * Update the container properties.
173      * Note - if you change the underlying data file you must update the properties.
174      *
175      */
176     public void update()
177         throws FileStoreServiceException ;
178 
179     }
180