Package org.codehaus.mojo.mrm.api
Interface FileSystem
- All Known Implementing Classes:
BaseFileSystem
public interface FileSystem
A repository is just a type of file system.
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionReturns the entry at the specified path.long
getLastModified
(DirectoryEntry entry) Returns the time that the specified directory entry was last modified.getRoot()
Returns the root directory entry.Entry[]
listEntries
(DirectoryEntry directory) Lists the entries in the specified directory.put
(DirectoryEntry parent, String name, InputStream content) Puts the specified content into a the specified directory.
-
Method Details
-
listEntries
Lists the entries in the specified directory. Some implementations may be lazy caching implementations, in which case it is permitted to return either an empty array, or only those entries which have been loaded into the cache, so consumers should not assume that a missing entry implies non-existence. The only way to be sure that an artifact does not exist is to call theFileEntry.getInputStream()
method, althoughget(String)
returningnull
is also definitive, a non-null does not prove existence).- Parameters:
directory
- the directory to list the entries of.- Returns:
- a copy of the known entries in the specified directory, never
null
. The caller can safely modify the returned array. - Since:
- 1.0
-
getRoot
DirectoryEntry getRoot()Returns the root directory entry.- Returns:
- the root directory entry.
- Since:
- 1.0
-
get
Returns the entry at the specified path. Anull
result proves the path does not exist, however very lazy caching implementations may return a non-null entry for paths which do not exist. -
getLastModified
Returns the time that the specified directory entry was last modified. Note:DefaultDirectoryEntry.getLastModified()
delegates to this method.- Parameters:
entry
- the directory entry.- Returns:
- A
long
value representing the time the directory was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or0L
if the the time is unknown. - Throws:
IOException
- if an I/O error occurs.- Since:
- 1.0
-
put
Puts the specified content into a the specified directory.- Parameters:
parent
- the directory in which the content is to be created/updated.name
- the name of the file.content
- the content (implementer is responsible for closing).- Returns:
- the
FileEntry
that was created/updated. - Throws:
UnsupportedOperationException
- if the repository is read-only.IOException
- if the content could not be read/written.- Since:
- 1.0
-