KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > filesys > server > filesys > DiskInterface


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.filesys.server.filesys;
18
19 import org.alfresco.filesys.server.SrvSession;
20 import org.alfresco.filesys.server.core.DeviceContext;
21 import org.alfresco.filesys.server.core.DeviceInterface;
22
23 /**
24  * The disk interface is implemented by classes that provide an interface for a disk type shared
25  * device.
26  */

27 public interface DiskInterface extends DeviceInterface
28 {
29
30     /**
31      * Close the file.
32      *
33      * @param sess Server session
34      * @param tree Tree connection.
35      * @param param Network file context.
36      * @exception java.io.IOException If an error occurs.
37      */

38     public void closeFile(SrvSession sess, TreeConnection tree, NetworkFile param) throws java.io.IOException JavaDoc;
39
40     /**
41      * Create a new directory on this file system.
42      *
43      * @param sess Server session
44      * @param tree Tree connection.
45      * @param params Directory create parameters
46      * @exception java.io.IOException If an error occurs.
47      */

48     public void createDirectory(SrvSession sess, TreeConnection tree, FileOpenParams params) throws java.io.IOException JavaDoc;
49
50     /**
51      * Create a new file on the file system.
52      *
53      * @param sess Server session
54      * @param tree Tree connection
55      * @param params File create parameters
56      * @return NetworkFile
57      * @exception java.io.IOException If an error occurs.
58      */

59     public NetworkFile createFile(SrvSession sess, TreeConnection tree, FileOpenParams params)
60             throws java.io.IOException JavaDoc;
61
62     /**
63      * Delete the directory from the filesystem.
64      *
65      * @param sess Server session
66      * @param tree Tree connection
67      * @param dir Directory name.
68      * @exception java.io.IOException The exception description.
69      */

70     public void deleteDirectory(SrvSession sess, TreeConnection tree, String JavaDoc dir) throws java.io.IOException JavaDoc;
71
72     /**
73      * Delete the specified file.
74      *
75      * @param sess Server session
76      * @param tree Tree connection
77      * @param file NetworkFile
78      * @exception java.io.IOException The exception description.
79      */

80     public void deleteFile(SrvSession sess, TreeConnection tree, String JavaDoc name) throws java.io.IOException JavaDoc;
81
82     /**
83      * Check if the specified file exists, and whether it is a file or directory.
84      *
85      * @param sess Server session
86      * @param tree Tree connection
87      * @param name java.lang.String
88      * @return int
89      * @see FileStatus
90      */

91     int fileExists(SrvSession sess, TreeConnection tree, String JavaDoc name);
92
93     /**
94      * Flush any buffered output for the specified file.
95      *
96      * @param sess Server session
97      * @param tree Tree connection
98      * @param file Network file context.
99      * @exception java.io.IOException The exception description.
100      */

101     public void flushFile(SrvSession sess, TreeConnection tree, NetworkFile file) throws java.io.IOException JavaDoc;
102
103     /**
104      * Get the file information for the specified file.
105      *
106      * @param sess Server session
107      * @param tree Tree connection
108      * @param name File name/path that information is required for.
109      * @return File information if valid, else null
110      * @exception java.io.IOException The exception description.
111      */

112     public FileInfo getFileInformation(SrvSession sess, TreeConnection tree, String JavaDoc name) throws java.io.IOException JavaDoc;
113
114     /**
115      * Determine if the disk device is read-only.
116      *
117      * @param sess Server session
118      * @param ctx Device context
119      * @return boolean
120      * @exception java.io.IOException If an error occurs.
121      */

122     boolean isReadOnly(SrvSession sess, DeviceContext ctx) throws java.io.IOException JavaDoc;
123
124     /**
125      * Open a file on the file system.
126      *
127      * @param sess Server session
128      * @param tree Tree connection
129      * @param params File open parameters
130      * @return NetworkFile
131      * @exception java.io.IOException If an error occurs.
132      */

133     public NetworkFile openFile(SrvSession sess, TreeConnection tree, FileOpenParams params) throws java.io.IOException JavaDoc;
134
135     /**
136      * Read a block of data from the specified file.
137      *
138      * @param sess Session details
139      * @param tree Tree connection
140      * @param file Network file
141      * @param buf Buffer to return data to
142      * @param bufPos Starting position in the return buffer
143      * @param siz Maximum size of data to return
144      * @param filePos File offset to read data
145      * @return Number of bytes read
146      * @exception java.io.IOException The exception description.
147      */

148     public int readFile(SrvSession sess, TreeConnection tree, NetworkFile file, byte[] buf, int bufPos, int siz,
149             long filePos) throws java.io.IOException JavaDoc;
150
151     /**
152      * Rename the specified file.
153      *
154      * @param sess Server session
155      * @param tree Tree connection
156      * @param oldName java.lang.String
157      * @param newName java.lang.String
158      * @exception java.io.IOException The exception description.
159      */

160     public void renameFile(SrvSession sess, TreeConnection tree, String JavaDoc oldName, String JavaDoc newName)
161             throws java.io.IOException JavaDoc;
162
163     /**
164      * Seek to the specified file position.
165      *
166      * @param sess Server session
167      * @param tree Tree connection
168      * @param file Network file.
169      * @param pos Position to seek to.
170      * @param typ Seek type.
171      * @return New file position, relative to the start of file.
172      */

173     long seekFile(SrvSession sess, TreeConnection tree, NetworkFile file, long pos, int typ) throws java.io.IOException JavaDoc;
174
175     /**
176      * Set the file information for the specified file.
177      *
178      * @param sess Server session
179      * @param tree Tree connection
180      * @param name java.lang.String
181      * @param info FileInfo
182      * @exception java.io.IOException The exception description.
183      */

184     public void setFileInformation(SrvSession sess, TreeConnection tree, String JavaDoc name, FileInfo info)
185             throws java.io.IOException JavaDoc;
186
187     /**
188      * Start a new search on the filesystem using the specified searchPath that may contain
189      * wildcards.
190      *
191      * @param sess Server session
192      * @param tree Tree connection
193      * @param searchPath File(s) to search for, may include wildcards.
194      * @param attrib Attributes of the file(s) to search for, see class SMBFileAttribute.
195      * @return SearchContext
196      * @exception java.io.FileNotFoundException If the search could not be started.
197      */

198     public SearchContext startSearch(SrvSession sess, TreeConnection tree, String JavaDoc searchPath, int attrib)
199             throws java.io.FileNotFoundException JavaDoc;
200
201     /**
202      * Truncate a file to the specified size
203      *
204      * @param sess Server session
205      * @param tree Tree connection
206      * @param file Network file details
207      * @param siz New file length
208      * @exception java.io.IOException The exception description.
209      */

210     public void truncateFile(SrvSession sess, TreeConnection tree, NetworkFile file, long siz)
211             throws java.io.IOException JavaDoc;
212
213     /**
214      * Write a block of data to the file.
215      *
216      * @param sess Server session
217      * @param tree Tree connection
218      * @param file Network file details
219      * @param buf byte[] Data to be written
220      * @param bufoff Offset within the buffer that the data starts
221      * @param siz int Data length
222      * @param fileoff Position within the file that the data is to be written.
223      * @return Number of bytes actually written
224      * @exception java.io.IOException The exception description.
225      */

226     public int writeFile(SrvSession sess, TreeConnection tree, NetworkFile file, byte[] buf, int bufoff, int siz,
227             long fileoff) throws java.io.IOException JavaDoc;
228 }
Popular Tags