|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.maverick.sshd.fs.AbstractFileSystem<T,K>
public class AbstractFileSystem<T extends AbstractFile,K extends FileSystemMount>
| Field Summary | |
|---|---|
protected AbstractFileFactory<T,K> |
fileFactory
|
protected Map<String,com.maverick.sshd.fs.AbstractFileSystem.OpenDirectory> |
openDirectories
|
protected Map<String,com.maverick.sshd.fs.AbstractFileSystem.OpenFile> |
openFiles
|
| Fields inherited from interface com.maverick.sshd.sftp.FileSystem |
|---|
AUTHORIZED_KEYS_STORE, OPEN_APPEND, OPEN_CREATE, OPEN_EXCLUSIVE, OPEN_READ, OPEN_TRUNCATE, OPEN_WRITE, SCP, SFTP, SSH |
| Constructor Summary | |
|---|---|
AbstractFileSystem(AbstractFileFactory<T,K> fileFactory,
Connection con,
String protocolInUse)
|
|
| Method Summary | |
|---|---|
void |
closeFile(byte[] handle)
Close an open file or directory. |
boolean |
closeFile(byte[] handle,
boolean remove)
|
void |
closeFilesystem()
The filesystem instance is being closed and no further use of the instance is required. |
void |
createSymbolicLink(String link,
String target)
Create a symbolic link. |
boolean |
fileExists(String path)
Determine whether a file exists and return the result |
String |
getDefaultPath()
Get the default path for the current session. |
SftpFileAttributes |
getFileAttributes(byte[] handle)
Get the attributes for a given file handle. |
SftpFileAttributes |
getFileAttributes(String path)
Get the attributes for a given file. |
AbstractFileFactory<T,K> |
getFileFactory()
|
MountManager<K> |
getMountManager()
|
String |
getRealPath(String path)
Get the real path for a given path. |
boolean |
makeDirectory(String path,
SftpFileAttributes attrs)
Create a directory. |
byte[] |
openDirectory(String path)
Open a directory for reading and allocate an open file handle. |
byte[] |
openFile(String path,
com.maverick.util.UnsignedInteger32 flags,
SftpFileAttributes attrs)
Open a file for reading/writing and allocate an open file handle. |
SftpFile[] |
readDirectory(byte[] handle)
Read the contents of a directory. |
int |
readFile(byte[] handle,
com.maverick.util.UnsignedInteger64 offset,
byte[] buf,
int start,
int numBytesToRead)
Read a block of data from an open file. |
SftpFile |
readSymbolicLink(String path)
Read the target location of a symbolic link. |
void |
removeDirectory(String path)
Remove an empty directory from the file system. |
void |
removeFile(String path)
Remove a file. |
void |
renameFile(String oldpath,
String newpath)
Rename a file. |
AbstractFile |
resolveFile(String path)
|
void |
setFileAttributes(byte[] handle,
SftpFileAttributes attrs)
Set the open files attributes |
void |
setFileAttributes(String path,
SftpFileAttributes attrs)
Set the files attributes. |
boolean |
supportsMounting()
|
void |
writeFile(byte[] handle,
com.maverick.util.UnsignedInteger64 offset,
byte[] data,
int off,
int len)
Write a block of data to an open file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Map<String,com.maverick.sshd.fs.AbstractFileSystem.OpenFile> openFiles
protected Map<String,com.maverick.sshd.fs.AbstractFileSystem.OpenDirectory> openDirectories
protected AbstractFileFactory<T extends AbstractFile,K extends FileSystemMount> fileFactory
| Constructor Detail |
|---|
public AbstractFileSystem(AbstractFileFactory<T,K> fileFactory,
Connection con,
String protocolInUse)
| Method Detail |
|---|
public AbstractFile resolveFile(String path)
throws PermissionDeniedException,
IOException
PermissionDeniedException
IOExceptionpublic void closeFilesystem()
FileSystem
closeFilesystem in interface FileSystem<K extends FileSystemMount>
public boolean makeDirectory(String path,
SftpFileAttributes attrs)
throws PermissionDeniedException,
FileNotFoundException,
IOException
FileSystem
makeDirectory in interface FileSystem<K extends FileSystemMount>path - String the absolute path to the new directory.
PermissionDeniedException - if the user cannot perform this
operation.
FileNotFoundException - if the parent directory does not exist.
IOException
public SftpFileAttributes getFileAttributes(byte[] handle)
throws IOException,
InvalidHandleException,
PermissionDeniedException
FileSystem
getFileAttributes in interface FileSystem<K extends FileSystemMount>handle - byte[]
IOException
InvalidHandleException
PermissionDeniedException
public SftpFileAttributes getFileAttributes(String path)
throws IOException,
FileNotFoundException,
PermissionDeniedException
FileSystem
getFileAttributes in interface FileSystem<K extends FileSystemMount>path - String the absolute path to the file
IOException
FileNotFoundException - if the file cannot be found
PermissionDeniedException - if the user does not have access to
this filecom.maverick.sftp.SftpFileAttributes
public byte[] openDirectory(String path)
throws PermissionDeniedException,
FileNotFoundException,
IOException
FileSystem
openDirectory in interface FileSystem<K extends FileSystemMount>path - String
PermissionDeniedException
FileNotFoundException
IOException
public SftpFile[] readDirectory(byte[] handle)
throws InvalidHandleException,
EOFException,
IOException,
PermissionDeniedException
FileSystemRead the contents of a directory. Each call to this method should return one or more file objects with full file attributes for each file. The client will call this method repeatedly until an EOFException is thrown indicating that there are no more files to read from the directory. If there are no files to list then the EOFException should be thrown upon first call.
IMPORTANT: Each SftpFile object should be initialized with the relative path of the file AND NOT the absolute path.
readDirectory in interface FileSystem<K extends FileSystemMount>handle - byte[]
InvalidHandleException - the handle supplied is invalid.
EOFException - thrown once all the files contained with the
directory have been read.
IOException - an error occurred
PermissionDeniedException
public byte[] openFile(String path,
com.maverick.util.UnsignedInteger32 flags,
SftpFileAttributes attrs)
throws PermissionDeniedException,
FileNotFoundException,
IOException
FileSystem
openFile in interface FileSystem<K extends FileSystemMount>path - Stringflags - UnsignedInteger32attrs - SftpFileAttributes
PermissionDeniedException
FileNotFoundException
IOException
public int readFile(byte[] handle,
com.maverick.util.UnsignedInteger64 offset,
byte[] buf,
int start,
int numBytesToRead)
throws InvalidHandleException,
EOFException,
IOException
FileSystem
readFile in interface FileSystem<K extends FileSystemMount>handle - byte[]offset - UnsignedInteger64buf - byte[]start - intnumBytesToRead - int
InvalidHandleException
EOFException
IOException
public void writeFile(byte[] handle,
com.maverick.util.UnsignedInteger64 offset,
byte[] data,
int off,
int len)
throws InvalidHandleException,
IOException
FileSystem
writeFile in interface FileSystem<K extends FileSystemMount>handle - byte[]offset - UnsignedInteger64data - byte[]off - intlen - int
InvalidHandleException
IOException
public void closeFile(byte[] handle)
throws InvalidHandleException,
IOException
FileSystem
closeFile in interface FileSystem<K extends FileSystemMount>handle - byte[]
InvalidHandleException
IOException
public boolean closeFile(byte[] handle,
boolean remove)
throws InvalidHandleException,
IOException
InvalidHandleException
IOException
public void removeFile(String path)
throws PermissionDeniedException,
IOException,
FileNotFoundException
FileSystem
removeFile in interface FileSystem<K extends FileSystemMount>path - String
PermissionDeniedException
IOException
FileNotFoundException
public void renameFile(String oldpath,
String newpath)
throws PermissionDeniedException,
FileNotFoundException,
IOException
FileSystem
renameFile in interface FileSystem<K extends FileSystemMount>oldpath - Stringnewpath - String
PermissionDeniedException
FileNotFoundException
IOException
public String getDefaultPath()
throws IOException,
PermissionDeniedException
FileSystem
getDefaultPath in interface FileSystem<K extends FileSystemMount>FileNotFoundException - if the users default path does not exist.
IOException
PermissionDeniedException
public void removeDirectory(String path)
throws PermissionDeniedException,
FileNotFoundException,
IOException
FileSystem
removeDirectory in interface FileSystem<K extends FileSystemMount>path - String
PermissionDeniedException
FileNotFoundException
IOException
public void setFileAttributes(String path,
SftpFileAttributes attrs)
throws PermissionDeniedException,
IOException,
FileNotFoundException
FileSystem
setFileAttributes in interface FileSystem<K extends FileSystemMount>path - Stringattrs - SftpFileAttributes
PermissionDeniedException
IOException
FileNotFoundException
public void setFileAttributes(byte[] handle,
SftpFileAttributes attrs)
throws PermissionDeniedException,
IOException,
InvalidHandleException
FileSystem
setFileAttributes in interface FileSystem<K extends FileSystemMount>handle - byte[]attrs - SftpFileAttributes
PermissionDeniedException
IOException
InvalidHandleException
public SftpFile readSymbolicLink(String path)
throws UnsupportedFileOperationException,
FileNotFoundException,
IOException,
PermissionDeniedException
FileSystem
readSymbolicLink in interface FileSystem<K extends FileSystemMount>path - String
UnsupportedFileOperationException
FileNotFoundException
IOException
PermissionDeniedException
public void createSymbolicLink(String link,
String target)
throws UnsupportedFileOperationException,
FileNotFoundException,
IOException,
PermissionDeniedException
FileSystem
createSymbolicLink in interface FileSystem<K extends FileSystemMount>link - Stringtarget - String
UnsupportedFileOperationException
FileNotFoundException
IOException
PermissionDeniedException
public boolean fileExists(String path)
throws IOException,
PermissionDeniedException
FileSystem
fileExists in interface FileSystem<K extends FileSystemMount>path - String
IOException
PermissionDeniedException
public String getRealPath(String path)
throws IOException,
FileNotFoundException,
PermissionDeniedException
FileSystem
getRealPath in interface FileSystem<K extends FileSystemMount>path - String the path to canonicalize.
IOException - if an unrecoverable error occurs.
FileNotFoundException - if the path cannot be found.
PermissionDeniedExceptionpublic boolean supportsMounting()
supportsMounting in interface FileSystem<K extends FileSystemMount>
public MountManager<K> getMountManager()
throws IOException,
PermissionDeniedException
getMountManager in interface FileSystem<K extends FileSystemMount>IOException
PermissionDeniedExceptionpublic AbstractFileFactory<T,K> getFileFactory()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||