Project Report: fawkez

Packagesummary org.jcoderz.commons.connector.file

org.jcoderz.commons.connector.file.FsConnection

LineHitsNoteSource
1  /*
2   * $Id: FsConnection.java 1011 2008-06-16 17:57:36Z amandel $
3   *
4   * Copyright 2006, The jCoderZ.org Project. All rights reserved.
5   *
6   * Redistribution and use in source and binary forms, with or without
7   * modification, are permitted provided that the following conditions are
8   * met:
9   *
10   *    * Redistributions of source code must retain the above copyright
11   *      notice, this list of conditions and the following disclaimer.
12   *    * Redistributions in binary form must reproduce the above
13   *      copyright notice, this list of conditions and the following
14   *      disclaimer in the documentation and/or other materials
15   *      provided with the distribution.
16   *    * Neither the name of the jCoderZ.org Project nor the names of
17   *      its contributors may be used to endorse or promote products
18   *      derived from this software without specific prior written
19   *      permission.
20   *
21   * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
22   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24   * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS
25   * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28   * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32   */
33  package org.jcoderz.commons.connector.file;
34  
35  import java.io.FileInputStream;
36  import java.io.FileNotFoundException;
37  import java.io.RandomAccessFile;
38  
39  import javax.resource.ResourceException;
40  
41  /**
42   * The File System Connection Interface.
43   *
44   */
45 (1)public interface FsConnection
46  {
47     /**
48      * Initiates close of the connection handle at the application level.
49      * A connection client is required to call this method after the
50      * connection is no more in use.
51      *
52      * @throws ResourceException thrown if close on a connection handle fails.
53      * Any invalid connection close invocation should also throw this exception.
54      */
55     void close ()
56           throws ResourceException;
57  
58     /**
59      * Tests whether the givent file or directory <code>file</code> exists.
60      *
61      * @param file The file or directory to be checked.
62      * @return True if and only the givent file or directory <code>file</code>
63      *    exists; false otherwise.
64      * @throws ResourceException The Security method denies read access to
65      *    the file or directory <code>file</code>.
66      */
67     boolean isExists (String file)
68           throws ResourceException;
69  
70     /**
71      * Deletes the supplied file or directory <code>file</code>.
72      *
73      * @param file The file or directory to be deleted.
74      *
75      * @return if and only if the file or directory is successfully deleted;
76      *    false otherwise
77      *
78      * @throws ResourceException If a security manager does not allow the file to
79      *    be deleted.
80      */
81     boolean deleteFile (String file)
82           throws ResourceException;
83  
84     /**
85      * Renames the supplied file <code>from</code> to <code>to</code>.
86      *
87      * @param from The file to be renamed.
88      * @param to The new file name.
89      *
90      * @throws ResourceException Thrown to indicate that the file
91      *    <code>from</code> could not be deleted. For example: The Security
92      *    method denies write access to the file or directory <code>to</code>.
93      */
94     void renameFile (String from, String to)
95           throws ResourceException;
96  
97     /**
98      * Moves the file <code>src</code> to <code>dest</code>.
99      *
100      * @param src The file to be moved from.
101      * @param dest The file to be moved to.
102      *
103      * @throws ResourceException Thrown to indicate that the file
104      *    <code>src</code> could not be moved to the <code>dest</code>.
105      *    For example: The Security method denies write access to the file
106      *    or directory <code>dest</code>.
107      */
108     void moveFile (String src, String dest)
109           throws ResourceException;
110  
111     /**
112      * Returns an array of strings naming the files and directories in the
113      * directory <code>dir</code>.
114      *
115      * @see java.io.File#list()
116      *
117      * @param dir The directory whose file's list has be retrieved.
118      *
119      * @return If the given path <code>dir</code> does not exist or does not
120      * denote a directory, then this method returns null. Otherwise returns the
121      * list of files in the directory <code>dir</code>.
122      *
123      * @throws ResourceException Thrown in error cases.
124      *
125      */
126     String [] listFiles (String dir)
127           throws ResourceException;
128  
129     /**
130      * Returns a random access file.
131      *
132      * @param file The system-dependent filename
133      * @param mode The access mode
134      *
135      * @return RandomAccessFile instance.
136      *
137      * @throws ResourceException thrown in error cases.
138      * @throws FileNotFoundException if the file exists but is a directory rather
139      *       than a regular file, or cannot be opened or created for any other
140      *       reason.
141      */
142     RandomAccessFile getRandomAccessFile (String file, String mode)
143           throws ResourceException, FileNotFoundException;
144  
145     /**
146      * Returns a FileInputStream instance.
147      *
148      * @param file The system-dependent filename
149      *
150      * @return FileInputStream instance.
151      *
152      * @throws ResourceException thrown in error cases.
153      * @throws FileNotFoundException If the file does not exist, is a directory
154      * rather than a regular file, or for some other reason cannot be opened
155      * for reading.
156      */
157     FileInputStream getFileInputStream (String file)
158           throws ResourceException, FileNotFoundException;
159  
160  
161     /**
162      * Creates an empty file in the default temporary-file directory.
163      *
164      * @return The name of the created file.
165      *
166      * @throws ResourceException If a security manager does not allow a file to
167      * be created or a file could not be created for some other reasons.
168      */
169     String createTempFile ()
170           throws ResourceException;
171  
172     /**
173      * Creates an empty file in the supplied <code>dir</code> directory.
174      *
175      * @param dir The parent directory for the file to be created.
176      *
177      * @return The name of the created file.
178      *
179      * @throws ResourceException If the supplied <code>dir</code> directory does
180      *    not exist, If a security manager does not allow a file to
181      *    be created or a file could not be created for some other reasons.
182      */
183     String createTempFile (String dir)
184           throws ResourceException;
185  
186     /**
187      * Creates a new, empty file named by the given parameter <code>file</code>
188      * if and only if a file with this name does not yet exist.
189      * Any required parent folders will be created if they do not exist yet.
190      *
191      * @param file The name of the file to be created.
192      *
193      * @return true If the file <code>file</code> does not exist and was
194      *    successfully created; false if the named file already exists.
195      *
196      * @throws ResourceException If a security manager does not allow a file to
197      *    be created or a file could not be created for some other reasons.
198      */
199     boolean createFile (String file)
200           throws ResourceException;
201  
202     /**
203      * Renames the as parameter passed file <code>file</code> to a temp file in
204      * the default temporary-file directory.
205      *
206      * @param file The name of the file to be reanmed.
207      *
208      * @return The name of the temp file.
209      *
210      * @throws ResourceException If a security manager does not allow the file to
211      *    be renamed or a temp file to be created; or if a file could not be
212      *    renamed for some other reasons.
213      */
214     String renameToTempFile (String file)
215           throws ResourceException;
216  }

Findings in this File

c (2) Got an exception - java.lang.RuntimeException: Unable to get class information for @throws tag 'ResourceException'.
c (1) 45 : 0 Type Javadoc comment is missing an @author tag.