Package org.apache.sshd.common.file.root
Class RootedFileSystemProvider
- java.lang.Object
-
- java.nio.file.spi.FileSystemProvider
-
- org.apache.sshd.common.file.root.RootedFileSystemProvider
-
public class RootedFileSystemProvider extends FileSystemProvider
File system provider which provides a rooted file system. The file system only gives access to files under the root directory.- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Logger
log
-
Constructor Summary
Constructors Constructor Description RootedFileSystemProvider()
-
Method Summary
-
Methods inherited from class java.nio.file.spi.FileSystemProvider
installedProviders
-
-
-
-
Method Detail
-
getScheme
public String getScheme()
- Specified by:
getScheme
in classFileSystemProvider
-
newFileSystem
public FileSystem newFileSystem(URI uri, Map<String,?> env) throws IOException
- Specified by:
newFileSystem
in classFileSystemProvider
- Throws:
IOException
-
getFileSystem
public FileSystem getFileSystem(URI uri)
- Specified by:
getFileSystem
in classFileSystemProvider
-
newFileSystem
public FileSystem newFileSystem(Path path, Map<String,?> env) throws IOException
- Overrides:
newFileSystem
in classFileSystemProvider
- Throws:
IOException
-
newFileSystem
protected FileSystem newFileSystem(Object src, Path path, Map<String,?> env) throws IOException
- Throws:
IOException
-
getPath
public Path getPath(URI uri)
- Specified by:
getPath
in classFileSystemProvider
-
newInputStream
public InputStream newInputStream(Path path, OpenOption... options) throws IOException
- Overrides:
newInputStream
in classFileSystemProvider
- Throws:
IOException
-
newOutputStream
public OutputStream newOutputStream(Path path, OpenOption... options) throws IOException
- Overrides:
newOutputStream
in classFileSystemProvider
- Throws:
IOException
-
newFileChannel
public FileChannel newFileChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException
- Overrides:
newFileChannel
in classFileSystemProvider
- Throws:
IOException
-
newAsynchronousFileChannel
public AsynchronousFileChannel newAsynchronousFileChannel(Path path, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs) throws IOException
- Overrides:
newAsynchronousFileChannel
in classFileSystemProvider
- Throws:
IOException
-
newByteChannel
public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException
- Specified by:
newByteChannel
in classFileSystemProvider
- Throws:
IOException
-
newDirectoryStream
public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) throws IOException
- Specified by:
newDirectoryStream
in classFileSystemProvider
- Throws:
IOException
-
root
protected DirectoryStream<Path> root(RootedFileSystem rfs, DirectoryStream<Path> ds)
-
root
protected Iterator<Path> root(RootedFileSystem rfs, Iterator<Path> iter)
-
createDirectory
public void createDirectory(Path dir, FileAttribute<?>... attrs) throws IOException
- Specified by:
createDirectory
in classFileSystemProvider
- Throws:
IOException
-
createSymbolicLink
public void createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs) throws IOException
- Overrides:
createSymbolicLink
in classFileSystemProvider
- Throws:
IOException
-
createLink
public void createLink(Path link, Path existing) throws IOException
- Overrides:
createLink
in classFileSystemProvider
- Throws:
IOException
-
createLink
protected void createLink(Path link, Path target, boolean symLink, FileAttribute<?>... attrs) throws IOException
- Throws:
IOException
-
delete
public void delete(Path path) throws IOException
- Specified by:
delete
in classFileSystemProvider
- Throws:
IOException
-
deleteIfExists
public boolean deleteIfExists(Path path) throws IOException
- Overrides:
deleteIfExists
in classFileSystemProvider
- Throws:
IOException
-
readSymbolicLink
public Path readSymbolicLink(Path link) throws IOException
- Overrides:
readSymbolicLink
in classFileSystemProvider
- Throws:
IOException
-
copy
public void copy(Path source, Path target, CopyOption... options) throws IOException
- Specified by:
copy
in classFileSystemProvider
- Throws:
IOException
-
move
public void move(Path source, Path target, CopyOption... options) throws IOException
- Specified by:
move
in classFileSystemProvider
- Throws:
IOException
-
isSameFile
public boolean isSameFile(Path path, Path path2) throws IOException
- Specified by:
isSameFile
in classFileSystemProvider
- Throws:
IOException
-
isHidden
public boolean isHidden(Path path) throws IOException
- Specified by:
isHidden
in classFileSystemProvider
- Throws:
IOException
-
getFileStore
public FileStore getFileStore(Path path) throws IOException
- Specified by:
getFileStore
in classFileSystemProvider
- Throws:
IOException
-
getFileSystem
protected RootedFileSystem getFileSystem(Path path) throws FileSystemNotFoundException
- Throws:
FileSystemNotFoundException
-
checkAccess
public void checkAccess(Path path, AccessMode... modes) throws IOException
- Specified by:
checkAccess
in classFileSystemProvider
- Throws:
IOException
-
getFileAttributeView
public <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options)
- Specified by:
getFileAttributeView
in classFileSystemProvider
-
readAttributes
public <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options) throws IOException
- Specified by:
readAttributes
in classFileSystemProvider
- Throws:
IOException
-
readAttributes
public Map<String,Object> readAttributes(Path path, String attributes, LinkOption... options) throws IOException
- Specified by:
readAttributes
in classFileSystemProvider
- Throws:
IOException
-
setAttribute
public void setAttribute(Path path, String attribute, Object value, LinkOption... options) throws IOException
- Specified by:
setAttribute
in classFileSystemProvider
- Throws:
IOException
-
provider
protected FileSystemProvider provider(Path path)
-
root
protected Path root(RootedFileSystem rfs, Path nat)
-
unroot
protected Path unroot(Path path)
- Parameters:
path
- The original (rooted)Path
- Returns:
- The actual absolute local
Path
represented by the rooted one - Throws:
IllegalArgumentException
- ifnull
path argumentProviderMismatchException
- if not aRootedPath
- See Also:
resolveLocalPath(RootedPath)
-
resolveLocalPath
protected Path resolveLocalPath(RootedPath path)
- Parameters:
path
- The originalRootedPath
- nevernull
- Returns:
- The actual absolute local
Path
represented by the rooted one - Throws:
InvalidPathException
- If the resolved path is not a proper sub-path of the rooted file system
-
-