goldengate.common.file
Interface DirInterface

All Known Implementing Classes:
AbstractDir, FilesystemBasedDirImpl, PassthroughBasedDirImpl

public interface DirInterface

Interface for Directory support

Author:
Frederic Bregier

Field Summary
static String SEPARATOR
          FileInterface separator for external
static char SEPARATORCHAR
          FileInterface separator for external
 
Method Summary
 boolean canRead()
           
 boolean canWrite()
           
 boolean changeDirectory(String path)
          Change directory with the one given as argument
 boolean changeDirectoryNotChecked(String path)
          Change directory with the one given as argument without checking existence
 boolean changeParentDirectory()
          Change for parent directory
 void checkIdentify()
          Check if the authentication is correct
 void clear()
          Set empty this FtpDir, mark it unReady.
 boolean exists()
           
 String fileFull(String path, boolean lsFormat)
          Give for 1 file all informations from the given path (could be a file or a directory)
 long getCRC(String path)
          Get the CRC of the given FileInterface
 long getFreeSpace()
           
 byte[] getMD5(String path)
          Get the MD5 of the given FileInterface
 String getModificationTime(String path)
          Return the Modification time for the path
 OptsMLSxInterface getOptsMLSx()
           
 String getPwd()
           
 SessionInterface getSession()
           
 byte[] getSHA1(String path)
          Get the SHA-1 of the given FileInterface
 void initAfterIdentification()
          Init DirInterface after authentication is done
 boolean isDirectory(String path)
          Is the given path a directory and exists
 boolean isFile(String path)
          Is the given path a file and exists
 List<String> list(String path)
          List all files from the given path (could be a file or a directory)
 List<String> listFull(String path, boolean lsFormat)
          List all files with other informations from the given path (could be a file or a directory)
 String mkdir(String directory)
          Create the directory associated with the String as path
 FileInterface newFile(String path, boolean append)
          Create a new File
 String rmdir(String directory)
          Delete the directory associated with the String as path
 FileInterface setFile(String path, boolean append)
          Set a path as the current FileInterface
 FileInterface setUniqueFile()
          Set a new unique path as the current FileInterface from the current Directory (STOU)
 String validatePath(String path)
          Construct and Check if the given path is valid from business point of view (see AuthInterface)
 

Field Detail

SEPARATOR

static final String SEPARATOR
FileInterface separator for external

See Also:
Constant Field Values

SEPARATORCHAR

static final char SEPARATORCHAR
FileInterface separator for external

See Also:
Constant Field Values
Method Detail

getOptsMLSx

OptsMLSxInterface getOptsMLSx()
Returns:
the current value of Options for MLSx

clear

void clear()
Set empty this FtpDir, mark it unReady.


initAfterIdentification

void initAfterIdentification()
Init DirInterface after authentication is done


checkIdentify

void checkIdentify()
                   throws Reply530Exception
Check if the authentication is correct

Throws:
Reply530Exception

getSession

SessionInterface getSession()
Returns:
the FtpSession

validatePath

String validatePath(String path)
                    throws CommandAbstractException
Construct and Check if the given path is valid from business point of view (see AuthInterface)

Parameters:
path -
Returns:
the construct and validated path (could be different than the one given as argument, example: '..' are removed)
Throws:
CommandAbstractException

getPwd

String getPwd()
              throws CommandAbstractException
Returns:
the current PWD
Throws:
CommandAbstractException

changeDirectory

boolean changeDirectory(String path)
                        throws CommandAbstractException
Change directory with the one given as argument

Parameters:
path -
Returns:
True if the change is valid
Throws:
CommandAbstractException

changeDirectoryNotChecked

boolean changeDirectoryNotChecked(String path)
                                  throws CommandAbstractException
Change directory with the one given as argument without checking existence

Parameters:
path -
Returns:
True if the change is valid
Throws:
CommandAbstractException

changeParentDirectory

boolean changeParentDirectory()
                              throws CommandAbstractException
Change for parent directory

Returns:
True if the change is valid
Throws:
CommandAbstractException

mkdir

String mkdir(String directory)
             throws CommandAbstractException
Create the directory associated with the String as path

Parameters:
directory -
Returns:
the full path of the new created directory
Throws:
CommandAbstractException

rmdir

String rmdir(String directory)
             throws CommandAbstractException
Delete the directory associated with the String as path

Parameters:
directory -
Returns:
the full path of the new deleted directory
Throws:
CommandAbstractException

isDirectory

boolean isDirectory(String path)
                    throws CommandAbstractException
Is the given path a directory and exists

Parameters:
path -
Returns:
True if it is a directory and it exists
Throws:
CommandAbstractException

isFile

boolean isFile(String path)
               throws CommandAbstractException
Is the given path a file and exists

Parameters:
path -
Returns:
True if it is a file and it exists
Throws:
CommandAbstractException

getModificationTime

String getModificationTime(String path)
                           throws CommandAbstractException
Return the Modification time for the path

Parameters:
path -
Returns:
the Modification time as a String YYYYMMDDHHMMSS.sss
Throws:
CommandAbstractException

list

List<String> list(String path)
                  throws CommandAbstractException
List all files from the given path (could be a file or a directory)

Parameters:
path -
Returns:
the list of paths
Throws:
CommandAbstractException

listFull

List<String> listFull(String path,
                      boolean lsFormat)
                      throws CommandAbstractException
List all files with other informations from the given path (could be a file or a directory)

Parameters:
path -
lsFormat - True if ls Format, else MLSx format
Returns:
the list of paths and other informations
Throws:
CommandAbstractException

fileFull

String fileFull(String path,
                boolean lsFormat)
                throws CommandAbstractException
Give for 1 file all informations from the given path (could be a file or a directory)

Parameters:
path -
lsFormat - True if ls Format, else MLSx format
Returns:
the path and other informations
Throws:
CommandAbstractException

getFreeSpace

long getFreeSpace()
                  throws CommandAbstractException
Returns:
the free space of the current Directory
Throws:
CommandAbstractException

newFile

FileInterface newFile(String path,
                      boolean append)
                      throws CommandAbstractException
Create a new File

Parameters:
path -
append -
Returns:
the new FileInterface
Throws:
CommandAbstractException

setFile

FileInterface setFile(String path,
                      boolean append)
                      throws CommandAbstractException
Set a path as the current FileInterface

Parameters:
path -
append - True if this file is supposed to be in append mode (APPE), False in any other cases
Returns:
the FileInterface if it is correctly initiate
Throws:
CommandAbstractException

setUniqueFile

FileInterface setUniqueFile()
                            throws CommandAbstractException
Set a new unique path as the current FileInterface from the current Directory (STOU)

Returns:
the FileInterface if it is correctly initiate
Throws:
CommandAbstractException

canRead

boolean canRead()
                throws CommandAbstractException
Returns:
True if the current FileInterface is ready for reading
Throws:
CommandAbstractException

canWrite

boolean canWrite()
                 throws CommandAbstractException
Returns:
True if the current FileInterface is ready for writing
Throws:
CommandAbstractException

exists

boolean exists()
               throws CommandAbstractException
Returns:
True if the current FileInterface exists
Throws:
CommandAbstractException

getCRC

long getCRC(String path)
            throws CommandAbstractException
Get the CRC of the given FileInterface

Parameters:
path -
Returns:
the CRC
Throws:
CommandAbstractException

getMD5

byte[] getMD5(String path)
              throws CommandAbstractException
Get the MD5 of the given FileInterface

Parameters:
path -
Returns:
the MD5
Throws:
CommandAbstractException

getSHA1

byte[] getSHA1(String path)
               throws CommandAbstractException
Get the SHA-1 of the given FileInterface

Parameters:
path -
Returns:
the SHA-1
Throws:
CommandAbstractException


Copyright © 2009-2012 Frederic Bregier. All Rights Reserved.