Interface IReadableRepository
- All Known Subinterfaces:
IBuildInformationRepository
,IReportsRepository
,ISourceRepository
No assumption about the nature of location revisions can be maintained (whether or not they are repository-wide).
Relative locations are forbidden. Locations with .. path components are forbidden too.
Note that ILocation.getRepositoryName()
can be used by underlying implementation.
- Version:
- $Revision$ $Date$
- Author:
- Stepan Roh, Polarion Software
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
copyToLocalFile
(ILocation location, File file) Will copy file or folder to given local file or directory.boolean
Whether given location exists (either as a file or as a folder).long
getFileSize
(ILocation location) Return file size in bytes.long
getLastModificationTime
(ILocation location) Return time of last modification if location is file.boolean
Whether given location exists as a file.boolean
Whether given location exists as a folder.listFolder
(ILocation location, boolean recurse) List folder contents.Read data from given file.
-
Method Details
-
exists
Whether given location exists (either as a file or as a folder).- Parameters:
location
- location- Returns:
true
if given location exists- Throws:
IllegalArgumentException
- if location isnull
IllegalArgumentException
- if location is relative
-
isFolder
Whether given location exists as a folder.- Parameters:
location
- location- Returns:
true
if given location exists and is a folder- Throws:
IllegalArgumentException
- if location isnull
IllegalArgumentException
- if location is relative
-
isFile
Whether given location exists as a file.- Parameters:
location
- location- Returns:
true
if given location exists and is a file- Throws:
IllegalArgumentException
- if location isnull
IllegalArgumentException
- if location is relative
-
getLastModificationTime
Return time of last modification if location is file.- Parameters:
location
- file location- Returns:
- last modification time in miliseconds or zero if location is not file
- Throws:
IllegalArgumentException
- if location isnull
IllegalArgumentException
- if location is relative
-
getFileSize
Return file size in bytes.The return value is unspecified for anything which is not file.
- Parameters:
location
- file location- Returns:
- file size in bytes or zero if location does not exist
- Throws:
IllegalArgumentException
- if location isnull
IllegalArgumentException
- if location is relative
-
readFile
Read data from given file.Returned stream should be closed as soon as possible, however it is ensured that it will work until it is closed.
- Parameters:
location
- location- Returns:
- file data as
InputStream
(notnull
) - Throws:
IllegalArgumentException
- if location isnull
IllegalArgumentException
- if location is relativeIOException
- if error occurs or location is not file
-
listFolder
List folder contents.If given location has revision, returned locations have revision corresponding to it.
- Parameters:
location
- locationrecurse
-true
if listing should be recursive- Returns:
List
of absoluteILocation
s (notnull
)- Throws:
IllegalArgumentException
- if location isnull
IllegalArgumentException
- if location is relativeIOException
- if error occurs or location is not folder
-
copyToLocalFile
Will copy file or folder to given local file or directory.If given location is file then file data are written into given local file.
If given location is folder then
File.mkdirs()
is called on given local file and folder contents are (recursively) copied under it.Note that last modification time of target files will mirror those of source (but might be slightly different due to difference in precision).
- Parameters:
location
- location to copy fromfile
- file or directory to copy to- Throws:
IllegalArgumentException
- if location isnull
IllegalArgumentException
- if location is relativeIllegalArgumentException
- if file isnull
IOException
- if error occurs
-