public class SftpFileSystem extends AbstractFileSystem
Modifier and Type | Field and Description |
---|---|
private int |
connectTimeoutMillis |
private static int |
EXEC_BUFFER_SIZE |
private int[] |
groupsIds
Cache for the user groups ids (null when not set)
|
private com.jcraft.jsch.ChannelSftp |
idleChannel |
private static long |
LAST_MOD_TIME_ACCURACY |
private com.jcraft.jsch.Session |
session
Session; never null.
|
private static int |
SLEEP_MILLIS |
private int |
uid
Cache for the user ID (-1 when not set)
|
private static int |
UNIDENTIFED |
Modifier | Constructor and Description |
---|---|
protected |
SftpFileSystem(GenericFileName rootName,
com.jcraft.jsch.Session session,
FileSystemOptions fileSystemOptions) |
Modifier and Type | Method and Description |
---|---|
protected void |
addCapabilities(java.util.Collection<Capability> caps)
Adds the capabilities of this file system.
|
protected FileObject |
createFile(AbstractFileName name)
Creates a file object.
|
protected void |
doCloseCommunicationLink()
Closes the underlying link used to access the files.
|
private int |
executeCommand(java.lang.String command,
java.lang.StringBuilder output)
Executes a command and returns the (standard) output through a StringBuilder.
|
protected com.jcraft.jsch.ChannelSftp |
getChannel()
Returns an SFTP channel to the server.
|
int[] |
getGroupsIds()
Gets the (numeric) group IDs.
|
double |
getLastModTimeAccuracy()
Last modification time is only an int and in seconds, thus can be off by 999.
|
private com.jcraft.jsch.Session |
getSession()
Ensures that the session link is established.
|
int |
getUId()
Gets the (numeric) group IDs.
|
protected void |
putChannel(com.jcraft.jsch.ChannelSftp channel)
Returns a channel to the pool.
|
addJunction, addListener, close, closeCommunicationLink, decorateFileObject, doReplicateFile, fireFileChanged, fireFileCreated, fireFileDeleted, getAttribute, getFileFromCache, getFileSystemManager, getFileSystemOptions, getParentLayer, getRoot, getRootName, getRootURI, hasCapability, init, isOpen, isReleaseable, notifyAllStreamsClosed, putFileToCache, removeFileFromCache, removeJunction, removeListener, replicateFile, resolveFile, resolveFile, setAttribute
getContext, getLogger, setContext, setLogger
private static final int UNIDENTIFED
private static final int SLEEP_MILLIS
private static final int EXEC_BUFFER_SIZE
private static final long LAST_MOD_TIME_ACCURACY
private volatile com.jcraft.jsch.Session session
DCL pattern requires that the ivar be volatile.
private volatile com.jcraft.jsch.ChannelSftp idleChannel
private final int connectTimeoutMillis
private volatile int uid
DCL pattern requires that the ivar be volatile.
private volatile int[] groupsIds
DCL pattern requires that the ivar be volatile.
protected SftpFileSystem(GenericFileName rootName, com.jcraft.jsch.Session session, FileSystemOptions fileSystemOptions)
protected void doCloseCommunicationLink()
AbstractFileSystem
doCloseCommunicationLink
in class AbstractFileSystem
protected com.jcraft.jsch.ChannelSftp getChannel() throws java.io.IOException
FileSystemException
- if a session cannot be created.java.io.IOException
- if an I/O error is detected.private com.jcraft.jsch.Session getSession() throws FileSystemException
FileSystemException
- if a session cannot be created.protected void putChannel(com.jcraft.jsch.ChannelSftp channel)
channel
- the used channel.protected void addCapabilities(java.util.Collection<Capability> caps)
addCapabilities
in class AbstractFileSystem
caps
- collections of Capabilities, can be immutable.protected FileObject createFile(AbstractFileName name) throws FileSystemException
createFile
in class AbstractFileSystem
name
- name referencing the new file.FileSystemException
public double getLastModTimeAccuracy()
getLastModTimeAccuracy
in interface FileSystem
getLastModTimeAccuracy
in class AbstractFileSystem
public int[] getGroupsIds() throws com.jcraft.jsch.JSchException, java.io.IOException
com.jcraft.jsch.JSchException
- If a problem occurs while retrieving the group IDs.java.io.IOException
- if an I/O error is detected.public int getUId() throws com.jcraft.jsch.JSchException, java.io.IOException
com.jcraft.jsch.JSchException
- If a problem occurs while retrieving the group ID.java.io.IOException
- if an I/O error is detected.private int executeCommand(java.lang.String command, java.lang.StringBuilder output) throws com.jcraft.jsch.JSchException, java.io.IOException
command
- The commandoutput
- The outputcom.jcraft.jsch.JSchException
- if a JSch error is detected.FileSystemException
- if a session cannot be created.java.io.IOException
- if an I/O error is detected.