OpenAPI 1.0

com.aquafold.openapi.net
Interface AQFtpFileSystem


public interface AQFtpFileSystem

The file transfer protocol (FTP) file system.

All methods operate on remote location except when explicitly named "local".


Method Summary
 void chgrp(String source, String group)
          Changes the group ownership of a file or all files inside the directory.
 void chmod(String source, String permissions)
          Changes the permissions of a file or all files inside the specified directory.
 void chown(String source, String owner)
          Changes the owner of a file or all files inside the specified directory.
 void copy(String source, String destination)
          Copies a single file to another file or a directory to another directory.
 void copyFromLocalFile(String source, String destination)
          Copies a local file or directory to a new file, or a directory to a new FS directory.
 void copyFromLocalFileSets(AQFileSet[] filesets, String destination)
          Copies local files as specified in the AQFileSet object to a new FS location.
 void copyToLocalFile(String source, String destination)
          Copies FS files as specified to a new local location.
 boolean createDirectory(String directory)
          Creates a directory.
 boolean deleteDirectory(String directory, boolean recursive)
          Deletes a directory.
 boolean deleteFile(String file)
          Deletes a single file.
 int directoryCount(String location, boolean recurse)
          To count the number of directories under a directory.
 long directorySize(String location, boolean recurse)
          Returns the size of a directory denoted by this location name.
 boolean exists(String source)
          Tests whether a file or directory exists.
 int fileCount(String location, boolean recurse)
          To count the number of files under a directory.
 long fileSize(String source)
          Returns the length of the file denoted by this file name.
 String[] glob(String pattern)
          Returns all the files that match filePattern and are not checksum files.
 String[] glob(String pattern, AQPathFilter filter)
          Returns an array of FileStatus objects whose path names match pathPattern and is accepted by the user-supplied path filter.
 boolean isDirectory(String directory)
          Tests whether the directory specified exists.
 boolean isFile(String file)
          Tests whether the file specified exists.
 String lastModified(String Source)
          Returns the time that the file or directory denoted by source was last modified.
 String[] list(String source)
          Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname.
 void move(String source, String destination)
          Moves a file or directory to a new file, or a directory to a new directory.
 void moveFromLocalFile(String source, String destination)
          Moves a local file or directory to a new file, or a directory to a new FS directory.
 void moveFromLocalFileSets(AQFileSet[] filesets, String destination)
          Moves local files as specified in the AQFileSet object to a new FS location.
 void moveToLocalFile(String source, String destination)
          Moves FS files as specified to a new local location.
 AQFileSet newFileSet()
          Returns a new instance of local FileSet.
 AQPathFilter newRegexExcludeFilter(String regex)
          Returns a new instance of filter that passes only files that don't match the regular expression.
 void rename(String source, String destination)
          Renames a file or a directory.
 void touch(String file, String modificationTime)
          Changes the modification time of a file and possibly creates it at the same time.
 

Method Detail

chgrp

void chgrp(String source,
           String group)
           throws Exception
Changes the group ownership of a file or all files inside the directory. Currently, it has effect only under Unix.

Parameters:
source - The file or directory to perform the task; required.
group - The name of the group; required.
Throws:
Exception - on error

chmod

void chmod(String source,
           String permissions)
           throws Exception
Changes the permissions of a file or all files inside the specified directory. Currently, it has effect only under Unix. The permissions are also UNIX style, like the arguments for the chmod command.

Parameters:
source - The file or directory to perform the task; required.
permissions - The Unix symbolic permission string e.g. "-rw-rw-rw-"; required.
Throws:
Exception - If the file or directory does not exist. Also if source is null or and empty string.

chown

void chown(String source,
           String owner)
           throws Exception
Changes the owner of a file or all files inside the specified directory. Currently, it has effect only under Unix.

Parameters:
source - The file or directory to perform the task; required.
owner - The name of the new owner; required.
Throws:
Exception - on error

copy

void copy(String source,
          String destination)
          throws Exception
Copies a single file to another file or a directory to another directory. If the a file with the same name exist in the destination, it will be overwritten.

Parameters:
source - The source file or directory to be copied; required.
destination - The location of where the file will be copied; required.
Throws:
Exception - on error

copyFromLocalFile

void copyFromLocalFile(String source,
                       String destination)
                       throws Exception
Copies a local file or directory to a new file, or a directory to a new FS directory. The destination file or directory is overwritten if it exists.

Parameters:
source - The file or directory to be copied; required.
destination - The destination file or directory; required.
Throws:
Exception - on error

copyFromLocalFileSets

void copyFromLocalFileSets(AQFileSet[] filesets,
                           String destination)
                           throws Exception
Copies local files as specified in the AQFileSet object to a new FS location.

Parameters:
filesets - A list of files to be copied as defined in the AQFileSet object; required. Use Unix glob pattern for filesets.
destination - The destination directory; required.
Throws:
Exception - on error

copyToLocalFile

void copyToLocalFile(String source,
                     String destination)
                     throws Exception
Copies FS files as specified to a new local location.

Parameters:
source - The file or directory to be copied; required. object; required. Use Unix glob pattern for filesets.
destination - The destination file or directory; required.
Throws:
Exception - on error

deleteFile

boolean deleteFile(String file)
                   throws Exception
Deletes a single file.

Parameters:
file - The name of the file to be deleted; required.
Returns:
true if deletion is successful; false otherwise.
Throws:
Exception - on error

deleteDirectory

boolean deleteDirectory(String directory,
                        boolean recursive)
                        throws Exception
Deletes a directory. If recursive is false, directory will be removed only if there are no underlying files or sub directories.

Parameters:
directory - The name of the directory to be deleted; required.
Returns:
true if deletion is successful; false otherwise.
Throws:
Exception - on error

exists

boolean exists(String source)
               throws Exception
Tests whether a file or directory exists.

Parameters:
source - The file or directory; required.
Returns:
Returns true if a file or directory denoted exists on the file system; false otherwise.
Throws:
Exception

fileSize

long fileSize(String source)
              throws Exception
Returns the length of the file denoted by this file name. The return value is unspecified if this file name denotes a directory.

Parameters:
source - The file; required.
Returns:
The length, in bytes, of the file denoted by this abstract pathname, or 0L if the file does not exist. Some operating systems may return 0L for pathnames denoting system-dependent entities such as devices or pipes.
Throws:
Exception - on error

isDirectory

boolean isDirectory(String directory)
                    throws Exception
Tests whether the directory specified exists.

Parameters:
directory - The name of the directory; required.
Returns:
Returns true if and only if the directory denoted exists; false otherwise.
Throws:
Exception - on error

isFile

boolean isFile(String file)
               throws Exception
Tests whether the file specified exists.

Parameters:
file - The name of the file; required.
Returns:
Returns true if and only if the file denoted exists and is a normal file; false otherwise.
Throws:
Exception - on error

lastModified

String lastModified(String Source)
                    throws Exception
Returns the time that the file or directory denoted by source was last modified.

Parameters:
Source - The file name or the directory name; required.
Returns:
String A string value representing the time the file was last modified, display in default time zone with the given system locale. or null if the file does not exist or if an I/O error occurs
Throws:
Exception - on error

list

String[] list(String source)
              throws Exception
Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname.

If source does not denote a directory, then this method returns null. Otherwise an array of strings is returned, one for each file or directory in the directory. Names denoting the directory itself and the directory's parent directory are not included in the result. Each string is a file name rather than a complete path.

There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.

Parameters:
source - The directory; required.
Returns:
An array of String, if the source is a directory, otherwise null.
Throws:
Exception - on error

createDirectory

boolean createDirectory(String directory)
                        throws Exception
Creates a directory. Non-existent parent directories are created, when necessary.

Parameters:
directory - The directory to create; required.
Returns:
True if the operation succeeds.
Throws:
Exception - on error

newFileSet

AQFileSet newFileSet()
Returns a new instance of local FileSet.

Returns:
AQFileSet

newRegexExcludeFilter

AQPathFilter newRegexExcludeFilter(String regex)
Returns a new instance of filter that passes only files that don't match the regular expression.

Parameters:
regex - The regular expression
Returns:
AQFilter

move

void move(String source,
          String destination)
          throws Exception
Moves a file or directory to a new file, or a directory to a new directory. The destination file or directory is overwritten if it exists.

Parameters:
source - The file or directory to be moved; required.
destination - The destination file or directory; required.
Throws:
Exception - on error

moveFromLocalFile

void moveFromLocalFile(String source,
                       String destination)
                       throws Exception
Moves a local file or directory to a new file, or a directory to a new FS directory. The destination file or directory is overwritten if it exists.

Parameters:
source - The file or directory to be moved; required.
destination - The destination file or directory; required.
Throws:
Exception - on error

moveFromLocalFileSets

void moveFromLocalFileSets(AQFileSet[] filesets,
                           String destination)
                           throws Exception
Moves local files as specified in the AQFileSet object to a new FS location.

Parameters:
filesets - A list of files to be moved as defined in the AQFileSet object; required. Use Unix glob pattern for filesets.
destination - The destination directory; required.
Throws:
Exception - on error

moveToLocalFile

void moveToLocalFile(String source,
                     String destination)
                     throws Exception
Moves FS files as specified to a new local location.

Parameters:
source - The file or directory to be moved; required. object; required. Use Unix glob pattern for filesets.
destination - The destination file or directory; required.
Throws:
Exception - on error

rename

void rename(String source,
            String destination)
            throws Exception
Renames a file or a directory.

Parameters:
source - The location and name of the file or directory to be renamed; required.
destination - The new name of the file or directory; required.
Throws:
Exception - on error, if destination exists

glob

String[] glob(String pattern)
              throws Exception

Returns all the files that match filePattern and are not checksum files. Results are sorted by their names.

A filename pattern is composed of regular characters and special pattern matching characters, which are:

?
Matches any single character.

*
Matches zero or more characters.

[abc]
Matches a single character from character set {a,b,c}.

[a-b]
Matches a single character from the character range {a...b}. Note that character a must be lexicographically less than or equal to character b.

[^a]
Matches a single character that is not from character set or range {a}. Note that the ^ character must occur immediately to the right of the opening bracket.

\c
Removes (escapes) any special meaning of character c.

{ab,cd}
Matches a string from the string set {ab, cd}

{ab,c{de,fh}}
Matches a string from the string set {ab, cde, cfh}

Parameters:
pattern - a regular expression specifying a path pattern
Returns:
an array of paths that match the pattern
Throws:
Exception - on error

glob

String[] glob(String pattern,
              AQPathFilter filter)
              throws Exception
Returns an array of FileStatus objects whose path names match pathPattern and is accepted by the user-supplied path filter. Results are sorted by their path names.

Returns null if pathPattern has no glob and the path does not exist. Returns an empty array if pathPattern has a glob and no path matches it.

Parameters:
pattern - The Unix glob pattern.
filter - A user-supplied filter
Returns:
A list of files. The list contains the absolute path of the file.
Throws:
Exception - on error

touch

void touch(String file,
           String modificationTime)
           throws Exception
Changes the modification time of a file and possibly creates it at the same time. The modificationTime, if set, needs to be in the format "MM/DD/YYYY HH:MM AM or PM" or "MM/DD/YYYY HH:MM:SS AM or PM".

Parameters:
file - The file to be touched. If the file doesn't exist, it will be created.
modificationTime - The new modification time of the file. The string should be in the following format "MM/DD/YYYY HH:MM AM or PM" or "MM/DD/YYYY HH:MM:SS AM or PM".
Throws:
Exception - on error

fileCount

int fileCount(String location,
              boolean recurse)
              throws Exception
To count the number of files under a directory. If the recurse flag is set to true, it will count all files in the sub directories as well.

Parameters:
location - The location of the files to be counted; required. If location is a file, an exception will be thrown.
recurse - If recurse is true, count files in the sub directory, otherwise don't include files in the sub directory in the count; required.
Returns:
The number of files in the location specified.
Throws:
Exception - If the location is invalid or if location is not a directory.

directoryCount

int directoryCount(String location,
                   boolean recurse)
                   throws Exception
To count the number of directories under a directory. If the recurse flag is set to true, it will count all directories in the sub directories as well.

Parameters:
location - The location of the directories to be counted; required. If location is a file, an exception will be thrown.
recurse - If recurse is true, count directories in the sub directory, otherwise don't include directories in the sub directory in the count; required.
Returns:
A count of the directories in the location specified.
Throws:
Exception - If the location is invalid or if location is not a directory.

directorySize

long directorySize(String location,
                   boolean recurse)
                   throws Exception
Returns the size of a directory denoted by this location name.

Parameters:
location - The location of the directory.
recurse - If recurse is true, count files in the sub directory, otherwise don't include files in the sub directory in the count; required
Returns:
The length, in bytes, of all the files under this location depending of whether the recurse flag is set or not.
Throws:
Exception - on error

OpenAPI 1.0


Copyright © 2010 AquaFold, Inc. All Rights Reserved. Use is subject to license terms.