com.ssh.sft
Class Session

java.lang.Object
  extended bycom.ssh.sft.SftLib
      extended bycom.ssh.sft.SftBase
          extended bycom.ssh.sft.ObjectBase
              extended bycom.ssh.sft.Session
All Implemented Interfaces:
SftLibConstants

public class Session
extends com.ssh.sft.ObjectBase

An ongoing SFTP session in a remote or local host. Each Session object represents a connection to an SFTP server or to a virtual server that can be used to access the local filesystem. There may be several sessions to a single server, and each session supports multiple concurrent operations.


Field Summary
 
Fields inherited from interface com.ssh.sft.SftLibConstants
SSH_SFT_API_VERSION, SSH_SFT_DIR_RECURSIVE, SSH_SFT_HASH_MAX_BLOCK_SIZE, SSH_SFT_HASH_MAX_ITERATIONS, SSH_SFT_HASH_MIN_BLOCK_SIZE, SSH_SFT_REQUEST_MAX_NUM, SSH_SFT_REQUEST_MAX_SIZE
 
Method Summary
 void abort()
          Aborts the session.
 void close()
          Releases the resources used by this object.
 File getFile(String path)
          Returns a File object representing the file at the named path.
 Location getLocation(String path)
          Returns a Location representing the named path.
 long getProtocolVersion()
          Returns the version of the SFTP protocol that is used in this session for communicating with the SFTP server.
 URI getURI()
          Returns the URI for this session's SFTP server.
 boolean isClosed()
          Tests if this object has been closed.
 boolean isConnected()
          Checks if the Session is still connected to the server.
 void resume()
          Resumes the session.
 void suspend()
          Suspends the session.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProtocolVersion

public long getProtocolVersion()
Returns the version of the SFTP protocol that is used in this session for communicating with the SFTP server.

Returns:
the protocol version

getLocation

public Location getLocation(String path)
Returns a Location representing the named path.

Parameters:
path - the path to access
Returns:
a Location object representing the named path accessed through this session

getFile

public File getFile(String path)
             throws NoSuchFileException,
                    SftException
Returns a File object representing the file at the named path.

Parameters:
path - the path to access
Returns:
a File object representing the file currently found at the named path
Throws:
NoSuchFileException - if no file exists at the named path
SftException

suspend

public void suspend()
Suspends the session. All currently active file operations in this session are paused until resume() is called. If the session is already suspended, invoking this method has no effect.


resume

public void resume()
Resumes the session. If the session was suspended, all paused operations are now resumed. Otherwise, this method has no effect.


abort

public void abort()
Aborts the session. All currently active file operations are terminated and they throw an AbortedException.


getURI

public URI getURI()
Returns the URI for this session's SFTP server. The URI is of the form "sftp://user@host".

Returns:
the URI for this session's SFTP server.

isConnected

public boolean isConnected()
Checks if the Session is still connected to the server.

Returns:
TRUE if it is connected, FALSE otherwise.

close

public void close()
           throws SftException
Releases the resources used by this object. After this method has been called, all further operations on this object will throw a IllegalStateException.

Throws:
SftException

isClosed

public boolean isClosed()
Tests if this object has been closed.

Returns:
true if ObjectBase.close() has been called on this object, false otherwise