edu.isi.pegasus.gridftp

## Class GridFTPConnection

- java.lang.Object
- - edu.isi.pegasus.gridftp.GridFTPConnection

    public class GridFTPConnection
    extends java.lang.Object

A connection to a GridFTP server

Author:
  Gideon Juve <juve@usc.edu>

### Nested Class Summary

Nested Classes
`private class` `GridFTPConnection.StringBuilderDataSink` This class is used to collect data returned by the list command into a StringBuilder.

### Field Summary

Fields
`private org.globus.ftp.GridFTPClient` `client`
`private org.ietf.jgss.GSSCredential` `credential`
`private java.lang.String` `host`
`private org.apache.commons.logging.Log` `logger`
`private int` `port`

### Constructor Summary

Constructors
Constructor and Description
`GridFTPConnection(java.lang.String host, int port, org.ietf.jgss.GSSCredential credential)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()` Close the connection
`boolean` `exists(java.lang.String path)` Return true if path exists, false otherwise
`java.lang.String` `getURLFor(java.lang.String path)` Return a gsiftp:// URL for path
`java.util.List<FileInfo>` `ll(java.lang.String path)` List contents of path in long format
`java.util.List<FileInfo>` `ls(java.lang.String path)` List contents of path in short (filename only) format
`private java.util.List<FileInfo>` `ls(java.lang.String path, boolean longFormat)` List contents of path.
`void` `mkdir(java.lang.String path)` Create directory path
`void` `rm(java.lang.String path)` Remove path
`void` `rmdir(java.lang.String path)` Remove directory path
`FileInfo` `stat(java.lang.String path)` Return information about path
`private void` `translateException(java.lang.Exception e, java.lang.String message)` Translate the exception e into one of the subclasses of GridFTPException

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### logger

    private org.apache.commons.logging.Log logger

#### host

    private java.lang.String host

#### port

    private int port

#### credential

    private org.ietf.jgss.GSSCredential credential

#### client

    private org.globus.ftp.GridFTPClient client

### Constructor Detail

#### GridFTPConnection

    public GridFTPConnection(java.lang.String host,
                             int port,
                             org.ietf.jgss.GSSCredential credential)
                      throws java.lang.Exception

Throws:
  `java.lang.Exception`

### Method Detail

#### ll

    public java.util.List<FileInfo> ll(java.lang.String path)
                                throws GridFTPException

List contents of path in long format

Throws:
  `GridFTPException`

#### ls

    public java.util.List<FileInfo> ls(java.lang.String path)
                                throws GridFTPException

List contents of path in short (filename only) format

Throws:
  `GridFTPException`

#### ls

    private java.util.List<FileInfo> ls(java.lang.String path,
                                        boolean longFormat)
                                 throws GridFTPException

List contents of path. If longFormat is true, return the long format listing.

Throws:
  `GridFTPException`

#### rm

    public void rm(java.lang.String path)
            throws GridFTPException

Remove path

Throws:
  `GridFTPException`

#### rmdir

    public void rmdir(java.lang.String path)
               throws GridFTPException

Remove directory path

Throws:
  `GridFTPException`

#### mkdir

    public void mkdir(java.lang.String path)
               throws GridFTPException

Create directory path

Throws:
  `GridFTPException`

#### exists

    public boolean exists(java.lang.String path)
                   throws GridFTPException

Return true if path exists, false otherwise

Throws:
  `GridFTPException`

#### stat

    public FileInfo stat(java.lang.String path)
                  throws GridFTPException

Return information about path

Throws:
  `GridFTPException`

#### translateException

    private void translateException(java.lang.Exception e,
                                    java.lang.String message)
                             throws GridFTPException

Translate the exception e into one of the subclasses of GridFTPException

Throws:
  `GridFTPException`

#### getURLFor

    public java.lang.String getURLFor(java.lang.String path)

Return a gsiftp:// URL for path

#### close

    public void close()

Close the connection