Package org.mycore.datamodel.niofs
Class MCRAbstractFileSystem
java.lang.Object
java.nio.file.FileSystem
org.mycore.datamodel.niofs.MCRAbstractFileSystem
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
MCRIFSFileSystem
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
abstract void
createRoot
(String owner) Creates a new root under the given name.static MCRAbstractFileSystem
getInstance
(String scheme) Returns any subclass that implements and handles the given scheme.static MCRPath
getPath
(String owner, String path, MCRAbstractFileSystem fs) getPathMatcher
(String syntaxAndPattern) getRootDirectory
(String owner) boolean
isOpen()
boolean
abstract void
removeRoot
(String owner) Removes a root with the given name.toThisFileSystem
(MCRPath other) boolean
Checks if the file for given Path is still valid.boolean
verifies
(MCRPath path, MCRFileAttributes<?> attrs) Checks if the file for given Path is still valid.Methods inherited from class java.nio.file.FileSystem
getFileStores, getRootDirectories, provider
-
Field Details
-
SEPARATOR
public static final char SEPARATOR- See Also:
-
SEPARATOR_STRING
-
-
Constructor Details
-
MCRAbstractFileSystem
public MCRAbstractFileSystem()
-
-
Method Details
-
getInstance
Returns any subclass that implements and handles the given scheme.- Parameters:
scheme
- a validURI
scheme- Throws:
FileSystemNotFoundException
- if no filesystem handles this scheme- See Also:
-
getPath
-
createRoot
Creates a new root under the given name. After calling this method the implementing FileSystem should be ready to accept data for this root.- Parameters:
owner
- ,e.g. derivate ID- Throws:
FileSystemException
- if creating the root directory failsFileAlreadyExistsException
- more specific, if the directory already exists
-
verifies
Checks if the file for given Path is still valid. This should check if the file is still completely readable and the MD5 sum still matches the recorded value.- Parameters:
path
- Path to the file to check- Returns:
- if the file is still in good condition
- Throws:
NoSuchFileException
-
verifies
Checks if the file for given Path is still valid. This should check if the file is still completely readable and the MD5 sum still matches the recorded value. This method does the same asverifies(MCRPath)
but uses the given attributes to save a file access.- Parameters:
path
- Path to the file to checkattrs
- matching attributes to file- Throws:
NoSuchFileException
-
removeRoot
Removes a root with the given name. Call this method if you want to remove a stalled directory that is not in use anymore.- Parameters:
owner
- ,e.g. derivate ID- Throws:
FileSystemException
- if removing the root directory failsDirectoryNotEmptyException
- more specific, if the directory is not emptyNoSuchFileException
- more specific, if the directory does not exist
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classFileSystem
- Throws:
IOException
-
emptyPath
-
getPath
- Specified by:
getPath
in classFileSystem
-
getPathMatcher
- Specified by:
getPathMatcher
in classFileSystem
-
getRootDirectory
-
getSeparator
- Specified by:
getSeparator
in classFileSystem
-
getUserPrincipalLookupService
- Specified by:
getUserPrincipalLookupService
in classFileSystem
-
isOpen
public boolean isOpen()- Specified by:
isOpen
in classFileSystem
-
isReadOnly
public boolean isReadOnly()- Specified by:
isReadOnly
in classFileSystem
-
newWatchService
- Specified by:
newWatchService
in classFileSystem
- Throws:
IOException
-
supportedFileAttributeViews
- Specified by:
supportedFileAttributeViews
in classFileSystem
-
toThisFileSystem
-