Package com.sshtools.daemon.vfs
Class VirtualFileSystem
- java.lang.Object
-
- com.sshtools.daemon.platform.NativeFileSystemProvider
-
- com.sshtools.daemon.vfs.VirtualFileSystem
-
public class VirtualFileSystem extends NativeFileSystemProvider
- Version:
- $Revision: 1.32 $
- Author:
- $author$
-
-
Field Summary
-
Fields inherited from class com.sshtools.daemon.platform.NativeFileSystemProvider
OPEN_APPEND, OPEN_CREATE, OPEN_EXCLUSIVE, OPEN_READ, OPEN_TRUNCATE, OPEN_WRITE
-
-
Constructor Summary
Constructors Constructor Description VirtualFileSystem()
Creates a new VirtualFileSystem object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeFile(byte[] handle)
void
createSymbolicLink(java.lang.String link, java.lang.String target)
boolean
fileExists(java.lang.String path)
java.lang.String
getCanonicalPath(java.lang.String path)
java.lang.String
getDefaultPath(java.lang.String username)
FileAttributes
getFileAttributes(byte[] handle)
FileAttributes
getFileAttributes(java.lang.String path)
java.lang.String
getRealPath(java.lang.String path)
VFSPermission
getVFSPermission(java.lang.String path)
boolean
makeDirectory(java.lang.String path)
byte[]
openDirectory(java.lang.String path)
byte[]
openFile(java.lang.String path, UnsignedInteger32 flags, FileAttributes attrs)
SftpFile[]
readDirectory(byte[] handle)
byte[]
readFile(byte[] handle, UnsignedInteger64 offset, UnsignedInteger32 len)
SftpFile
readSymbolicLink(java.lang.String path)
void
removeDirectory(java.lang.String path)
void
removeFile(java.lang.String path)
void
renameFile(java.lang.String oldpath, java.lang.String newpath)
void
setFileAttributes(byte[] handle, FileAttributes attrs)
void
setFileAttributes(java.lang.String path, FileAttributes attrs)
static void
setPermissionHandler(VFSPermissionHandler permissionHandler)
static boolean
startsWithIgnoreCase(java.lang.String str, java.lang.String with)
static java.lang.String
translateCanonicalPath(java.lang.String path, java.lang.String securemount)
static java.lang.String
translateNFSPath(java.lang.String nfspath)
static java.lang.String
translateVFSPath(java.lang.String vfspath)
static java.lang.String
translateVFSPath(java.lang.String vfspath, java.lang.String vfscwd)
void
verifyPermissions(java.lang.String username, java.lang.String path, java.lang.String permissions)
void
writeFile(byte[] handle, UnsignedInteger64 offset, byte[] data, int off, int len)
-
Methods inherited from class com.sshtools.daemon.platform.NativeFileSystemProvider
getInstance
-
-
-
-
Method Detail
-
setPermissionHandler
public static void setPermissionHandler(VFSPermissionHandler permissionHandler)
-
startsWithIgnoreCase
public static boolean startsWithIgnoreCase(java.lang.String str, java.lang.String with)
- Parameters:
str
-with
-- Returns:
-
translateNFSPath
public static java.lang.String translateNFSPath(java.lang.String nfspath) throws java.io.FileNotFoundException
- Parameters:
nfspath
-- Returns:
- Throws:
java.io.FileNotFoundException
-
translateVFSPath
public static java.lang.String translateVFSPath(java.lang.String vfspath) throws java.io.FileNotFoundException
- Parameters:
vfspath
-- Returns:
- Throws:
java.io.FileNotFoundException
-
translateVFSPath
public static java.lang.String translateVFSPath(java.lang.String vfspath, java.lang.String vfscwd) throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
-
translateCanonicalPath
public static java.lang.String translateCanonicalPath(java.lang.String path, java.lang.String securemount) throws java.io.FileNotFoundException
- Parameters:
path
-securemount
-- Returns:
- Throws:
java.io.FileNotFoundException
-
makeDirectory
public boolean makeDirectory(java.lang.String path) throws PermissionDeniedException, java.io.FileNotFoundException, java.io.IOException
- Specified by:
makeDirectory
in classNativeFileSystemProvider
- Parameters:
path
-- Returns:
- Throws:
PermissionDeniedException
java.io.FileNotFoundException
java.io.IOException
-
getVFSPermission
public VFSPermission getVFSPermission(java.lang.String path) throws java.io.FileNotFoundException, java.io.IOException
- Parameters:
path
-- Returns:
- Throws:
java.io.FileNotFoundException
java.io.IOException
-
getFileAttributes
public FileAttributes getFileAttributes(byte[] handle) throws java.io.IOException, InvalidHandleException
- Specified by:
getFileAttributes
in classNativeFileSystemProvider
- Parameters:
handle
-- Returns:
- Throws:
java.io.IOException
InvalidHandleException
-
getFileAttributes
public FileAttributes getFileAttributes(java.lang.String path) throws java.io.IOException, java.io.FileNotFoundException
- Specified by:
getFileAttributes
in classNativeFileSystemProvider
- Parameters:
path
-- Returns:
- Throws:
java.io.IOException
java.io.FileNotFoundException
-
openDirectory
public byte[] openDirectory(java.lang.String path) throws PermissionDeniedException, java.io.FileNotFoundException, java.io.IOException
- Specified by:
openDirectory
in classNativeFileSystemProvider
- Parameters:
path
-- Returns:
- Throws:
PermissionDeniedException
java.io.FileNotFoundException
java.io.IOException
-
readDirectory
public SftpFile[] readDirectory(byte[] handle) throws InvalidHandleException, java.io.EOFException, java.io.IOException
- Specified by:
readDirectory
in classNativeFileSystemProvider
- Parameters:
handle
-- Returns:
- Throws:
InvalidHandleException
java.io.EOFException
java.io.IOException
EOFException
-
openFile
public byte[] openFile(java.lang.String path, UnsignedInteger32 flags, FileAttributes attrs) throws PermissionDeniedException, java.io.FileNotFoundException, java.io.IOException
- Specified by:
openFile
in classNativeFileSystemProvider
- Parameters:
path
-flags
-attrs
-- Returns:
- Throws:
PermissionDeniedException
java.io.FileNotFoundException
java.io.IOException
-
readFile
public byte[] readFile(byte[] handle, UnsignedInteger64 offset, UnsignedInteger32 len) throws InvalidHandleException, java.io.EOFException, java.io.IOException
- Specified by:
readFile
in classNativeFileSystemProvider
- Parameters:
handle
-offset
-len
-- Returns:
- Throws:
InvalidHandleException
java.io.EOFException
java.io.IOException
-
writeFile
public void writeFile(byte[] handle, UnsignedInteger64 offset, byte[] data, int off, int len) throws InvalidHandleException, java.io.IOException
- Specified by:
writeFile
in classNativeFileSystemProvider
- Parameters:
handle
-offset
-data
-off
-len
-- Throws:
InvalidHandleException
java.io.IOException
-
closeFile
public void closeFile(byte[] handle) throws InvalidHandleException, java.io.IOException
- Specified by:
closeFile
in classNativeFileSystemProvider
- Parameters:
handle
-- Throws:
InvalidHandleException
java.io.IOException
-
removeFile
public void removeFile(java.lang.String path) throws PermissionDeniedException, java.io.IOException, java.io.FileNotFoundException
- Specified by:
removeFile
in classNativeFileSystemProvider
- Parameters:
path
-- Throws:
PermissionDeniedException
java.io.IOException
java.io.FileNotFoundException
-
renameFile
public void renameFile(java.lang.String oldpath, java.lang.String newpath) throws PermissionDeniedException, java.io.FileNotFoundException, java.io.IOException
- Specified by:
renameFile
in classNativeFileSystemProvider
- Parameters:
oldpath
-newpath
-- Throws:
PermissionDeniedException
java.io.FileNotFoundException
java.io.IOException
-
removeDirectory
public void removeDirectory(java.lang.String path) throws PermissionDeniedException, java.io.FileNotFoundException, java.io.IOException
- Specified by:
removeDirectory
in classNativeFileSystemProvider
- Parameters:
path
-- Throws:
PermissionDeniedException
java.io.FileNotFoundException
java.io.IOException
-
setFileAttributes
public void setFileAttributes(java.lang.String path, FileAttributes attrs) throws PermissionDeniedException, java.io.IOException, java.io.FileNotFoundException
- Specified by:
setFileAttributes
in classNativeFileSystemProvider
- Parameters:
path
-attrs
-- Throws:
PermissionDeniedException
java.io.IOException
java.io.FileNotFoundException
-
setFileAttributes
public void setFileAttributes(byte[] handle, FileAttributes attrs) throws PermissionDeniedException, java.io.IOException, InvalidHandleException
- Specified by:
setFileAttributes
in classNativeFileSystemProvider
- Parameters:
handle
-attrs
-- Throws:
PermissionDeniedException
java.io.IOException
InvalidHandleException
-
readSymbolicLink
public SftpFile readSymbolicLink(java.lang.String path) throws UnsupportedFileOperationException, java.io.FileNotFoundException, java.io.IOException, PermissionDeniedException
- Specified by:
readSymbolicLink
in classNativeFileSystemProvider
- Parameters:
path
-- Returns:
- Throws:
UnsupportedFileOperationException
java.io.FileNotFoundException
java.io.IOException
PermissionDeniedException
-
createSymbolicLink
public void createSymbolicLink(java.lang.String link, java.lang.String target) throws UnsupportedFileOperationException, java.io.FileNotFoundException, java.io.IOException, PermissionDeniedException
- Specified by:
createSymbolicLink
in classNativeFileSystemProvider
- Parameters:
link
-target
-- Throws:
UnsupportedFileOperationException
java.io.FileNotFoundException
java.io.IOException
PermissionDeniedException
-
fileExists
public boolean fileExists(java.lang.String path) throws java.io.IOException
- Specified by:
fileExists
in classNativeFileSystemProvider
- Parameters:
path
-- Returns:
- Throws:
java.io.IOException
java.io.FileNotFoundException
-
getDefaultPath
public java.lang.String getDefaultPath(java.lang.String username) throws java.io.FileNotFoundException
- Specified by:
getDefaultPath
in classNativeFileSystemProvider
- Throws:
java.io.FileNotFoundException
-
getCanonicalPath
public java.lang.String getCanonicalPath(java.lang.String path) throws java.io.IOException, java.io.FileNotFoundException
- Specified by:
getCanonicalPath
in classNativeFileSystemProvider
- Parameters:
path
-- Returns:
- Throws:
java.io.IOException
java.io.FileNotFoundException
-
getRealPath
public java.lang.String getRealPath(java.lang.String path) throws java.io.FileNotFoundException
- Specified by:
getRealPath
in classNativeFileSystemProvider
- Parameters:
path
-- Returns:
- Throws:
java.io.FileNotFoundException
-
verifyPermissions
public void verifyPermissions(java.lang.String username, java.lang.String path, java.lang.String permissions) throws PermissionDeniedException, java.io.FileNotFoundException, java.io.IOException
- Specified by:
verifyPermissions
in classNativeFileSystemProvider
- Parameters:
username
-path
-permissions
-- Throws:
PermissionDeniedException
java.io.FileNotFoundException
java.io.IOException
-
-