com.ssh.sft
Class Location

java.lang.Object
  extended bycom.ssh.sft.SftLib
      extended bycom.ssh.sft.SftBase
          extended bycom.ssh.sft.Location
All Implemented Interfaces:
com.ssh.sft.SftLibConstants

public class Location
extends com.ssh.sft.SftBase

A location for a remote file. Instances of this class represent remote file locations which may be occupied by files. A location has two components: a Session that determines a host, and a path within that host. Operations on file locations are not reliable if the relevant parts of the file system are concurrently being modified by external processes.


Field Summary
static int SSH_SFT_DIR_RECURSIVE
           
static int SSH_SFT_HASH_MAX_BLOCK_SIZE
           
static int SSH_SFT_HASH_MAX_ITERATIONS
           
static int SSH_SFT_HASH_MIN_BLOCK_SIZE
           
static int SSH_SFT_REQUEST_MAX_NUM
           
static int SSH_SFT_REQUEST_MAX_SIZE
           
 
Method Summary
 Directory createDirectory(FileAttributes attrs)
          Creates a new directory at this location.
 RegularFile createFile()
          Creates a new file at this location, initially empty.
 SymLink createSymLink(Location target)
          Creates a new symbolic link at this location.
 Location getCanonicalPath()
           
 File getFile()
          Returns a representation of the file at this location.
 String getPath()
          Returns the path that this location's session uses to access this location.
 Session getSession()
          Returns the session that is used to access this location.
 URI getURI()
           
 Location resolve(String relPath)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SSH_SFT_REQUEST_MAX_SIZE

public static final int SSH_SFT_REQUEST_MAX_SIZE
See Also:
Constant Field Values

SSH_SFT_REQUEST_MAX_NUM

public static final int SSH_SFT_REQUEST_MAX_NUM
See Also:
Constant Field Values

SSH_SFT_HASH_MAX_ITERATIONS

public static final int SSH_SFT_HASH_MAX_ITERATIONS
See Also:
Constant Field Values

SSH_SFT_HASH_MIN_BLOCK_SIZE

public static final int SSH_SFT_HASH_MIN_BLOCK_SIZE
See Also:
Constant Field Values

SSH_SFT_HASH_MAX_BLOCK_SIZE

public static final int SSH_SFT_HASH_MAX_BLOCK_SIZE
See Also:
Constant Field Values

SSH_SFT_DIR_RECURSIVE

public static final int SSH_SFT_DIR_RECURSIVE
See Also:
Constant Field Values
Method Detail

getFile

public File getFile()
             throws NoSuchFileException,
                    SftException
Returns a representation of the file at this location. The returned object is transient, i.e. it only represents the file's state and location at the time when this method was called, and becomes invalid when the file is moved, deleted or changed.

Returns:
a representation of the file at this location
Throws:
NoSuchFileException - if no file is found at this location
SftException

getPath

public String getPath()
Returns the path that this location's session uses to access this location.

Returns:
the path to this location

resolve

public Location resolve(String relPath)

getCanonicalPath

public Location getCanonicalPath()

createDirectory

public Directory createDirectory(FileAttributes attrs)
                          throws PermissionDeniedException,
                                 NoSuchFileException,
                                 SftException
Creates a new directory at this location. For this operation to succeed, the parent directory of this location must exist, and no file must yet exist at this location.

Parameters:
attrs - the attributes to assign to the new directory
Returns:
a handle to the newly created directory
Throws:
NoSuchFileException - if the parent directory of this location does not exist
PermissionDeniedException - if the client does not have the rights to create a new directory
SftException

createSymLink

public SymLink createSymLink(Location target)
                      throws SftException
Creates a new symbolic link at this location. For this operation to succeed, the parent directory of this location must exist, and no file must yet exist at this location. The target location must have the same session as this location.

Parameters:
target - the location to link to
Returns:
a handle to the newly created symbolic link
Throws:
SftException

createFile

public RegularFile createFile()
                       throws SftException
Creates a new file at this location, initially empty. For this operation to succeed, the parent directory of this location must exist, and no file must yet exist at this location.

Returns:
a handle to the newly created file
Throws:
SftException

getSession

public Session getSession()
Returns the session that is used to access this location.

Returns:
this location's session

getURI

public URI getURI()